:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-elevated: #0c1a2c;
  --panel: rgba(14, 29, 48, 0.92);
  --panel-strong: #102137;
  --border: rgba(148, 178, 211, 0.16);
  --border-strong: rgba(125, 211, 252, 0.34);
  --text: #e8f1fb;
  --muted: #8fa5bc;
  --faint: #60758c;
  --accent: #67e8f9;
  --accent-strong: #22d3ee;
  --accent-ink: #04202a;
  --success: #86efac;
  --error: #fda4af;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(34, 211, 238, 0.14), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(59, 130, 246, 0.1), transparent 30rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="text"] {
  min-height: 44px;
}

button,
.file-button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.file-button:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 28px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 26px;
}

.brand-block {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.brand-mark {
  display: grid;
  flex: 0 0 62px;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.2), rgba(34, 211, 238, 0.04));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 12px 34px rgba(34, 211, 238, 0.1);
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(27px, 3vw, 42px);
  line-height: 1.14;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-accent {
  border-color: rgba(103, 232, 249, 0.24);
  background: rgba(34, 211, 238, 0.07);
  color: var(--accent);
}

.privacy-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid rgba(134, 239, 172, 0.12);
  border-radius: 12px;
  background: rgba(134, 239, 172, 0.045);
  color: #b8d8c5;
  font-size: 12px;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(134, 239, 172, 0.08);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-panel {
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.file-button:hover {
  border-color: var(--border-strong);
  background: rgba(103, 232, 249, 0.05);
  color: var(--text);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.code-input {
  display: block;
  width: calc(100% - 32px);
  min-height: 250px;
  margin: 0 16px;
  padding: 16px;
  resize: vertical;
  border: 1px solid rgba(148, 178, 211, 0.12);
  border-radius: 12px;
  background: #081522;
  color: #d7e7f7;
  caret-color: var(--accent);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.75;
  tab-size: 2;
}

.code-input::placeholder {
  color: #526a82;
}

.code-input:focus {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.06);
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 22px 16px;
  color: var(--faint);
  font-size: 11px;
}

.mini-stat {
  color: var(--muted);
  white-space: nowrap;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(170px, 0.32fr) minmax(280px, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(12, 26, 44, 0.76);
}

.control-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.control-field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.control-field select,
.control-field input[type="text"] {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #091727;
  color: var(--text);
}

.control-field select {
  cursor: pointer;
}

.field-hint {
  color: var(--faint);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  line-height: 1.5;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-primary {
  min-width: 116px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-ink);
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.14);
}

.button-primary:hover {
  background: linear-gradient(135deg, #a5f3fc, var(--accent-strong));
}

.button-secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: rgba(103, 232, 249, 0.06);
}

.button-quiet {
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  color: var(--text);
}

.message {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-error {
  border: 1px solid rgba(253, 164, 175, 0.22);
  background: rgba(244, 63, 94, 0.08);
  color: var(--error);
}

.message-success {
  border: 1px solid rgba(134, 239, 172, 0.18);
  background: rgba(74, 222, 128, 0.06);
  color: var(--success);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 26, 44, 0.66);
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.stat-card-accent {
  border-color: rgba(103, 232, 249, 0.2);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.09), rgba(12, 26, 44, 0.72));
}

.stat-card-accent strong {
  color: var(--accent);
}

.output-panel {
  margin-bottom: 18px;
}

.output-heading {
  border-bottom: 1px solid rgba(148, 178, 211, 0.08);
}

.output-actions {
  display: flex;
  gap: 8px;
}

.output-text {
  min-height: 300px;
  margin-bottom: 0;
}

.help-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 26, 44, 0.54);
}

.help-panel summary {
  padding: 16px 20px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style-position: inside;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 20px;
}

.help-grid > div {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(148, 178, 211, 0.09);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.help-grid code {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}

.help-grid span {
  color: var(--faint);
  font-size: 11px;
  line-height: 1.65;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.03em;
}

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

@media (max-width: 1050px) {
  .control-panel {
    grid-template-columns: minmax(160px, 0.35fr) minmax(260px, 1fr);
  }

  .action-row {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 28px, 1440px);
    padding-top: 28px;
  }

  .hero {
    display: grid;
    gap: 16px;
  }

  .brand-block {
    gap: 14px;
  }

  .brand-mark {
    flex-basis: 50px;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    font-size: 17px;
  }

  .hero-badges {
    justify-content: flex-start;
    padding-top: 0;
  }

  .input-grid,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .button-primary {
    flex: 1 1 120px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    min-height: 86px;
    padding: 13px;
  }

  .stat-card strong {
    font-size: 21px;
  }

  .panel-heading {
    padding: 17px 16px 14px;
  }

  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 12px 18px 15px;
  }

  .output-heading {
    align-items: flex-start;
  }

  .output-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
