/* TAMIIIKKO/TAMIKO skin for the LernApp (Shifu).
 *
 * This file is a pure OVERLAY: it is loaded AFTER the inline <style> block in
 * index.html and wins by cascade order. The original inline stylesheet is not
 * touched — remove the corresponding <link> in index.html to disable this skin
 * entirely, or run `./revert.sh` to also restore the pre-Tamiko index.html.
 *
 * Design principles applied from the Tamiko system:
 *   - IBM Plex Sans as body font (Chinese fonts unchanged for CN characters)
 *   - Graphite neutrals: surface/ink tokens
 *   - Navy accent (#3a5c8a) — matches the launcher's --acc-lernapp
 *   - Keep correct/wrong colours: they are semantic state feedback, valid use
 *   - Keep XP gold: it's a game element, not chrome
 *   - Cleaner shadows without blue tint (Tamiko: achromatic)
 *
 * Deliberately NOT changed:
 *   - The pop/shake/pulse animations (kids app benefits from motion)
 *   - The Panda / mascot / celebratory bits
 *   - Chinese font stack (Ma Shan Zheng, Noto Sans SC, etc.)
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ------- Token remap (light) ------- */
:root {
  /* Accent — navy for Shifu (matches launcher --acc-lernapp) */
  --primary:       #3a5c8a;
  --primary-light: #6d8bb8;
  --primary-dark:  #26456a;

  /* Surfaces & ink — Tamiko graphite */
  --bg:         #f5f5f6;
  --card:       #ffffff;
  --text:       #18191b;
  --text-light: #5e6063;
  --muted:      #8e9195;

  /* Correct / wrong — semantic; keep hue, dial down saturation slightly */
  --correct:       #0d7f77;   /* Tamiko teal (positive value colour) */
  --correct-light: #a8dfd6;
  --wrong:         #b2402c;   /* Tamiko brick (negative value colour) */
  --wrong-light:   #e6b5a8;

  /* XP gold — game feedback, keep bright */
  --xp-gold:      #FDCB6E;
  --xp-gold-dark: #f9a825;

  /* Shadows — Tamiko is achromatic (no blue tint) */
  --shadow:    0 1px 2px rgba(24,25,27,0.05), 0 1px 3px rgba(24,25,27,0.06);
  --shadow-lg: 0 2px 8px rgba(24,25,27,0.06), 0 6px 20px rgba(24,25,27,0.06);

  /* Radii — slightly tighter than the original */
  --radius:    12px;
  --radius-sm: 8px;
}

/* ------- Dark mode (matches Tamiko dark) ------- */
@media (prefers-color-scheme: dark) {
  :root {
    --primary:       #6d8bb8;
    --primary-light: #93aad2;
    --primary-dark:  #4a6a99;

    --bg:         #141516;
    --card:       #1e1f21;
    --text:       #ededee;
    --text-light: #a3a5a8;
    --muted:      #7a7d81;

    --correct:       #3fb8ad;
    --correct-light: #6bccc3;
    --wrong:         #e07a66;
    --wrong-light:   #eba99a;

    --shadow:    0 1px 2px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.28);
    --shadow-lg: 0 2px 8px rgba(0,0,0,0.35), 0 6px 20px rgba(0,0,0,0.42);
  }
}
:root[data-theme="dark"] {
  --primary:       #6d8bb8;
  --primary-light: #93aad2;
  --primary-dark:  #4a6a99;
  --bg:         #141516;
  --card:       #1e1f21;
  --text:       #ededee;
  --text-light: #a3a5a8;
  --muted:      #7a7d81;
  --correct:       #3fb8ad;
  --correct-light: #6bccc3;
  --wrong:         #e07a66;
  --wrong-light:   #eba99a;
  --shadow:    0 1px 2px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.28);
  --shadow-lg: 0 2px 8px rgba(0,0,0,0.35), 0 6px 20px rgba(0,0,0,0.42);
}

