:root {
  color-scheme: dark;
  --bg: #11141b;
  --panel: #191e28;
  --panel-raised: #222a38;
  --line: #343d4f;
  --text: #f1f5ef;
  --muted: #a0aabd;
  --accent: #83aaff;
  --accent-dark: #1b2b4a;
  --accent-soft: #7dcbff;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: "Manrope", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(ellipse at 50% -22%, rgba(125, 171, 255, .13), transparent 55%),
    var(--bg);
  min-height: 100vh;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
.site-shell { max-width: 1180px; width: calc(100% - 64px); margin: 0 auto; }
.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(160, 170, 189, .15);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 800; letter-spacing: -1.4px; }
.brand-light { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; background: #e5b85c; border-radius: 50%; box-shadow: 0 0 0 4px rgba(229,184,92,.1); }
.status-dot.ready { background: var(--accent); box-shadow: 0 0 0 4px rgba(131,170,255,.1); }
.status-dot.error { background: #ff8c83; box-shadow: 0 0 0 4px rgba(255,140,131,.1); }
.github-link { margin-left: 18px; color: var(--text); border: 1px solid var(--line); padding: 9px 12px; border-radius: 8px; transition: border-color .2s, background .2s; }
.github-link:hover { border-color: #52698f; background: rgba(255,255,255,.03); }
main { padding: 65px 0 38px; }
.hero { max-width: 730px; margin: 0 auto 38px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font: 10px var(--mono); letter-spacing: 1.8px; }
.eyebrow-line { width: 22px; height: 1px; background: var(--accent); }
h1 { margin: 17px 0 13px; font-size: clamp(44px, 6vw, 70px); line-height: 1.08; letter-spacing: -4.4px; font-weight: 800; }
h1 span { color: var(--accent); }
.hero-copy { max-width: 560px; margin: 0 auto; color: var(--muted); font-size: 15px; line-height: 1.8; }
.translator-card { overflow: hidden; border: 1px solid var(--line); background: rgba(25,30,40,.93); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.15); }
.mode-bar { min-height: 68px; display: flex; justify-content: space-between; align-items: center; padding: 0 22px; border-bottom: 1px solid var(--line); }
.mode-tabs { display: flex; align-items: stretch; align-self: stretch; gap: 25px; }
.mode-tab { position: relative; border: 0; padding: 0 2px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.mode-tab span { padding: 0 7px; color: #8491a7; }
.mode-tab.active { color: var(--text); }
.mode-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.mode-tab.active span { color: var(--accent); }
.swap-button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #242d3d; color: var(--muted); font-size: 12px; transition: color .2s, border-color .2s; }
.swap-button:hover { color: var(--accent); border-color: #536a92; }
.swap-button:first-letter { font-size: 16px; }
.translation-grid { display: grid; grid-template-columns: minmax(0,1fr) 42px minmax(0,1fr); padding: 21px; gap: 0; }
.text-panel { min-width: 0; min-height: 280px; border: 1px solid var(--line); border-radius: 10px; background: #141923; display: flex; flex-direction: column; }
.panel-heading { min-height: 55px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid rgba(52,61,79,.75); font-size: 12px; font-weight: 700; }
.panel-heading label, #result-label { display: flex; align-items: center; gap: 9px; }
.language-pill { display: inline-flex; align-items: center; border-radius: 4px; padding: 4px 6px; background: #253753; color: var(--accent-soft); font: 9px var(--mono); letter-spacing: .7px; }
.blub-pill { color: var(--accent); background: #253753; }
.text-action { border: 0; padding: 5px 0; color: var(--muted); background: transparent; font-size: 11px; white-space: nowrap; }
.text-action:hover { color: var(--accent); }
textarea { width: 100%; flex: 1; min-height: 170px; resize: vertical; border: 0; outline: 0; padding: 18px 16px; background: transparent; color: var(--text); font: 13px/1.85 var(--mono); caret-color: var(--accent); }
textarea::placeholder { color: #68768d; }
textarea:focus-visible { outline: 0; box-shadow: inset 0 0 0 1px rgba(131,170,255,.3); border-radius: 8px; }
.result-text { flex: 1; min-height: 170px; padding: 18px 16px; color: #d0d9e8; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.85 var(--mono); }
.result-text.placeholder { color: #68768d; }
.panel-footer { min-height: 39px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid rgba(52,61,79,.75); padding: 0 13px; color: #8290a5; font-size: 10px; }
.char-count { font-family: var(--mono); white-space: nowrap; }
.direction-divider { display: flex; align-items: center; justify-content: center; color: #8290aa; font-size: 20px; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 21px 21px; }
.privacy-note { color: var(--muted); font-size: 11px; }
.privacy-note span { color: var(--accent-soft); margin-right: 5px; }
.translate-button { min-height: 45px; display: inline-flex; justify-content: center; align-items: center; gap: 24px; border: 0; border-radius: 8px; padding: 0 16px 0 20px; background: var(--accent); color: #111827; font-size: 12px; font-weight: 800; transition: transform .18s, background .18s, opacity .18s; }
.translate-button:hover:not(:disabled) { transform: translateY(-1px); background: #a7c3ff; }
.translate-button:disabled { cursor: not-allowed; opacity: .45; }
.button-arrow { font-size: 17px; }
.notice { margin: 0 21px 20px; padding: 11px 13px; border: 1px solid rgba(131,170,255,.25); border-radius: 8px; background: rgba(131,170,255,.06); color: #dce7ff; font-size: 12px; line-height: 1.6; }
.notice.warning { border-color: rgba(229,184,92,.3); background: rgba(229,184,92,.06); }
.notice[hidden] { display: none; }
.below-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 17px; margin-top: 20px; }
.info-card { padding: 21px 22px 22px; border: 1px solid rgba(52,61,79,.85); border-radius: 12px; background: rgba(25,30,40,.55); }
.info-icon { color: var(--accent); font: 10px var(--mono); letter-spacing: 1px; }
.info-card h2 { margin: 15px 0 8px; font-size: 14px; letter-spacing: -.3px; }
.info-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.footnote { max-width: 680px; margin: 23px auto 0; text-align: center; color: #8290a5; font-size: 10px; line-height: 1.8; }
.footer { min-height: 85px; border-top: 1px solid rgba(160,170,189,.15); display: flex; align-items: center; justify-content: space-between; gap: 18px; color: #8794aa; font-size: 10px; }
.footer-brand { color: var(--text); font-size: 17px; letter-spacing: -1px; gap: 7px; }
.heart { color: var(--accent); }

@media (max-width: 760px) {
  .site-shell { width: calc(100% - 34px); }
  .topbar { height: 70px; }
  .topbar-right { gap: 7px; }
  #system-status { display: none; }
  main { padding-top: 45px; }
  .hero { margin-bottom: 29px; }
  h1 { letter-spacing: -2.8px; }
  .hero-copy { font-size: 13px; }
  .translation-grid { grid-template-columns: minmax(0,1fr); gap: 12px; padding: 13px; }
  .text-panel { min-height: 245px; }
  .direction-divider { height: 15px; font-size: 0; }
  .direction-divider span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: 16px; transform: rotate(90deg); }
  .mode-bar { padding: 0 13px; min-height: 60px; }
  .mode-tabs { gap: 15px; }
  .mode-tab { font-size: 11px; }
  .swap-button { padding: 8px; }
  .swap-button span { display: none; }
  .action-row { padding: 0 13px 13px; align-items: flex-start; flex-direction: column; }
  .translate-button { width: 100%; }
  .below-grid { grid-template-columns: 1fr; gap: 10px; }
  .info-card { padding: 17px 18px; }
  .info-card h2 { margin-top: 10px; }
  .footer { padding: 19px 0; flex-wrap: wrap; justify-content: space-between; }
  .footer > span:nth-of-type(1) { order: 3; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Dictionary navigation and page */
.nav-link, .footer-nav {
  color: var(--text);
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: 8px;
  transition: border-color .2s, background .2s;
}
.nav-link:hover, .footer-nav:hover { border-color: #52698f; background: rgba(255,255,255,.03); }
.footer-nav { border: 0; padding: 0; color: var(--accent); }
.dictionary-hero { max-width: 760px; margin: 0 auto 32px; text-align: center; }
.dictionary-hero h1 { font-size: clamp(40px, 5vw, 60px); }
.dictionary-card { overflow: hidden; border: 1px solid var(--line); background: rgba(25,30,40,.93); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.15); }
.dictionary-tools { display: flex; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dictionary-search { flex: 1 1 240px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #141923; color: var(--text); padding: 12px 14px; font: 13px var(--mono); }
.dictionary-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dictionary-filter { border: 1px solid var(--line); border-radius: 8px; background: #222a38; color: var(--text); padding: 10px 12px; font: 12px var(--sans); }
.dictionary-summary { display: flex; justify-content: space-between; gap: 12px; padding: 13px 18px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
.dictionary-table-wrap { overflow-x: auto; }
.dictionary-table { width: 100%; border-collapse: collapse; text-align: left; }
.dictionary-table th { padding: 13px 18px; color: var(--muted); background: rgba(255,255,255,.02); font: 10px var(--mono); text-transform: uppercase; letter-spacing: 1px; }
.dictionary-table td { padding: 12px 18px; border-top: 1px solid rgba(52,61,79,.55); font-size: 13px; }
.dictionary-table tr:hover td { background: rgba(131,170,255,.035); }
.dictionary-english { font-weight: 700; overflow-wrap: anywhere; }
.dictionary-token { color: var(--accent); font: 13px var(--mono); white-space: nowrap; }
.dictionary-type { color: var(--muted); font-size: 11px !important; }
.dictionary-empty { padding: 32px 18px !important; text-align: center; color: var(--muted); }
.dictionary-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 18px; border-top: 1px solid var(--line); }
.dictionary-pagination button { border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; background: #222a38; color: var(--text); font-size: 11px; }
.dictionary-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.dictionary-pagination span { color: var(--muted); font-size: 11px; }
.dictionary-note { max-width: 760px; margin: 18px auto 0; color: var(--muted); font-size: 11px; line-height: 1.8; text-align: center; }
.dictionary-active { color: var(--accent) !important; }
@media (max-width: 760px) {
  .topbar-right { gap: 8px; }
  .nav-link { padding: 8px 9px; font-size: 11px; }
  .dictionary-tools { padding: 12px; }
  .dictionary-summary { padding: 12px; }
  .dictionary-table th, .dictionary-table td { padding: 11px 12px; }
  .dictionary-type { display: none; }
  .dictionary-pagination { padding: 12px; }
  .footer-nav { order: 4; }
}
