/* ==========================================================================
   GENBA KOTOBA  v2  —  refined Industrial Warmth
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@500;700;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* base palette — refined for clarity */
  --ink:        #14110D;
  --ink-2:      #2A241D;
  --ink-soft:   #463E33;
  --paper:      #F4ECDA;            /* slightly warmer cream */
  --paper-2:    #ECE2CB;
  --card:       #FFFCF3;            /* near-white card */
  --line:       #1F1A12;

  --hi-vis:     #FF6A1A;
  --hi-vis-2:   #FF8A3D;
  --hi-vis-deep:#D9510B;
  --hazard:     #FFCB05;
  --blueprint:  #14387F;
  --concrete:   #807766;
  --safety-red: #C8200F;
  --grass:      #1E7A47;

  --shadow-hard: 4px 4px 0 var(--ink);
  --shadow-card: 0 1px 0 rgba(255,255,255,.6) inset, 0 14px 28px -18px rgba(20,17,13,.35), 0 1.5px 0 rgba(20,17,13,.05);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --safe-top:    env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'Plus Jakarta Sans', 'Noto Sans JP', system-ui, sans-serif;
  --font-jp:      'Noto Sans JP', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ol, ul { list-style: none; }
input, textarea { font: inherit; color: inherit; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* very subtle paper texture only */
  background-image:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(255,203,5,.05), transparent 50%);
}
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .6;
}

/* ── icon system ──────────────────────────────────────────────────────── */
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ── shell ────────────────────────────────────────────────────────────── */
.shell {
  position: relative; z-index: 2;
  max-width: 480px; margin: 0 auto;
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: calc(108px + var(--safe-bottom));
}

/* ── topbar ───────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(to bottom, var(--paper) 70%, transparent);
  padding-top: calc(14px + var(--safe-top));
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  background: var(--ink); color: var(--hazard);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 20px;
  border-radius: 10px;
  position: relative;
  box-shadow: 3px 3px 0 var(--ink), inset 0 0 0 2px var(--hazard);
  transform: rotate(-2deg);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800; font-size: 19px;
  letter-spacing: -0.025em; line-height: 1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .2em;
  color: var(--concrete); text-transform: uppercase;
  margin-top: 3px;
}
.lang-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.lang-pill:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
.lang-pill .flag { font-size: 16px; line-height: 1; }

/* ── hazard tape ──────────────────────────────────────────────────────── */
.hazard-tape {
  height: 14px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, var(--ink) 14px 28px);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  margin: 4px 0 18px;
}

/* ── headings ─────────────────────────────────────────────────────────── */
.label-mono {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-soft);
  font-weight: 700;
}
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  padding: 26px 18px 12px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1;
}

/* ── HERO  (home greeting) ────────────────────────────────────────────── */
.hero {
  margin: 0 16px;
  padding: 24px 22px 24px;
  background:
    radial-gradient(circle at 110% -10%, rgba(255,203,5,.18), transparent 50%),
    var(--ink);
  color: var(--paper);
  border-radius: var(--r-xl);
  position: relative; overflow: hidden;
  box-shadow: 0 24px 50px -25px rgba(20,17,13,.5), 0 0 0 1.5px var(--ink);
}
.hero::before {
  content: '';
  position: absolute; top: -30px; right: -40px;
  width: 220px; height: 220px;
  background: repeating-linear-gradient(135deg, var(--hi-vis) 0 6px, transparent 6px 14px);
  opacity: .25;
  transform: rotate(15deg);
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .25em; color: var(--hazard);
  text-transform: uppercase; font-weight: 700;
}
.hero-tag::before {
  content: ''; width: 8px; height: 8px;
  background: var(--hazard); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255,203,5,.2);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 800;
  letter-spacing: -0.038em; line-height: 1.0;
  margin: 12px 0 6px;
}
.hero .sub {
  color: rgba(244,236,218,.7);
  font-size: 13px;
  max-width: 80%;
}
.hero .stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed rgba(244,236,218,.18);
}
.hero .stat-num {
  font-family: var(--font-display);
  font-weight: 800; font-size: 30px; line-height: 1;
  color: var(--hazard);
  letter-spacing: -0.04em;
  display: flex; align-items: baseline; gap: 4px;
}
.hero .stat-num .unit {
  font-size: 11px; color: rgba(244,236,218,.4);
  font-family: var(--font-mono); font-weight: 700;
  letter-spacing: .1em;
}
.hero .stat-label {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(244,236,218,.5);
  margin-top: 6px;
}

