/* ============================================================================
   TRANSLATION TOOL  ·  pages/translate/style.css
   ----------------------------------------------------------------------------
   The home design language: dark glass cards, thin lines, Space Grotesk for
   text, IBM Plex Mono for keys and labels, Instrument Serif for the accent
   word. Blue marks shipped game text. Gold marks your edits. Orange marks a
   row whose English text changed after you saved the edit.

   GREP TARGETS  (grep -n "<target>" style.css)
     tokens ............... ":root"
     hero ................. ".hero"
     language cards ....... ".lang"
     compact picker ....... ".langs.compact"
     intro tips ........... ".intro"
     toolbar .............. ".tools"
     progress ............. ".prog"
     rows ................. ".row"
     placeholder marks .... ".ph"
     export dock .......... ".dock"
     toast ................ ".toast"
     breakpoints .......... "@media"
     landscape phone ...... "short landscape"
     touch sizes .......... "pointer: coarse"
   ============================================================================ */

:root {
  --bg: #0a0c12; --bg2: #0e1119; --bg3: #131826;
  --ink: #eef3fb; --text: #c3d0e2; --dim: #7f91ad; --faint: #3a4866;
  --line: rgba(150, 200, 255, 0.09); --line2: rgba(150, 200, 255, 0.18);
  --blue: #96c8ff; --gold: #ffc832; --orange: #ff7b00; --red: #ff6b6b;
  --glass: rgba(16, 21, 33, 0.62);
  --f-sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --f-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --r: 16px; --r-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: clamp(16px, 3.4vw, 44px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { font: 400 15px/1.55 var(--f-sans); color: var(--text); background: var(--bg); overflow-x: hidden; -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
  background-image: radial-gradient(70% 45% at 85% -10%, rgba(150, 200, 255, .08), transparent 60%), radial-gradient(50% 35% at 0% 5%, rgba(255, 200, 50, .05), transparent 60%); }
body.has-dock { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .4; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--gold); }
kbd { font: 500 0.66rem/1 var(--f-mono); padding: 3px 6px; border: 1px solid var(--line2); border-radius: 5px; color: var(--dim); background: rgba(150, 200, 255, 0.05); }
.kicker { font: 500 0.7rem/1.4 var(--f-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); opacity: .85; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter) 40px; }

/* ── hero ─────────────────────────────────────────────────────────────── */
.hero { padding: clamp(28px, 6vh, 64px) 0 22px; }
.hero h1 { margin: 8px 0 10px; font: 300 clamp(2.2rem, 5vw, 3.8rem)/1 var(--f-sans); letter-spacing: -0.025em; color: var(--ink); }
.lead { max-width: 620px; color: var(--dim); font-size: 1rem; }

/* ── language cards ───────────────────────────────────────────────────── */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sec-note { font: 500 0.68rem/1 var(--f-mono); color: var(--dim); letter-spacing: .08em; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 10px; }
.lang { position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "flag txt code" "bar bar bar" "stat stat stat"; align-items: center; column-gap: 12px; row-gap: 8px; padding: 14px 14px 12px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, var(--bg3), var(--bg2)); text-align: left; transition: transform .35s var(--ease), border-color .25s, box-shadow .35s; }
.lang:hover { transform: translateY(-3px); border-color: rgba(150, 200, 255, .4); box-shadow: 0 18px 40px -22px rgba(150, 200, 255, .55); }
.lang.on { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255, 200, 50, .25), 0 16px 40px -24px rgba(255, 200, 50, .7); }
.flag { grid-area: flag; font-size: 1.7rem; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.l-txt { grid-area: txt; min-width: 0; display: flex; flex-direction: column; }
.l-name { font-weight: 600; color: var(--ink); font-size: 0.98rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-sub { font-size: 0.74rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-code { grid-area: code; font: 500 0.68rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.l-bar { grid-area: bar; height: 4px; border-radius: 4px; background: rgba(150, 200, 255, .08); overflow: hidden; }
.l-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5d8fd0, var(--blue)); }
.l-stat { grid-area: stat; font: 500 0.66rem/1 var(--f-mono); color: var(--dim); letter-spacing: .04em; }
.l-stat b { color: var(--gold); font-weight: 500; }

/* Once a language is on, the cards shrink to one scrolling chip row. */
.langs.compact { position: relative; margin: 0 calc(-1 * var(--gutter)); }
.langs.compact .lang-grid { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter) 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.langs.compact .lang-grid::-webkit-scrollbar { display: none; }
.langs.compact .lang { flex: none; grid-template-columns: auto auto; grid-template-areas: "flag txt" "bar bar"; padding: 8px 12px; row-gap: 6px; border-radius: 12px; }
.langs.compact .lang:hover { transform: none; }
.langs.compact .flag { font-size: 1.2rem; }
.langs.compact .l-sub, .langs.compact .l-code, .langs.compact .l-stat { display: none; }
.langs.compact .l-name { font-size: 0.84rem; }
.langs.compact .l-bar { height: 3px; }

/* ── intro tips ───────────────────────────────────────────────────────── */
.intro { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 22px; }
.tip { padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); display: flex; flex-direction: column; gap: 6px; }
.tip b { color: var(--ink); font-weight: 600; }
.tip span { color: var(--dim); font-size: 0.86rem; line-height: 1.7; }
.tip.keys { grid-column: 1 / -1; }

/* ── toolbar ──────────────────────────────────────────────────────────── */
.work { margin-top: 6px; }
.tools { position: sticky; top: 0; z-index: 20; margin: 0 calc(-1 * var(--gutter)); padding: 10px var(--gutter); background: rgba(10, 12, 18, .88); box-shadow: 0 0 0 100vmax rgba(10, 12, 18, .88); clip-path: inset(0 -100vmax); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--glass); color: var(--text); font-weight: 500; font-size: 0.88rem; transition: border-color .2s, background .2s; }
.cat .ct { font: 500 0.68rem/1 var(--f-mono); color: var(--dim); }
.cat:hover { border-color: rgba(150, 200, 255, .45); }
.cat.on { color: #1a1204; background: linear-gradient(135deg, #ffd65c, #ffb31a 55%, #ff8a3d); border-color: transparent; }
.cat.on .ct { color: rgba(26, 18, 4, .7); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sel { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); }
.sel span { font: 500 0.68rem/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.sel select { background: transparent; border: 0; outline: 0; color: var(--ink); font-size: 0.84rem; max-width: 220px; padding: 6px 4px; }
.sel select option { background: var(--bg2); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); }
.seg button { height: 30px; padding: 0 11px; border-radius: 7px; font-size: 0.8rem; color: var(--dim); white-space: nowrap; }
.seg button.on { background: rgba(150, 200, 255, .14); color: var(--ink); }
.find { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); }
.find:focus-within { border-color: rgba(150, 200, 255, .5); }
.find svg { width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; flex: none; }
.find input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; height: 100%; font-size: 16px; color: var(--ink); }
.find input::placeholder { color: var(--dim); }