/* ------- Font stack — Plex Sans + preserve Chinese fonts ------- */
body,
button,
input,
select,
textarea {
  font-family: 'IBM Plex Sans', 'Ma Shan Zheng', 'Noto Sans SC', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Numbers tabular where they matter (scores, timers, XP counters) */
.xp, .score, .timer, .streak, .stat-value,
[class*="counter"], [class*="score"], [class*="timer"] {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Preserve the display fonts for Chinese characters — they usually have
 * their own classes; if not, wrap CN text in .cn or the existing hanzi class. */
.hanzi, .cn, [lang="zh"], [lang="zh-CN"] {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', 'Noto Sans SC', serif;
}

/* ------- Surgical overrides for jarring hardcoded colours ------- */

/* PIN button gradient — was solid white-to-lightgrey, now flat-ish raised */
.pin-btn {
  background: var(--card) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
}
.pin-btn:active {
  background: var(--primary) !important;
  color: #fff !important;
}

/* User card gradient likewise */
.user-card {
  background: var(--card) !important;
  border-color: transparent;
}

/* Pin dot pulse — was hardcoded blue rgba, replace with primary token */
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(58, 92, 138, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(58, 92, 138, 0.15); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--xp-gold); }
  50%      { box-shadow: 0 0 18px var(--xp-gold), 0 0 32px rgba(253, 203, 110, 0.4); }
}

/* Header brand — apply the wordmark accent treatment where a class exists */
.app-title, .header-title, .brand-name {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Meta status bar tinting */
html { background: var(--bg); }

/* ================================================================
 * TAMIKO TOPBAR — header + tabs (injected by tamiko-nav.js)
 * ================================================================ */

/* Accent alias used by the mark's 4th bar */
:root { --acc-shifu: var(--primary); }

.tn-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid rgba(24, 25, 27, 0.10);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  user-select: none;
}
@media (prefers-color-scheme: dark) {
  .tn-topbar { border-bottom-color: rgba(237, 237, 238, 0.12); }
}
:root[data-theme="dark"] .tn-topbar { border-bottom-color: rgba(237, 237, 238, 0.12); }

/* Sharing mode: no brand column */
.tn-topbar--share { grid-template-columns: 1fr auto; }

.tn-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.tn-mark { color: var(--text); }
.tn-wm {
  font-size: 18px; font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
}
.tn-wm-acc { color: var(--acc-shifu); }
.tn-sub {
  font-size: 12px; font-weight: 500;
  color: var(--text-light);
  padding-left: 10px;
  border-left: 1px solid rgba(24, 25, 27, 0.10);
  letter-spacing: 0.02em;
}
@media (prefers-color-scheme: dark) {
  .tn-sub { border-left-color: rgba(237, 237, 238, 0.12); }
}

.tn-tabs {
  display: flex; align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0;
  min-width: 0;
}
.tn-tabs::-webkit-scrollbar { display: none; }
.tn-tab {
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 120ms, border-color 120ms;
  border-radius: 0;
}
.tn-tab:hover { color: var(--text); }
.tn-tab.active {
  color: var(--acc-shifu);
  border-bottom-color: var(--acc-shifu);
}
.tn-tab:active { transform: none; }  /* override .screen 's scale(0.96) */

.tn-right {
  display: flex; align-items: center; gap: 6px;
}
.tn-user {
  background: rgba(24, 25, 27, 0.05);
  border: 1px solid transparent;
  color: var(--text);
  padding: 6px 10px 6px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
  display: inline-flex; align-items: center; gap: 4px;
}
.tn-user-name { font-weight: 600; }
.tn-user-chev { font-size: 11px; color: var(--text-light); }
.tn-user:hover { background: rgba(24, 25, 27, 0.08); }
@media (prefers-color-scheme: dark) {
  .tn-user { background: rgba(237, 237, 238, 0.08); }
  .tn-user:hover { background: rgba(237, 237, 238, 0.14); }
}
.tn-userstats {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 4px;
}
.tn-userstat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" 1, "lnum" 1;
  white-space: nowrap;
}
.tn-userstat-icon {
  font-size: 12px;
  line-height: 1;
  font-family: 'IBM Plex Sans', sans-serif;
}
.tn-userstat--streak {
  background: color-mix(in srgb, #E8412B 12%, transparent);
  color: #E8412B;
}
@media (max-width: 720px) {
  .tn-userstats { display: none; }
}
.tn-menu-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-light);
  width: 32px; height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 18px;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.tn-menu-btn:hover {
  background: rgba(24, 25, 27, 0.05);
  color: var(--text);
}