/* ── continue card ────────────────────────────────────────────────────── */
.continue-card {
  margin: 16px;
  padding: 18px 18px;
  background: var(--hi-vis);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  display: flex; align-items: center; gap: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  position: relative; overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
.continue-card::after {
  /* corner accent */
  content: ''; position: absolute; bottom: -20px; right: -20px;
  width: 90px; height: 90px;
  background: var(--hazard);
  transform: rotate(45deg);
  opacity: .5;
}
.continue-card:active { transform: translate(5px,5px); box-shadow: 0 0 0 var(--ink); }
.continue-card .lead-icon {
  width: 52px; height: 52px;
  background: var(--ink); color: var(--hazard);
  border-radius: 14px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.continue-card h3 {
  font-family: var(--font-display);
  font-weight: 800; font-size: 18px;
  letter-spacing: -0.02em; line-height: 1.05;
}
.continue-card p { font-size: 12px; color: rgba(20,17,13,.7); margin-top: 3px; }
.continue-card .arrow {
  margin-left: auto; z-index: 1;
  width: 36px; height: 36px;
  background: var(--ink); color: var(--hi-vis);
  border-radius: 50%;
  display: grid; place-items: center;
}

/* ── safety hero ──────────────────────────────────────────────────────── */
.safety-hero {
  margin: 16px;
  background: linear-gradient(135deg, var(--safety-red) 0%, #A41A0C 100%);
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 18px 18px 18px 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 5px 5px 0 var(--ink);
  position: relative; overflow: hidden;
}
.safety-hero::before {
  content: '!'; font-family: var(--font-display);
  font-weight: 800; font-size: 130px;
  position: absolute; right: -16px; bottom: -50px;
  opacity: .12; line-height: 1; color: var(--paper);
}
.safety-hero .badge {
  width: 56px; height: 56px;
  background: var(--paper); color: var(--safety-red);
  border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--ink);
}
.safety-hero h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.1;
}
.safety-hero p { font-size: 12px; opacity: .9; margin-top: 3px; }

/* ── category grid (improved composition) ─────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}
.cat-card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 18px 16px 16px;
  min-height: 168px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-card), 3px 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
  overflow: hidden;
}
.cat-card:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.cat-card .cat-num {
  position: absolute; top: 14px; right: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .15em;
  color: var(--concrete); font-weight: 700;
}
.cat-card .cat-icon-wrap {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--ink); color: var(--hazard);
  display: grid; place-items: center;
  margin-bottom: 14px;
  box-shadow: 2px 2px 0 var(--ink);
}
.cat-card .cat-icon-wrap .ic { color: inherit; }
.cat-card .title-jp {
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em; line-height: 1.1;
}
.cat-card .title-loc {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.cat-card .count {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--concrete);
  letter-spacing: .1em; font-weight: 700;
  margin-top: auto; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.cat-card .count::after {
  content: '→';
  background: var(--paper-2);
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 14px; color: var(--ink);
  font-weight: 800;
}
.cat-progress {
  width: 48px; height: 6px;
  background: var(--paper-2);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(20,17,13,.1);
}
.cat-progress-fill {
  height: 100%;
  background: var(--hi-vis);
  border-radius: 3px;
  transition: width .3s;
}
.cat-card.urgent .cat-progress { background: rgba(20,17,13,.15); }
.cat-card.urgent .cat-progress-fill { background: var(--safety-red); }

.cat-card.urgent { background: var(--hazard); }
.cat-card.urgent .cat-icon-wrap { background: var(--safety-red); color: var(--paper); }
.cat-card.urgent::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 14px, rgba(20,17,13,.04) 14px 15px);
  pointer-events: none;
}
.cat-card.urgent .count::after {
  background: var(--ink); color: var(--hazard);
}
.cat-card.urgent .cat-num { color: var(--ink); }

/* ── word-of-the-day ──────────────────────────────────────────────────── */
.word-day {
  margin: 16px;
  padding: 22px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  position: relative;
  box-shadow: var(--shadow-card), 3px 3px 0 var(--ink);
  display: flex; gap: 18px; align-items: center;
}
.word-day .stamp {
  position: absolute; top: -10px; right: 16px;
  background: var(--safety-red); color: var(--paper);
  font-family: var(--font-mono); font-weight: 700; font-size: 9px;
  letter-spacing: .18em; padding: 5px 10px;
  border: 1.5px solid var(--ink);
  text-transform: uppercase;
  transform: rotate(3deg);
  border-radius: 4px;
}
.word-day .icon-box {
  width: 72px; height: 72px;
  background: var(--ink); color: var(--hi-vis);
  border-radius: 16px;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 3px 3px 0 var(--ink);
}
.word-day .icon-box.typo {
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-jp);
  font-weight: 900; font-size: 36px;
}
.word-day .big {
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.02em; line-height: 1.1;
}
.word-day .meta {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .12em; color: var(--concrete);
  text-transform: uppercase; margin-top: 6px; font-weight: 700;
}
.word-day .tr {
  font-size: 14px; margin-top: 8px; color: var(--blueprint);
  font-weight: 600;
}

