/* Self-hosted: Literata (OFL) + Onest (OFL), subsets latin, latin-ext, cyrillic, cyrillic-ext */
@font-face{font-family:'Literata';font-style:italic;font-weight:400 600;font-display:swap;src:url(/static/fonts/literata-italic-cyrillic-ext.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F}
@font-face{font-family:'Literata';font-style:italic;font-weight:400 600;font-display:swap;src:url(/static/fonts/literata-italic-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116}
@font-face{font-family:'Literata';font-style:italic;font-weight:400 600;font-display:swap;src:url(/static/fonts/literata-italic-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Literata';font-style:italic;font-weight:400 600;font-display:swap;src:url(/static/fonts/literata-italic-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Literata';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/literata-normal-cyrillic-ext.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F}
@font-face{font-family:'Literata';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/literata-normal-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116}
@font-face{font-family:'Literata';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/literata-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Literata';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/literata-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Onest';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/onest-normal-cyrillic-ext.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F}
@font-face{font-family:'Onest';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/onest-normal-cyrillic.woff2) format('woff2');unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116}
@font-face{font-family:'Onest';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/onest-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Onest';font-style:normal;font-weight:400 700;font-display:swap;src:url(/static/fonts/onest-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

/* ==========================================================================
   kazakhtili.com: public site stylesheet (admin pages keep css/style.css)
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --font-ui: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-serif: 'Literata', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --page: #F8F6F1;
  --bg: #FFFFFF;
  --bg-soft: #F6F3ED;
  --bg-2: #EEEAE2;
  --line: #E5E0D6;
  --line-2: #EEE9E0;
  --ink: #16191D;
  --ink-2: #353A41;
  --muted: #646B73;
  --muted-2: #8C9299;
  --accent: #0B6A8B;
  --accent-d: #085571;
  --accent-w: #E5F1F5;
  --accent-line: #B8D8E4;
  --on-accent: #FFFFFF;
  --kk: #173F55;
  --gold: #C8951A;
  --gold-d: #7A5408;
  --gold-w: #FBF1D9;
  --good: #1D7A4C;
  --good-w: #E6F3EB;
  --bad: #B3261E;
  --bad-w: #FBEAE7;
  --warn: #A85A0B;
  --warn-w: #FCEFDF;

  --foot-bg: #10232C;
  --foot-ink: #DCE7EB;
  --foot-muted: #93A9B2;
  --foot-line: #21404C;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-1: 0 1px 2px rgba(22, 25, 29, .05);
  --shadow-2: 0 1px 2px rgba(22, 25, 29, .04), 0 4px 14px rgba(22, 25, 29, .06);
  --shadow-3: 0 2px 6px rgba(22, 25, 29, .06), 0 16px 40px rgba(22, 25, 29, .12);
  --shadow-sm: var(--shadow-1);

  --wrap: 1200px;
  --gutter: 32px;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* icon masks */
  --i-vol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4z' fill='black'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E");
  --i-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.2v13.6a1 1 0 0 0 1.5.86l11-6.8a1 1 0 0 0 0-1.72l-11-6.8A1 1 0 0 0 8 5.2z' fill='black'/%3E%3C/svg%3E");
  --i-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='4.5' width='4.2' height='15' rx='1.3' fill='black'/%3E%3Crect x='13.8' y='4.5' width='4.2' height='15' rx='1.3' fill='black'/%3E%3C/svg%3E");
  --i-prev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 5.5v13L9.5 12z' fill='black'/%3E%3Cpath d='M5.5 5v14'/%3E%3C/svg%3E");
  --i-next: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5.5v13l9.5-6.5z' fill='black'/%3E%3Cpath d='M18.5 5v14'/%3E%3C/svg%3E");
  --i-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");

  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #0D1013;
  --bg: #14191E;
  --bg-soft: #1A2026;
  --bg-2: #222A31;
  --line: #2A333B;
  --line-2: #212930;
  --ink: #EDEFF1;
  --ink-2: #CDD2D7;
  --muted: #9AA3AC;
  --muted-2: #6E7882;
  --accent: #5BBAD8;
  --accent-d: #82CDE6;
  --accent-w: #12303B;
  --accent-line: #24576A;
  --on-accent: #062431;
  --kk: #A8DBEB;
  --gold: #E2B33F;
  --gold-d: #F2CF7A;
  --gold-w: #2E2511;
  --good: #4CC08A;
  --good-w: #12291E;
  --bad: #F27D72;
  --bad-w: #2F1715;
  --warn: #F0A35A;
  --warn-w: #2F2112;

  --foot-bg: #090C0F;
  --foot-ink: #C9D3D9;
  --foot-muted: #7E8B94;
  --foot-line: #1C252C;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 44px rgba(0, 0, 0, .45);

  color-scheme: dark;
}

@media (max-width: 1024px) { :root { --gutter: 24px; } }
@media (max-width: 640px)  { :root { --gutter: 16px; --header-h: 58px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
  line-height: 1.2;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 1.45rem + 1.5vw, 2.7rem); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-d); }

img, svg, video { max-width: 100%; }
img { height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

code, kbd { font-family: var(--font-mono); font-size: .88em; }
code { background: var(--bg-2); padding: .1em .38em; border-radius: 5px; }

::selection { background: var(--accent-line); color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico-svg { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }

/* Kazakh text */
.kk { font-family: var(--font-serif); color: var(--kk); font-weight: 500; }
.correct .kk, .wrong .kk, .ok .kk, .bad .kk, .btn-primary .kk,
.type-correct .kk, .revealed .kk, .matched .kk, .kk.matched { color: inherit; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--page); padding: 10px 14px; border-radius: 8px;
  font-weight: 600; transition: top .15s;
}
.skip-link:focus { top: 10px; color: var(--page); }

p.breadcrumb { display: none; }

/* ---------- Layout ---------- */
main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 80px;
}

.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0;
  margin: 22px 0 18px;
  font-size: 13.5px; color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { margin: 0 8px; color: var(--muted-2); }
.crumbs > span:last-child { color: var(--ink-2); }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 18px 32px;
  margin: 0 0 30px;
}
.ph-text { flex: 1 1 560px; min-width: 0; }
.page-head h1 { margin: 0; }
.ph-sub { margin: 12px 0 0; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.6; }
.ph-meta { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.ph-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ph-note { color: var(--muted); font-size: 13.5px; }

.eyebrow {
  margin: 0 0 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  font: 600 12.5px/1.3 var(--font-ui);
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow .kk { text-transform: none; letter-spacing: 0; font-size: 14.5px; color: inherit; }

.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 8px 16px; margin: 0 0 16px;
}
.section-head h2 { margin: 0; font-size: 1.375rem; }
.section-head .count {
  display: inline-block; vertical-align: 3px; margin-left: 6px;
  font: 600 12.5px/1 var(--font-ui); letter-spacing: 0;
  color: var(--muted); background: var(--bg-2);
  padding: 4px 8px; border-radius: 999px;
}
.section-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14.5px; }
.section-note { color: var(--muted); font-size: 14.5px; margin: -6px 0 16px; }
.page-section { margin-top: 44px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #0EA5E9, #0369A1);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 1px 2px rgba(3, 105, 161, .25);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-en { font: 600 19px/1.1 var(--font-serif); letter-spacing: -0.015em; }
.brand-kk { font: 500 12px/1.2 var(--font-ui); color: var(--muted); letter-spacing: .02em; margin-top: 1px; }

.primary-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.primary-nav > a,
.nav-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 12px;
  border-radius: 10px; border: 0; background: none;
  color: var(--ink-2);
  font: 500 15px/1 var(--font-ui);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.primary-nav > a:hover, .nav-trigger:hover { background: var(--bg-2); color: var(--ink); }
.primary-nav > a.active { background: var(--accent-w); color: var(--accent-d); }
.primary-nav .nav-ico { width: 17px; height: 17px; opacity: .9; }
.nav-only-mobile { display: none !important; }

.nav-signin { color: var(--accent) !important; font-weight: 600 !important; }

.nav-dropdown { position: relative; }
.nav-trigger .chev {
  width: 12px; height: 12px; background: currentColor; opacity: .7;
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
  transition: transform .15s;
}
.nav-dropdown.open .chev { transform: rotate(180deg); }
.nav-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-3);
}
.nav-dropdown.open .nav-menu { display: block; }
.nav-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 15px; }
.nav-menu a:hover { background: var(--bg-soft); color: var(--ink); }
.nav-acct-email {
  display: block; padding: 8px 12px 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
  color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.header-utils { display: flex; align-items: center; gap: 6px; flex: none; }

.streak-link:has(.streak-pill[hidden]) { display: none; }
.streak-link { display: inline-flex; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 11px;
  border-radius: 999px;
  background: var(--gold-w); color: var(--gold-d);
  font: 600 13.5px/1 var(--font-ui);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.streak-pill .flame { font-size: 14px; line-height: 1; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--ink-2);
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn .ico-svg { width: 19px; height: 19px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.mobile-menu-toggle { display: none; }
.mobile-menu-toggle .i-close { display: none; }
.site-header.nav-open .mobile-menu-toggle .i-menu { display: none; }
.site-header.nav-open .mobile-menu-toggle .i-close { display: inline-block; }

/* labels only between 1081 and 1279 */
@media (max-width: 1279px) and (min-width: 1081px) {
  .primary-nav .nav-ico { display: none; }
  .primary-nav > a, .nav-trigger { padding: 0 11px; }
  .nav-account .nav-ico { display: inline-block; }
  .nav-account .nav-trigger > span:not(.chev) { display: none; }
}

/* hamburger at 1080 and below */
@media (max-width: 1080px) {
  .mobile-menu-toggle { display: inline-grid; }
  .header-utils { margin-left: auto; }
  .primary-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    margin: 0;
    padding: 12px var(--gutter) 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 30px rgba(0, 0, 0, .10);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .site-header.nav-open .primary-nav { display: grid; }
  .primary-nav > a, .nav-trigger { height: 48px; padding: 0 14px; font-size: 16px; justify-content: flex-start; }
  .primary-nav .nav-ico { width: 19px; height: 19px; color: var(--accent); }
  .nav-only-mobile { display: inline-flex !important; }
  .nav-dropdown { grid-column: 1 / -1; border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 8px; }
  .nav-trigger { display: none; }
  .nav-menu {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px;
    position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; background: none;
  }
  .nav-acct-email { grid-column: 1 / -1; border: 0; padding: 4px 14px; margin: 0; }
  .nav-menu a { height: 48px; display: flex; align-items: center; padding: 0 14px; font-size: 16px; }
}
@media (max-width: 420px) {
  .brand-kk { display: none; }
  .brand-en { font-size: 18px; }
  .site-header-inner { gap: 12px; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--foot-bg); color: var(--foot-ink); flex: none; }
.site-footer-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 56px var(--gutter) 44px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 40px 64px;
}
.site-footer .brand { color: #fff; }
.site-footer .brand:hover { color: #fff; }
.site-footer .brand-kk { color: var(--foot-muted); }
.foot-tag { margin: 16px 0 0; color: var(--foot-muted); font-size: 15px; line-height: 1.6; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.foot-h {
  display: block; margin-bottom: 12px;
  font: 600 12px/1.2 var(--font-ui); letter-spacing: .09em; text-transform: uppercase;
  color: var(--foot-muted);
}
.foot-col a { display: block; padding: 5px 0; color: var(--foot-ink); font-size: 15px; }
.foot-col a:hover { color: #fff; }
.foot-base { border-top: 1px solid var(--foot-line); }
.foot-base-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto; padding: 18px var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-size: 13.5px; color: var(--foot-muted);
}
.foot-base a { color: var(--foot-ink); }
.foot-base a:hover { color: #fff; }
@media (max-width: 760px) {
  .site-footer-inner { grid-template-columns: 1fr; gap: 32px; padding-top: 40px; padding-bottom: 32px; }
}
@media (max-width: 420px) {
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .brand-kk { display: inline; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 17px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: 600 15px/1.2 var(--font-ui);
  text-align: center; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); color: var(--ink); background: var(--bg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; box-shadow: none; }
.btn .ico-svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn .badge { margin-left: 2px; }

/* ---------- Audio buttons: icon drawn with a mask, text glyph hidden ---------- */
.play-btn,
.audio-play {
  --ic: var(--accent);
  position: relative;
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent-line);
  background: var(--accent-w);
  color: var(--accent-d);
  font: 600 14px/1 var(--font-ui);
  vertical-align: middle;
  transition: background .15s, border-color .15s, transform .1s;
}
.play-btn,
.audio-play:not([aria-label="Play form"]):not([aria-label="Play full sentence"]) {
  font-size: 0 !important; color: transparent !important;
}
.play-btn::before,
.audio-play:not([aria-label="Play form"]):not([aria-label="Play full sentence"])::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 46%; height: 46%;
  background: var(--ic);
  -webkit-mask: var(--i-vol) center / contain no-repeat; mask: var(--i-vol) center / contain no-repeat;
}
.play-btn:hover, .audio-play:hover,
.is-audio-card:hover .play-btn {
  --ic: var(--on-accent);
  background: var(--accent); border-color: var(--accent);
}
.play-btn:active, .audio-play:active { transform: scale(.94); }
.play-btn.sm, .audio-play-sm { width: 28px; height: 28px; }
.play-btn.lg { width: 46px; height: 46px; }
.audio-play-lg { width: 76px; height: 76px; --ic: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-2); }
.audio-play-lg:hover { background: var(--accent-d); border-color: var(--accent-d); }
.audio-play[aria-label="Play form"],
.audio-play[aria-label="Play full sentence"] {
  width: auto; height: 38px; padding: 0 16px; border-radius: 999px;
  font-size: 14.5px; color: var(--accent-d);
}
.audio-play[aria-label="Play form"]:hover,
.audio-play[aria-label="Play full sentence"]:hover { color: var(--on-accent); }
span.audio-play { cursor: pointer; }

/* ---------- Small shared pieces ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 7px;
  border-radius: 999px;
  background: var(--gold); color: #fff;
  font: 700 12px/1 var(--font-ui);
}
:root[data-theme="dark"] .badge { color: #1A1306; }
.badge-planned { background: var(--accent-w); color: var(--accent-d); }
.badge-in_progress { background: var(--gold-w); color: var(--gold-d); }
.badge-done { background: var(--good-w); color: var(--good); }
.badge-new { background: var(--bg-2); color: var(--ink-2); }
.badge-wontfix { background: var(--bg-2); color: var(--muted); }
.badge[class*="badge-"] { height: 22px; padding: 0 9px; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; }

.chip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink-2); font-size: 14.5px; font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent-d); }

.kbd, .key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 5px;
  border: 1px solid currentColor;
  font: 600 11px/1 var(--font-mono);
  opacity: .6;
}

.empty-note {
  margin: 0;
  padding: 18px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 15px;
}
.empty-state {
  text-align: center;
  padding: 52px 24px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.empty-state h2 { margin: 0 0 10px; font-size: 1.6rem; }
.empty-state p { color: var(--ink-2); margin: 0 auto 6px; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.done-state h2 { color: var(--ink); }

.prose h2 { font-size: 1.3rem; margin: 0 0 12px; }
.prose h3 { font-size: 1.1rem; margin: 18px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose p:last-child, .prose ul:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--muted-2); }
.prose a, .prose-block a, .lesson-intro a {
  text-decoration: underline; text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.prose a:hover, .prose-block a:hover, .lesson-intro a:hover { text-decoration-color: currentColor; }
.prose strong { font-weight: 600; color: var(--ink); }

/* ---------- Form fields ---------- */
.ag-input, .auth-input, .suggest-input, .lesson-search, .select,
.type-input, .drill-type-input {
  display: block; width: 100%;
  min-height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.4 var(--font-ui);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.ag-input:focus, .auth-input:focus, .suggest-input:focus, .lesson-search:focus, .select:focus,
.type-input:focus, .drill-type-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-w);
}
textarea.suggest-input { padding: 12px 14px; min-height: 150px; resize: vertical; line-height: 1.55; }
::placeholder { color: var(--muted-2); opacity: 1; }
.ag-input.kk, .type-input.kk { font-family: var(--font-serif); color: var(--ink); }

.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: var(--muted); pointer-events: none;
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
}
.select { padding-right: 42px; cursor: pointer; }
select.ag-input {
  padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  margin: 0 0 22px;
}
.filter-bar form { display: contents; }
.filter-bar label { font-size: 14px; color: var(--muted); font-weight: 500; }
.filter-bar .ag-input { width: auto; min-width: 180px; }

/* ==========================================================================
   Home
   ========================================================================== */
.page-home main { padding-top: 12px; }

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 40px 64px;
  align-items: center;
  padding: 36px 0 24px;
}
.hh-copy h1 {
  font-size: clamp(2.6rem, 1.5rem + 3.1vw, 4.2rem);
  line-height: 1.03;
  letter-spacing: -0.032em;
  margin: 0 0 22px;
}
.hh-copy h1 .kk { font-style: italic; font-weight: 600; color: var(--accent); letter-spacing: -0.02em; }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-2); margin: 0 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-facts {
  display: flex; flex-wrap: wrap;
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hf { display: flex; flex-direction: column; gap: 3px; padding: 0 26px; border-left: 1px solid var(--line); }
.hf:first-child { padding-left: 0; border-left: 0; }
.hf .num { font: 600 1.8rem/1.05 var(--font-serif); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hf .lbl { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.hf-own .num { color: var(--accent); }

.hh-visual { margin: 0; position: relative; }
.hh-img {
  display: block; overflow: hidden;
  border-radius: 26px;
  box-shadow: var(--shadow-3);
  background: var(--bg-2);
}
.hh-img img { display: block; width: 100%; aspect-ratio: 6 / 5; object-fit: cover; transition: transform .6s var(--ease); }
.hh-img:hover img { transform: scale(1.025); }
.hh-phrase {
  position: absolute; left: -28px; bottom: 54px;
  display: flex; align-items: center; gap: 13px;
  max-width: calc(100% - 20px);
  padding: 12px 20px 12px 12px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--bg); color: var(--ink);
  box-shadow: var(--shadow-3);
  text-align: left;
  transition: transform .15s var(--ease), border-color .15s;
}
.hh-phrase:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.hh-play {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
}
.hh-play .ico-svg { width: 20px; height: 20px; }
.hh-phrase-text { display: flex; flex-direction: column; min-width: 0; }
.hh-phrase-text .kk { font-size: 1.12rem; font-weight: 600; line-height: 1.3; }
.hh-en { font-size: 13.5px; color: var(--muted); }
.hh-visual figcaption { margin-top: 14px; text-align: right; font-size: 13.5px; }
.hh-visual figcaption a { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.hh-visual figcaption a:hover { color: var(--accent); }
.hh-visual figcaption .ico-svg { width: 15px; height: 15px; }

.home-group { margin-top: 56px; }
.home-group-h {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 16px;
  font: 600 12.5px/1.2 var(--font-ui); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.home-group-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.home-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-tile {
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.home-tile:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.ht-ico {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-w); color: var(--accent);
}
.ht-ico .ico-svg { width: 22px; height: 22px; }
.ht-ico-text { font: 600 18px/1 var(--font-serif); letter-spacing: -0.01em; }
.ht-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ht-name { font: 600 1.2rem/1.25 var(--font-serif); }
.ht-desc { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.ht-meta {
  display: flex; align-items: center; gap: 6px;
  padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 13.5px; font-weight: 600; color: var(--accent-d);
}
.ht-meta .ico-svg { width: 17px; height: 17px; }
.home-tile.is-due { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.home-tile.is-due .ht-meta { color: var(--gold-d); }
.home-tile.is-due .ht-ico { background: var(--gold-w); color: var(--gold-d); }

@media (max-width: 1080px) {
  .home-hero { gap: 32px 40px; }
  .hf { padding: 0 18px; }
  .hh-phrase { left: -16px; }
}
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; padding-top: 16px; }
  .hh-img img { aspect-ratio: 4 / 3; }
  .hh-phrase { left: 14px; bottom: 50px; }
  .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hh-copy h1 { font-size: clamp(2.3rem, 1.4rem + 4.6vw, 2.9rem); margin-bottom: 16px; }
  .lede { font-size: 1.06rem; margin-bottom: 22px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 0; margin-top: 30px; padding-top: 20px; }
  .hf { padding: 0 12px; }
  .hf:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
  .hf .num { font-size: 1.45rem; }
  .hf .lbl { font-size: 12.5px; }
  .hh-img { border-radius: 18px; }
  .hh-phrase { left: 10px; right: 10px; bottom: 44px; max-width: none; padding: 10px 14px 10px 10px; }
  .hh-phrase-text .kk { font-size: 1.02rem; }
  .home-group { margin-top: 40px; }
  .home-tiles { grid-template-columns: 1fr; gap: 10px; }
  .home-tile { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 0; padding: 14px 16px; }
  .ht-ico { width: 44px; height: 44px; }
  .ht-body { gap: 2px; }
  .ht-name { font-size: 1.05rem; }
  .ht-desc { font-size: 13.5px; line-height: 1.4; }
  .ht-meta { border: 0; padding: 0; font-size: 12.5px; white-space: nowrap; }
}

/* ==========================================================================
   Lessons index
   ========================================================================== */
.lessons-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 32px; }
.search-field { position: relative; flex: 1 1 320px; display: block; }
.search-field .ico-svg { position: absolute; left: 14px; top: 50%; margin-top: -9px; color: var(--muted); pointer-events: none; }
.search-field .lesson-search { padding-left: 42px; }
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.lf-btn {
  min-height: 38px; padding: 0 15px;
  border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); font: 500 14.5px/1 var(--font-ui); white-space: nowrap;
  transition: background .15s, color .15s;
}
.lf-btn:hover { color: var(--ink); }
.lf-btn.active { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

.lg-section { margin: 0 0 40px; }
.lg-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px;
  margin: 0 0 14px; padding-left: 14px;
  border-left: 4px solid var(--gc, var(--accent));
}
.lg-name { margin: 0; font-size: 1.4rem; }
.lg-count { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.lg-desc { flex-basis: 100%; margin: 2px 0 0; font-size: 14.5px; color: var(--muted); }

.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lesson-list > li { min-width: 0; }
.lesson-row {
  height: 100%;
  display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center;
  gap: 14px 12px;
  padding: 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.lesson-row:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.lesson-row .num {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  font: 600 15px/1 var(--font-serif);
  color: var(--lc, var(--accent));
  background: color-mix(in srgb, var(--lc, var(--accent)) 13%, var(--bg));
}
.lesson-row .body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lesson-row .title { font: 600 15.5px/1.3 var(--font-ui); color: var(--ink); }
.lesson-row .meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-height: 17px; }
.ring-wrap { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.ring {
  flex: 1; height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) calc(var(--p, 0) * 1%), var(--bg-2) 0);
}
.ring-wrap .pct { min-width: 34px; text-align: right; font: 600 12.5px/1 var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }

@media (max-width: 1100px) { .lesson-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .lesson-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .lessons-toolbar { margin-bottom: 24px; }
  .seg { display: flex; width: 100%; }
  .lf-btn { flex: 1; padding: 0 4px; font-size: 13.5px; }
}
@media (max-width: 560px) {
  .lesson-list { grid-template-columns: 1fr; gap: 8px; }
  .lesson-row { grid-template-columns: 34px minmax(0, 1fr) 86px; padding: 12px 14px; gap: 12px; }
  .lesson-row .num { width: 34px; height: 34px; font-size: 14px; }
  .ring-wrap { grid-column: auto; gap: 8px; }
  .ring-wrap .pct { min-width: 30px; }
}

/* ==========================================================================
   Lesson page
   ========================================================================== */
.lesson-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 32px; align-items: start; }
.lesson-side { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 16px; }
.side-card {
  padding: 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.side-h {
  margin: 0 0 14px;
  font: 600 12.5px/1.2 var(--font-ui); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.lesson-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; margin: 0 0 18px; }
.lesson-stat { display: flex; flex-direction: column; gap: 2px; }
.lesson-stat strong { font: 600 1.4rem/1.1 var(--font-serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.lesson-stat span { font-size: 12.5px; color: var(--muted); }
.lesson-stat-pct strong { color: var(--accent); }
.ls-bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.ls-bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s var(--ease); }
.lesson-actions { display: grid; gap: 8px; }

/* practice tiles: list in the lesson sidebar, cards on the games page */
.play-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.play-tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease), background .15s;
}
.play-tile:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.play-tile .ico {
  width: 44px; height: 44px; margin-bottom: 12px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-w); color: var(--accent);
}
.play-tile .ico .ico-svg { width: 21px; height: 21px; }
.play-tile .name { font: 600 1.05rem/1.3 var(--font-serif); }
.play-tile .desc { font-size: 14px; line-height: 1.45; color: var(--muted); }
.play-grid-wide { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.play-list { grid-template-columns: 1fr; gap: 2px; margin: 0 -8px; }
.play-list .play-tile {
  display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 12px; row-gap: 1px; align-items: center;
  padding: 9px 8px;
  border: 0; border-radius: 10px; background: none; box-shadow: none;
}
.play-list .play-tile:hover { background: var(--bg-soft); transform: none; box-shadow: none; }
.play-list .play-tile .ico { grid-row: span 2; width: 38px; height: 38px; margin: 0; border-radius: 10px; }
.play-list .play-tile .ico .ico-svg { width: 19px; height: 19px; }
.play-list .play-tile .name { font: 600 15px/1.3 var(--font-ui); }
.play-list .play-tile .desc { font-size: 13px; line-height: 1.35; }

.lesson-main { min-width: 0; }
.lesson-main .section-head { margin-bottom: 14px; }
.tap-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.tap-hint .ico-svg { width: 16px; height: 16px; color: var(--accent); }

.cards { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cards:last-child { margin-bottom: 0; }
.cards-sentences { grid-template-columns: 1fr; }
.card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-height: 74px; padding: 14px 14px 14px 18px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: transparent; transition: background .2s;
}
.card[data-mastery="learning"]::before { background: var(--gold); }
.card[data-mastery="mastered"]::before { background: var(--good); }
.is-audio-card { cursor: pointer; }
.is-audio-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.card-pic {
  width: 54px; height: 54px; flex: none;
  border-radius: 10px; overflow: hidden;
  background: var(--bg-soft);
}
.card-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-swatch { display: block; width: 100%; height: 100%; border-radius: 10px; border: 1px solid rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .card-swatch { border-color: rgba(255, 255, 255, .1); }
.card-main { flex: 1; min-width: 0; }
.card-kk .kk { font-size: 1.22rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.card-en { margin-top: 2px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.card-note { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.sentence-card .card-kk .kk { font-size: 1.1rem; font-weight: 500; }
.card .play-btn { align-self: center; }

@media (max-width: 1100px) { .lesson-layout { grid-template-columns: 290px minmax(0, 1fr); gap: 24px; } }
@media (max-width: 960px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
  .lesson-side { grid-template-columns: 1fr; }
  .play-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; gap: 8px; }
  .card { min-height: 64px; padding: 12px 12px 12px 16px; gap: 12px; }
  .card-pic { width: 46px; height: 46px; }
  .card-kk .kk { font-size: 1.12rem; }
}
@media (max-width: 420px) {
  .play-list { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Games index, tap cards
   ========================================================================== */
.tap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tap-card {
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.tap-card:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.tap-card-img { aspect-ratio: 16 / 10; background-color: var(--bg-2); background-size: cover; background-position: center; }
.tap-card-title { padding: 14px 16px 2px; font: 600 1.05rem/1.3 var(--font-serif); }
.tap-card-meta { padding: 0 16px 16px; font-size: 13px; color: var(--muted); }

@media (max-width: 1100px) { .play-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .play-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .play-grid-wide .play-tile { padding: 16px; }
  .play-grid-wide .play-tile .ico { width: 40px; height: 40px; margin-bottom: 8px; }
  .tap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 380px) { .tap-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Grammar
   ========================================================================== */
.tool-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.tool-card:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.tool-ico {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-w); color: var(--accent);
}
.tool-ico .ico-svg { width: 22px; height: 22px; }
.tool-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tool-name { font: 600 1.1rem/1.3 var(--font-serif); }
.tool-desc { font-size: 14px; line-height: 1.45; color: var(--muted); }
.tool-go { color: var(--muted-2); flex: none; transition: color .15s, transform .15s; }
.tool-card:hover .tool-go { color: var(--accent); transform: translateX(2px); }

.section-head .section-note { margin: 0; flex-basis: 100%; }

.grammar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grammar-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.grammar-card:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.g-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.g-card-title { font: 600 1.1rem/1.3 var(--font-serif); }
.g-card-desc { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.g-level {
  display: inline-flex; align-items: center; flex: none;
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--gold-w); color: var(--gold-d);
  font: 700 11.5px/1 var(--font-ui); letter-spacing: .04em; text-transform: none;
}
.verb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.verb-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.verb-card:hover { color: var(--ink); border-color: var(--accent-line); background: var(--accent-w); }
.verb-card .g-card-title.kk { font-size: 1.1rem; color: var(--kk); }
.verb-card .g-card-desc { font-size: 13.5px; }

@media (max-width: 960px) {
  .tool-row { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { padding: 16px; }
  .grammar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grammar-grid { grid-template-columns: 1fr; gap: 10px; }
  .verb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Topic and scene blocks: label column + body */
.block {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px 32px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.block-label {
  padding-top: 4px;
  font: 600 12.5px/1.3 var(--font-ui); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.block-body { min-width: 0; }
.block-body > h3 { margin: 0 0 12px; font-size: 1.2rem; }
.block-meta { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.prose-block { font-size: 1.02rem; line-height: 1.7; color: var(--ink-2); overflow-x: auto; }
.prose-block > :first-child { margin-top: 0; }
.prose-block > :last-child { margin-bottom: 0; }
.prose-block p { margin: 0 0 14px; }
.prose-block ul, .prose-block ol { margin: 0 0 14px; padding-left: 22px; }
.prose-block li { margin: 6px 0; }
.prose-block h3, .prose-block h4 { margin: 22px 0 10px; color: var(--ink); }
.prose-block strong { color: var(--ink); font-weight: 600; }
.prose-block table { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: 15px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.prose-block th, .prose-block td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.prose-block th { background: var(--bg-soft); font-size: 13px; font-weight: 600; color: var(--muted); }
.prose-block tr:last-child td { border-bottom: 0; }
.prose-block blockquote { margin: 0 0 14px; padding: 12px 18px; border-left: 3px solid var(--accent-line); background: var(--bg); border-radius: 0 10px 10px 0; }

.ex-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ex-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.ex-row .play-btn { margin-top: 1px; }
.ex-text { min-width: 0; }
.ex-kk .kk { font-size: 1.12rem; font-weight: 600; line-height: 1.35; }
.ex-en { margin-top: 2px; font-size: 14.5px; color: var(--ink-2); }
.ex-gloss { margin-top: 3px; font-size: 13px; color: var(--muted); font-style: italic; }

.drill-host { margin-top: 4px; }

@media (max-width: 860px) {
  .block { grid-template-columns: 1fr; gap: 12px; padding: 24px 0; }
  .ex-list { grid-template-columns: 1fr; }
}

/* Verb tables (built by verbs.js with inline styles) */
.verb-picker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 0 0 24px; padding: 14px 18px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.verb-picker .picker-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; text-transform: none; }
.verb-picker .select-wrap { flex: 0 1 340px; min-width: 200px; }
.verb-meaning { font-size: 15px; color: var(--ink-2); }

.tense-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.tense-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tense-col > div:first-child,
.kt-noun-table {
  margin: 0 !important;
  background: var(--bg) !important;
  border-color: var(--line) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-1);
}
.tense-col > div:first-child > div:first-child,
.kt-noun-table > div:first-child {
  padding: 12px 16px !important;
  background: var(--bg-soft) !important;
  border-bottom-color: var(--line) !important;
  gap: 10px;
}
.tense-col > div:first-child > div:first-child strong,
.kt-noun-table > div:first-child strong { font: 600 1rem/1.3 var(--font-serif) !important; color: var(--ink); }
.tense-col table tr, .kt-noun-table table tr { border-top-color: var(--line-2) !important; }
.tense-col table td, .kt-noun-table table td { padding: 8px 14px !important; vertical-align: middle; }
.tense-col table td .kk, .kt-noun-table table td .kk { font-size: 1.06rem; }
.tense-col .audio-play, .kt-noun-table .audio-play, .verb-example .audio-play { width: 30px; height: 30px; }

.verb-examples {
  padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 14px;
}
.verb-examples-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.verb-examples-label { font: 600 12px/1.2 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.verb-examples-list { display: grid; gap: 10px; }
.verb-example { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; row-gap: 1px; align-items: start; }
.verb-example > .audio-play { grid-row: span 2; }
.verb-example > .kk { font-size: 1.02rem; line-height: 1.4; }
.verb-example > .kk:first-child { grid-column: 1 / -1; }
.verb-example-en { grid-column: 2; font-size: 13.5px; color: var(--muted); }

.note-card {
  margin-top: 36px; padding: 24px 26px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.note-h { margin: 0 0 14px; font-size: 1.2rem; }
.note-list { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
.note-list > div { min-width: 0; }
.note-list dt { font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.note-list dd { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }

@media (max-width: 1080px) { .tense-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .tense-grid { grid-template-columns: 1fr; }
  .note-list { grid-template-columns: 1fr; }
  .verb-picker .select-wrap { flex: 1 1 100%; }
}

/* Nouns */
.noun-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.noun-card {
  padding: 22px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.noun-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.noun-card-head h2.kk { margin: 0; font-size: 1.55rem; font-weight: 600; }
.noun-card-en { font-size: 14.5px; color: var(--muted); }
.noun-card-intro { margin: 0 0 16px; font-size: 14.5px; color: var(--ink-2); }
.kt-noun-card-body { display: grid; gap: 14px; }
.noun-card .kt-noun-table { box-shadow: none; }
@media (max-width: 900px) { .noun-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .noun-card { padding: 16px; } }

/* Sentences browser */
.sentence-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kt-sentence-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s;
  min-width: 0;
}
.kt-sentence-card.is-audio-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.kt-sentence-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kt-sentence { font-size: 1.1rem; font-weight: 500; line-height: 1.4; }
.kt-sentence-en { font-size: 14.5px; color: var(--ink-2); }
.kt-sentence-meta { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--muted); }
.kt-sentence-meta .kk { color: inherit; }
@media (max-width: 1024px) { .sentence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .sentence-grid { grid-template-columns: 1fr; gap: 8px; }
  .filter-bar .ag-input { flex: 1 1 140px; min-width: 0; }
}

/* ==========================================================================
   Scenes
   ========================================================================== */
.scene-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.scene-card {
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.scene-card:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.scene-thumb { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-2); }
.scene-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.scene-card:hover .scene-thumb img { transform: scale(1.03); }
.scene-thumb-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.scene-meta { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.scene-card-kk { margin: 0; font-size: 15px; }
.scene-card-title { margin: 0; font-size: 1.22rem; }
.scene-card-sum { margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
@media (max-width: 960px) { .scene-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
@media (max-width: 600px) { .scene-list { grid-template-columns: 1fr; } }

.scene-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 48px; align-items: center; margin: 0 0 32px; }
.scene-header h1 { margin: 0 0 16px; }
.scene-header .lesson-intro { font-size: 1.08rem; line-height: 1.65; color: var(--ink-2); }
.scene-header .lesson-intro p { margin: 0 0 12px; }
.scene-header .lesson-intro p:last-child { margin: 0; }
.scene-image { border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-3); background: var(--bg-2); }
.scene-image img { display: block; width: 100%; aspect-ratio: 6 / 5; object-fit: cover; }
.scene-fallback {
  aspect-ratio: 6 / 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-align: center; padding: 20px;
}
@media (max-width: 900px) {
  .scene-hero { grid-template-columns: 1fr; }
  .scene-image img, .scene-fallback { aspect-ratio: 4 / 3; }
}

.block-culture .block-body {
  padding: 20px 24px;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 14px;
}
.phrase-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.phrase-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.phrase-row .play-btn { margin-top: 1px; }
.phrase-text { min-width: 0; }
.phrase-kk .kk { font-size: 1.1rem; font-weight: 600; line-height: 1.35; }
.phrase-en { margin-top: 2px; font-size: 14.5px; color: var(--ink-2); }
.phrase-when { margin-top: 5px; font-size: 13px; color: var(--muted); }

.q-prompt { margin: 0 0 14px; font-size: 1.08rem; font-weight: 600; color: var(--ink); }
.q-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.q-option {
  display: block; width: 100%;
  padding: 14px 16px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  color: var(--ink); text-align: left; font: 500 15.5px/1.45 var(--font-ui);
  transition: border-color .15s, background .15s;
}
.q-option:hover:not(:disabled) { border-color: var(--accent); }
.q-option.correct { background: var(--good-w); border-color: var(--good); color: var(--good); }
.q-option.wrong { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.q-feedback {
  margin-top: 12px; padding: 13px 16px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 12px;
  font-size: 15px; color: var(--ink-2);
}
.q-feedback .ok, .ok { color: var(--good); }
.q-feedback .bad, .bad { color: var(--bad); }

.dialogue-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.dialogue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.dialogue-line {
  display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 12px 14px;
  border: 1px solid transparent; border-radius: 12px;
  transition: background .2s, border-color .2s;
}
.dialogue-line:nth-child(odd) { background: var(--bg); border-color: var(--line-2); }
.dialogue-line.active { background: var(--accent-w); border-color: var(--accent-line); }
.speaker-tag {
  justify-self: start; max-width: 100%;
  margin-top: 4px; padding: 4px 9px;
  border-radius: 999px;
  background: var(--speaker-color, var(--accent)); color: #fff;
  font: 700 11px/1.2 var(--font-ui); letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dialogue-text { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.dialogue-kk { font-size: 1.08rem; font-weight: 500; line-height: 1.45; }
.dialogue-en { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.dialogue-text .play-btn ~ .dialogue-en { padding-left: 38px; }
.scene-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
@media (max-width: 760px) {
  .phrase-list, .q-options { grid-template-columns: 1fr; }
  .dialogue-line { grid-template-columns: 1fr; gap: 6px; padding: 12px; }
}

/* ==========================================================================
   Listen
   ========================================================================== */
.pod-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pod-card {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--ink); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.pod-card:hover { color: var(--ink); border-color: var(--accent-line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.pod-ico {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-w); color: var(--accent);
}
.pod-ico .ico-svg { width: 22px; height: 22px; }
.pod-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pod-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pod-title { font: 600 1.12rem/1.3 var(--font-serif); }
.pod-intro { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.pod-meta { font-size: 13px; color: var(--muted); }
.pod-go { align-self: center; color: var(--muted-2); transition: color .15s, transform .15s; }
.pod-card:hover .pod-go { color: var(--accent); transform: translateX(2px); }
@media (max-width: 760px) { .pod-list { grid-template-columns: 1fr; gap: 10px; } .pod-card { padding: 16px; } }

.listen-layout { display: grid; gap: 18px; }
.lp-player {
  padding: 26px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-2);
}
.lp-card {
  min-height: 190px;
  display: flex; flex-direction: column; gap: 14px;
  margin: 0 0 20px; padding: 20px 24px;
  background: var(--bg-soft); border-radius: 16px;
}
.lp-card-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font: 600 12px/1.2 var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.lp-card[data-speak^="kk"] .lp-card-speaker { color: var(--accent-d); }
.lp-card[data-speak^="en"] .lp-card-speaker { color: var(--gold-d); }
.lp-card[data-speak$="-slow"] .lp-card-speaker::after { content: ' · slow'; color: var(--accent); margin-left: .25rem; }
.lp-card-pos { font-variant-numeric: tabular-nums; }
.lp-card-text {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  font: 600 1.75rem/1.35 var(--font-serif); color: var(--ink);
  overflow-wrap: anywhere;
}
.lp-card-text.kk { color: var(--kk); }
.lp-card-text.is-narrator { font: italic 400 1.15rem/1.5 var(--font-ui); color: var(--muted); }
.lp-progress-row { margin: 0 2px; }
.lp-progress-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.lp-progress-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s var(--ease); }
.lp-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 22px; }
.lp-icon-btn, .lp-main-btn {
  --ic: var(--ink-2);
  position: relative;
  display: grid; place-items: center;
  border-radius: 50%; padding: 0;
  font-size: 0 !important; color: transparent !important;
  transition: background .15s, border-color .15s, transform .1s;
}
.lp-icon-btn { width: 50px; height: 50px; border: 1px solid var(--line); background: var(--bg); }
.lp-icon-btn:hover { border-color: var(--accent-line); background: var(--accent-w); --ic: var(--accent-d); }
.lp-main-btn { width: 72px; height: 72px; border: 0; background: var(--accent); --ic: var(--on-accent); box-shadow: var(--shadow-2); }
.lp-main-btn:hover { background: var(--accent-d); }
.lp-icon-btn:active, .lp-main-btn:active { transform: scale(.95); }
.lp-icon-btn::before, .lp-main-btn::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 42%; height: 42%; background: var(--ic);
  -webkit-mask: var(--i-play) center / contain no-repeat; mask: var(--i-play) center / contain no-repeat;
}
#lp-play::before { transform: translateX(2px); }
#lp-pause::before { -webkit-mask-image: var(--i-pause); mask-image: var(--i-pause); }
#lp-prev::before { -webkit-mask-image: var(--i-prev); mask-image: var(--i-prev); }
#lp-next::before { -webkit-mask-image: var(--i-next); mask-image: var(--i-next); }

.lp-transcript { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.lp-transcript > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--ink);
}
.lp-transcript > summary::-webkit-details-marker { display: none; }
.lp-transcript > summary::after {
  content: ""; width: 16px; height: 16px; flex: none; background: var(--muted);
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
  transition: transform .2s;
}
.lp-transcript[open] > summary::after { transform: rotate(180deg); }
.lp-transcript > summary:hover { background: var(--bg-soft); }
.listen-segments { list-style: none; margin: 0; padding: 4px 12px 14px; display: grid; gap: 2px; }
.listen-seg {
  display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s;
}
.listen-seg:hover { background: var(--bg-soft); }
.listen-seg.is-current { background: var(--accent-w); border-color: var(--accent-line); }
.seg-lang { padding-top: 4px; font: 700 10.5px/1.2 var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.listen-seg[class*="listen-seg-kk"] .seg-lang { color: var(--accent-d); }
.listen-seg[class*="listen-seg-en"] .seg-lang { color: var(--gold-d); }
.listen-seg[class*="-slow"] .seg-lang::after { content: ' · slow'; font-weight: 500; color: var(--accent); }
.seg-text { font-size: 1.02rem; line-height: 1.5; color: var(--ink); }
.listen-seg[class*="listen-seg-en"] .seg-text { font-size: .95rem; font-style: italic; color: var(--muted); }
.listen-seg-pause { opacity: .55; }
@media (max-width: 640px) {
  .lp-player { padding: 16px; border-radius: 18px; }
  .lp-card { min-height: 160px; padding: 16px; }
  .lp-card-text { font-size: 1.4rem; }
  .listen-seg { grid-template-columns: 54px minmax(0, 1fr); gap: 8px; padding: 9px 8px; }
  .listen-segments { padding: 4px 6px 10px; }
}

/* ==========================================================================
   Review
   ========================================================================== */
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr); gap: 24px; align-items: start; }
.review-side { position: sticky; top: calc(var(--header-h) + 20px); }
.review-progress { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
#card-mode-label { font-weight: 500; color: var(--muted); }
.progress-bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s var(--ease); }
#card-source { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
#card-source:empty { display: none; }
.review-main { display: grid; gap: 14px; }
.review-prompt { background: var(--bg); border-color: var(--line); box-shadow: var(--shadow-2); min-height: 220px; }
.big-card.answer { background: var(--accent-w); border-color: var(--accent-line); }
#answer-note { font-size: 14px; color: var(--muted); }
#answer-note:empty { display: none; }
#show-answer .kbd { border-color: currentColor; }
.rate-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.btn.rate { min-height: 52px; justify-content: space-between; padding: 0 16px; }
.rate[data-rating="0"] { color: var(--bad); }
.rate[data-rating="3"] { color: var(--warn); }
.rate[data-rating="4"] { color: var(--good); }
.rate[data-rating="5"] { color: var(--accent); }
.rate[data-rating="0"]:hover { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.rate[data-rating="3"]:hover { background: var(--warn-w); border-color: var(--warn); color: var(--warn); }
.rate[data-rating="4"]:hover { background: var(--good-w); border-color: var(--good); color: var(--good); }
.rate[data-rating="5"]:hover { background: var(--accent-w); border-color: var(--accent); color: var(--accent); }
@media (max-width: 860px) {
  .review-layout { grid-template-columns: 1fr; gap: 14px; }
  .review-side { position: static; }
}
@media (max-width: 480px) {
  .rate-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Stats
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.stat-card {
  display: flex; flex-direction: column;
  padding: 18px 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.stat-card .v { font: 600 2rem/1.1 var(--font-serif); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat-card .l { margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.stat-card .sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.stat-card .sub:empty { display: none; }
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.page-section + .stats-row { margin-top: 40px; }
.panel {
  min-width: 0; padding: 20px 22px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.panel .section-head h2 { font-size: 1.2rem; }
.panel-h { margin: 0 0 8px; font-size: 1.2rem; }
.panel p { color: var(--ink-2); font-size: 14.5px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.panel-msg { font-size: 13.5px; color: var(--muted); }

.heatmap-wrap { overflow-x: auto; padding-bottom: 2px; }
.heatmap { display: flex; gap: 3px; width: max-content; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm-month { height: 14px; font-size: 10.5px; line-height: 14px; color: var(--muted); white-space: nowrap; width: 15px; overflow: visible; }
.hm-col:has(+ .hm-col > .hm-month:not(:empty)) > .hm-month { visibility: hidden; }
.hm-cell { width: 15px; height: 15px; border-radius: 3px; background: var(--bg-2); display: inline-block; }
.hm-cell.empty { background: transparent; }
.hm-cell.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--bg-2)); }
.hm-cell.l2 { background: color-mix(in srgb, var(--accent) 52%, var(--bg-2)); }
.hm-cell.l3 { background: color-mix(in srgb, var(--accent) 76%, var(--bg-2)); }
.hm-cell.l4 { background: var(--accent); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.heatmap-legend .hm-cell { width: 12px; height: 12px; }
.heatmap-legend span:first-child { margin-right: 4px; }
.heatmap-legend span:last-child { margin-left: 4px; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.games-grid .empty-note { grid-column: 1 / -1; }
.game-card {
  --cat: var(--accent);
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-top: 3px solid var(--cat);
  border-radius: 12px;
}
.game-card[data-cat="listen_podcast"] { --cat: var(--gold); }
.game-card[data-cat="tap_picture"] { --cat: var(--good); }
.game-card[data-cat="lesson_play"] { --cat: var(--accent-d); }
.game-card[data-cat="speed_round"] { --cat: var(--warn); }
.gc-name { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.gc-num { font: 600 1.6rem/1.15 var(--font-serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.gc-sub { font-size: 12.5px; color: var(--muted); }
.stats-lessons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-lessons .lesson-row { grid-template-columns: 1fr; }
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-row { grid-template-columns: 1fr; }
  .stats-lessons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .stat-grid { gap: 8px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .v { font-size: 1.6rem; }
  .stats-lessons { grid-template-columns: 1fr; }
  .stats-lessons .lesson-row { grid-template-columns: minmax(0, 1fr) 96px; }
}
@media (max-width: 420px) {
  .hm-cell { width: 11px; height: 11px; }
  .heatmap, .hm-col { gap: 2px; }
  .hm-month { width: 11px; font-size: 9.5px; }
  .panel { padding: 16px; }
}

/* ==========================================================================
   About, sign in, suggest
   ========================================================================== */
.about-grid { columns: 2; column-gap: 20px; }
.about-card {
  break-inside: avoid; display: block; width: 100%;
  margin: 0 0 20px; padding: 24px 26px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  color: var(--ink-2);
}
.practise-list { margin: 0; display: grid; gap: 10px; }
.practise-list > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.practise-list > div:first-child { border-top: 0; padding-top: 0; }
.practise-list dt { font-weight: 600; color: var(--ink); }
.practise-list dd { margin: 0; }
@media (max-width: 860px) { .about-grid { columns: 1; } .about-card { padding: 20px; } }
@media (max-width: 480px) { .practise-list > div { grid-template-columns: 1fr; gap: 2px; } }

.auth-page, .suggest-page.has-roadmap {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px 40px; align-items: start;
}
.auth-main h1 { margin: 0 0 6px; }
.auth-main .ph-sub { margin: 10px 0 0; }
.auth-card, .suggest-card {
  display: grid; gap: 10px;
  margin-top: 22px; padding: 24px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.suggest-card { margin-top: 0; }
.suggest-card + .suggest-card { margin-top: 14px; }
.auth-card p, .suggest-card p { margin: 0; color: var(--ink-2); }
.auth-card-ok, .suggest-ok { background: var(--good-w); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.auth-card-err, .suggest-err { background: var(--bad-w); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.auth-card-err p, .suggest-err p { color: var(--bad); }
.auth-label, .suggest-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.suggest-label:not(:first-child) { margin-top: 8px; }
.auth-submit, .suggest-submit { justify-self: start; margin-top: 6px; }
.auth-small { font-size: 13.5px; color: var(--muted); }
.auth-foot { margin: 16px 0 0; }
.auth-side, .suggest-side {
  padding: 24px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.check-list li { position: relative; padding-left: 30px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--good-w);
}
.check-list li::after {
  content: ""; position: absolute; left: 4px; top: 6px; width: 12px; height: 12px; background: var(--good);
  -webkit-mask: var(--i-check) center / contain no-repeat; mask: var(--i-check) center / contain no-repeat;
}
.suggest-roadmap-h { margin: 0 0 6px; font-size: 1.2rem; }
.suggest-side > .auth-small { margin: 0; }
.suggest-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; }
.suggest-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.suggest-item .badge { flex: none; margin-top: 1px; }
.suggest-title { font-size: 14.5px; color: var(--ink); }
.suggest-foot { margin: 4px 0 0; }
@media (max-width: 860px) {
  .auth-page, .suggest-page.has-roadmap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .auth-card, .suggest-card, .auth-side, .suggest-side { padding: 18px; }
  .auth-submit, .suggest-submit { justify-self: stretch; }
}

/* ==========================================================================
   Games: shared stage
   ========================================================================== */
.game-head { margin-bottom: 24px; }
.game-stage {
  padding: 28px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
}
.game-stage .empty-state { border: 0; background: none; padding: 36px 8px 20px; box-shadow: none; }
.game-stage .empty-state h2 { font-size: 1.8rem; }

.game-setup, .difficulty-picker { display: grid; gap: 12px; }
.picker-label {
  margin: 8px 0 0;
  font: 600 12.5px/1.2 var(--font-ui); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.picker-label:first-child { margin-top: 0; }
.mode-tiles, .difficulty-options, .diff-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.btn.mode-tile, .diff-tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px;
  min-height: 0; height: auto; padding: 16px 18px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--ink); text-align: left; white-space: normal;
  box-shadow: none;
  font: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.btn.mode-tile:hover, .diff-tile:hover { border-color: var(--accent-line); background: var(--bg-soft); color: var(--ink); }
.btn.mode-tile.active, .diff-tile.active {
  border-color: var(--accent); background: var(--accent-w);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.mt-name, .diff-name { font: 600 15.5px/1.3 var(--font-ui); color: var(--ink); }
.mt-sub, .diff-sub { font: 400 13.5px/1.45 var(--font-ui); color: var(--muted); }
.diff-best {
  display: inline-flex; align-items: center;
  margin-top: 6px; padding: 3px 9px; border-radius: 999px;
  background: var(--gold-w); color: var(--gold-d);
  font: 600 12px/1.2 var(--font-ui);
}
.picker-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.scoreboard {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 34px;
  margin: 0 0 22px; padding: 0 0 18px;
  border-bottom: 1px solid var(--line-2);
}
.scoreboard > div { display: flex; flex-direction: column; gap: 3px; }
.scoreboard .v { font: 600 1.65rem/1 var(--font-serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.scoreboard .l { font-size: 12.5px; font-weight: 500; color: var(--muted); }
#mode-chip, .diff-best-inline { margin-left: auto; }
#mode-chip {
  display: inline-flex; flex-direction: row; align-items: center;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2);
  font: 600 12.5px/1.2 var(--font-ui);
}
#mode-chip:empty { display: none; }
.diff-best-inline { margin-top: 0; }

.big-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  min-height: 180px; margin: 0 0 20px; padding: 32px 24px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 18px;
  text-align: center;
  font-size: 1.35rem; line-height: 1.35; color: var(--ink);
  overflow-wrap: anywhere;
}
.big-card .kk { font-size: clamp(1.7rem, 1.2rem + 1.5vw, 2.4rem); font-weight: 600; line-height: 1.22; }
.big-card .audio-play { width: 48px; height: 48px; }
.big-card-audio { min-height: 200px; }
.big-card .prompt-strip { margin: 0; padding: 0; background: none; border: 0; justify-content: center; }
.big-card .clock-face { width: 170px; height: 170px; }

.mc-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mc-option, .drill-opt {
  display: flex; align-items: center; justify-content: center;
  min-height: 62px; padding: 12px 16px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--ink); text-align: center;
  font: 500 16.5px/1.35 var(--font-ui);
  overflow-wrap: anywhere;
  transition: border-color .15s, background .15s, transform .1s;
}
.mc-option:hover:not(:disabled), .drill-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-w); }
.mc-option:active:not(:disabled), .drill-opt:active:not(:disabled) { transform: scale(.985); }
.mc-option .kk, .drill-opt .kk { font-size: 1.15rem; }
.mc-option.kk, .drill-opt.kk { font-family: var(--font-serif); font-size: 1.15rem; }
.mc-option.correct, .drill-opt.correct, .drill-opt.ok { background: var(--good-w); border-color: var(--good); color: var(--good); }
.mc-option.wrong, .drill-opt.wrong, .drill-opt.bad { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.mc-option:disabled, .drill-opt:disabled { cursor: default; }

.game-actions, .build-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

@keyframes kt-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.shake { animation: kt-shake .4s ease; }

/* Type the answer */
.type-input { min-height: 58px; font-size: 1.3rem; text-align: center; font-family: var(--font-serif); }
.type-input.correct { border-color: var(--good); box-shadow: 0 0 0 3px var(--good-w); }
.type-input.wrong { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-w); }
.kk-helper { margin: 10px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
#feedback { min-height: 30px; margin-top: 12px; text-align: center; font-size: 1.05rem; }
#feedback:empty { min-height: 0; }
.type-correct { color: var(--good); font-weight: 600; }
.type-correct .kk { font-size: 1.2rem; }
.actual { font-weight: 600; }

/* Sentence builder */
.game-stage .review-progress { justify-content: flex-start; margin-bottom: 14px; color: var(--muted); }
.build-en { font-size: 1.25rem; color: var(--ink); }
.build-answer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  min-height: 70px; margin: 0 0 14px; padding: 14px;
  background: var(--bg-soft); border: 2px dashed var(--line); border-radius: 16px;
  transition: border-color .2s, background .2s;
}
.build-answer.ok { border-style: solid; border-color: var(--good); background: var(--good-w); }
.build-answer.bad { border-style: solid; border-color: var(--bad); background: var(--bad-w); }
.build-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 52px; }
.build-tile, .build-chip {
  display: inline-flex; align-items: center;
  min-height: 46px; padding: 0 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  font: 500 1.08rem/1.2 var(--font-serif); color: var(--kk);
  box-shadow: var(--shadow-1);
  transition: border-color .15s, transform .1s, opacity .15s;
}
.build-tile:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.build-tile:disabled { opacity: .3; box-shadow: none; }
.build-chip { background: var(--accent-w); border-color: var(--accent-line); cursor: pointer; }
.build-chip.revealed { background: var(--good-w); border-color: var(--good); color: var(--good); cursor: default; }
.build-feedback { min-height: 26px; margin-top: 12px; text-align: center; font-weight: 600; }
.build-feedback.ok { color: var(--good); }
.build-feedback.bad { color: var(--bad); }

/* Speed round */
.speed-time-bar { height: 8px; margin: 0 0 18px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.speed-time-bar-fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width 1s linear, background .3s; }
.speed-time-bar-fill.urgent, .speed-time-bar.urgent .speed-time-bar-fill { background: var(--bad); }

/* Memory */
.memory-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.memory-card {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px;
  text-align: center; cursor: pointer; user-select: none;
  transition: transform .15s var(--ease), border-color .15s, background .2s;
  font-family: var(--font-ui);
}
.memory-card .memory-back, .memory-card .memory-front {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 8px; line-height: 1.25;
  overflow-wrap: anywhere;
  transition: opacity .18s ease;
}
.memory-card .memory-back { opacity: 1; font: 600 1.7rem/1 var(--font-serif); color: var(--accent); }
.memory-card .memory-front { opacity: 0; }
.memory-card.flipped .memory-back, .memory-card.matched .memory-back { opacity: 0; }
.memory-card.flipped .memory-front, .memory-card.matched .memory-front { opacity: 1; }
.memory-card.face-down {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 22%, transparent) 1px, transparent 1.5px) 0 0 / 14px 14px,
    var(--accent-w);
  border-color: var(--accent-line);
}
.memory-card.face-down:hover { transform: translateY(-2px); border-color: var(--accent); }
.memory-card.flipped { background: var(--bg); border-color: var(--accent); box-shadow: var(--shadow-2); }
.memory-card.matched { background: var(--good-w); border-color: var(--good); cursor: default; }
.memory-card.kk .memory-front { font: 600 1.08rem/1.25 var(--font-serif); color: var(--kk); }
.memory-card.en .memory-front { font: 500 14.5px/1.3 var(--font-ui); color: var(--ink-2); }
.memory-card.matched .memory-front { color: var(--good); }
@media (max-width: 960px) { .memory-board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .memory-board { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .memory-card { aspect-ratio: 1 / 1; border-radius: 12px; }
  .memory-card.kk .memory-front { font-size: .95rem; }
  .memory-card.en .memory-front { font-size: 12.5px; }
  .memory-card .memory-back { font-size: 1.35rem; }
}

/* Prompt strip (months, compass, numbers, clock) */
.prompt-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  margin: 0 0 20px; padding: 20px 22px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 18px;
  overflow-wrap: anywhere;
}
.prompt-strip .audio-play { width: 54px; height: 54px; --ic: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.prompt-strip .audio-play:hover { background: var(--accent-d); border-color: var(--accent-d); }
.prompt-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.prompt-text .kk { font-size: 1.7rem; font-weight: 600; line-height: 1.25; }

/* Clock */
.clock-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.clock-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--bg-soft); border: 1.5px solid var(--line-2); border-radius: 16px;
  color: var(--ink);
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.clock-btn:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: translateY(-2px); }
.clock-btn.correct { background: var(--good-w); border-color: var(--good); color: var(--good); }
.clock-btn.wrong { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.clock-face { width: 132px; height: 132px; color: var(--ink); }
.clock-btn.correct .clock-face, .clock-btn.wrong .clock-face { color: inherit; }
.time-text-btn { min-height: 100px; }

/* Picture tiles (numbers) */
.picture-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.picture-grid.grid-mode { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pic-tile {
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px;
  color: var(--ink); overflow-wrap: anywhere;
  transition: border-color .15s, transform .15s var(--ease), background .15s;
}
.pic-tile:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.pic-tile.correct { background: var(--good-w); border-color: var(--good); color: var(--good); }
.pic-tile.wrong { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.pic-tile .emoji { font-size: clamp(2.8rem, 8vw, 4rem); line-height: 1; }
.pic-tile img { width: 86%; height: 86%; object-fit: cover; border-radius: 10px; }
.pic-tile .pic-label { font-size: 13px; color: var(--muted); text-align: center; }
.pic-tile.correct .pic-label { color: var(--good); }
.pic-tile.wrong .pic-label { color: var(--bad); }
.pic-tile .swatch { width: 70%; aspect-ratio: 1 / 1; border-radius: 12px; border: 1px solid rgba(0, 0, 0, .08); display: block; }
:root[data-theme="dark"] .pic-tile .swatch { border-color: rgba(255, 255, 255, .1); }
.picture-grid.grid-mode .pic-tile { padding: 8px; border-radius: 12px; }
.picture-grid.grid-mode .pic-tile .swatch { width: 100%; height: 100%; border-radius: 9px; }
.numeral-tile { padding: 10px; aspect-ratio: auto; min-height: 150px; }
.picture-grid.grid-mode .numeral-tile { min-height: 116px; }
.numeral-tile .big-num { font: 600 clamp(2.2rem, 6vw, 3.4rem)/1.05 var(--font-serif); color: inherit; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; max-width: 100%; }

/* Months */
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.month-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 92px; padding: 14px 10px;
  background: var(--bg-soft); border: 1.5px solid var(--line-2); border-radius: 14px;
  color: var(--ink); overflow-wrap: anywhere;
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.month-tile:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: translateY(-2px); }
.month-num { font: 600 1.4rem/1 var(--font-serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.month-name { font-size: 1.05rem; font-weight: 600; text-align: center; }
.month-tile.correct { background: var(--good-w); border-color: var(--good); color: var(--good); }
.month-tile.wrong { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.month-tile.correct .month-num, .month-tile.correct .month-name { color: var(--good); }
.month-tile.wrong .month-num, .month-tile.wrong .month-name { color: var(--bad); }

/* Compass */
.compass-rose {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px; width: 100%; max-width: 400px; aspect-ratio: 1 / 1; margin: 6px auto 0;
}
.compass-cell { display: flex; align-items: center; justify-content: center; min-width: 0; }
.compass-btn {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
  background: var(--bg-soft); border: 1.5px solid var(--line); border-radius: 16px;
  color: var(--ink); text-align: center;
  font: 600 15px/1.25 var(--font-ui);
  overflow-wrap: anywhere;
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.compass-btn:hover:not(:disabled) { background: var(--bg); border-color: var(--accent); transform: scale(1.03); }
.compass-btn.correct { background: var(--good-w); border-color: var(--good); color: var(--good); }
.compass-btn.wrong { background: var(--bad-w); border-color: var(--bad); color: var(--bad); }
.compass-center { font-size: 1.8rem; color: var(--muted-2); user-select: none; }

@media (max-width: 960px) {
  .picture-grid.grid-mode { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .game-stage { padding: 16px; border-radius: 18px; }
  .game-head { margin-bottom: 16px; }
  .scoreboard { gap: 8px 22px; padding-bottom: 14px; margin-bottom: 16px; }
  .scoreboard .v { font-size: 1.35rem; }
  .big-card { min-height: 140px; padding: 24px 16px; margin-bottom: 14px; }
  .big-card .kk { font-size: 1.6rem; }
  .mc-option, .drill-opt { min-height: 54px; font-size: 15.5px; padding: 10px 12px; }
  .prompt-strip { padding: 14px 16px; gap: 12px; margin-bottom: 14px; }
  .prompt-strip .audio-play { width: 46px; height: 46px; }
  .prompt-text .kk { font-size: 1.25rem; line-height: 1.35; }
  .clock-face { width: 104px; height: 104px; }
  .big-card .clock-face { width: 140px; height: 140px; }
  .picture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .picture-grid.grid-mode { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pic-tile { aspect-ratio: auto; min-height: 112px; padding: 10px 6px; }
  .picture-grid.grid-mode .pic-tile { aspect-ratio: 1 / 1; min-height: 0; }
  .numeral-tile .big-num { font-size: clamp(1rem, 6vw, 2.4rem) !important; }
  .pic-tile .kk { font-size: .95rem !important; line-height: 1.3; padding: 6px 4px !important; }
  .compass-btn { font-size: 13.5px; border-radius: 12px; }
  .build-tile, .build-chip { min-height: 42px; padding: 0 12px; font-size: 1rem; }
}
@media (max-width: 480px) {
  .mc-options { grid-template-columns: 1fr; gap: 8px; }
  .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-tiles, .difficulty-options, .diff-tiles { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Tap the picture
   ========================================================================== */
.tap-prompt-bar {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 20px; padding: 0 0 16px;
  border-bottom: 1px solid var(--line-2);
}
.tap-progress { min-width: 56px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tap-prompt-bar .play-btn { width: 46px; height: 46px; }
.tap-prompt { flex: 1; min-width: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.25; }
.tap-picture-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tap-picture-opt {
  display: block; aspect-ratio: 1 / 1; padding: 6px;
  background: var(--bg-soft); border: 2px solid var(--line); border-radius: 16px;
  transition: transform .12s var(--ease), border-color .15s, background .15s;
}
.tap-picture-opt img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.tap-picture-opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); }
.tap-picture-opt.correct { border-color: var(--good); background: var(--good-w); }
.tap-picture-opt.wrong { border-color: var(--bad); background: var(--bad-w); }
.tap-emoji-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tap-emoji-opt {
  padding: 28px 8px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 16px;
  font-size: 3.2rem; line-height: 1;
  transition: transform .12s var(--ease), border-color .15s, background .15s;
}
.tap-emoji-opt:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent); background: var(--bg-soft); }
.tap-emoji-opt.correct { background: var(--good-w); border-color: var(--good); }
.tap-emoji-opt.wrong { background: var(--bad-w); border-color: var(--bad); }
.tap-picture-opt:disabled, .tap-emoji-opt:disabled { cursor: default; }
.tap-feedback {
  min-height: 46px; margin: 16px 0 0; padding: 11px 16px;
  background: var(--bg-soft); border-radius: 12px;
  text-align: center; font-size: 15px; color: var(--ink-2);
}
.tap-feedback[hidden] { display: block !important; visibility: hidden; }
.tap-feedback .ok { color: var(--good); font-weight: 600; }
.tap-feedback .bad { color: var(--bad); font-weight: 600; margin-right: .25rem; }
.tap-controls { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.tap-score { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 760px) {
  .tap-picture-grid, .tap-emoji-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tap-prompt { font-size: 1.25rem; }
  .tap-emoji-opt { font-size: 2.6rem; padding: 22px 6px; }
}

/* Old tap-on-image mode markers (kept for any page that still uses them) */
.tap-stage { position: relative; margin-top: 12px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; user-select: none; }
.tap-stage img { display: block; width: 100%; height: auto; }
.tap-pins { position: absolute; inset: 0; pointer-events: none; }
.tap-ripple { position: absolute; width: 60px; height: 60px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; animation: tap-pop .9s ease-out forwards; }
.tap-ripple.correct { background: color-mix(in srgb, var(--good) 35%, transparent); border: 3px solid var(--good); }
.tap-ripple.wrong { background: color-mix(in srgb, var(--bad) 35%, transparent); border: 3px solid var(--bad); }
@keyframes tap-pop { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.5); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } }
.tap-target-marker { position: absolute; width: 28px; height: 28px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 35%, transparent); pointer-events: none; animation: tap-pulse .5s ease-out; }
@keyframes tap-pulse { 0% { transform: translate(-50%, -50%) scale(.4); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* ==========================================================================
   Drills (grammar topic drill, noun and sentence drills)
   ========================================================================== */
.drill {
  padding: 24px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-2);
}
.drill-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 18px; padding: 0 0 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.drill-body { display: grid; gap: 14px; }
.drill-prompt-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 18px;
  background: var(--bg-soft); border-radius: 14px; text-align: center;
}
.drill-prompt-label { font: 600 12px/1.2 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.drill-prompt { font-size: 1.35rem; font-weight: 600; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.drill-prompt .kk { font-size: 1.5rem; }
.drill-prompt-play { margin-right: 8px; }
.drill-listen-play {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 20px;
  border: 1px solid var(--accent-line); border-radius: 999px;
  background: var(--accent-w); color: var(--accent-d);
  font: 600 15px/1 var(--font-ui);
  transition: background .15s, color .15s;
}
.drill-listen-play:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.drill-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drill-feedback { min-height: 24px; text-align: center; font-weight: 500; color: var(--ink-2); }
.drill-feedback:empty { min-height: 0; }
.drill-feedback .ok, .drill-feedback.ok { color: var(--good); }
.drill-feedback .bad, .drill-feedback.bad { color: var(--bad); }
.drill-next { justify-self: center; }
.drill-type-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.drill-type-input { flex: 1 1 240px; width: auto; font-family: var(--font-serif); font-size: 1.15rem; }
.drill-final { text-align: center; padding: 18px 8px 6px; }
.drill-final-score { font: 600 2.6rem/1.1 var(--font-serif); color: var(--ink); }
.drill-final-pct { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--accent); }
.drill-final-msg { margin: 10px 0 18px; color: var(--ink-2); }
.drill-start { margin-top: 2px; }

.drill-stage {
  padding: 24px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-2);
}
.nd-input-area, .sd-input-area { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.nd-feedback, .sd-feedback { margin-top: 12px; border-radius: 10px; }
.drill-stage .btn.kk { white-space: normal; min-height: 48px; }
@media (max-width: 640px) {
  .drill, .drill-stage { padding: 16px; }
  .drill-options { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Word-note popup, misc
   ========================================================================== */
#kt-note-popup { color: var(--ink); box-shadow: var(--shadow-3) !important; }
.kt-pop-base { font-weight: 600; }
.kt-pop-form { font-family: var(--font-serif); color: var(--kk); }
.kt-pop-gloss, .kt-pop-case { color: var(--muted); font-size: .92em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
