/* =====================================================================
   QWIZOS - 5-THEME WARM PASTEL DESIGN SYSTEM (Zero CSS Frameworks)
   ===================================================================== */
:root,
[data-theme="cream"] {
  --bg-page: #FAF8F5;
  --bg-ambient:
    radial-gradient(circle at 12% 14%, rgba(235, 232, 245, 0.72) 0%, transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(229, 243, 236, 0.75) 0%, transparent 44%),
    radial-gradient(circle at 85% 12%, rgba(250, 236, 230, 0.52) 0%, transparent 32%);
  --surface: rgba(255, 255, 255, 0.90);
  --surface-solid: #FFFFFF;
  --surface-subtle: #F4F1EB;

  --ink: #353A45;
  --ink-word: #353A45;
  --ink-muted: #767D8C;
  --ink-placeholder: #A7AEBA;

  --accent: #7FA99B;
  --accent-hover: #6D9789;
  --accent-soft: #E8F4EE;
  --accent-soft-text: #2A614B;

  --accent-2: #9B8EC4;
  --accent-2-soft: #F1EEF8;
  --accent-2-text: #4F4478;

  --accent-3: #E6A899;
  --accent-3-soft: #FCEEE8;
  --accent-3-text: #8A4538;

  --cta-bg: #7FA99B;
  --cta-hover: #6D9789;
  --cta-text: #FFFFFF;

  --border: rgba(53, 58, 69, 0.11);
  --border-strong: rgba(53, 58, 69, 0.19);
  --border-dashed: rgba(53, 58, 69, 0.16);

  --veil-bg: rgba(250, 248, 245, 0.54);
  --veil-border: rgba(255, 255, 255, 0.82);
  --veil-shadow: 0 3px 14px rgba(53, 58, 69, 0.06);

  --correct-text: #2C664F;
  --error-border: rgba(217, 130, 118, 0.85);
  --error-ring: rgba(252, 234, 230, 0.9);

  --key-bg: #FFFFFF;
  --key-bg-accent: #F4F1EC;
  --key-border: rgba(53, 58, 69, 0.12);
  --key-shadow: 0 1px 0 rgba(53, 58, 69, 0.10);

  --shadow-sm: 0 2px 10px rgba(53, 58, 69, 0.045);
  --shadow-md: 0 10px 28px rgba(53, 58, 69, 0.08);
  --shadow-tile: 0 8px 24px rgba(45, 49, 66, 0.055);
  --shadow-tile-hover: 0 14px 34px rgba(45, 49, 66, 0.10);
}

[data-theme="blossom"],
[data-theme="stone"] {
  --bg-page: #FBF7FA;
  --bg-ambient:
    radial-gradient(circle at 14% 14%, rgba(247, 228, 240, 0.78) 0%, transparent 44%),
    radial-gradient(circle at 86% 84%, rgba(235, 229, 249, 0.74) 0%, transparent 45%),
    radial-gradient(circle at 84% 14%, rgba(252, 236, 234, 0.56) 0%, transparent 34%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #FFFFFF;
  --surface-subtle: #F5EDF3;

  --ink: #38323F;
  --ink-word: #38323F;
  --ink-muted: #7C7185;
  --ink-placeholder: #ADA2B5;

  --accent: #B57BA6;
  --accent-hover: #9F6690;
  --accent-soft: #F5EBF3;
  --accent-soft-text: #6E3E62;

  --accent-2: #8E86C6;
  --accent-2-soft: #EFEDF9;
  --accent-2-text: #4B437D;

  --accent-3: #E0988A;
  --accent-3-soft: #FBEFEA;
  --accent-3-text: #8A4538;

  --cta-bg: #B57BA6;
  --cta-hover: #9F6690;
  --cta-text: #FFFFFF;

  --border: rgba(56, 50, 63, 0.11);
  --border-strong: rgba(56, 50, 63, 0.20);
  --border-dashed: rgba(110, 62, 98, 0.22);

  --veil-bg: rgba(251, 247, 250, 0.58);
  --veil-border: rgba(255, 255, 255, 0.86);
  --veil-shadow: 0 3px 14px rgba(56, 50, 63, 0.06);

  --correct-text: #2C664F;
  --error-border: rgba(214, 118, 114, 0.85);
  --error-ring: rgba(252, 232, 230, 0.94);

  --key-bg: #FFFFFF;
  --key-bg-accent: #F4ECF2;
  --key-border: rgba(56, 50, 63, 0.12);
  --key-shadow: 0 1px 0 rgba(56, 50, 63, 0.10);

  --shadow-sm: 0 2px 10px rgba(56, 50, 63, 0.05);
  --shadow-md: 0 10px 28px rgba(56, 50, 63, 0.09);
  --shadow-tile: 0 8px 24px rgba(56, 42, 66, 0.058);
  --shadow-tile-hover: 0 14px 34px rgba(56, 42, 66, 0.105);
}

[data-theme="terracotta"],
[data-theme="paper"] {
  --bg-page: #FAF6F3;
  --bg-ambient:
    radial-gradient(circle at 14% 14%, rgba(250, 232, 224, 0.78) 0%, transparent 44%),
    radial-gradient(circle at 86% 84%, rgba(246, 238, 224, 0.74) 0%, transparent 45%),
    radial-gradient(circle at 84% 14%, rgba(238, 235, 247, 0.48) 0%, transparent 34%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #FFFFFF;
  --surface-subtle: #F4ECE7;

  --ink: #383331;
  --ink-word: #383331;
  --ink-muted: #7C726D;
  --ink-placeholder: #AEA39D;

  --accent: #C45642;
  --accent-hover: #AD4634;
  --accent-soft: #F9EAE6;
  --accent-soft-text: #7D2E20;

  --accent-2: #6B82A6;
  --accent-2-soft: #EBF0F7;
  --accent-2-text: #394F70;

  --accent-3: #D49A58;
  --accent-3-soft: #FBF2E6;
  --accent-3-text: #80541F;

  --cta-bg: #C45642;
  --cta-hover: #AD4634;
  --cta-text: #FFFFFF;

  --border: rgba(56, 51, 49, 0.11);
  --border-strong: rgba(56, 51, 49, 0.21);
  --border-dashed: rgba(125, 46, 32, 0.21);

  --veil-bg: rgba(250, 246, 243, 0.58);
  --veil-border: rgba(255, 255, 255, 0.86);
  --veil-shadow: 0 3px 14px rgba(56, 51, 49, 0.06);

  --correct-text: #2C664F;
  --error-border: rgba(196, 86, 66, 0.85);
  --error-ring: rgba(249, 234, 230, 0.95);

  --key-bg: #FFFFFF;
  --key-bg-accent: #F4ECE7;
  --key-border: rgba(56, 51, 49, 0.13);
  --key-shadow: 0 1px 0 rgba(56, 51, 49, 0.11);

  --shadow-sm: 0 2px 10px rgba(56, 51, 49, 0.05);
  --shadow-md: 0 10px 28px rgba(56, 51, 49, 0.09);
  --shadow-tile: 0 8px 24px rgba(56, 40, 34, 0.058);
  --shadow-tile-hover: 0 14px 34px rgba(56, 40, 34, 0.105);
}

[data-theme="misty"] {
  --bg-page: #F2F5F9;
  --bg-ambient:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.72) 0%, transparent 45%),
    radial-gradient(circle at 86% 84%, rgba(216, 230, 244, 0.75) 0%, transparent 46%);
  --surface: rgba(255, 255, 255, 0.90);
  --surface-solid: #FFFFFF;
  --surface-subtle: #E6EEF7;

  --ink: #2E3746;
  --ink-word: #353A45;
  --ink-muted: #677487;
  --ink-placeholder: #9EABB9;

  --accent: #6890B8;
  --accent-hover: #567EA6;
  --accent-soft: #E2EEF9;
  --accent-soft-text: #2C5073;

  --accent-2: #8286BC;
  --accent-2-soft: #ECEEF9;
  --accent-2-text: #44487C;

  --accent-3: #DA958C;
  --accent-3-soft: #FAECEB;
  --accent-3-text: #85433B;

  --cta-bg: #6890B8;
  --cta-hover: #567EA6;
  --cta-text: #FFFFFF;

  --border: rgba(46, 55, 70, 0.11);
  --border-strong: rgba(46, 55, 70, 0.20);
  --border-dashed: rgba(54, 75, 99, 0.18);

  --veil-bg: rgba(242, 245, 249, 0.56);
  --veil-border: rgba(255, 255, 255, 0.84);
  --veil-shadow: 0 3px 12px rgba(46, 55, 70, 0.06);

  --correct-text: #2A6450;
  --error-border: rgba(209, 122, 118, 0.85);
  --error-ring: rgba(246, 232, 232, 0.95);

  --key-bg: #FFFFFF;
  --key-bg-accent: #E6EFF7;
  --key-border: rgba(46, 55, 70, 0.12);
  --key-shadow: 0 1px 0 rgba(46, 55, 70, 0.10);

  --shadow-sm: 0 2px 10px rgba(46, 55, 70, 0.05);
  --shadow-md: 0 10px 28px rgba(46, 55, 70, 0.09);
  --shadow-tile: 0 8px 22px rgba(37, 49, 66, 0.06);
  --shadow-tile-hover: 0 14px 32px rgba(37, 49, 66, 0.11);
}