/* ── tab bar ──────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  padding: 12px 14px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--paper) 60%, transparent);
  pointer-events: none;
}
.tabbar-inner {
  pointer-events: auto;
  max-width: 452px; margin: 0 auto;
  background: var(--ink);
  border-radius: 999px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px;
  box-shadow: 0 18px 36px -16px rgba(20,17,13,.5), 0 0 0 1.5px var(--ink), 4px 4px 0 var(--hazard);
}
.tab {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  padding: 9px 0 7px;
  color: rgba(244,236,218,.5);
  border-radius: 999px;
  transition: color .15s, background .15s;
  position: relative;
}
.tab .icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
}
.tab .label {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700;
}
.tab.is-active {
  color: var(--ink);
  background: var(--hazard);
}

/* ── language select ──────────────────────────────────────────────────── */
.lang-page {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: 0 22px;
  position: relative;
}
.lang-page .top {
  margin-top: calc(60px + var(--safe-top));
  text-align: center;
}
.lang-page .crown {
  width: 88px; height: 88px;
  margin: 0 auto 22px;
  background: var(--hazard);
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.lang-page h1 {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 800;
  letter-spacing: -0.035em; line-height: 1;
}
.lang-page .lead {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 14px;
}
.lang-list {
  margin-top: 38px;
  display: flex; flex-direction: column; gap: 12px;
}
.lang-option {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.lang-option:active { transform: translate(4px,4px); box-shadow: 0 0 0 var(--ink); }
.lang-option .flag {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  font-size: 30px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}
.lang-option .l {
  font-family: var(--font-display);
  font-weight: 800; font-size: 19px;
  letter-spacing: -0.02em;
}
.lang-option .l-sub {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .15em;
  color: var(--concrete); text-transform: uppercase;
  margin-top: 3px; font-weight: 700;
}
.lang-option .arrow {
  margin-left: auto;
  width: 38px; height: 38px;
  background: var(--ink); color: var(--hazard);
  border-radius: 50%;
  display: grid; place-items: center;
}
.lang-page .footer-mark {
  margin-top: auto;
  padding: 30px 0 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .25em;
  color: var(--concrete); font-weight: 700;
}

/* ── page-head ────────────────────────────────────────────────────────── */
.page-head {
  padding: 6px 18px 16px;
  display: flex; align-items: end; justify-content: space-between;
  gap: 12px;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.035em; line-height: 1;
  display: flex; align-items: center; gap: 12px;
}
.page-head h1 .head-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--ink); color: var(--hazard);
  display: grid; place-items: center;
}
.page-head .meta {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .15em;
  color: var(--concrete); text-transform: uppercase; font-weight: 700;
}

