:root {
  color-scheme: dark;
  --green: #76b900;
  --green-light: #9ad720;
  --green-dim: rgba(118, 185, 0, 0.12);
  --green-border: rgba(118, 185, 0, 0.24);
  --bg: #050505;
  --surface: #101010;
  --surface-2: #171717;
  --surface-3: #202020;
  --border: rgba(255, 255, 255, 0.08);
  --frame: rgba(236, 72, 153, 0.22);
  --frame-soft: rgba(236, 72, 153, 0.12);
  --text: #f7f7f7;
  --text-dim: #d9d9d9;
  --text-muted: #8f8f8f;
  --text-soft: #b9b9b9;
  --danger: #f87171;
  --info: #38bdf8;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(118, 185, 0, 0.16), transparent 22%),
    radial-gradient(circle at bottom right, rgba(118, 185, 0, 0.08), transparent 20%),
    linear-gradient(180deg, #090909, #050505);
  color: var(--text);
  font: 16px/1.6 "Barlow", "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--green); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header__inner {
  width: min(1152px, calc(100% - 32px));
  min-height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand, .site-tools, .actions { display: flex; align-items: center; }
.brand { gap: 4px; min-width: 0; }
.brand { color: var(--text); text-decoration: none; }
.brand__icon { width: 32px; height: 32px; flex: 0 0 auto; object-fit: contain; background: #fff; }
.brand__name { font-family: "Barlow Condensed", sans-serif; font-size: 24px; font-weight: 900; letter-spacing: -0.025em; white-space: nowrap; }
.brand__name--desktop { display: none; }
.brand__name span { color: var(--green-light); }
.site-nav { display: flex; align-items: center; gap: 32px; color: var(--text-dim); font-size: 1.05rem; font-weight: 600; letter-spacing: 0.04em; }
.site-nav a { color: inherit; text-decoration: none; transition: color 160ms ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--text); }
.site-tools { gap: 4px; flex: 0 0 auto; }
.header-icon-link { display: grid; width: 28px; height: 28px; place-items: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-dim); text-decoration: none; transition: border-color 160ms ease, color 160ms ease, background 160ms ease; }
.header-icon-link:hover, .header-icon-link:focus-visible { border-color: var(--green-border); background: rgba(118, 185, 0, 0.1); color: var(--green); outline: 0; }
.header-icon-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.site-tools .text-size-control {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
}
.site-tools .text-size-control svg { width: 15px; height: 15px; }
.text-size-popover { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; }
.text-size-popover-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: min(304px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(12, 12, 12, .98);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .44);
}
.text-size-control-panel { padding: 16px; }
.text-size-control-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-dim); font-size: 12px; font-weight: 800; }
.text-size-control-head strong { color: var(--green-light); }
.text-size-slider { width: 100%; margin-top: 12px; }
.text-size-popover-panel[hidden] { display: none; }
.header-auth, .header-user, .mobile-nav__user { display: flex; align-items: center; }
.header-auth { gap: 8px; }
.header-login { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-dim); font-size: 12px; font-weight: 500; text-decoration: none; }
.header-login svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.header-login:hover, .header-login:focus-visible { border-color: var(--green-border); color: var(--green); outline: 0; }
.header-user { gap: 8px; }
.header-user__picture { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.header-user__email { max-width: 150px; overflow: hidden; color: var(--text-dim); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.header-logout { min-height: 28px; border: 0; background: transparent; color: var(--text-dim); padding: 4px; }
.header-logout:hover { border: 0; background: transparent; color: var(--green); transform: none; }
.header-logout svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.mobile-menu-toggle, .mobile-nav { display: none; }

.project-chip, .service-state {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  padding: 5px 8px;
}

.project-chip { color: var(--green-light); border-color: var(--green-border); }
.service-state { display: inline-flex; align-items: center; gap: 7px; }
.service-state__dot { width: 7px; height: 7px; background: var(--green); box-shadow: 0 0 12px rgba(118, 185, 0, 0.72); }

.shell { width: min(1152px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0 44px; }
.intro { margin-bottom: 34px; }
.eyebrow, .section-kicker { margin: 0; color: var(--green-light); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
h1, h2 { margin: 0; line-height: 1.06; }
h1 { margin-top: 8px; font-size: 52.5px; font-weight: 950; letter-spacing: -0.065em; }
h1 span { color: var(--green); }
h2 { margin-top: 4px; font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.025em; }

.workspace-card {
  position: relative;
  background: linear-gradient(145deg, rgba(23, 23, 23, 0.86), rgba(16, 16, 16, 0.96));
  border: 1px solid var(--frame);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 22px 70px rgba(0, 0, 0, 0.24);
}

.workspace-card::before {
  content: "";
  position: absolute;
  inset: -1px auto auto -1px;
  width: 58px;
  height: 2px;
  background: var(--green);
}

.section-heading {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.section-heading__index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--green-border);
  background: var(--green-dim);
  color: var(--green-light);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

form { margin-top: 28px; }
.field-label { display: block; margin: 0 0 8px; color: var(--text-soft); font-size: 13px; font-weight: 700; }
.input-shell { position: relative; min-width: 0; }
.input-shell__mark { position: absolute; left: 14px; top: 50%; color: var(--green); font-size: 11px; transform: translateY(-50%); pointer-events: none; }

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #0a0a0a;
  color: var(--text);
  padding: 11px 13px;
}

.input-shell input { padding-left: 38px; }
input::placeholder { color: #666; }
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--green-light); outline-offset: 3px; }

button, .button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px solid var(--green);
  border-radius: 2px;
  background: var(--green);
  color: #071000;
  cursor: pointer;
  font-weight: 850;
  padding: 11px 18px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover, .button:hover { background: var(--green-light); border-color: var(--green-light); transform: translateY(-1px); }
button:disabled { cursor: wait; opacity: 0.55; transform: none; }

.form-settings { margin-top: 18px; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; }
.range-field { margin-top: 18px; }
.range-field__label { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.range-field__label output { color: var(--green-light); font-size: 12px; font-weight: 800; }
input[type="range"] { min-height: auto; border: 0; background: transparent; padding: 0; accent-color: var(--green); }
.form-actions { display: flex; margin-top: 18px; }

.status {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  border-left: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
  padding: 11px 14px;
  font-size: 13px;
}

.status__indicator { width: 8px; height: 8px; border: 1px solid currentColor; }
.status[data-state="working"] { border-left-color: var(--info); color: var(--text-dim); }
.status[data-state="working"] .status__indicator { background: var(--info); animation: pulse 1s ease-in-out infinite; }
.status[data-state="done"] { border-left-color: var(--green); color: var(--green-light); }
.status[data-state="done"] .status__indicator { background: var(--green); }
.status[data-state="error"] { border-left-color: var(--danger); color: var(--danger); }
.status[data-state="error"] .status__indicator { background: var(--danger); }

.result-panel { margin-top: 20px; }
.result-heading { grid-template-columns: 48px minmax(0, 1fr) auto; }
.actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.result-action { min-height: 42px; font-size: 13px; font-weight: 800; }
.result-action--copy { border-color: var(--green); background: rgba(118, 185, 0, 0.2); color: var(--green-light); }
.result-action--copy:hover { border-color: var(--green-light); background: rgba(118, 185, 0, 0.3); color: var(--text); }
.result-action--download { border-color: var(--green); background: var(--green); color: #071000; }
.result-action--download:hover { border-color: var(--green-light); background: var(--green-light); color: #071000; }
.transcript { margin-top: 10px; }
.transcript-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 20px; padding: 17px 4px; border-bottom: 1px solid var(--border); }
.timestamp { color: var(--green-light); font-variant-numeric: tabular-nums; font-weight: 800; }
.transcript-text { color: var(--text-dim); white-space: pre-wrap; }
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--bg); color: var(--text-dim); }
.site-footer__inner { width: min(1152px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0; display: flex; flex-direction: column; gap: 16px; font-size: 14px; }
.site-footer__main { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-decoration: none; transition: color 160ms ease; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--green); }
.site-footer__main > p a { color: var(--text); font-weight: 700; }
.site-footer__links { display: flex; align-items: center; gap: 16px; color: var(--text-dim); }
.site-footer__links span { color: var(--green-light); font-family: "JetBrains Mono", monospace; font-size: 12px; }
.site-footer__notice { color: var(--text-dim); opacity: .6; font-size: 12px; }

body { --text-scale: 1; }
body[data-text-size="small"] { --text-scale: .94; }
body[data-text-size="large"] { --text-scale: 1.08; }
body[data-text-size="xlarge"] { --text-scale: 1.18; }
body[data-text-size] h1 { font-size: calc(52.5px * var(--text-scale)); }
body[data-text-size] h2 { font-size: clamp(calc(22px * var(--text-scale)), calc(3vw * var(--text-scale)), calc(30px * var(--text-scale))); }
body[data-text-size] .site-nav,
body[data-text-size] .header-login,
body[data-text-size] .header-user__email,
body[data-text-size] .mobile-nav a,
body[data-text-size] .field-label,
body[data-text-size] input,
body[data-text-size] button,
body[data-text-size] .status,
body[data-text-size] .timestamp,
body[data-text-size] .transcript-text,
body[data-text-size] .site-footer__inner { font-size: calc(1em * var(--text-scale)); }
body[data-text-size] .eyebrow,
body[data-text-size] .section-kicker,
body[data-text-size] .range-field__label output,
body[data-text-size] .status__label,
body[data-text-size] .site-footer__notice { font-size: calc(11px * var(--text-scale)); }

@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.78); } }