[data-theme="dark"] {
  --bg-page: #181B21;
  --bg-ambient:
    radial-gradient(circle at 14% 14%, rgba(56, 68, 84, 0.28) 0%, transparent 45%),
    radial-gradient(circle at 86% 84%, rgba(62, 84, 78, 0.22) 0%, transparent 45%);
  --surface: #22262F;
  --surface-solid: #242933;
  --surface-subtle: #2C313D;

  --ink: #E6EAF0;
  --ink-word: #DFE4ED;
  --ink-muted: #98A0B0;
  --ink-placeholder: #6A7284;

  --accent: #7FB3A1;
  --accent-hover: #90C2B1;
  --accent-soft: rgba(127, 179, 161, 0.19);
  --accent-soft-text: #B2E0D0;

  --accent-2: #A99CD4;
  --accent-2-soft: rgba(169, 156, 212, 0.20);
  --accent-2-text: #CFC6F0;

  --accent-3: #E6A395;
  --accent-3-soft: rgba(230, 163, 149, 0.19);
  --accent-3-text: #F2C0B6;

  --cta-bg: #7FB3A1;
  --cta-hover: #90C2B1;
  --cta-text: #161A1E;

  --border: rgba(230, 234, 240, 0.10);
  --border-strong: rgba(230, 234, 240, 0.19);
  --border-dashed: rgba(230, 234, 240, 0.17);

  --veil-bg: rgba(34, 38, 47, 0.58);
  --veil-border: rgba(230, 234, 240, 0.15);
  --veil-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);

  --correct-text: #9AD2BD;
  --error-border: rgba(224, 132, 122, 0.85);
  --error-ring: rgba(224, 132, 122, 0.22);

  --key-bg: #2A2F3A;
  --key-bg-accent: #222732;
  --key-border: rgba(230, 234, 240, 0.11);
  --key-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.42);
  --shadow-tile: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-tile-hover: 0 14px 34px rgba(0, 0, 0, 0.42);
}

/* =====================================================================
   2. BASE & ZERO HORIZONTAL SHIFT (scrollbar-gutter: stable)
   ===================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background-color: var(--bg-page);
  background-image: var(--bg-ambient);
  background-attachment: fixed;
  line-height: 1.48;
  transition: background-color 200ms ease, color 180ms ease;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.is-hidden { display: none !important; }

/* =====================================================================
   3. TOPBAR
   ===================================================================== */
.topbar {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.topbar-center { justify-self: center; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 12px;
  transition: opacity 150ms ease;
  white-space: nowrap;
}

.brand-btn:hover { opacity: 0.76; }

.brand-mini-emblem {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.brand-mini-emblem span {
  display: inline-block;
  border-radius: 3.5px;
}

.brand-mini-emblem span:nth-child(1) { width: 7px; height: 10px; background: var(--accent-soft); border: 1.4px solid var(--accent); }
.brand-mini-emblem span:nth-child(2) { width: 8px; height: 15px; background: var(--accent-2-soft); border: 1.4px solid var(--accent-2); }
.brand-mini-emblem span:nth-child(3) { width: 7px; height: 10px; background: var(--accent-3-soft); border: 1.4px solid var(--accent-3); }

.soft-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: all 140ms ease;
}

.soft-pill-btn:hover { color: var(--ink); border-color: var(--accent); }
.soft-pill-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-soft-text);
}

.theme-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease;
}

.theme-swatch:hover { transform: scale(1.13); }
.theme-swatch svg { width: 22px; height: 22px; display: block; overflow: visible; }
.theme-swatch .swatch-ring { opacity: 0; transition: opacity 140ms ease; }
.theme-swatch.active .swatch-ring { opacity: 1; }

.dropdown {
  position: relative;
  display: inline-flex;
}