/* Popup menu */
.tn-menu {
  position: fixed;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(24, 25, 27, 0.14);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 4px;
  z-index: 200;
  font-family: 'IBM Plex Sans', sans-serif;
}
.tn-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.tn-menu-item:hover { background: rgba(24, 25, 27, 0.05); }
.tn-menu-sep {
  height: 1px;
  margin: 4px 8px;
  background: rgba(24, 25, 27, 0.10);
}
@media (prefers-color-scheme: dark) {
  .tn-menu-sep { background: rgba(237, 237, 238, 0.14); }
}

/* Adjust screen height to accommodate sticky header */
.tn-topbar ~ .screen.active,
.tn-topbar + .screen.active {
  min-height: calc(100dvh - 62px);
}

/* ================================================================
 * Injected screens: tn-overview-screen + tn-skills-screen
 * ================================================================ */

.tn-injected {
  padding: 24px 16px 40px !important;
  max-width: 900px;
  margin: 0 auto;
  animation: none !important;
}

.tn-ov-wrap, .tn-sk-wrap {
  display: flex; flex-direction: column;
  gap: 24px;
  width: 100%;
  font-family: 'IBM Plex Sans', sans-serif;
}

.tn-ov-greeting {
  display: flex; flex-direction: column; gap: 4px;
  padding-bottom: 4px;
}
.tn-ov-hello {
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
  line-height: 1.2;
}
.tn-ov-hint {
  font-size: 13px; color: var(--text-light);
  letter-spacing: 0.01em;
}

/* KPI stats row */
.tn-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.tn-kpi-row--clickable {
  background: transparent; border: none; padding: 0;
  cursor: pointer;
  font: inherit; color: inherit; text-align: left;
  transition: transform 160ms;
}
.tn-kpi-row--clickable:hover { transform: translateY(-1px); }
.tn-kpi-row--clickable:hover .tn-kpi {
  border-color: color-mix(in srgb, var(--kpi-acc) 40%, rgba(24,25,27,0.10));
}
.tn-kpi {
  --kpi-acc: var(--primary);
  display: flex; align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid rgba(24, 25, 27, 0.10);
  border-radius: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.tn-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--kpi-acc);
}
.tn-kpi-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: color-mix(in srgb, var(--kpi-acc) 14%, transparent);
}
.tn-kpi-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tn-kpi-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-light);
}
.tn-kpi-value {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  font-feature-settings: "tnum" 1, "lnum" 1;
  line-height: 1.1;
}
.tn-kpi-sub {
  font-size: 12px; font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
@media (prefers-color-scheme: dark) {
  .tn-kpi { border-color: rgba(237, 237, 238, 0.12); }
}

/* Overview action cards */
.tn-ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.tn-ov-card, .tn-sk-card {
  --card-acc: var(--primary);
  text-align: left;
  background: var(--card);
  border: 1px solid rgba(24, 25, 27, 0.10);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 160ms, box-shadow 160ms, transform 160ms;
  display: flex; flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  color: var(--text);
}
.tn-ov-card::before, .tn-sk-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--card-acc);
  transition: width 160ms;
}
.tn-ov-card:hover, .tn-sk-card:hover {
  border-color: color-mix(in srgb, var(--card-acc) 40%, rgba(24,25,27,0.10));
  box-shadow: 0 2px 6px rgba(24,25,27,0.06), 0 10px 24px rgba(24,25,27,0.08);
  transform: translateY(-1px);
}
.tn-ov-card:hover::before, .tn-sk-card:hover::before { width: 5px; }

