:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #252b35;
  background: #f3f4f6;
  font-synthesis: none;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}

main {
  width: calc(100% - 40px);
  max-width: 1100px;
  margin: 20px auto;
  padding: 28px 32px 24px;
  background: #fff;
  border: 1px solid #e2e5e9;
  border-radius: 12px;
}

header {
  position: relative;
  text-align: center;
}
.logout-link {
  position: absolute;
  top: 0;
  right: 0;
  color: #707887;
  font-size: 0.8rem;
  text-underline-offset: 3px;
}
h1 {
  margin: 0 0 8px;
  color: #1b3e76;
  font-size: clamp(1.65rem, 3vw, 2rem);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.035em;
}
.intro {
  max-width: 850px;
  margin: 0 auto;
  font-size: 1rem;
  color: #586170;
}
.instructions {
  margin: 20px 0 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e5e9;
  font-size: 0.95rem;
}
.sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}
.source {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.source + .source {
  padding-left: 24px;
  border-left: 1px solid #e2e5e9;
}
.source:first-child {
  padding-right: 24px;
}
.source-heading,
.example-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.example-link {
  flex-shrink: 0;
  color: #1b3e76;
  font-size: 0.85rem;
  text-underline-offset: 3px;
}
h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  color: #1b3e76;
}
.source p {
  flex: 1;
  margin: 12px 0 16px;
  font-size: 0.9rem;
  color: #586170;
}
code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf1f7;
  color: #1b3e76;
  font-size: 0.95em;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
textarea {
  display: block;
  width: 100%;
  min-height: 124px;
  height: 124px;
  padding: 12px 14px;
  border: 1px solid #bfc7d2;
  border-radius: 6px;
  background: #fff;
  color: #252b35;
  font:
    0.9rem/1.5 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  resize: vertical;
}
textarea::placeholder {
  color: #737d8d;
  opacity: 1;
}
textarea:disabled {
  background: #f6f7f9;
}
textarea:focus {
  border-color: #1b3e76;
  outline: 3px solid #e4ebf6;
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid #9aafd3;
  outline-offset: 4px;
}

.download {
  margin-top: 24px;
  text-align: center;
}
button {
  padding: 13px 36px;
  border: 0;
  border-radius: 6px;
  background: #1b3e76;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: #132e59;
}
button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.status {
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.is-error {
  color: #a12d2d;
}
.is-warning {
  color: #805015;
}
.is-success {
  color: #25603c;
}
.download-link {
  display: inline-block;
  margin-top: 8px;
  color: #1b3e76;
  text-underline-offset: 3px;
}

footer {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e5e9;
  text-align: center;
}
footer p {
  margin: 0 0 6px;
  color: #707887;
  font-size: 0.8rem;
}
.logo {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: 20px;
  place-items: center;
}
.login-card {
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 32px;
  border: 1px solid #e2e5e9;
  border-radius: 12px;
}
.login-card h1 {
  font-size: 1.75rem;
}
.login-form {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}
.login-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #bfc7d2;
  border-radius: 6px;
  background: #fff;
  color: #252b35;
  font: inherit;
}
.login-form input:focus-visible {
  border-color: #1b3e76;
  outline: 3px solid #e4ebf6;
  outline-offset: 2px;
}
.remember-me {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 400;
}
.remember-me input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1b3e76;
}
.login-error {
  margin: 0;
  font-size: 0.9rem;
}
.login-form button {
  width: 100%;
}

.modal-open {
  overflow: hidden;
}
#example-dialog {
  width: min(1180px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 0;
  border-radius: 10px;
  color: #252b35;
  background: #fff;
  box-shadow: 0 20px 80px #101c3255;
}
#example-dialog::backdrop {
  background: #101c3299;
}
.example-heading {
  margin-bottom: 16px;
}
#close-example {
  flex-shrink: 0;
  padding: 6px 12px;
  background: #edf1f7;
  color: #1b3e76;
  font-size: 0.9rem;
}
#close-example:hover {
  background: #dfe7f2;
}
#example-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 150px);
  object-fit: contain;
}
#example-original {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #1b3e76;
  text-underline-offset: 3px;
}

@media (max-width: 800px) {
  :root {
    background: #fff;
  }
  main {
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
    border: 0;
    border-radius: 0;
  }
  .instructions {
    margin-bottom: 24px;
  }
  .sources {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .source:first-child,
  .source + .source {
    padding: 0;
    border: 0;
  }
  #download-button {
    width: 100%;
  }
  .logo {
    width: 230px;
  }
  .logout-link {
    position: static;
    display: block;
    margin-bottom: 8px;
    text-align: right;
  }
}

@media (min-width: 801px) and (max-height: 700px) {
  main {
    margin: 12px auto;
    padding: 20px 28px 16px;
  }
  h1 {
    font-size: 1.75rem;
  }
  .intro {
    font-size: 0.95rem;
  }
  .instructions {
    margin: 16px 0 20px;
    padding-top: 12px;
  }
  textarea {
    min-height: 110px;
    height: 110px;
  }
  .download {
    margin-top: 18px;
  }
  #download-button {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  footer {
    margin-top: 18px;
    padding-top: 12px;
  }
  .logo {
    width: 205px;
  }
}

@media (max-width: 480px) {
  footer {
    flex-direction: column;
    gap: 14px;
  }
  #example-dialog {
    padding: 16px;
  }
  .example-heading {
    align-items: flex-start;
  }
  .example-heading h2 {
    font-size: 1rem;
  }
}