.pill-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: all 140ms ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pill-trigger:hover { border-color: var(--accent); }
.dropdown.open .pill-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pill-trigger .chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-muted);
  transition: transform 150ms ease;
  flex-shrink: 0;
}

.dropdown.open .pill-trigger .chevron { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 156px;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 60;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity 130ms ease, transform 130ms ease;
}

.dropdown-menu.lang-dropdown-menu {
  min-width: 224px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lang-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.lang-search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--ink-muted);
  pointer-events: none;
}

.lang-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.lang-search-input::placeholder { color: var(--ink-placeholder); }
.lang-search-input:focus {
  border-color: var(--accent);
  background: var(--surface-solid);
}

/* Max 10 language items visible at once; scrollable via wheel, drag, or touch */
.lang-list-scroll {
  max-height: 382px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.lang-list-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
  flex-shrink: 0;
}

.lang-empty-msg {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.dropdown.menu-center .dropdown-menu {
  left: 50%;
  right: auto;
  min-width: 118px;
  transform: translate(-50%, -4px) scale(0.98);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown.open.menu-center .dropdown-menu {
  transform: translate(-50%, 0) scale(1);
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color 120ms ease;
}

.dropdown-item:hover { background: var(--surface-subtle); }
.dropdown-item.selected {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-weight: 700;
}

.dropdown-item-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.dropdown-item-code {
  font-size: 0.74rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.flag-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 15px;
  border-radius: 3.5px;
  overflow: hidden;
  flex-shrink: 0;
}

.flag-box svg,
.flag-box img {
  display: block;
  width: 22px;
  height: 15px;
  object-fit: cover;
}

.flag-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3.5px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  pointer-events: none;
}

/* Theme compact dropdown (shown automatically when 5-dot bar would collide) */
.theme-dropdown {
  display: none;
}

.topbar.is-theme-compact .theme-bar {
  display: none;
}

.topbar.is-theme-compact .theme-dropdown {
  display: inline-flex;
}

.topbar.is-theme-compact.is-theme-tight {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.topbar.is-theme-compact.is-theme-tight .topbar-center {
  justify-self: end;
}

.topbar.is-theme-compact.is-theme-tight .theme-dropdown.menu-center .dropdown-menu {
  left: auto;
  right: 0;
  transform: translateY(-4px) scale(0.98);
}

.topbar.is-theme-compact.is-theme-tight .theme-dropdown.open.menu-center .dropdown-menu {
  transform: translateY(0) scale(1);
}

.theme-pill-trigger {
  padding: 6px 10px;
  gap: 5px;
}

.theme-active-swatch,
.theme-menu-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.theme-active-swatch svg,
.theme-menu-swatch svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
}

.dropdown.menu-center .dropdown-menu.theme-dropdown-menu,
.dropdown-menu.theme-dropdown-menu {
  min-width: 0;
  width: auto;
  padding: 10px 5px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.theme-menu-opt-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 140ms ease;
}

.theme-menu-opt-btn:hover {
  transform: scale(1.13);
}

.theme-menu-opt-btn .swatch-ring {
  opacity: 0;
  transition: opacity 140ms ease;
}

.theme-menu-opt-btn.selected .swatch-ring {
  opacity: 1;
}

@media (max-width: 780px) {
  .topbar {
    padding: 12px 14px 6px;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 10px 10px 6px;
    gap: 6px;
  }
  .topbar-left { gap: 6px; }
  .topbar-right { gap: 6px; }
  .brand-btn { font-size: 0.98rem; gap: 7px; padding: 4px 4px; }
  .soft-pill-btn { padding: 6px 10px; font-size: 0.8rem; gap: 4px; }
  .pill-trigger { padding: 6px 10px; gap: 6px; font-size: 0.82rem; }
  .theme-pill-trigger { padding: 5px 8px; gap: 4px; }
}

/* =====================================================================
   4. MAIN WRAPPER
   ===================================================================== */
.main-wrap {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 6px 20px 18px;
  display: flex;
  flex-direction: column;
}

/* =====================================================================
   5. HOME HUB
   ===================================================================== */
.hub-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(8px, 1.8vh, 18px);
  padding-bottom: 16px;
}

.hub-desc-wrap {
  max-width: 580px;
  text-align: center;
  margin-bottom: 28px;
  padding: 0 12px;
}

.hub-desc {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink-muted);
  font-weight: 600;
  line-height: 1.6;
}

.hub-tag-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
  max-width: 720px;
}

.tag-filter-pill {
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 140ms ease;
}

.tag-filter-pill:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.tag-filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-soft-text);
}

.hub-grid {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}

.game-tile {
  width: 256px;
  height: 256px;
  aspect-ratio: 1 / 1;
  background: var(--surface-solid);
  border: 1.5px solid var(--border);
  border-radius: 28px;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-tile);
  transition: transform 170ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.game-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-tile-hover);
  border-color: var(--accent);
}

.game-tile:active { transform: translateY(-1px) scale(0.99); }