/* ── word list ────────────────────────────────────────────────────────── */
.word-list {
  padding: 0 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.word-row {
  display: flex; align-items: stretch; gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: 3px 3px 0 var(--ink);
}
.word-row .left {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  flex-shrink: 0;
}
.word-row .left.typo {
  font-family: var(--font-jp);
  font-weight: 900; font-size: 32px;
}
.word-row .left.typo.num {
  font-family: var(--font-display);
  font-weight: 800; font-size: 26px;
}
.word-row .body { flex: 1; min-width: 0; align-self: center; }
.word-row .ja {
  font-family: var(--font-jp);
  font-weight: 900; font-size: 22px;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.word-row .romaji {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .1em;
  color: var(--concrete); font-weight: 700;
  margin-top: 3px;
}
.word-row .tr {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600; font-size: 14px;
  color: var(--blueprint);
  background: rgba(20,56,127,.08);
  padding: 4px 10px; border-radius: 6px;
}
.word-row .play-btn {
  align-self: center;
  width: 44px; height: 44px;
  border: 1.5px solid var(--ink);
  background: var(--hazard);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
}
.word-row .play-btn:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
.word-row.urgent .left { background: var(--safety-red); color: var(--paper); border-color: var(--ink); }

/* ── sticky CTA ───────────────────────────────────────────────────────── */
.cta-fixed {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(108px + var(--safe-bottom));
  z-index: 19;
  padding: 14px 26px;
  background: var(--hi-vis);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800; font-size: 16px; letter-spacing: -0.01em;
  box-shadow: 4px 4px 0 var(--ink);
  display: inline-flex; align-items: center; gap: 10px;
}
.cta-fixed:active { transform: translate(calc(-50% + 4px), 4px); box-shadow: 0 0 0 var(--ink); }
.cta-fixed .ic { color: var(--ink); }

/* ── quiz ─────────────────────────────────────────────────────────────── */
.quiz-page { padding: 0 18px; }
.quiz-bar {
  margin: 6px 0 22px;
  display: flex; align-items: center; gap: 12px;
}
.quiz-bar .progress {
  flex: 1; height: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  position: relative; overflow: hidden;
}
.quiz-bar .progress::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, var(--hazard) 0 6px, transparent 6px 12px);
}
.quiz-bar .progress .fill {
  position: relative; z-index: 1;
  height: 100%;
  background: var(--hi-vis);
  border-right: 1.5px solid var(--ink);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.quiz-bar .count {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
}

.q-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,106,26,.25), transparent 50%),
    var(--ink);
  color: var(--paper);
  border-radius: var(--r-xl);
  padding: 30px 24px 32px;
  text-align: center;
  position: relative; overflow: hidden;
  box-shadow: 6px 6px 0 var(--hi-vis), 0 0 0 1.5px var(--ink);
}
.q-card::before {
  content: 'Q'; font-family: var(--font-display);
  font-weight: 800; font-size: 220px;
  position: absolute; left: -20px; bottom: -100px;
  color: rgba(255,106,26,.16); line-height: 1;
}
.q-card .label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .25em;
  color: var(--hazard);
  text-transform: uppercase; font-weight: 700;
}
.q-card .icon-big {
  width: 120px; height: 120px;
  margin: 18px auto 14px;
  background: var(--paper); color: var(--ink);
  border-radius: 26px;
  display: grid; place-items: center;
  border: 2px solid var(--paper);
  box-shadow: 4px 4px 0 var(--hi-vis);
}
.q-card .icon-big.typo {
  font-family: var(--font-jp); font-weight: 900;
  font-size: 60px;
}
.q-card .icon-big.typo.num { font-family: var(--font-display); font-size: 50px; }
.q-card .ja {
  font-family: var(--font-jp);
  font-weight: 900; font-size: 28px;
  letter-spacing: -0.03em;
}
.q-card .romaji {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .15em;
  color: rgba(244,236,218,.55);
  margin-top: 6px; font-weight: 700;
}