.tn-ov-card-title, .tn-sk-card-title {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text);
  transition: color 160ms;
}
.tn-ov-card:hover .tn-ov-card-title,
.tn-sk-card:hover .tn-sk-card-title { color: var(--card-acc); }

.tn-ov-card-desc, .tn-sk-card-desc {
  font-size: 12.5px; color: var(--text-light);
  line-height: 1.45;
}
.tn-ov-card-go, .tn-sk-card-tag {
  margin-top: 6px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--card-acc);
}

/* Skills hub */
.tn-sk-head {
  display: flex; flex-direction: column; gap: 4px;
}
.tn-sk-title {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em; margin: 0;
  color: var(--text);
}
.tn-sk-sub {
  font-size: 13px; color: var(--text-light);
  margin: 0;
}
.tn-sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.tn-sk-card--soon {
  opacity: 0.5;
  cursor: default;
}
.tn-sk-card--soon:hover {
  transform: none;
  border-color: rgba(24, 25, 27, 0.10);
  box-shadow: var(--shadow);
}
.tn-sk-card--soon:hover::before { width: 3px; }
.tn-sk-card--soon:hover .tn-sk-card-title { color: var(--text); }

/* Icon + meta for Skills/Schulfächer/Projekte hub cards */
.tn-sk-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--card-acc) 14%, transparent);
  font-size: 22px;
  font-family: 'IBM Plex Sans', 'Noto Sans SC', sans-serif;
  margin-bottom: 4px;
  transition: background 160ms;
}
.tn-sk-card:hover .tn-sk-card-icon {
  background: color-mix(in srgb, var(--card-acc) 24%, transparent);
}
.tn-sk-card-meta {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 6px;
}
.tn-sk-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-acc) 12%, transparent);
  color: var(--card-acc);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em;
}
.tn-sk-empty {
  padding: 24px; text-align: center;
  color: var(--text-light); font-size: 13.5px;
  grid-column: 1 / -1;
}

/* Drill-down head: back button + subject title + count */
.tn-sk-head--drill {
  display: flex; flex-direction: column; gap: 6px;
}
.tn-back-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(24, 25, 27, 0.10);
  color: var(--text-light);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.10em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.tn-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.tn-back-arrow { font-size: 14px; line-height: 1; }
.tn-back-label { letter-spacing: 0.10em; }

.tn-sk-title { display: flex; align-items: center; gap: 12px; }
.tn-sk-title-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  font-size: 20px;
  font-family: 'IBM Plex Sans', 'Noto Sans SC', sans-serif;
}
@media (prefers-color-scheme: dark) {
  .tn-back-btn { border-color: rgba(237, 237, 238, 0.14); }
}

/* Vertical topic list — one row per topic */
.tn-topic-list {
  display: flex; flex-direction: column;
  gap: 8px;
}
.tn-topic-card {
  display: grid !important;
  grid-template-columns: 44px 1fr auto auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 12px 16px 12px 18px;
}
.tn-topic-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--card-acc) 14%, transparent);
  font-size: 20px;
  font-family: 'IBM Plex Sans', 'Noto Sans SC', sans-serif;
  transition: background 160ms;
}
.tn-topic-card:hover .tn-topic-icon {
  background: color-mix(in srgb, var(--card-acc) 24%, transparent);
}
.tn-topic-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tn-topic-body .tn-sk-card-title { font-size: 14.5px; }
.tn-topic-body .tn-sk-card-desc  { font-size: 12px; }
.tn-topic-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; min-width: 90px;
}
.tn-topic-count, .tn-topic-stars {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-light);
  font-feature-settings: "tnum" 1, "lnum" 1;
  white-space: nowrap;
}
.tn-topic-stars { color: var(--card-acc); }
.tn-topic-progress {
  display: block;
  width: 90px; height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-acc) 14%, transparent);
  overflow: hidden;
}
.tn-topic-progress-fill {
  display: block; height: 100%;
  background: var(--card-acc);
  transition: width 300ms;
}
.tn-topic-go {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 14px; font-weight: 600;
  color: var(--card-acc);
  padding-left: 4px;
  transition: transform 160ms;
}
.tn-topic-card:hover .tn-topic-go { transform: translateX(3px); }