.tile-icon-wrap {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.tile-icon-wrap svg,
.tile-icon-wrap img {
  height: 44px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  border-radius: 8px;
}

.tile-title {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.tile-sub {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-weight: 600;
  line-height: 1.4;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
}

.tile-tag-mini {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

/* =====================================================================
   6. FLASHWORD INTRO SCREEN - OPTICALLY CENTERED (Matches Reference #6)
   ===================================================================== */
.game-intro-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 12px;
  padding-bottom: 8vh;
}

.game-emblem-slot {
  height: 52px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-emblem-slot svg,
.game-emblem-slot img {
  height: 48px;
  width: auto;
  max-width: 112px;
  object-fit: contain;
  border-radius: 8px;
}

.game-intro-title {
  margin: 0;
  font-size: clamp(2.25rem, 4.9vw, 2.95rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.game-intro-sub {
  margin: 9px 0 0;
  font-size: 1.02rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.setup-stack {
  margin-top: 30px;
  width: 100%;
  max-width: 370px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.diff-segmented {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.diff-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.diff-btn:hover { color: var(--ink); }
.diff-btn[data-diff="easy"].active { background: var(--accent-soft); color: var(--accent-soft-text); }
.diff-btn[data-diff="normal"].active { background: var(--accent-2-soft); color: var(--accent-2-text); }
.diff-btn[data-diff="hard"].active { background: var(--accent-3-soft); color: var(--accent-3-text); }

.pill-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill-row .dropdown { flex: 1; }
.pill-row .pill-trigger {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.95rem;
}

.pill-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--accent);
}

.cta-btn {
  margin-top: 28px;
  padding: 13px 48px;
  border: none;
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background-color 140ms ease, transform 110ms ease;
}

.cta-btn:hover { background: var(--cta-hover); transform: translateY(-1px); }
.cta-btn:active { transform: scale(0.98); }

/* =====================================================================
   7. FLASHWORD PLAY SCREEN - AIRY, NON-SHRINKING, STRICTLY DOWNWARD VK
   ===================================================================== */
.play-screen {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  padding: clamp(28px, 5.5vh, 56px) 0 28px;
}

.play-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 2px;
}

.progress-counter {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 160ms ease-out;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.time-pill svg { width: 13px; height: 13px; color: var(--accent); }

.icon-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
  flex-shrink: 0;
}

.icon-close-btn:hover { background: var(--surface-subtle); color: var(--ink); }

/* Safe-zone Stage: Generous height, strictly non-shrinking, NO focus dot */
.safe-zone {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: clamp(290px, 43vh, 390px);
  border: 1.5px dashed var(--border-dashed);
  border-radius: 26px;
  background: transparent;
  overflow: hidden;
  user-select: none;
}

.word-tile {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  visibility: hidden;
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity 100ms ease,
    transform 110ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
  max-width: calc(100% - 20px);
  overflow: hidden;
}

.word-tile.is-preparing {
  visibility: hidden !important;
  opacity: 0 !important;
  transition: none !important;
}

.word-tile.is-mounted {
  visibility: visible;
  opacity: 1;
  transform: scale(1);
}

.word-tile.is-blurred {
  background: var(--veil-bg);
  border-color: var(--veil-border);
  box-shadow: var(--veil-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.word-text {
  display: inline-flex;
  align-items: baseline;
  line-height: 1.24;
  white-space: nowrap;
  letter-spacing: 0.01em;
  color: var(--ink-word);
  filter: blur(0px);
  opacity: 1;
  transition: filter 150ms ease, opacity 150ms ease, transform 140ms ease;
  will-change: filter, opacity;
}

.word-tile.is-blurred .word-text {
  filter: blur(var(--word-blur, 6.5px));
  opacity: 0.72;
}

.word-tile.is-correct .word-text { transform: scale(1.03); }
.word-tile.is-correct .word-text,
.word-tile.is-correct .word-text span { color: var(--correct-text) !important; }

/* Input Pill & Circular Action Icons (Reference #3) */
.controls-stack {
  flex-shrink: 0;
  width: 100%;
  max-width: 480px;
  margin: 4px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.input-shell {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.word-input {
  width: 100%;
  height: 52px;
  padding: 0 58px 0 24px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1.5px solid var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  outline: none;
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.word-input::placeholder { color: var(--ink-placeholder); font-weight: 500; }
.word-input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.word-input:disabled { opacity: 0.88; }

@keyframes quickShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.word-input.shake-input {
  animation: quickShake 220ms ease;
  border-color: var(--error-border) !important;
  box-shadow: 0 0 0 3px var(--error-ring) !important;
}

.submit-icon-btn {
  position: absolute;
  right: 6px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease, transform 100ms ease;
}

[data-theme="dark"] .submit-icon-btn { color: #161A1E; }
.submit-icon-btn:hover { background: var(--accent-hover); }
.submit-icon-btn:active { transform: scale(0.94); }

.action-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.action-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 140ms ease;
}

.action-icon-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.action-icon-btn:active { transform: scale(0.94); }

/* FIXED-HEIGHT RESERVED FEEDBACK SLOT - LARGER READABLE EXPLANATION */
.game-feedback-slot {
  flex-shrink: 0;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  height: 92px;
  min-height: 92px;
  max-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dict-pill {
  max-width: 100%;
  max-height: 88px;
  overflow-y: auto;
  padding: 10px 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.98rem;
  line-height: 1.44;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 10px;
  text-align: center;
  opacity: 0;
  transform: translateY(3px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.dict-pill.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dict-pill.is-error {
  background: var(--accent-3-soft);
  border-color: var(--error-border);
  color: var(--accent-3-text);
  font-weight: 700;
}

.dict-word { font-size: 1.04rem; font-weight: 800; color: var(--ink); }
.dict-pos {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Collapsible Digital Keyboard Bar (Reference #4, strictly downward) */
.vk-wrap {
  flex-shrink: 0;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 22px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-radius 160ms ease;
}

.vk-wrap.collapsed { border-radius: 999px; }

.vk-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 12px;
}

.vk-toggle-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.vk-toggle-bar:hover { color: var(--ink); background: var(--surface-subtle); }
.vk-toggle-left { display: inline-flex; align-items: center; gap: 9px; }
.vk-toggle-bar svg { width: 16px; height: 16px; }
.vk-chevron { transition: transform 180ms ease; }
.vk-wrap:not(.collapsed) .vk-chevron { transform: rotate(180deg); }

.vk-mode-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-left: 8px;
}

.vk-wrap.collapsed .vk-mode-pills { display: none; }

.vk-mode-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.vk-mode-btn.active {
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

.vk-body {
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--border);
}

.vk-wrap.collapsed .vk-body { display: none; }
.vk-row { display: flex; justify-content: center; gap: 4px; width: 100%; }

.vk-key {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 2px;
  border-radius: 9px;
  border: 1px solid var(--key-border);
  background: var(--key-bg);
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
  box-shadow: var(--key-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background-color 90ms ease, transform 70ms ease;
}

.vk-key:hover { background: var(--surface-subtle); }
.vk-key:active, .vk-key.is-pressed {
  transform: translateY(1px) scale(0.95);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

.vk-key.is-num-key,
.vk-key.is-accent-key {
  height: 33px;
  font-size: 0.86rem;
  background: var(--key-bg-accent);
}

.vk-key.is-action { flex: 1.5; background: var(--key-bg-accent); }
.vk-key.is-submit {
  flex: 1.6;
  background: var(--accent);
  border-color: transparent;
  color: #FFFFFF;
}

[data-theme="dark"] .vk-key.is-submit { color: #161A1E; }

.vk-ime-note {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
}

/* =====================================================================
   8. SUMMARY & CUSTOM MODULE PREVIEW
   ===================================================================== */
.summary-screen,
.custom-module-screen {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 36px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.summary-title { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.025em; }
.stats-grid {
  width: 100%;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px 10px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.stat-card.s-easy { background: var(--accent-soft); }
.stat-card.s-norm { background: var(--accent-2-soft); }
.stat-card.s-hard { background: var(--accent-3-soft); }

.stat-val { font-size: 1.45rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 0.78rem; font-weight: 700; color: var(--ink-muted); }

.missed-wrap { width: 100%; margin-top: 18px; text-align: left; }
.missed-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.missed-row {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.summary-actions { margin-top: 26px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.summary-actions .cta-btn { margin-top: 0; padding: 12px 34px; }

/* =====================================================================
   9. LIVE PASTEL 5-TAB ADMIN PANEL
   ===================================================================== */
.admin-screen {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 8px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.admin-top-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

.status-pill.is-draft {
  background: var(--accent-3-soft);
  color: var(--accent-3-text);
}

.admin-tabs-wrap { display: flex; justify-content: center; }

.admin-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.admin-tab {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.87rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 140ms ease;
}

.admin-tab:hover { color: var(--ink); }
.admin-tab.active { background: var(--accent-soft); color: var(--accent-soft-text); }

.admin-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-head h2 { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.admin-sub { margin: 3px 0 0; font-size: 0.85rem; color: var(--ink-muted); font-weight: 600; }

.a-section {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.a-section h3 { margin: 0; font-size: 0.96rem; font-weight: 800; color: var(--ink); }

.a-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.a-grid-2.align-end { align-items: end; }
.a-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* Horizontally scrollable compact TAG row sized for 20+ languages */
.tag-trans-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.tag-trans-cell {
  flex: 0 0 120px;
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.tag-trans-cell .a-input {
  padding: 6px 8px;
  font-size: 0.82rem;
}

.a-subcard {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a-subcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.a-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-muted);
  min-width: 0;
}

.a-field-lbl {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a-check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.a-check-row input { margin-top: 3px; flex-shrink: 0; }
.a-check-note { display: block; font-size: 0.76rem; font-weight: 600; color: var(--ink-muted); margin-top: 2px; }

.a-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.a-input, .a-select, .a-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 600;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.a-kv .a-input { width: 104px; text-align: right; padding: 6px 9px; }
.a-select { border-radius: 999px; cursor: pointer; }
.a-input:focus, .a-select:focus, .a-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 140ms ease;
}

.a-btn:hover { border-color: var(--accent); background: var(--surface-subtle); }
.a-btn.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
[data-theme="dark"] .a-btn.primary { color: #161A1E; }
.a-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.a-btn.danger-icon {
  padding: 5px 10px;
  border-color: transparent;
  background: var(--accent-3-soft);
  color: var(--accent-3-text);
  font-size: 0.8rem;
}

.a-btn.danger-icon.confirming {
  background: #C85A4B;
  color: #FFFFFF;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-box {
  width: 46px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.preview-box img, .preview-box svg {
  max-width: 36px;
  max-height: 28px;
  object-fit: contain;
}

.path-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--ink-muted);
  background: var(--surface-solid);
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.inline-add-panel {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.dict-add-bar {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 2fr 0.72fr auto;
  gap: 8px;
  background: var(--surface-subtle);
  border: 1.5px dashed var(--border-dashed);
  padding: 11px;
  border-radius: 16px;
  align-items: center;
}

.table-frame {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
}

td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-flash td { animation: rowHighlight 1.2s ease; }

@keyframes rowHighlight {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}

.cell-inp {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  outline: none;
}

.cell-inp:hover { background: var(--surface-subtle); }
.cell-inp:focus { background: var(--surface-solid); border-color: var(--accent); }

.game-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.game-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
}

.game-chip svg, .game-chip img { height: 18px; width: auto; max-width: 34px; object-fit: contain; }
.game-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-text); }

.font-grid, .tag-toggle-grid { display: flex; flex-wrap: wrap; gap: 7px; }

.font-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  font-size: 0.81rem;
  font-weight: 600;
}

.font-pill label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.font-del-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 50%;
  line-height: 1;
}

.font-del-btn:hover { background: var(--accent-3-soft); color: var(--accent-3-text); }

.tag-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink-muted);
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
}

.tag-toggle-pill.active {
  background: var(--accent-2-soft);
  border-color: var(--accent-2);
  color: var(--accent-2-text);
}

.math-grid-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}

.math-grid-row input {
  text-align: center;
  padding: 6px 4px;
  font-weight: 700;
}

/* =====================================================================
   10. FOOTER DONATION PILL, MODAL & TOAST
   ===================================================================== */
.donation-footer {
  width: 100%;
  padding: 10px 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donation-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 150ms ease;
}

.donation-pill svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }
.donation-pill:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 27, 33, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 120;
}

.modal-box {
  width: 100%;
  max-width: 390px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-box h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.modal-box p { margin: -6px 0 0; font-size: 0.84rem; color: var(--ink-muted); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--ink);
  color: var(--bg-page);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 130;
}

.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 820px) {
  .a-grid-2, .a-grid-3, .dict-add-bar { grid-template-columns: 1fr; }
  .math-grid-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .admin-card { padding: 16px; }
  .game-tile { width: calc(50% - 11px); min-width: 156px; height: auto; aspect-ratio: 1 / 1; padding: 14px 12px 12px; }
}

@media (max-width: 480px) {
  .main-wrap { padding: 6px 12px 12px; }
  .safe-zone { height: clamp(240px, 38vh, 320px); }
  .vk-key { height: 35px; font-size: 0.84rem; border-radius: 7px; }
  .vk-key.is-num-key, .vk-key.is-accent-key { height: 30px; font-size: 0.78rem; }
  .vk-row { gap: 3px; }
}

/* =====================================================================
   11. DYNAMIC GAME HOST & COLLAPSIBLE ADMIN SECTIONS (v2)
   ===================================================================== */
.game-host-screen {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.a-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.a-collapse-trigger {
  flex: 1;
  min-width: 200px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.a-collapse-trigger:hover { opacity: 0.82; }

.a-collapse-chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.a-section.is-open .a-collapse-chevron {
  transform: rotate(180deg);
}

.a-collapsible-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.a-section:not(.is-open) .a-collapsible-body {
  display: none;
}

/* =====================================================================
   12. ADMIN DIRECT FOLDER SAVE STATUS & HINT (v3)
   ===================================================================== */
.admin-fs-hint {
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--accent-2-soft);
  border: 1px solid var(--border);
  color: var(--accent-2-text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.admin-fs-hint code {
  background: var(--surface-solid);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.status-pill.is-warn {
  background: var(--accent-3-soft);
  color: var(--accent-3-text);
}

.status-pill.is-info {
  background: var(--accent-2-soft);
  color: var(--accent-2-text);
}


/* =====================================================================
   13. PLATFORM MODE, TILE MEDALS, 3-COLUMN FOOTER & ROUND SUPPORT (v6)
   ===================================================================== */
html.is-app-mode .web-only {
  display: none !important;
}

.tile-top-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 0;
}

.tile-progress-bar {
  width: 100%;
  flex-shrink: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-play-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tile-play-count svg {
  width: 11px;
  height: 11px;
  color: var(--accent);
}

.tile-medals-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tile-medal {
  width: 24px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease;
}

.tile-medal svg,
.tile-medal img {
  width: 22px;
  height: 25px;
  object-fit: contain;
  display: block;
}

.tile-medal.is-tier-none {
  opacity: 0.85;
}

/* 3-zone Footer Layout: Legal & Copyright | Support Pill | Store Icons */
.footer-inner {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 18px;
}

.footer-left {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  justify-self: stretch;
}

.footer-legal-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
  opacity: 0.65;
  transition: opacity 150ms ease;
}

.footer-legal-links:hover {
  opacity: 1;
}

.footer-legal-link {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.footer-legal-link:hover {
  color: var(--accent);
}

.footer-legal-sep {
  opacity: 0.55;
}

.footer-copyright {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  opacity: 0.68;
  white-space: nowrap;
  justify-self: center;
  text-align: center;
}

.footer-center {
  justify-self: center;
}

.footer-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
}

.footer-stores {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.store-icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 150ms ease;
}

.store-icon-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.store-icon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
}

.store-icon-slot svg,
.store-icon-slot img {
  width: 19px;
  height: 19px;
  object-fit: contain;
  display: block;
}

.store-admin-row {
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Round Summary Medal & End-of-Round Support Notice (5th-round Accent Highlight) */
.summary-medal-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.summary-medal-slot:empty {
  display: none;
}

.summary-medal-icon svg,
.summary-medal-icon img {
  width: 24px;
  height: 27px;
  display: block;
  object-fit: contain;
}

.summary-medal-label {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--ink);
}

.round-support-card {
  width: 100%;
  margin-top: 18px;
  padding: 11px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 160ms ease;
}

.round-support-card:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.round-support-card.is-highlighted {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  color: var(--accent-soft-text);
}

.round-support-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
}

.round-support-icon svg {
  width: 18px;
  height: 18px;
}

.round-support-card.is-highlighted .round-support-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--cta-text);
}

@media (max-width: 780px) {
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 10px;
  }
  .footer-left {
    order: 2;
    width: auto;
    display: flex;
    flex-wrap: wrap;
    justify-self: center;
    justify-content: center;
    gap: 12px;
  }
  .footer-center {
    order: 1;
  }
  .footer-right {
    order: 3;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  .footer-stores {
    justify-content: center;
  }
  .round-support-card {
    flex-direction: column;
    text-align: center;
  }
}


/* =====================================================================
   14. PATCH 1 (v1.8.1) -- PILL STORE BADGE & COMPACT ADMIN LANG TABLES
   ===================================================================== */
.store-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 15px 6px 12px;
  min-height: 38px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.store-badge-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-solid);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.store-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.store-badge-icon svg,
.store-badge-icon img {
  width: 19px;
  height: 19px;
  object-fit: contain;
  display: block;
}

.store-badge-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  text-align: left;
}

.store-badge-sub {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 160ms ease;
}

.store-badge-main {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: inherit;
}

.store-badge-pill:hover .store-badge-sub {
  color: var(--accent);
}

/* Compact Admin multilingual tables (like Common Dictionary) */
.lang-table-scroll {
  max-height: 460px;
  overflow-y: auto;
}

.lang-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-solid);
  box-shadow: inset 0 -1px 0 var(--border);
}

.lang-cell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.84rem;
  white-space: nowrap;
}

.lang-cell-short {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-muted);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
}

/* Prevent double box framing when module renderAdminRules mounts inside collapsible section */
.module-rules-inner > .a-section {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}


/* =====================================================================
   15. PATCH 2 (v1.8.2) -- CONDITIONAL DIFF HINT, SAMPLES & H-SCROLL LANG TABLE
   ===================================================================== */
.diff-hint-bar {
  max-width: 390px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.fn-sample-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.fn-sample-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink);
}

.fn-sample-chip.is-easy   { background: var(--accent-soft);   border-color: var(--accent);   color: var(--accent-soft-text); }
.fn-sample-chip.is-normal { background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--ink); }
.fn-sample-chip.is-hard   { background: var(--accent-3-soft); border-color: var(--accent-3); color: var(--ink); }

/* Tab 2 Horizontally Scrollable Language Matrix Table */
.langs-matrix-scroll {
  max-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
}

.langs-matrix-scroll table {
  min-width: 2950px;
  border-collapse: separate;
  border-spacing: 0;
}

.langs-matrix-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-solid);
  box-shadow: inset 0 -1px 0 var(--border);
  white-space: nowrap;
}

.langs-matrix-scroll .col-sticky-num {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-solid);
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.langs-matrix-scroll .col-sticky-lang {
  position: sticky;
  left: 42px;
  z-index: 2;
  background: var(--surface-solid);
  min-width: 205px;
  box-shadow: inset -1px 0 0 var(--border);
}

.langs-matrix-scroll thead .col-sticky-num,
.langs-matrix-scroll thead .col-sticky-lang {
  z-index: 5;
}

.langs-matrix-scroll tbody tr:hover td {
  background: var(--surface-subtle);
}

.langs-matrix-scroll .cell-inp {
  min-width: 112px;
}

.langs-matrix-scroll .cell-inp.is-narrow {
  min-width: 72px;
  width: 72px;
}

.langs-matrix-scroll .cell-inp.is-wide {
  min-width: 175px;
}

.kb-editor-panel {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-subtle);
  border: 1.5px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* =====================================================================
   16. UPDATE 9 (v1.9.0) -- FLOWWORD & CLUEWORD MODULE UI STYLES
   ===================================================================== */
.time-pill.is-urgent {
  background: var(--accent-3-soft);
  border-color: var(--accent-3);
  color: var(--danger);
}

/* FlowWord */
.fw-target-bar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.fw-find-label {
  justify-self: end;
  text-align: right;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.fw-target-word {
  justify-self: center;
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--accent-soft-text);
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  padding: 4px 16px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  text-align: center;
}

.fw-target-dots {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
}

@media (max-width: 520px) {
  .fw-target-bar {
    gap: 8px;
    padding: 10px 12px;
  }
  .fw-find-label {
    font-size: 0.78rem;
  }
  .fw-target-word {
    font-size: 1.12rem;
    padding: 4px 12px;
  }
}

.fw-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.8px solid var(--accent);
  background: transparent;
  transition: background 180ms ease, transform 180ms ease;
}

.fw-dot.is-hit {
  background: var(--accent);
  transform: scale(1.15);
}

.fw-stream-box {
  width: 100%;
  min-height: 180px;
  padding: 22px 24px;
  border-radius: 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  line-height: 1.85;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  user-select: none;
  -webkit-user-select: none;
}

.fw-word-token {
  display: inline;
  cursor: pointer;
  border-radius: 10px;
  padding: 2px 0;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.fw-word-token.has-sep {
  padding: 2px 4px;
}

.fw-word-token:hover {
  background: var(--surface-subtle);
}

.fw-word-token.is-found {
  background: var(--accent-soft);
  color: var(--accent-soft-text) !important;
  box-shadow: 0 0 0 2px var(--accent);
  padding: 2px 6px;
  margin: 0 2px;
  cursor: default;
}

.fw-word-token.is-found > span {
  color: var(--accent-soft-text) !important;
}

.fw-word-token.is-revealed {
  background: var(--accent-2-soft);
  color: var(--ink) !important;
  box-shadow: 0 0 0 2px var(--accent-2);
  padding: 2px 6px;
  margin: 0 2px;
  cursor: default;
}

.fw-word-token.is-wrong {
  background: var(--accent-3-soft);
  box-shadow: 0 0 0 2px var(--accent-3);
  padding: 2px 4px;
}

.fw-sep {
  color: var(--ink-muted);
  pointer-events: none;
}

.fw-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
}

.fw-next-btn {
  margin-top: 0 !important;
  padding: 10px 24px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ClueWord */
.cw-stage-card {
  width: 100%;
  padding: 24px 22px;
  border-radius: 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.cw-pos-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--accent-2-soft);
  border: 1px solid var(--accent-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cw-meaning-text {
  margin: 0;
  max-width: 520px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink);
}

.cw-slots-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.cw-slot {
  min-width: 40px;
  height: 46px;
  padding: 0 8px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.32rem;
  font-weight: 800;
  border: 1.8px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink-muted);
  transition: all 180ms ease;
}

.cw-slot.is-locked {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-soft-text);
  box-shadow: var(--shadow-sm);
}

.cw-slot.is-draft {
  background: var(--surface-subtle);
  border-color: var(--accent-2);
  color: var(--ink);
}

.cw-slot.is-wrong {
  background: var(--accent-3-soft);
  border-color: var(--accent-3);
  color: var(--danger);
  animation: shake 280ms ease;
}

.cw-slot.is-sep {
  min-width: 18px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-muted);
}

