:root {
  color-scheme: light;
  --accent: #c8102e;
  --accent-hover: #a30d25;
  --accent-bg: rgba(200, 16, 46, 0.08);
  --accent-focus: rgba(200, 16, 46, 0.3);
  --header-bg: #34383d;
  --header-text: #f3f4f6;
  --header-muted: #b8bcc2;
  --canvas: #383d43;
  --canvas-deep: #2e3237;
  --bg: #ffffff;
  --bg-secondary: #f6f7f9;
  --bg-tertiary: #eceff2;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #20242a;
  --text-secondary: #606871;
  --border: #d8dce1;
  --border-strong: #b7bdc4;
  --success: #147a50;
  --success-bg: #eaf7f1;
  --warning: #936214;
  --warning-bg: #fff8e8;
  --danger: #b91c36;
  --danger-bg: #fff0f2;
  --shadow-sm: 0 8px 24px rgba(8, 12, 18, 0.12);
  --shadow-card: 0 24px 70px rgba(8, 12, 18, 0.22);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --touch-target: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #f2606b;
  --accent-hover: #ff7b85;
  --accent-bg: rgba(242, 96, 107, 0.12);
  --accent-focus: rgba(242, 96, 107, 0.34);
  --header-bg: #101216;
  --header-text: #f3f4f6;
  --header-muted: #aeb4bd;
  --canvas: #0f1115;
  --canvas-deep: #0b0d10;
  --bg: #151924;
  --bg-secondary: #1b202c;
  --bg-tertiary: #222936;
  --surface: #151924;
  --surface-elevated: #1a1f2b;
  --text: #eef1f5;
  --text-secondary: #aeb7c4;
  --border: #2a3242;
  --border-strong: #465066;
  --success: #59d39e;
  --success-bg: rgba(35, 153, 103, 0.15);
  --warning: #f5c15d;
  --warning-bg: rgba(184, 120, 23, 0.15);
  --danger: #ff7b85;
  --danger-bg: rgba(200, 16, 46, 0.16);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--canvas);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% -18%, rgba(200, 16, 46, 0.24), transparent 28rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 24rem);
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