/* Mobile: stack meta below body */
@media (max-width: 620px) {
  .tn-topic-card {
    grid-template-columns: 40px 1fr auto;
    grid-template-areas: "icon body go" "icon meta go";
    gap: 10px 12px;
  }
  .tn-topic-icon { grid-area: icon; }
  .tn-topic-body { grid-area: body; }
  .tn-topic-meta { grid-area: meta; align-items: flex-start; min-width: 0; }
  .tn-topic-go   { grid-area: go; align-self: center; }
  .tn-topic-meta {
    flex-direction: row; align-items: center; gap: 10px;
  }
}

/* Foot link (below action cards on Übersicht) */
.tn-ov-foot { margin-top: 8px; }
.tn-ov-link {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(24, 25, 27, 0.20);
}
.tn-ov-link:hover {
  color: var(--text);
  text-decoration-color: var(--primary);
}

/* Compact on narrow screens */
@media (max-width: 620px) {
  .tn-topbar { grid-template-columns: 1fr auto; row-gap: 0; padding: 8px 12px; }
  .tn-brand { grid-column: 1; }
  .tn-right { grid-column: 2; }
  .tn-tabs {
    grid-column: 1 / -1;
    padding-top: 4px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .tn-topbar--share { grid-template-columns: 1fr auto; }
  .tn-topbar--share .tn-tabs { grid-column: 1 / -1; }
  .tn-sub { display: none; }
}

/* Minimal topbar (pre-login: PIN + User-Select screens) — brand left-aligned like other apps */
.tn-topbar--minimal {
  grid-template-columns: 1fr;
  justify-items: start;
  padding: 20px 24px 16px;
  background: transparent;
  border-bottom: none;
}
.tn-topbar--minimal .tn-brand { pointer-events: none; }
.tn-topbar--minimal .tn-wm { font-size: 20px; }
.tn-topbar--minimal .tn-sub { padding-left: 12px; }

/* ================================================================
 * PIN + User-Select screens — Tamiko polish
 * ================================================================ */

.pin-screen, .user-select-screen {
  padding-top: 8px !important;
  gap: 24px !important;
  position: relative;
}

/* Shifu brand block above the face grid */
.user-select-brand {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-bottom: 4px;
}
.user-select-panda {
  font-size: 64px; line-height: 1;
  filter: grayscale(1) contrast(1.2);
}
.user-select-wordmark {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 34px; letter-spacing: 8px; font-weight: 400;
  color: var(--text);
}

/* Shown on the public domain when no share link was used */
.user-select-hint {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13.5px; line-height: 1.6;
  color: var(--text-light);
  text-align: center;
  max-width: 320px;
  margin: -8px auto 0;
}

/* Back button on the PIN screen */
.pin-back {
  position: absolute; top: 12px; left: 12px;
  background: transparent;
  border: 1px solid rgba(24, 25, 27, 0.10);
  color: var(--text-light);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.10em; text-transform: uppercase;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.pin-back:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
@media (prefers-color-scheme: dark) {
  .pin-back { border-color: rgba(237, 237, 238, 0.14); }
}

/* The face of whoever is logging in, shown above the PIN dots */
.pin-face {
  font-size: 72px; line-height: 1;
  margin-bottom: 2px;
}

/* Hand-off card after creating a kid — shows the generated PIN big */
.newkid-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(20, 21, 22, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.newkid-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 28px 32px 22px;
  text-align: center;
  max-width: 360px; width: 100%;
  font-family: 'IBM Plex Sans', sans-serif;
}
.newkid-avatar { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.newkid-name {
  font-size: 17px; font-weight: 600; color: var(--text);
  margin-bottom: 18px;
}
.newkid-pin-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-light);
}
.newkid-pin {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 46px; font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--primary);
  margin: 2px 0 16px;
  user-select: all;
}
.newkid-url {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px; color: var(--text);
  background: rgba(24, 25, 27, 0.05);
  padding: 8px 10px; border-radius: 6px;
  word-break: break-all;
  user-select: all;
  margin-bottom: 10px;
}
.newkid-hint {
  font-size: 12.5px; color: var(--text-light);
  line-height: 1.45; margin-bottom: 18px;
}
.newkid-actions {
  display: flex; gap: 10px; justify-content: center;
}
.newkid-close, .newkid-copy {
  border-radius: 8px;
  padding: 10px 18px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.newkid-close { background: var(--primary); color: #fff; border: none; }
.newkid-copy {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(24, 25, 27, 0.20);
}
.newkid-copy:hover { border-color: var(--primary); color: var(--primary); }
@media (prefers-color-scheme: dark) {
  .newkid-copy { border-color: rgba(237, 237, 238, 0.22); }
}
@media (prefers-color-scheme: dark) {
  .newkid-url { background: rgba(237, 237, 238, 0.08); }
}

/* Adult tile in the face grid — visually distinct from the kid tiles */
.user-card--adult {
  border-style: dashed !important;
  border-color: rgba(24, 25, 27, 0.22) !important;
  background: transparent !important;
  box-shadow: none !important;
}
.user-card--adult:hover, .user-card--adult:active {
  border-style: solid !important;
  border-color: var(--primary) !important;
  background: var(--card) !important;
}
.user-card--adult .user-avatar { filter: grayscale(1); opacity: 0.75; }
@media (prefers-color-scheme: dark) {
  .user-card--adult { border-color: rgba(237, 237, 238, 0.22) !important; }
}
.pin-title, .user-select-title {
  font-family: 'IBM Plex Sans', sans-serif !important;
  font-size: 26px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
  color: var(--text) !important;
  text-shadow: none !important;
}
.pin-subtitle {
  font-family: 'IBM Plex Sans', sans-serif !important;
  color: var(--text-light) !important;
  font-size: 14px !important;
  letter-spacing: 0.01em !important;
}
.pin-dot {
  border-color: rgba(24, 25, 27, 0.24) !important;
}
.pin-dot.filled {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(58, 92, 138, 0.14) !important;
}
.pin-btn {
  background: var(--card) !important;
  border: 1px solid rgba(24, 25, 27, 0.10) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
  font-family: 'IBM Plex Mono', ui-monospace, monospace !important;
  font-weight: 500 !important;
  font-feature-settings: "tnum" 1, "lnum" 1 !important;
  transition: border-color 140ms, background 140ms !important;
}
.pin-btn:hover {
  border-color: var(--primary) !important;
}
.pin-btn:active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}
.pin-btn.backspace {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--text-light) !important;
}

.user-card {
  background: var(--card) !important;
  border: 1px solid rgba(24, 25, 27, 0.10) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
  padding: 24px 28px !important;
  transition: border-color 160ms, transform 160ms, box-shadow 160ms !important;
  min-width: 170px !important;
}
.user-card:hover, .user-card:active {
  border-color: var(--primary) !important;
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-lg) !important;
}
.user-card > div,
.user-card [class*="avatar"],
.user-card [class*="emoji"] {
  filter: none !important; /* keep the 3D emoji colorful */
}
@media (prefers-color-scheme: dark) {
  .pin-btn { border-color: rgba(237, 237, 238, 0.12) !important; }
  .pin-dot { border-color: rgba(237, 237, 238, 0.30) !important; }
  .user-card { border-color: rgba(237, 237, 238, 0.12) !important; }
}