@media (max-width: 600px) {
  .fw-stream-box { padding: 16px 14px; line-height: 1.95; }
  .cw-stage-card { padding: 18px 14px; }
  .cw-slot { min-width: 32px; height: 39px; font-size: 1.1rem; border-radius: 10px; }
}


/* =====================================================================
   17. UPDATE 10 (v1.10.0) -- HAMBURGER MENU & DASHED-FRAME INFO SCREEN
   ===================================================================== */
.menu-pill-trigger {
  padding: 7px 10px;
  gap: 0;
}

.dropdown-menu.menu-dropdown-panel {
  min-width: 176px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

.menu-donation-item {
  text-decoration: none;
  color: var(--accent-soft-text);
  font-weight: 700;
}

.menu-donation-item:hover {
  background: var(--accent-soft);
}

.menu-item-icon-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.menu-item-icon-row svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.info-screen {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 14px auto 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.info-dashed-box {
  width: 100%;
  height: clamp(360px, calc(100dvh - 185px), 620px);
  border: 1.5px dashed var(--border-dashed);
  border-radius: 26px;
  background: transparent;
  padding: 18px 10px 18px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.info-scroll-inner {
  flex: 1;
  min-height: 0;
  padding: 8px 20px 8px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.info-scroll-inner.is-panning {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.info-scroll-inner::-webkit-scrollbar {
  width: 6px;
}

.info-scroll-inner::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px 0;
}

.info-scroll-inner::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.info-scroll-inner::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.info-scroll-inner::-webkit-scrollbar-button,
.info-scroll-inner::-webkit-scrollbar-button:single-button,
.info-scroll-inner::-webkit-scrollbar-button:start:decrement,
.info-scroll-inner::-webkit-scrollbar-button:end:increment,
.info-scroll-inner::-webkit-scrollbar-button:vertical:start:decrement,
.info-scroll-inner::-webkit-scrollbar-button:vertical:end:increment {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

.info-article {
  display: flex;
  flex-direction: column;
  gap: 13px;
  color: var(--ink);
}

.info-article h1 {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.info-article h3 {
  margin: 8px 0 -4px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-soft-text);
}

.info-article p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.62;
  color: var(--ink);
}

.info-article .info-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: -6px;
}

.info-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-subtle);
}

.info-contact-box {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.info-email-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-soft-text);
  word-break: break-all;
}