.choices {
  margin-top: 22px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.choice {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  padding: 16px 14px;
  text-align: left;
  font-weight: 600; font-size: 15px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .15s;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.choice .num {
  width: 24px; height: 24px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  background: var(--paper);
  flex-shrink: 0;
}
.choice:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.choice.is-correct { background: var(--grass); color: var(--paper); border-color: var(--ink); }
.choice.is-correct .num { background: var(--paper); color: var(--grass); }
.choice.is-wrong { background: var(--safety-red); color: var(--paper); border-color: var(--ink); }
.choice.is-wrong .num { background: var(--paper); color: var(--safety-red); }
.choice[disabled] { pointer-events: none; opacity: .65; }
.choice.is-correct[disabled], .choice.is-wrong[disabled] { opacity: 1; }

.feedback {
  margin-top: 18px; text-align: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 24px;
  letter-spacing: -0.02em;
  min-height: 32px;
}
.feedback.ok { color: var(--grass); }
.feedback.ng { color: var(--safety-red); }

.next-btn {
  margin: 16px auto 0;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--hi-vis); color: var(--ink);
  border: 2px solid var(--ink);
  padding: 14px 36px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800; font-size: 16px;
  box-shadow: 4px 4px 0 var(--ink);
}
.next-btn:active { transform: translate(4px,4px); box-shadow: 0 0 0 var(--ink); }

.result-card {
  text-align: center;
  padding: 30px 20px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: 6px 6px 0 var(--hazard);
  margin-top: 20px;
}
.result-card .big {
  font-family: var(--font-display);
  font-weight: 800; font-size: 64px;
  letter-spacing: -0.04em; line-height: 1;
}
.result-card .small { color: var(--ink-soft); margin-top: 8px; }
.result-card .xp {
  display: inline-block; margin-top: 16px;
  background: var(--hazard); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  letter-spacing: .08em;
}

/* ── phrasebook ───────────────────────────────────────────────────────── */
.pb-grid {
  padding: 0 16px;
  display: grid; gap: 10px;
}
.pb-card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 3px 3px 0 var(--ink);
  text-align: left;
  transition: transform .12s, box-shadow .12s;
}
.pb-card:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.pb-card.urgent { background: var(--safety-red); color: var(--paper); border-color: var(--ink); }
.pb-card.urgent .pb-icon { background: var(--paper); color: var(--safety-red); }
.pb-card .pb-icon {
  width: 48px; height: 48px;
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.pb-card .ja {
  font-family: var(--font-jp);
  font-weight: 900; font-size: 18px; line-height: 1.15;
}
.pb-card .tr-sub {
  font-size: 12px; opacity: .75; margin-top: 3px; line-height: 1.2;
}

/* show modal */
.show-modal {
  position: fixed; inset: 0;
  background: var(--ink); color: var(--paper);
  z-index: 100;
  flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px; text-align: center;
  display: none;
}
.show-modal.is-open {
  display: flex;
  animation: pop .25s ease-out;
}
.show-modal.urgent { background: var(--safety-red); }
.show-modal .icon-huge {
  width: 180px; height: 180px;
  background: var(--paper); color: var(--ink);
  border-radius: 32px;
  display: grid; place-items: center;
}
.show-modal.urgent .icon-huge { color: var(--safety-red); }
.show-modal .icon-huge.typo {
  font-family: var(--font-jp); font-weight: 900; font-size: 90px;
}
.show-modal .ja {
  font-family: var(--font-jp);
  font-weight: 900; font-size: 52px;
  letter-spacing: -0.03em; line-height: 1.05;
  margin-top: 28px;
}
.show-modal .romaji {
  font-family: var(--font-mono);
  font-size: 16px; letter-spacing: .12em;
  color: rgba(244,236,218,.5);
  margin-top: 10px; font-weight: 700;
}
.show-modal .tr {
  margin-top: 20px;
  font-size: 28px;
  font-weight: 700;
  color: var(--hazard);
  background: rgba(255,203,5,.12);
  padding: 10px 24px;
  border-radius: 14px;
  border: 1.5px solid rgba(255,203,5,.3);
}
.show-modal .close {
  position: absolute; top: calc(20px + var(--safe-top)); right: 20px;
  width: 48px; height: 48px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 3px 3px 0 var(--ink);
  z-index: 101;
}
@keyframes pop {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── install / notify banner ─────────────────────────────────────────── */
.install-banner {
  margin: 16px;
  padding: 14px 16px;
  border: 1.5px dashed var(--ink);
  border-radius: var(--r);
  background: var(--paper-2);
  display: flex; align-items: center; gap: 14px;
  font-size: 13px;
}
.install-banner .glyph {
  width: 36px; height: 36px;
  background: var(--ink); color: var(--hazard);
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.install-banner button {
  margin-left: auto;
  background: var(--ink); color: var(--hazard);
  border-radius: 999px;
  padding: 9px 14px;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px;
  letter-spacing: .12em;
}

/* ── notification panel ───────────────────────────────────────── */
.notify-panel {
  margin: 0 16px 16px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}
.notify-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}
.notify-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: var(--ink);
  color: var(--hazard);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notify-body {
  flex: 1;
  min-width: 0;
}
.notify-body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.notify-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--concrete);
  font-weight: 700;
  margin-top: 3px;
  text-transform: uppercase;
}
.notify-toggle {
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s;
  position: relative;
  z-index: 5;
}
.notify-toggle:active {
  transform: scale(.95);
}
.notify-toggle.is-on {
  background: var(--grass);
  color: var(--paper);
  border-color: var(--grass);
}
.notify-settings {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1.5px dashed var(--line);
}
.notify-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.notify-time-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.notify-colon {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
}
.notify-select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  width: 68px;
  color: var(--ink);
  cursor: pointer;
}
.notify-input {
  width: 100%;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
}
.notify-input::placeholder {
  color: var(--concrete);
}
.notify-save {
  align-self: stretch;
  background: var(--hi-vis);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 14px 28px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.notify-save:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

/* ── ranking ──────────────────────────────────────────────────── */
.rank-list {
  padding: 0 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  box-shadow: 2px 2px 0 var(--ink);
}
.rank-row.rank-me {
  background: var(--hazard);
  border-width: 2px;
}
.rank-pos {
  font-family: var(--font-mono);
  font-weight: 700; font-size: 14px;
  width: 36px; text-align: center;
  color: var(--concrete);
  flex-shrink: 0;
}
.rank-pos.rank-top {
  font-size: 22px;
  color: var(--ink);
}
.rank-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--paper-2);
  display: grid; place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--ink);
}
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-meta {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--concrete);
  letter-spacing: .08em; margin-top: 2px;
}
.rank-xp {
  font-family: var(--font-display);
  font-weight: 800; font-size: 20px;
  color: var(--hi-vis); letter-spacing: -0.03em;
  flex-shrink: 0;
}
.rank-xp-unit {
  font-size: 10px; color: var(--concrete);
  margin-left: 2px;
  font-family: var(--font-mono);
}