*:focus-visible {
  outline: 3px solid var(--accent-focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 140ms ease;
}
.skip-link:focus { transform: translateY(0); }

.site-header,
#main-content,
.site-footer { position: relative; z-index: 2; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  color: var(--header-text);
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.header-leading,
.header-actions,
.guest-actions,
.user-actions {
  display: flex;
  align-items: center;
}

.header-leading { min-width: 0; gap: clamp(24px, 4vw, 54px); }
.header-actions { flex: 0 0 auto; gap: 8px; }
.guest-actions, .user-actions { gap: 8px; }

.brand {
  min-width: max-content;
  display: flex;
  flex-direction: column;
  color: var(--header-text);
  line-height: 1.05;
  text-decoration: none;
}

.brand-name { font-size: 1.16rem; font-weight: 800; letter-spacing: -0.035em; }
.brand-name span, .auth-brand span { color: #e8404f; }
.brand-subtitle {
  margin-top: 5px;
  color: var(--header-muted);
  font-size: 0.59rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.desktop-nav { display: flex; align-items: stretch; gap: 24px; }
.nav-link {
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  color: var(--header-muted);
  border-bottom: 2px solid transparent;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 150ms ease, border-color 150ms ease;
}
.nav-link:hover, .nav-link:focus-visible, .nav-link.is-active { color: #fff; }
.nav-link.is-active { border-color: #e8404f; }

.header-login,
.header-register,
.header-icon-button {
  min-height: var(--touch-target);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.header-login,
.header-register {
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
}
.header-login { color: var(--header-muted); background: transparent; border: 1px solid rgba(255, 255, 255, 0.24); }
.header-register { color: #fff; background: #c8102e; border: 1px solid #c8102e; }
.header-login:hover, .header-login:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.08); }
.header-register:hover, .header-register:focus-visible { background: #e02242; border-color: #e02242; }

.header-icon-button {
  width: var(--touch-target);
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--header-muted);
  background: transparent;
  border: 0;
}
.header-icon-button:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.header-icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sun-icon, :root[data-theme="dark"] .moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: block; }

.user-email {
  max-width: 165px;
  overflow: hidden;
  color: var(--header-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-loading { width: 28px; display: grid; place-items: center; }
.session-loading span {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.mobile-menu-toggle { display: none; }
.close-icon, .mobile-menu-toggle[aria-expanded="true"] .menu-icon { display: none; }
.mobile-menu-toggle[aria-expanded="true"] .close-icon { display: block; }

.mobile-menu {
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mobile-menu nav { width: min(100% - 32px, 680px); margin: 0 auto; padding: 12px 0 16px; display: grid; gap: 4px; }
.mobile-menu a, .mobile-menu button {
  min-height: var(--touch-target);
  padding: 10px 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}
.mobile-menu a:hover, .mobile-menu button:hover { color: var(--accent); background: var(--accent-bg); }

#main-content {
  width: min(1040px, calc(100% - 40px));
  min-height: calc(100vh - 230px);
  margin: 0 auto;
}

.route-view { min-width: 0; }

.hero {
  max-width: 830px;
  margin: 78px auto 42px;
  color: #fff;
  text-align: center;
}
.eyebrow {
  display: inline-flex;
  padding: 7px 13px;
  color: #fff;
  background: rgba(200, 16, 46, 0.24);
  border: 1px solid rgba(242, 96, 107, 0.44);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 22px 0 17px;
  color: #fff;
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.052em;
}
.hero-copy { max-width: 710px; margin: 0 auto; color: #d7dbe0; font-size: clamp(1rem, 2vw, 1.16rem); }
.format-pills { margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; }
.format-pills li {
  padding: 7px 12px;
  color: #f3f4f6;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
}
.privacy-note { width: fit-content; max-width: 100%; margin: 24px auto 0; display: flex; align-items: center; gap: 9px; color: #d8ebe3; font-size: 0.88rem; }
.privacy-icon { width: 24px; height: 24px; display: grid; place-items: center; color: #fff; background: var(--success); border-radius: 50%; font-size: 0.72rem; font-weight: 850; }

.converter-card,
.result-card,
.auth-card,
.legal-card {
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.converter-card, .result-card { padding: clamp(24px, 5vw, 42px); }
.card-heading, .result-heading, .preview-heading, .selected-file, .result-actions { display: flex; align-items: center; }
.card-heading, .preview-heading { justify-content: space-between; gap: 20px; }
.card-heading h2, .result-heading h2 { margin-bottom: 5px; color: var(--text); font-size: 1.35rem; letter-spacing: -0.025em; }
.section-kicker { margin: 0 0 4px; color: var(--accent); font-size: 0.69rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.card-heading p, .result-heading p, .preview-heading span { margin: 0; color: var(--text-secondary); font-size: 0.88rem; }
code { padding: 2px 5px; background: var(--bg-secondary); border-radius: 5px; }
.step-badge { flex: 0 0 auto; padding: 6px 10px; color: var(--text-secondary); background: var(--bg-secondary); border-radius: var(--radius-sm); font-size: 0.76rem; font-weight: 700; }

.drop-zone {
  min-height: 270px;
  margin-top: 28px;
  padding: 38px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.drop-zone:hover, .drop-zone:focus-within, .drop-zone:focus-visible, .drop-zone.is-dragging { color: var(--accent); background: var(--accent-bg); border-color: var(--accent); transform: translateY(-2px); }
.drop-zone[aria-disabled="true"] { opacity: 0.62; cursor: wait; transform: none; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { width: 62px; height: 62px; margin-bottom: 20px; display: grid; place-items: center; color: var(--accent); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.upload-icon svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { color: var(--text); font-size: 1.04rem; font-weight: 740; }
.drop-subtitle { margin: 4px 0 19px; font-size: 0.88rem; }
.choose-button { padding: 9px 16px; color: var(--accent); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-sm); font-size: 0.86rem; font-weight: 720; }

.selected-file { margin-top: 28px; padding: 17px; gap: 14px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); }
.file-icon { width: 47px; height: 47px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 10px; font-size: 0.68rem; font-weight: 850; }
.file-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy span { color: var(--text-secondary); font-size: 0.8rem; }
.icon-button { width: var(--touch-target); height: var(--touch-target); color: var(--text-secondary); background: transparent; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.35rem; }
.icon-button:hover { color: var(--danger); background: var(--danger-bg); }

.format-selector { min-width: 0; margin: 27px 0 0; padding: 0; border: 0; }
.format-selector legend { width: 100%; margin-bottom: 13px; color: var(--text); font-size: 1rem; font-weight: 780; }
.format-selector legend .section-kicker { display: block; }
.format-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.format-card { position: relative; min-width: 0; min-height: 92px; padding: 14px; display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: 160ms ease; }
.format-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.format-card:focus-within { outline: 3px solid var(--accent-focus); outline-offset: 2px; }
.format-card:has(input:checked) { background: var(--accent-bg); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.format-card:has(input:disabled) { opacity: 0.58; cursor: wait; transform: none; }
.format-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.format-icon { flex: 0 0 auto; width: 43px; height: 48px; display: grid; place-items: center; color: #fff; border-radius: 10px; font-size: 0.65rem; font-weight: 860; box-shadow: 0 7px 16px rgba(0, 0, 0, 0.18); }
.format-pdf { background: linear-gradient(145deg, #dc4a5b, #a31632); }
.format-docx { background: linear-gradient(145deg, #3978e7, #1853b7); font-size: 1rem; }
.format-xlsx { background: linear-gradient(145deg, #2e9a68, #137249); font-size: 1rem; }
.format-csv { background: linear-gradient(145deg, #68758c, #34435b); }
.format-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.format-copy strong { color: var(--text); font-size: 0.88rem; }
.format-copy small { margin-top: 2px; overflow: hidden; color: var(--text-secondary); font-size: 0.69rem; line-height: 1.25; text-overflow: ellipsis; }
.format-check { position: absolute; top: 8px; right: 8px; width: 19px; height: 19px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; font-size: 0.66rem; font-weight: 850; opacity: 0; transform: scale(0.7); transition: 140ms ease; }
.format-card input:checked ~ .format-check { opacity: 1; transform: scale(1); }

.recognition-note { margin-top: 16px; padding: 14px 16px; display: flex; align-items: flex-start; gap: 11px; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); }
.recognition-note p { margin: 0; font-size: 0.82rem; }
.recognition-note-icon { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 50%; font-size: 0.72rem; font-weight: 800; }

.primary-button, .secondary-button {
  min-height: var(--touch-target);
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.primary-button { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.primary-button:disabled { opacity: 0.52; cursor: not-allowed; }
.secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); }
.secondary-button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.secondary-button:disabled { opacity: 0.5; cursor: not-allowed; }
#convert-button { width: 100%; margin-top: 22px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.42); border-top-color: #fff; border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-text { min-height: 1.4em; margin: 10px 0 0; color: var(--text-secondary); font-size: 0.83rem; text-align: center; }
.progress-text[data-state="success"] { color: var(--success); }
.progress-text[data-state="error"] { color: var(--danger); }

.message { margin: 20px 0 0; padding: 13px 15px; border-radius: var(--radius-sm); font-size: 0.88rem; }
.message-error, .form-message.is-error { color: var(--danger); background: var(--danger-bg); border: 1px solid color-mix(in srgb, var(--danger) 38%, transparent); }
.form-message.is-success { color: var(--success); background: var(--success-bg); border: 1px solid color-mix(in srgb, var(--success) 38%, transparent); }

.result-card { margin-top: 24px; }
.result-heading { gap: 14px; }
.success-mark { flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: var(--success); border-radius: 50%; font-size: 1.15rem; font-weight: 850; }
.result-stats { margin: 24px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.result-stats div { padding: 14px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.result-stats dt { color: var(--text-secondary); font-size: 0.69rem; font-weight: 760; letter-spacing: 0.06em; text-transform: uppercase; }
.result-stats dd { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--text); font-size: 0.9rem; font-weight: 720; }
.warnings-panel { margin-top: 18px; padding: 16px 18px; color: var(--warning); background: var(--warning-bg); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); border-radius: var(--radius-md); }
.warnings-panel h3 { margin-bottom: 8px; font-size: 0.92rem; }
.warnings-panel ul { margin: 0; padding-left: 20px; font-size: 0.82rem; }
.warnings-panel p { margin: 9px 0 0; font-size: 0.77rem; }
.result-actions { margin-top: 22px; gap: 10px; }
.result-actions > * { flex: 1; }
.preview-block { margin-top: 24px; }
.preview-heading h3 { margin: 0; font-size: 1rem; }
.table-scroll { margin-top: 10px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.76rem; }
th, td { max-width: 260px; padding: 9px 11px; overflow: hidden; border-bottom: 1px solid var(--border); text-align: left; text-overflow: ellipsis; white-space: nowrap; }
th { color: var(--text); background: var(--bg-secondary); font-weight: 750; }
.binary-result-note { margin: 16px 0 0; color: var(--text-secondary); font-size: 0.8rem; text-align: center; }

.feature-grid { margin: 28px 0 70px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature-grid article { padding: 23px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.feature-number { color: var(--accent); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.1em; }
.feature-grid h2 { margin: 10px 0 7px; font-size: 1rem; }
.feature-grid p { margin: 0; color: var(--text-secondary); font-size: 0.82rem; }

.site-footer { color: #cbd0d6; background: var(--canvas-deep); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-inner { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 28px; font-size: 0.76rem; }
.footer-inner nav { justify-self: end; display: flex; flex-wrap: wrap; gap: 18px; }
.footer-inner a { color: #f0f1f3; text-decoration: none; }
.footer-inner a:hover { color: #f2606b; text-decoration: underline; }
.footer-inner p { grid-column: 1 / -1; margin: 0; color: #aeb4bb; }

.text-wallpaper { position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; user-select: none; }
.text-wallpaper-inner { position: absolute; left: 50%; top: 50%; width: 145%; height: 170%; transform: translate(-50%, -50%) rotate(-18deg); display: flex; flex-wrap: wrap; align-content: space-between; justify-content: center; gap: 1.5vmin 3vmin; }
.tw-item { color: #fff; font-size: clamp(0.65rem, 1.4vmin, 0.9rem); font-weight: 620; line-height: 1; opacity: 0.065; white-space: nowrap; }
.tw-logo { opacity: 0.105; }
.tw-logo span { color: #f2606b; }
.auth-route .text-wallpaper-inner { animation: wallpaper-drift 80s linear infinite alternate; }
.auth-route .tw-glow { animation: wallpaper-glow 18s linear infinite; animation-delay: var(--delay, 0s); }
@keyframes wallpaper-drift { to { transform: translate(-49%, -51%) rotate(-18deg); } }
@keyframes wallpaper-glow { 0%, 92%, 100% { opacity: 0.07; transform: scale(1); } 95% { opacity: 0.5; transform: scale(1.14); } }

.auth-route .site-header,
.auth-route .site-footer,
.auth-route .skip-link { display: none; }
.auth-route #main-content { width: 100%; max-width: none; min-height: 100vh; }
.auth-page { min-height: 100vh; padding: 42px 18px; display: grid; place-items: center; }
.auth-shell { position: relative; z-index: 2; width: 100%; margin: auto; }
.auth-shell-sm { max-width: 390px; }
.auth-shell-md { max-width: 610px; }
.auth-brand { margin-bottom: 24px; color: #fff; text-align: center; }
.auth-brand a { color: #fff; font-size: 1.65rem; font-weight: 800; letter-spacing: -0.045em; text-decoration: none; }
.auth-brand p { margin: 4px 0 0; color: #c8cdd3; font-size: 0.81rem; }
.auth-card { padding: clamp(22px, 5vw, 30px); }
.auth-card h1 { margin-bottom: 6px; color: var(--text); font-size: 1.28rem; line-height: 1.25; letter-spacing: -0.02em; }
.auth-intro { margin-bottom: 22px; color: var(--text-secondary); font-size: 0.86rem; }
.auth-card-centered { text-align: center; }
.form-stack { display: grid; gap: 16px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.79rem; font-weight: 680; }
.field label span { font-weight: 500; }
.field input, .field select, .phone-field select {
  width: 100%;
  min-height: var(--touch-target);
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field input:focus, .field select:focus, .phone-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field input::placeholder { color: color-mix(in srgb, var(--text-secondary) 72%, transparent); }
.field-help { min-height: 1.2em; display: block; margin-top: 5px; color: var(--text-secondary); font-size: 0.73rem; }
.field-help.is-success { color: var(--success); }
.field-help.is-error { color: var(--danger); }
.form-grid { display: grid; gap: 12px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-address { grid-template-columns: 2fr 1fr; }
.field-wide { min-width: 0; }
.input-action, .phone-field, .password-field { display: flex; align-items: stretch; gap: 8px; }
.input-action input, .phone-field input, .password-field input { min-width: 0; flex: 1; }
.phone-field select { flex: 0 0 88px; width: 88px; }
.password-field { position: relative; gap: 0; }
.password-field input { padding-right: 82px; }
.password-toggle { position: absolute; top: 1px; right: 1px; bottom: 1px; min-width: 74px; padding: 0 10px; color: var(--accent); background: var(--bg); border: 0; border-radius: 0 7px 7px 0; cursor: pointer; font-size: 0.7rem; font-weight: 700; }
.compact-button { min-height: var(--touch-target); padding: 8px 12px; flex: 0 0 auto; font-size: 0.76rem; white-space: nowrap; }
.form-row { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; }
.form-row-between { justify-content: space-between; }
.form-row a, .check-label a, .auth-switch a, .text-button { color: var(--accent); }
.check-label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); cursor: pointer; font-size: 0.78rem; }
.check-label-start { align-items: flex-start; line-height: 1.45; }
.check-label input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check-label-start input { margin-top: 2px; }
.auth-submit { width: 100%; }
.auth-switch { margin: 18px 0 0; color: var(--text-secondary); font-size: 0.8rem; text-align: center; }
.form-message { margin: -2px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.78rem; }
.text-button { width: 100%; min-height: var(--touch-target); margin-top: 10px; background: transparent; border: 0; cursor: pointer; font-size: 0.79rem; }
.code-input { text-align: center; font-size: 1.2rem !important; font-weight: 700; letter-spacing: 0.25em; }
.button-link { margin-top: 10px; }

.legal-page { padding: 58px 0 72px; }
.legal-card { max-width: 780px; margin: 0 auto; padding: clamp(25px, 5vw, 46px); }
.legal-card h1 { margin-bottom: 24px; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.04em; }
.legal-card h2 { margin: 28px 0 7px; font-size: 1rem; }
.legal-card p { color: var(--text-secondary); font-size: 0.9rem; }
.legal-card a:not(.button-link) { color: var(--accent); }
.legal-date { margin-top: 30px; font-size: 0.76rem !important; }

@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .mobile-menu-toggle { display: grid; }
  .user-email { display: none; }
  .format-grid { grid-template-columns: 1fr 1fr; }
  .result-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .header-inner { width: min(100% - 24px, 1180px); min-height: 62px; }
  .guest-actions, .user-actions .header-login { display: none; }
  .brand-subtitle { font-size: 0.52rem; }
  #main-content, .footer-inner { width: min(100% - 24px, 1040px); }
  .hero { margin-top: 48px; }
  .hero h1 { font-size: clamp(2rem, 11vw, 3rem); }
  .converter-card, .result-card { padding: 23px 18px; border-radius: var(--radius-md); }
  .card-heading { align-items: flex-start; }
  .step-badge { display: none; }
  .drop-zone { min-height: 230px; padding: 30px 15px; text-align: center; }
  .format-grid { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-actions { flex-direction: column; }
  .result-actions > * { width: 100%; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-inner nav { justify-self: start; }
  .form-grid-2, .form-grid-address { grid-template-columns: 1fr; }
  .input-action { flex-direction: column; }
  .input-action .compact-button { width: 100%; }
  .auth-page { padding: 28px 12px; }
  .auth-brand { margin-bottom: 18px; }
}

@media (max-width: 390px) {
  .brand-name { font-size: 1.04rem; }
  .header-actions { gap: 2px; }
  .header-icon-button { width: 40px; }
  .result-stats { grid-template-columns: 1fr; }
  .phone-field { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