.info-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.info-share-block {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-share-btn svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .info-dashed-box {
    padding: 14px 6px 14px 0;
    border-radius: 20px;
    height: clamp(320px, calc(100dvh - 170px), 560px);
  }
  .info-scroll-inner {
    padding: 4px 12px 4px 16px;
  }
  .menu-pill-trigger {
    padding: 6px 8px;
  }
}


/* =====================================================================
   18. UPDATE 12 PATCH 1 (v1.12.1) -- HUB BADGE STRIP, MEDAL SHELF & EQUAL BUTTONS
   ===================================================================== */
.hub-badge-strip {
  width: 100%;
  max-width: 812px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px;
  margin-bottom: clamp(14px, 2.8vh, 24px);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.hub-badge-strip::-webkit-scrollbar {
  display: none;
}

.hub-badge-strip.is-panning {
  cursor: grabbing;
}

.hub-badge-slot {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 13px;
  border: 1.5px dashed var(--border-dashed);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.hub-badge-slot:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.hub-badge-slot.is-unlocked {
  border-style: solid;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hub-badge-slot img,
.hub-badge-slot svg {
  width: 28px;
  height: 30px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.hub-badge-slot.is-locked svg {
  opacity: 0.72;
}

.hub-medal-shelf {
  width: 100%;
  max-width: 812px;
  margin-top: auto;
  padding-top: 26px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 1.5vw, 14px);
}

.hub-medal-item {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(16px, 5.2vw, 24px);
  height: clamp(19px, 6vw, 28px);
  opacity: 0.62;
  transition: transform 150ms ease, opacity 150ms ease;
  cursor: default;
}

.hub-medal-item.is-earned {
  opacity: 1;
}

.hub-medal-item:hover {
  opacity: 1;
  transform: translateY(-2px) scale(1.12);
}

.hub-medal-item img,
.hub-medal-item svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.info-actions-row .soft-pill-btn,
.info-actions-row .donation-pill {
  height: 38px;
  padding: 0 16px;
  font-size: 0.84rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .hub-badge-strip {
    gap: 8px;
    margin-bottom: 14px;
  }
  .hub-badge-slot {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
  .hub-badge-slot img,
  .hub-badge-slot svg {
    width: 24px;
    height: 26px;
  }
  .hub-medal-shelf {
    padding-top: 18px;
    gap: clamp(2px, 1.1vw, 8px);
  }
}
/* =====================================================================
   19. UPDATE 14 (v1.14.0) -- UNIFORM INTRO HEIGHT, MOBILE X CLOSE,
       FLOWWORD WHOLE-WORD WRAPPING & TAP TOOLTIPS
   ===================================================================== */

/* Consistent vertical starting height across all 4 games (regardless of diffHintBar lines) */
.game-intro-screen {
  position: relative;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  justify-content: flex-start;
  padding-top: clamp(34px, 9.5vh, 92px);
  padding-bottom: 32px;
}

.summary-screen {
  position: relative;
}

/* Mobile-only top-right X close button on intro & summary screens (replaces < Games pill) */
.intro-close-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 2px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 780px) {
  body[data-screen="game"] #backToHubBtn {
    display: none !important;
  }
  .intro-close-btn {
    display: inline-flex;
  }
  .game-intro-screen {
    padding-top: clamp(34px, 6.5vh, 56px);
    padding-bottom: 24px;
  }
}

/* FlowWord: keep continuous stream intact while never splitting a word mid-word across lines */
.fw-stream-box {
  word-break: normal;
  overflow-wrap: break-word;
}

.fw-word-unit {
  display: inline-block;
  white-space: nowrap;
}

.fw-word-token {
  display: inline-block;
  white-space: nowrap;
  line-height: 1.5;
  vertical-align: baseline;
}

.fw-word-token.is-seamless {
  padding: 1px 0;
}

.fw-word-token.is-seamless.is-found,
.fw-word-token.is-seamless.is-revealed {
  padding: 1px 6px;
}

.dict-pill .dict-timeup {
  font-weight: 800;
  color: var(--danger);
  margin-right: 4px;
}

/* Mobile & desktop tap tooltip for Badges and Medals */
.hub-badge-slot,
.hub-medal-item,
.tile-medal {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hub-badge-slot.is-tip-active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.hub-medal-item.is-tip-active {
  opacity: 1;
  transform: translateY(-2px) scale(1.14);
}

.tile-medal.is-tip-active {
  transform: scale(1.18);
}

.tap-tooltip {
  position: fixed;
  z-index: 160;
  max-width: min(290px, calc(100vw - 24px));
  padding: 8px 14px;
  border-radius: 13px;
  background: var(--ink);
  color: var(--bg-page);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.42;
  text-align: center;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 150ms ease, transform 150ms ease;
}

.tap-tooltip.is-below {
  transform: translateY(-4px) scale(0.97);
}

.tap-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Update 14 Patch 1 (v1.14.1) -- About screen left-aligned platform version */
.info-article .info-version-line {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: left;
  opacity: 0.8;
  letter-spacing: 0.01em;
}
/* =====================================================================
   20. UPDATE 14 PATCH 2 (v1.14.2) -- MOBILE INFO X CLOSE & COMPACT
       NARROW-PHONE GAME TILES (iPhone SE 375px & smaller)
   ===================================================================== */
.info-dashed-box {
  position: relative;
}

.info-close-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 780px) {
  body[data-screen="info"] #backToHubBtn,
  body[data-screen="customMod"] #backToHubBtn {
    display: none !important;
  }
  .info-close-btn {
    display: inline-flex;
  }
  .info-article h1 {
    padding-inline-end: 40px;
  }
}

/* Very narrow screens (iPhone SE 375px and below): hide tile subtitle so square tiles stay clean & balanced */
@media (max-width: 430px) {
  .hub-grid {
    gap: 12px;
  }
  .game-tile {
    width: calc(50% - 6px);
    min-width: 136px;
    padding: 12px 10px 10px;
    border-radius: 22px;
    gap: 6px;
  }
  .tile-top-content {
    gap: 5px;
  }
  .tile-icon-wrap {
    height: 38px;
    margin-bottom: 0;
  }
  .tile-icon-wrap svg,
  .tile-icon-wrap img {
    height: 34px;
    max-width: 78px;
  }
  .tile-title {
    font-size: 1.06rem;
  }
  .tile-sub {
    display: none;
  }
  .tile-progress-bar {
    padding-top: 8px;
    gap: 4px;
  }
  .tile-play-count {
    padding: 2px 7px;
    font-size: 0.72rem;
    gap: 3px;
  }
  .tile-play-count svg {
    width: 10px;
    height: 10px;
  }
  .tile-medals-row {
    gap: 4px;
  }
  .tile-medal {
    width: 20px;
    height: 22px;
  }
  .tile-medal svg,
  .tile-medal img {
    width: 19px;
    height: 21px;
  }
}
/* =====================================================================
   21. UPDATE 14 PATCH 3 (v1.14.3) -- MOBILE KEYBOARD STABILITY &
       SUPPRESS BROWSER AUTOFILL / SEARCH CLEAR DECORATIONS
   ===================================================================== */
.word-input::-webkit-search-decoration,
.word-input::-webkit-search-cancel-button,
.word-input::-webkit-search-results-button,
.word-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

@media (max-width: 780px) {
  body[data-screen="game"][data-playing="1"] .play-screen {
    padding-top: 8px;
    padding-bottom: 12px;
    gap: 11px;
  }
  body[data-screen="game"][data-playing="1"] .safe-zone {
    height: 196px;
    min-height: 196px;
    max-height: 196px;
    border-radius: 20px;
  }
  body[data-screen="game"][data-playing="1"] .controls-stack {
    margin-top: 0;
    gap: 9px;
  }
  body[data-screen="game"][data-playing="1"] .word-input {
    height: 46px;
  }
  body[data-screen="game"][data-playing="1"] .submit-icon-btn {
    width: 36px;
    height: 36px;
    right: 5px;
  }
  body[data-screen="game"][data-playing="1"] .action-icon-btn {
    width: 38px;
    height: 38px;
  }
  body[data-screen="game"][data-playing="1"] .game-feedback-slot {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
  }
  body[data-screen="game"][data-playing="1"] .dict-pill {
    padding: 6px 14px;
    font-size: 0.88rem;
    max-height: 52px;
  }
}
