:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #17212b;
  background: #f5f7f9;
  --blue: #18558a;
  --blue-dark: #123f67;
  --green: #26724b;
  --border: #d6dee5;
  --muted: #5b6874;
  --surface: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f5f7f9;
}

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

button,
input { font: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #78afe3;
  outline-offset: 2px;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  width: min(100% - 40px, 880px);
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #17212b;
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand span { display: grid; gap: 2px; }
.brand strong { color: var(--blue); font-size: 14px; }
.brand small { color: var(--muted); font-size: 12px; }

nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

nav a,
.text-button,
.inline-button {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

main {
  width: min(100% - 40px, 680px);
  margin: clamp(36px, 7vh, 72px) auto;
  flex: 1;
}

.intro { margin-bottom: 24px; }

h1 {
  margin: 0 0 9px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

#converter {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.file-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.file-field > p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

input[type="file"] {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid #aebbc7;
  border-radius: 4px;
  color: #334455;
  background: #f9fbfc;
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 12px;
  border: 1px solid #91a1af;
  border-radius: 4px;
  color: #17212b;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.file-field .file-selected {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
}

.file-field .file-selected.ready {
  color: var(--green);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.button--primary { color: #fff; background: var(--blue); }
.button--secondary { color: var(--blue); background: #fff; }
.button:hover:not(:disabled) { filter: brightness(.94); }
.button:disabled { cursor: not-allowed; opacity: .45; }

#status {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--green);
  font-size: 14px;
}

#status.error { color: #a53434; }

.resources {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

footer {
  padding: 17px 24px;
  border-top: 1px solid var(--border);
  color: #63717d;
  background: #fff;
  text-align: center;
  font-size: 12px;
}

footer p { margin: 0; }

dialog {
  width: min(720px, calc(100% - 32px));
  max-height: min(82vh, 760px);
  padding: 0;
  border: 1px solid #bcc8d2;
  border-radius: 7px;
  color: #17212b;
  background: #fff;
  box-shadow: 0 18px 50px rgba(27, 45, 61, .22);
}

dialog::backdrop { background: rgba(20, 31, 41, .48); }

.dialog__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.dialog__header h2 { margin: 0 0 5px; font-size: 23px; }
.dialog__header p { margin: 0; color: var(--muted); font-size: 14px; }

.close-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  color: #4b5965;
  background: #eef2f5;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.dialog__content {
  overflow: auto;
  padding: 4px 24px 8px;
}

.dialog__content section {
  padding: 18px 0;
  border-bottom: 1px solid #e3e8ec;
}

.dialog__content section:last-child { border-bottom: 0; }
.dialog__content h3 { margin: 0 0 9px; font-size: 16px; }
.dialog__content p,
.dialog__content li { font-size: 14px; line-height: 1.55; }
.dialog__content p { margin: 0 0 10px; }
.dialog__content p:last-child { margin-bottom: 0; }
.dialog__content ol { margin: 0; padding-left: 22px; }

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--blue);
  background: #f3f6f8;
  white-space: pre;
}

.dialog__footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 15px 24px;
  border-top: 1px solid var(--border);
  background: #fff;
}

@media (max-width: 600px) {
  .topbar__inner {
    width: min(100% - 28px, 880px);
    min-height: 78px;
    gap: 12px;
  }

  .brand strong { font-size: 13px; }
  .brand img { width: 38px; height: 38px; }
  nav { align-items: flex-end; flex-direction: column; gap: 7px; font-size: 13px; }
  main { width: min(100% - 28px, 680px); margin-top: 34px; }
  h1 { font-size: 24px; }
  #converter { padding: 20px; }
  .actions { flex-direction: column; }
  .actions .button { width: 100%; }
  .dialog__header,
  .dialog__content,
  .dialog__footer { padding-left: 18px; padding-right: 18px; }
}