/* ── progress ─────────────────────────────────────────────────────────── */
.prog { padding: 14px 0 6px; }
.bar { position: relative; display: flex; height: 6px; border-radius: 6px; overflow: hidden; background: rgba(150, 200, 255, .08); }
.bar i { display: block; height: 100%; transition: width .5s var(--ease); }
.b-game { background: linear-gradient(90deg, #5d8fd0, var(--blue)); }
.b-mine { background: linear-gradient(90deg, #ffb31a, var(--gold)); box-shadow: 0 0 10px rgba(255, 200, 50, .5); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 9px; font: 500 0.68rem/1.3 var(--f-mono); color: var(--dim); letter-spacing: .04em; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-weight: 500; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.d-game { background: var(--blue); } .d-mine { background: var(--gold); } .d-chg { background: var(--orange); } .d-todo { background: var(--faint); }
.legend .pc { margin-left: auto; color: var(--ink); font-size: 0.8rem; }

/* ── rows ─────────────────────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.sh { display: flex; align-items: baseline; gap: 10px; margin: 16px 2px 2px; }
.sh span { font-weight: 600; color: var(--ink); font-size: 1rem; }
.sh code { font: 500 0.66rem/1 var(--f-mono); color: var(--dim); }
.row { position: relative; padding: 12px 14px 10px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(19, 24, 38, .9), rgba(14, 17, 25, .9)); transition: border-color .25s, box-shadow .3s; }
.row:focus-within { border-color: rgba(150, 200, 255, .45); box-shadow: 0 16px 40px -26px rgba(150, 200, 255, .6); }
.row.st-mine { border-left: 2px solid var(--gold); }
.row.st-changed { border-left: 2px solid var(--orange); }
.r-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.st-game .dot { background: var(--blue); }
.st-mine .dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.st-changed .dot { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.key { min-width: 0; font: 400 0.68rem/1.3 var(--f-mono); color: var(--dim); overflow-wrap: anywhere; }
.badge { flex: none; font: 500 0.66rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line2); color: var(--blue); }
.badge.chg { color: var(--orange); border-color: rgba(255, 123, 0, .45); }
.src { margin: 7px 0 0; color: var(--ink); font-size: 0.96rem; line-height: 1.5; overflow-wrap: anywhere; }
.ph { font-family: var(--f-mono); font-size: 0.86em; color: var(--blue); background: rgba(150, 200, 255, .1); border-radius: 4px; padding: 0 3px; }
.mk { font-family: var(--f-mono); font-size: 0.86em; color: var(--gold); background: rgba(255, 200, 50, .08); border-radius: 4px; padding: 0 3px; }
.nl { color: var(--faint); font-size: 0.8em; margin-left: 2px; }
.game { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(150, 200, 255, .05); border: 1px solid var(--line); }
.g-lab { flex: none; font: 500 0.66rem/1.65 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.g-txt { flex: 1; min-width: 0; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
.ti { display: block; width: 100%; margin-top: 8px; min-height: 42px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(8, 10, 16, .7); color: var(--ink); font-size: 16px; line-height: 1.45; resize: none; outline: 0; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.ti::placeholder { color: var(--faint); }
.ti:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 50, .12); }
.st-mine .ti { border-color: rgba(255, 200, 50, .35); }
.st-changed .ti { border-color: rgba(255, 123, 0, .45); }
.r-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; min-height: 30px; }
.warn { margin-right: auto; font: 500 0.68rem/1.3 var(--f-mono); color: var(--orange); overflow-wrap: anywhere; }
.mini { flex: none; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line2); font: 500 0.72rem/1 var(--f-mono); letter-spacing: .04em; color: var(--text); transition: border-color .2s, color .2s; }
.mini:hover:not(:disabled) { border-color: var(--blue); color: var(--ink); }
.game .mini { height: 26px; }
.mini.send:not(:disabled) { border-color: rgba(255, 200, 50, .5); color: var(--gold); }
.ty { font: 500 0.72rem/1.2 var(--f-mono); color: #8be08b; }
.ty b { color: #b6f5b6; font-weight: 500; }
.more { margin: 10px auto 0; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text); font: 500 0.78rem/1 var(--f-mono); }
.empty { padding: 40px 10px; text-align: center; color: var(--dim); }

/* ── export dock ──────────────────────────────────────────────────────── */
.dock { position: fixed; z-index: 40; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(1100px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 18px; border: 1px solid var(--line2); background: rgba(14, 18, 28, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .9); }
.dock-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 0.86rem; color: var(--ink); line-height: 1.25; }
.dock-info .flag { font-size: 1.4rem; }
.dock-info small { color: var(--dim); font: 500 0.66rem/1.3 var(--f-mono); }
.dock-info .mode { font: 500 0.68rem/1 var(--f-mono); color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.dock-acts { display: flex; gap: 6px; flex: none; }
.btn { height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); font-weight: 500; font-size: 0.86rem; transition: transform .25s var(--ease), box-shadow .3s, border-color .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.gold { background: linear-gradient(135deg, #ffd65c, #ffb31a 55%, #ff8a3d); color: #1a1204; border-color: transparent; box-shadow: 0 8px 26px -10px rgba(255, 190, 40, .6); }
.btn.ghost { color: var(--ink); background: rgba(150, 200, 255, .05); }
.btn.danger { color: var(--red); border-color: rgba(255, 107, 107, .35); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 96px; transform: translate(-50%, 16px); padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(14, 18, 28, .96); color: var(--ink); font-size: 0.86rem; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s var(--ease); max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── phone ────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .lang-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lang { padding: 12px 11px 10px; column-gap: 9px; grid-template-columns: auto 1fr; grid-template-areas: "flag txt" "bar bar" "stat stat"; }
  .l-code { display: none; }
  .flag { font-size: 1.45rem; }
  .l-name { font-size: 0.9rem; }
  .tools { position: static; padding-top: 4px; }
  .filters { gap: 6px; }
  .sel { flex: 1 1 100%; }
  .sel select { flex: 1; max-width: none; }
  .seg { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { flex: 1; padding: 0 6px; font-size: 0.76rem; }
  .find { flex: 1 1 100%; }
  .find kbd { display: none; }
  .row { padding: 11px 11px 9px; }
  .ti { min-height: 68px; } /* two lines, so the placeholder is not cut */
  .game { flex-direction: column; gap: 4px; }
  .game .mini { align-self: flex-end; }
  .dock { left: 0; right: 0; transform: none; width: auto; bottom: 0; border-radius: 16px 16px 0 0; border-bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .dock-info small { display: none; }
  .dock-info .mode { display: none; }
  .btn { height: 40px; padding: 0 12px; font-size: 0.8rem; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .dock-info b { display: none; }
}

/* ── short landscape screens ──────────────────────────────────────────── */
/* A phone on its side has little height. The toolbar stops sticking and
   the dock becomes a flat bottom bar, so the rows keep most of the screen. */
@media (max-height: 500px) and (max-width: 1279px) {
  .hero { padding: 16px 0 12px; }
  .hero h1 { font-size: 2rem; margin: 6px 0 6px; }
  .lead { font-size: 0.9rem; max-width: none; }
  .tools { position: static; }
  .dock { left: 0; right: 0; transform: none; width: auto; bottom: 0; border-radius: 16px 16px 0 0; border-bottom: 0; padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .dock-info small { display: none; }
  body.has-dock { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ── touch ────────────────────────────────────────────────────────────── */
/* Primary controls get a 44px hit area. Row buttons stay dense at 40px.
   Form fields use 16px text, so iOS Safari does not zoom on focus. */
@media (pointer: coarse) {
  .cat, .sel, .find, .btn { height: 44px; }
  .seg button { height: 38px; min-width: 44px; }
  .sel select { font-size: 16px; height: 100%; }
  .mini, .game .mini { height: 40px; padding: 0 14px; }
  .r-foot { min-height: 40px; }
  .langs.compact .lang { min-height: 44px; }
  .more { height: 48px; }
  /* The card title attribute is a hover tooltip. On touch the full
     English name and mode wrap in the card instead. */
  .l-sub { white-space: normal; overflow: visible; }
}

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