/* ── training stats ───────────────────────────────────────────── */
.train-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 48px;
}
.train-wrong {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--safety-red);
}
.train-correct {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--grass);
}

/* ── auth pages ───────────────────────────────────────────────── */
.auth-form-wrap {
  margin-top: 28px;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-social {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 20px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  font-weight: 700; font-size: 15px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.auth-social:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.auth-google { background: var(--card); color: var(--ink); }
.auth-line   { background: #06C755; color: #fff; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 6px 0;
  color: var(--concrete); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--paper-2);
}
.auth-form {
  display: flex; flex-direction: column; gap: 14px;
}
.auth-field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
}
.auth-field input {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px; color: var(--ink);
}
.auth-field input::placeholder { color: var(--concrete); }
.auth-field input:focus { outline: none; border-color: var(--hi-vis); box-shadow: 0 0 0 3px rgba(255,106,26,.15); }
.auth-submit {
  background: var(--hi-vis); color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 14px 28px;
  font-family: var(--font-display);
  font-weight: 800; font-size: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer; text-align: center;
  margin-top: 4px;
}
.auth-submit:active { transform: translate(4px,4px); box-shadow: 0 0 0 var(--ink); }
.auth-switch {
  text-align: center; font-size: 13px; color: var(--ink-soft);
  margin-top: 8px;
}
.auth-switch a {
  color: var(--hi-vis); font-weight: 700; text-decoration: underline;
}
.auth-error {
  background: var(--safety-red); color: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  text-align: center;
  margin-top: 16px;
}

/* ── legal pages ──────────────────────────────────────────────── */
.legal-page {
  padding: 16px 20px 60px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.legal-page h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  color: var(--ink); letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.legal-date {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--concrete);
  letter-spacing: .1em; margin-bottom: 24px;
}
.legal-page h2 {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  color: var(--ink);
  margin: 20px 0 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--paper-2);
}
.legal-page h2:first-of-type { border-top: none; }
.legal-page ul {
  padding-left: 20px; list-style: disc;
  margin: 8px 0;
}
.legal-page li { margin: 4px 0; }
.legal-page a { color: var(--hi-vis); text-decoration: underline; }

/* page enter animation */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.shell > * { animation: rise .35s ease-out both; }
.shell > *:nth-child(2) { animation-delay: .04s; }
.shell > *:nth-child(3) { animation-delay: .08s; }
.shell > *:nth-child(4) { animation-delay: .12s; }
.shell > *:nth-child(5) { animation-delay: .16s; }
.shell > *:nth-child(6) { animation-delay: .20s; }

.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

@media (min-width: 520px) {
  body { padding: 24px 0; }
  .shell {
    border-left: 1.5px solid var(--ink);
    border-right: 1.5px solid var(--ink);
    background: var(--paper);
  }
}
