:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #5b6577;
  --line: #dce2ea;
  --brand: #14746f;
  --brand-dark: #0c5551;
  --accent: #d97706;
  --soft: #edf7f5;
  --danger: #b42318;
  --ok: #157f3b;
  --shadow: 0 12px 30px rgba(24, 32, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

body {
  margin: 0;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1120px;
  padding: 14px 20px;
}

.brand {
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand span {
  color: var(--brand);
}

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

.nav-link-strong {
  background: var(--soft);
  border: 1px solid #cfe6e1;
  border-radius: 6px;
  color: var(--brand-dark);
  font-weight: 720;
  padding: 8px 10px;
}

.language-switch {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.language-switch select {
  min-height: 34px;
  padding: 5px 8px;
  width: auto;
}

.page {
  margin: 0 auto;
  max-width: 1120px;
  padding: 40px 20px 64px;
}

.hero {
  display: grid;
  gap: 24px;
  padding: 24px 0 18px;
}

.eyebrow {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.12;
  margin: 0;
}

h1 {
  font-size: clamp(34px, 7vw, 58px);
  max-width: 870px;
}

h2 {
  font-size: 28px;
  margin-bottom: 14px;
}

h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

p {
  margin: 0 0 14px;
}

.subtitle {
  color: var(--muted);
  font-size: 18px;
  max-width: 760px;
}

.section {
  padding: 34px 0 0;
}

.tool-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tool-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.tool-card {
  min-height: 190px;
}

.tool-card p,
.panel p,
li {
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.tag {
  background: var(--soft);
  border: 1px solid #cfe6e1;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
}

.button,
button {
  align-items: center;
  background: var(--brand);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 720;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
}

.button:hover,
button:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: #eff3f6;
  color: var(--ink);
}

.tool-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  margin-top: 24px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 720;
}

input,
textarea,
select {
  background: #fff;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 148px;
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.result-box {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 16px;
  white-space: normal;
}

.metric-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.metric strong {
  display: block;
  font-size: 24px;
}

.status-good {
  color: var(--ok);
  font-weight: 760;
}

.status-warn {
  color: var(--accent);
  font-weight: 760;
}

.status-bad {
  color: var(--danger);
  font-weight: 760;
}

.copy-output {
  background: #101828;
  border-radius: 8px;
  color: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

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

.faq details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
  padding: 14px 16px;
}

.faq summary {
  cursor: pointer;
  font-weight: 760;
}

.ad-band {
  display: block;
  margin: 48px auto 0;
  padding: 0 20px;
  text-align: center;
  width: 100%;
}

.ad-link {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 1024px;
  overflow: hidden;
  width: 100%;
}

.ad-link img {
  display: block;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  max-width: 1024px;
  width: 100%;
}

.pinyin-output {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 28px;
  line-height: 2.35;
  margin-top: 14px;
  padding: 18px;
  word-break: break-word;
}

.pinyin-ruby {
  display: inline-ruby;
  margin: 0 3px;
  ruby-align: center;
}

.pinyin-ruby rt {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.clock-controls {
  align-items: end;
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  padding: 16px;
}

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

.clock-card {
  background: linear-gradient(180deg, #ffffff 0%, #f9fcfb 100%);
  border: 1px solid #d4e3df;
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(24, 32, 47, 0.09);
  min-height: 238px;
  padding: 20px;
  position: relative;
}

.clock-card::before {
  background: var(--brand);
  border-radius: 8px 8px 0 0;
  content: "";
  height: 4px;
  left: -1px;
  position: absolute;
  right: -1px;
  top: -1px;
}

.clock-card-header {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.clock-card-header h3 {
  font-size: 22px;
}

.clock-card-header p {
  color: var(--muted);
  margin: 6px 0 0;
}

.clock-remove {
  min-height: 34px;
  padding: 6px 10px;
}

.clock-time {
  align-items: center;
  background: #eef8f6;
  border: 1px solid #cde5df;
  border-radius: 8px;
  color: var(--brand-dark);
  display: flex;
  font-variant-numeric: tabular-nums;
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 850;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  margin: 22px 0 16px;
  min-height: 92px;
  padding: 14px;
  text-align: center;
}

.clock-meta {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 14px;
  gap: 8px;
  justify-content: space-between;
  padding-top: 10px;
  margin-top: 10px;
}

.clock-meta strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.language-note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
}

.compact-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.furigana-output {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 180px;
  margin-top: 14px;
  padding: 18px;
  word-break: break-word;
}

.furigana-output:empty::before {
  color: var(--muted);
  content: "";
}

.furigana-output ruby {
  ruby-align: center;
}

.furigana-output rt {
  color: var(--brand-dark);
  font-size: 0.45em;
  font-weight: 700;
}

.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 860px) {
  .compact-controls,
  .clock-controls,
  .clock-grid {
    grid-template-columns: 1fr;
  }

  .clock-card {
    min-height: 0;
  }
}

.flashcard-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.flashcard-list li {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 10px 12px;
}

.flashcard-list span {
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  margin-top: 48px;
  padding: 32px 20px;
}

.footer-inner {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  margin: 0 auto;
  max-width: 1120px;
}

.footer-brand {
  color: var(--ink);
  font-weight: 760;
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: flex-end;
}

.copyright {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

@media (max-width: 860px) {
  .tool-grid,
  .tool-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    flex-wrap: wrap;
  }

  .page {
    padding-top: 24px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

.prompt-page {
  max-width: 1240px;
}

.prompt-hero {
  border-bottom: 3px double #141820;
  margin-bottom: 10px;
}

.prompt-workbench {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  margin-top: 22px;
}

.prompt-drawer {
  background: #fffdf7;
  border-color: #141820;
  box-shadow: 10px 10px 0 #141820;
  position: sticky;
  top: 88px;
  align-self: start;
}

.drawer-label {
  background: #141820;
  color: #fffdf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: -20px -20px 18px;
  padding: 9px 14px;
  text-transform: uppercase;
}

.prompt-filter-grid {
  gap: 12px;
}

.prompt-stats {
  border-top: 1px solid #141820;
  display: grid;
  gap: 6px 10px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 18px;
  padding-top: 16px;
}

.prompt-stats strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
}

.prompt-stats span,
.prompt-history p {
  color: var(--muted);
  font-size: 13px;
}

.prompt-history {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.prompt-card-shelf {
  min-width: 0;
}

.prompt-toolbar {
  align-items: end;
  border-bottom: 1px solid #141820;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.prompt-toolbar p {
  color: var(--muted);
  margin: 6px 0 0;
}

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

.prompt-card {
  background: #fffdf7;
  border: 1px solid #141820;
  border-radius: 6px;
  box-shadow: 7px 7px 0 rgba(20, 24, 32, 0.16);
  display: grid;
  gap: 13px;
  padding: 16px;
  position: relative;
}

.prompt-card::before {
  background: repeating-linear-gradient(90deg, #141820 0 7px, transparent 7px 13px);
  content: "";
  height: 4px;
  left: 12px;
  position: absolute;
  right: 12px;
  top: -1px;
}

.prompt-card-top,
.prompt-tags,
.prompt-fields,
.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-card-top {
  align-items: center;
  justify-content: space-between;
}

.file-tab,
.prompt-tags span {
  border: 1px solid #141820;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.file-tab {
  background: #f6d365;
  color: #141820;
}

.prompt-tags span {
  background: #ffffff;
  color: #303846;
}

.prompt-star {
  background: #eff3f6;
  border: 1px solid #141820;
  color: #141820;
  min-height: 34px;
  padding: 6px 10px;
}

.prompt-star.active {
  background: #141820;
  color: #fffdf7;
}

.prompt-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.prompt-output {
  background: #141820;
  border: 1px solid #141820;
  border-radius: 6px;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  min-height: 170px;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .prompt-workbench,
  .prompt-card-grid {
    grid-template-columns: 1fr;
  }

  .prompt-drawer {
    position: static;
  }
}

@media (max-width: 560px) {
  .prompt-toolbar,
  .prompt-fields {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.bilglot-body {
  background: #080b12;
  color: #e5eef9;
}

.bilglot-header {
  background: rgba(11, 16, 28, 0.96);
  border-bottom-color: #1f2a3d;
}

.bilglot-header .brand,
.bilglot-header .nav-links a,
.bilglot-header .language-switch {
  color: #e5eef9;
}

.bilglot-app {
  margin: 0 auto;
  max-width: 1440px;
  padding: 28px 18px 40px;
}

.bilglot-titlebar {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 8px 0 22px;
}

.bilglot-titlebar h1 {
  color: #f8fafc;
  font-size: clamp(30px, 5vw, 52px);
}

.bilglot-titlebar p:not(.eyebrow) {
  color: #93a4bc;
  margin-top: 10px;
  max-width: 780px;
}

.bilglot-status {
  background: #0f172a;
  border: 1px solid #2a3a55;
  border-radius: 6px;
  color: #38f5c5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 10px 12px;
}

.bilglot-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
}

.bilglot-left,
.bilglot-right {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.bilglot-dropzone,
.bilglot-player-panel,
.bilglot-dictation,
.subtitle-loader,
.subtitle-toolbar,
.subtitle-viewport {
  background: #0f172a;
  border: 1px solid #24324b;
  border-radius: 8px;
}

.bilglot-dropzone {
  color: #cbd5e1;
  display: grid;
  gap: 4px;
  padding: 18px;
  position: relative;
}

.bilglot-dropzone input {
  inset: 0;
  opacity: 0;
  position: absolute;
}

.bilglot-dropzone strong {
  color: #f8fafc;
  font-size: 20px;
}

.bilglot-player-panel {
  padding: 12px;
}

.bilglot-player-panel video {
  background: #020617;
  border: 1px solid #1f2a3d;
  border-radius: 6px;
  display: block;
  max-height: 54vh;
  width: 100%;
}

#waveCanvas {
  background: #0b1020;
  border: 1px solid #1f2a3d;
  border-radius: 6px;
  display: block;
  height: 120px;
  margin-top: 12px;
  width: 100%;
}

.bilglot-controls,
.subtitle-loader {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.subtitle-loader {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 160px;
  margin-top: 0;
  padding: 12px;
}

.bilglot-app label,
.bilglot-app h2,
.bilglot-app h3 {
  color: #f8fafc;
}

.bilglot-app input,
.bilglot-app select {
  background: #111c31;
  border-color: #314260;
  color: #e5eef9;
}

.subtitle-toolbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.subtitle-toolbar p,
.compact-toggle {
  color: #93a4bc;
  font-size: 13px;
  margin: 5px 0 0;
}

.subtitle-viewport {
  height: 72vh;
  overflow: auto;
  position: relative;
}

#subtitleSpacer {
  pointer-events: none;
  width: 1px;
}

#subtitleVisible {
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.subtitle-card {
  background: #111c31;
  border: 1px solid #253751;
  border-left: 4px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  margin: 8px 10px;
  overflow: hidden;
  padding: 12px 14px;
}

.subtitle-card.active {
  background: #17384a;
  border-color: #38f5c5;
  border-left-color: #38f5c5;
  box-shadow: 0 0 0 1px rgba(56, 245, 197, 0.25), 0 18px 36px rgba(0, 0, 0, 0.28);
}

.subtitle-time {
  color: #7dd3fc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  margin-bottom: 7px;
}

.subtitle-main {
  color: #f8fafc;
  font-size: 18px;
  line-height: 1.45;
}

.subtitle-main ruby rt {
  color: #38f5c5;
  font-size: 0.55em;
}

.subtitle-native {
  color: #a8b6ca;
  font-size: 15px;
  line-height: 1.35;
  margin-top: 7px;
}

.word-chip {
  background: transparent;
  border: 0;
  color: inherit;
  display: inline;
  font: inherit;
  min-height: 0;
  padding: 0;
  text-decoration: underline dotted #38f5c5;
}

.bilglot-dictation {
  padding: 16px;
}

.bilglot-dictation p {
  color: #93a4bc;
}

.dictation-line {
  background: #111c31;
  border: 1px solid #253751;
  border-radius: 8px;
  color: #f8fafc;
  font-size: 20px;
  line-height: 1.7;
  min-height: 84px;
  padding: 16px;
}

.dictation-input {
  display: inline-block;
  margin: 0 4px;
  min-height: 34px;
  padding: 5px 8px;
  width: 128px;
}

.dictation-input.correct {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.dictation-input.wrong {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.dictation-answer {
  background: #064e3b;
  border-radius: 4px;
  color: #bbf7d0;
  padding: 2px 6px;
}

.bilglot-dictionary {
  background: #0f172a;
  border-left: 1px solid #2a3a55;
  bottom: 0;
  box-shadow: -18px 0 38px rgba(0, 0, 0, 0.35);
  color: #e5eef9;
  max-width: 360px;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform 0.18s ease;
  width: 86vw;
  z-index: 30;
}

.bilglot-dictionary.open {
  transform: translateX(0);
}

.bilglot-dictionary p {
  color: #a8b6ca;
}

@media (max-width: 980px) {
  .bilglot-titlebar,
  .subtitle-toolbar {
    align-items: stretch;
    display: grid;
  }

  .bilglot-grid,
  .bilglot-controls,
  .subtitle-loader {
    grid-template-columns: 1fr;
  }

  .subtitle-viewport {
    height: 62vh;
  }
}

.bilglot-ad-band {
  margin-top: 34px;
}

.bilglot-ad-band .ad-link {
  background: #0f172a;
  border-color: #24324b;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.bilglot-footer {
  background: #080b12;
  border-top-color: #24324b;
  color: #93a4bc;
  margin-top: 34px;
}

.bilglot-footer .footer-brand {
  color: #f8fafc;
}

.bilglot-footer .copyright,
.bilglot-footer .footer-links a {
  color: #a8b6ca;
}

.bilglot-footer .footer-links a:hover {
  color: #38f5c5;
}