@media (max-width: 760px) {
  .site-header__inner, .shell, .site-footer__inner { width: min(100% - 28px, 1152px); }
  .site-header__inner { min-height: 56px; }
  .brand { gap: 4px; }
  .brand__icon { width: 32px; height: 32px; }
  .brand__name { font-size: 20px; }
  .brand__name--mobile { display: inline; }
  .brand__name--desktop { display: none; }
  .site-nav { display: none; }
  .site-tools { margin-left: auto; }
  .site-tools .header-icon-link { display: none; }
  .site-tools .text-size-control { display: grid; }
  .header-auth { display: none; }
  .mobile-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    padding: 0;
    border: 1px solid rgba(217, 217, 217, 0.28);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
  }
  .mobile-menu-toggle:hover, .mobile-menu-toggle:focus-visible {
    border-color: var(--green);
    color: var(--green-light);
  }
  .mobile-nav {
    width: min(100% - 28px, 1152px);
    margin: 0 auto;
    padding: 10px 0 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .mobile-nav[hidden] { display: none; }
  .mobile-nav a {
    padding: 9px 10px;
    border-left: 2px solid transparent;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
  }
  .mobile-nav a:hover, .mobile-nav a:focus-visible {
    border-left-color: var(--green);
    background: var(--green-dim);
    color: var(--green-light);
  }
  .mobile-nav__auth { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
  .mobile-nav__auth .header-login { display: inline-flex; }
  .mobile-nav__user { justify-content: space-between; gap: 10px; padding: 8px 10px; color: var(--text-dim); }
  .mobile-nav__user .header-user__email { max-width: 230px; }
  .mobile-nav__user .header-logout { min-height: 34px; }
  .shell { padding-top: 42px; }
  h1 { font-size: 52.5px; }
  .workspace-card { padding: 20px 14px; }
  .section-heading, .result-heading { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .section-heading__index { width: 38px; height: 38px; }
  .actions { grid-column: 1 / -1; }
  .actions { justify-content: stretch; }
  .actions > * { flex: 1 1 130px; }
  .field-grid { grid-template-columns: 1fr; }
  .form-actions button { width: 100%; }
  .transcript-row { grid-template-columns: 1fr; gap: 3px; }
  .site-footer__main { align-items: center; flex-direction: column; gap: 12px; }
  .site-footer__links { flex-wrap: wrap; gap: 10px 14px; }
  .site-footer__notice { text-align: center; }
}

@media (min-width: 640px) {
  .brand { gap: 8px; }
  .brand__icon { width: 36px; height: 36px; }
  .brand__name { font-size: 30px; }
  .brand__name--mobile { display: none; }
  .brand__name--desktop { display: inline; }
}

@media (min-width: 768px) {
  .header-icon-link { width: 32px; height: 32px; }
  .site-tools .text-size-control { width: 32px; height: 32px; min-width: 32px; }
  .site-tools { gap: 4px; }
  .header-login { display: inline-flex; align-items: center; }
  .site-footer__main { flex-direction: row; }
  .site-footer__notice { text-align: left; }
}

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