    :root {
      --bg: #14161c;
      --panel: #1c1f28;
      --panel-2: #232733;
      --ink: #eceae4;
      --muted: #8b90a0;
      --keycap: #eee9df;
      --keycap-shadow: #b7b0a0;
      --keycap-text: #24262d;
      --accent: #ff9142;
      --accent-2: #45d9c4;
      --error: #ff5f6d;
      --border: #2b2f3b;
      --font-ui: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
      --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', Consolas, monospace;
      --kb-unit: 42px;
      --kb-gap: 6px;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      padding: 0;
    }

    body {
      background: var(--bg);
      color: var(--ink);
      font-family: var(--font-ui);
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
    }

    @media (prefers-reduced-motion: reduce) {
      * {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
      }
    }

    /* ---------- Topbar ---------- */
    header.topbar {
      position: sticky;
      top: 0;
      z-index: 1000;
      display: flex;
      flex-direction: column;
      padding: 10px 16px;
      background: rgba(20, 22, 28, .95);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--border);
    }

    .topbar-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      width: 100%;
      position: relative;
    }

    .logo {
      display: flex;
      align-items: center;
      gap: 10px;
      font-weight: 700;
      font-size: 1.15rem;
      letter-spacing: .02em;
      flex-shrink: 0;
    }

    .logo img {
      border-radius: 6px;
    }

    /* Live Stats Display in Topbar Banner */
    .topbar-stats {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20px;
      margin: 0 auto;
    }

    .topbar-stats .stat {
      text-align: center;
    }

    .topbar-stats .stat .val {
      font-size: 1.15rem;
      font-weight: 700;
      font-family: var(--font-mono);
      color: var(--accent);
      line-height: 1.1;
    }

    .topbar-stats .stat .lbl {
      font-size: .62rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .stat-reset-btn {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      padding: 0;
      background: var(--panel-2);
      color: var(--muted);
      border: 1px solid var(--border);
      border-radius: 7px;
      cursor: pointer;
      transition: all 0.2s ease;
      flex-shrink: 0;
      user-select: none;
      -webkit-user-select: none;
    }

    .stat-reset-btn:hover {
      color: var(--ink);
      border-color: var(--accent);
      background: rgba(255, 145, 66, 0.12);
      transform: translateY(-1px);
    }

    .stat-reset-btn:active {
      transform: translateY(0);
    }

    .stat-reset-btn:active svg {
      transform: rotate(-180deg);
      transition: transform 0.25s ease;
    }

    /* Floating Tooltip */
    .stat-reset-btn::after {
      content: attr(data-tooltip);
      position: absolute;
      top: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%) translateY(-4px);
      background: #11141b;
      color: #eceae4;
      font-family: var(--font-ui);
      font-size: 0.7rem;
      font-weight: 500;
      letter-spacing: 0.01em;
      white-space: nowrap;
      padding: 5px 9px;
      border-radius: 6px;
      border: 1px solid var(--border);
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
      z-index: 1001;
    }

    .stat-reset-btn::before {
      content: '';
      position: absolute;
      top: calc(100% + 3px);
      left: 50%;
      transform: translateX(-50%);
      border-width: 0 5px 5px 5px;
      border-style: solid;
      border-color: transparent transparent #11141b transparent;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.16s ease, visibility 0.16s ease;
      z-index: 1002;
    }

    .stat-reset-btn:hover::after,
    .stat-reset-btn:focus-visible::after {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) translateY(0);
    }

    .stat-reset-btn:hover::before,
    .stat-reset-btn:focus-visible::before {
      opacity: 1;
      visibility: visible;
    }

    /* Topbar Right Group & Selected Config Summary Badge */
    .topbar-right-group {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
      flex-shrink: 0;
    }

    .topbar-config-summary {
      display: flex;
      align-items: center;
      gap: 5px;
      background: var(--panel-2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 6px 10px;
      cursor: pointer;
      font-family: var(--font-mono);
      font-size: .75rem;
      font-weight: 600;
      color: var(--muted);
      transition: all .15s ease;
      user-select: none;
    }

    .topbar-config-summary:hover {
      border-color: var(--accent);
      color: var(--ink);
      background: var(--panel);
    }

    .summary-badge {
      color: var(--accent);
      font-weight: 700;
    }

    .summary-divider {
      color: var(--border);
      font-size: .65rem;
    }

    /* Hamburger Menu Button (Always on topbar right) */
    .hamburger-btn {
      display: flex;
      background: var(--panel-2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px;
      cursor: pointer;
      flex-direction: column;
      gap: 4px;
      justify-content: center;
      align-items: center;
      width: 36px;
      height: 36px;
      flex-shrink: 0;
      transition: border-color .15s, background .15s;
    }

    .hamburger-btn:hover,
    .hamburger-btn[aria-expanded="true"] {
      border-color: var(--accent);
      background: var(--panel);
    }

    .hamburger-bar {
      display: block;
      width: 18px;
      height: 2px;
      background: var(--ink);
      border-radius: 2px;
    }

    /* Navigation & Settings Menu Dropdown */
    .nav-dropdown {
      position: absolute;
      top: calc(100% + 6px);
      right: 16px;
      width: 360px;
      max-width: calc(100vw - 24px);
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 14px 16px;
      box-shadow: 0 16px 40px rgba(0, 0, 0, .75);
      z-index: 100;
      animation: menuFadeIn .15s ease;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    @keyframes menuFadeIn {
      from { opacity: 0; transform: translateY(-6px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .nav-dropdown[hidden] {
      display: none !important;
    }

    .menu-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-bottom: 4px;
      border-bottom: 1px solid var(--border);
    }

    .menu-title {
      font-size: .78rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .06em;
    }

    .menu-rows {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .menu-row {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }

    .menu-label {
      font-size: .72rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .04em;
    }

    .pill-group {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      background: var(--panel-2);
      padding: 4px;
      border-radius: 10px;
      border: 1px solid var(--border);
    }

    .pill-btn {
      flex: 1 1 auto;
      background: transparent;
      border: none;
      color: var(--muted);
      font-family: var(--font-ui);
      font-size: .78rem;
      font-weight: 600;
      padding: 6px 8px;
      border-radius: 7px;
      cursor: pointer;
      text-align: center;
      white-space: nowrap;
      transition: all .15s ease;
      user-select: none;
    }

    .pill-btn:hover {
      color: var(--ink);
      background: rgba(255, 255, 255, .06);
    }

    .pill-btn.active {
      background: var(--accent);
      color: var(--bg);
      font-weight: 700;
      box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
    }

    .dropdown-divider {
      height: 1px;
      background: var(--border);
      margin: 2px 0;
    }

    .menu-links {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .menu-link-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--panel-2);
      border: 1px solid var(--border);
      color: var(--ink);
      font-family: var(--font-ui);
      font-size: .84rem;
      font-weight: 600;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      text-align: left;
      width: 100%;
      transition: background .15s, border-color .15s, color .15s;
    }

    .menu-link-btn:hover {
      background: var(--panel);
      border-color: var(--accent);
      color: var(--accent);
    }

    main {
      max-width: 1080px;
      margin: 0 auto;
      padding: 10px 16px 32px;
    }

    .view {
      display: none;
    }

    .view.active {
      display: block;
    }

    /* ---------- Controls bar ---------- */
    .controls {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: flex-end;
      width: 100%;
    }

    .control-group {
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1 1 auto;
      min-width: 130px;
    }

    .control-group label {
      font-size: .68rem;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--muted);
    }

    select,
    .btn {
      font-family: var(--font-ui);
      font-size: .85rem;
      font-weight: 600;
      background: var(--panel-2);
      color: var(--ink);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 6px 9px;
      cursor: pointer;
    }

    select:disabled {
      opacity: .45;
      cursor: not-allowed;
    }

    .btn {
      margin-left: auto;
      background: var(--accent);
      color: #20130a;
      border: none;
      align-self: flex-end;
    }

    .btn.btn-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 7px 11px;
      line-height: 1;
      height: 31px;
      flex-shrink: 0;
    }

    .btn.btn-icon svg {
      display: block;
      transition: transform .25s ease;
    }

    .btn.btn-icon:hover svg {
      transform: rotate(90deg);
    }

    .btn.btn-icon:active svg {
      transform: rotate(270deg);
    }

    .btn:hover {
      filter: brightness(1.08);
    }

    .btn.secondary {
      background: var(--panel-2);
      color: var(--ink);
      border: 1px solid var(--border);
    }

    /* ---------- Practice card ---------- */
    .practice-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 15px 18px;
      margin-bottom: 12px;
    }

    .stats-row {
      display: flex;
      justify-content: flex-end;
      gap: 22px;
      margin-bottom: 9px;
    }

    .topbar-stats {
      margin-left: auto;
      margin-bottom: 0;
      gap: 16px;
      padding-left: 8px;
      align-items: flex-end;
    }

    .topbar-stats .stat .val {
      font-size: 1.15rem;
      line-height: 1.1;
    }

    .topbar-stats .stat .lbl {
      font-size: .62rem;
    }

    .stat {
      text-align: right;
    }

    .stat .val {
      font-size: 1.4rem;
      font-weight: 700;
      font-family: var(--font-mono);
    }

    .stat .lbl {
      font-size: .66rem;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--muted);
    }

    .stat.accuracy .val {
      color: var(--accent-2);
    }

    .stat.wpm .val {
      color: var(--accent);
    }

    .text-display {
      font-family: var(--font-mono);
      font-size: 1.35rem;
      line-height: 2.1;
      letter-spacing: .01em;
      min-height: 3em;
      word-spacing: 2px;
    }

    .text-display .line {
      margin-bottom: 4px;
      opacity: .35;
    }

    .text-display .line.active-line {
      opacity: 1;
    }

    .char {
      position: relative;
    }

    .char.pending {
      color: var(--muted);
    }

    .char.correct {
      color: var(--accent-2);
    }

    .char.incorrect {
      color: var(--error);
      text-decoration: underline wavy var(--error);
    }

    .char.current {
      border-bottom: 2px solid var(--accent);
    }

    .enter-indicator {
      display: inline-block;
      margin-left: 12px;
      padding: 2px 8px;
      border: 1px solid var(--accent);
      border-radius: 6px;
      color: var(--accent);
      font-family: var(--font-ui);
      font-size: .72rem;
      font-weight: 700;
      vertical-align: middle;
    }

    .char.space.incorrect {
      background: rgba(255, 95, 109, .25);
      border-radius: 2px;
    }

    .hidden-input {
      position: fixed;
      top: 0;
      left: 0;
      opacity: 0;
      height: 1px;
      width: 1px;
      pointer-events: none;
      font-size: 16px !important;
    }

    .typing-input {
      width: 100%;
      margin-top: 8px;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-radius: 9px;
      outline: none;
      background: var(--panel-2);
      color: var(--ink);
      font-family: var(--font-mono);
      font-size: 1.05rem;
    }

    .typing-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(255, 145, 66, .14);
    }

    .typing-input.lang-nepali-trad {
      font-family: 'Noto Sans Devanagari', 'Mangal', sans-serif;
      font-size: 1.2rem;
    }

    .capture-hint {
      margin-top: 7px;
      font-size: .78rem;
      color: var(--muted);
    }

    .capture-hint:empty {
      display: none;
    }

    /* ---------- Keyboard (physical ANSI-style stagger) ---------- */
    .keyboard-wrap {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 16px;
      margin-bottom: 12px;
      overflow-x: auto;
    }

    .kb-header-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }

    .kb-toolbar-title {
      font-size: .8rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .btn-kb-toggle {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--text);
      font-family: inherit;
      font-size: .78rem;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 20px;
      cursor: pointer;
      transition: all .15s ease;
      user-select: none;
    }

    .btn-kb-toggle:hover {
      background: var(--border);
      color: var(--accent);
      border-color: var(--accent);
    }

    .keyboard-wrap.use-device-kb #keyboard-body {
      display: none;
    }

    .keyboard-wrap.use-device-kb .kb-header-toolbar {
      margin-bottom: 0;
      padding-bottom: 0;
      border-bottom: none;
    }

    #keyboard {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      width: 100%;
      min-width: 580px;
      margin: 0 auto;
    }

    .kb-row {
      display: flex;
      width: 100%;
      gap: var(--kb-gap);
      margin-bottom: var(--kb-gap);
    }

    .key {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: clamp(.95rem, 1.5vw, 1.25rem);
      background: linear-gradient(180deg, var(--keycap), var(--keycap-shadow));
      color: var(--keycap-text);
      height: clamp(46px, 5.2vw, 58px);
      border-radius: 8px;
      flex: var(--k-w, 1) var(--k-w, 1) 0px;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 3px 0 var(--keycap-shadow), 0 4px 6px rgba(0, 0, 0, .35);
      transition: transform .05s, box-shadow .05s, background .1s;
      user-select: none;
      cursor: pointer;
    }

    .key:hover {
      filter: brightness(1.12);
    }

    .key.special {
      font-size: clamp(.75rem, 1.1vw, .92rem);
      font-weight: 700;
      color: var(--keycap-text);
      opacity: .85;
      letter-spacing: .02em;
    }

    .key.pressed {
      transform: translateY(3px);
      box-shadow: 0 0 0 var(--keycap-shadow), 0 1px 2px rgba(0, 0, 0, .3);
    }

    .key.next {
      outline: 2px solid var(--accent);
      box-shadow: 0 3px 0 var(--keycap-shadow), 0 0 16px var(--accent);
      opacity: 1;
    }

    .key.flash-correct {
      background: var(--accent-2);
      color: #062621;
    }

    .key.flash-wrong {
      background: var(--error);
      color: #2a0406;
    }

    /* Dual-label keys (Nepali layouts) */
    .key.key-dual {
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 0;
      padding: 2px 4px;
      position: relative;
    }

    .key-np {
      font-family: 'Noto Sans Devanagari', 'Mangal', sans-serif;
      font-size: clamp(1.15rem, 1.8vw, 1.45rem);
      font-weight: 700;
      line-height: 1.1;
      color: var(--keycap-text);
    }

    .key-np-shift {
      position: absolute;
      top: 3px;
      left: 6px;
      font-family: 'Noto Sans Devanagari', 'Mangal', sans-serif;
      font-size: clamp(.72rem, 1.1vw, .88rem);
      font-weight: 600;
      color: #444b59;
      line-height: 1;
    }

    .key-en {
      font-family: var(--font-mono);
      font-size: clamp(.62rem, 0.9vw, .76rem);
      font-weight: 700;
      color: #4a5160;
      line-height: 1;
      letter-spacing: .02em;
      position: absolute;
      bottom: 4px;
      right: 6px;
    }

    .key.key-dual.flash-correct .key-np,
    .key.key-dual.flash-correct .key-np-shift,
    .key.key-dual.flash-correct .key-en {
      color: #062621;
    }

    .key.key-dual.flash-wrong .key-np,
    .key.key-dual.flash-wrong .key-np-shift,
    .key.key-dual.flash-wrong .key-en {
      color: #2a0406;
    }

    /* Devanagari font for the text display area */
    .text-display.lang-nepali-trad {
      font-family: 'Noto Sans Devanagari', 'Mangal', var(--font-mono);
      font-size: 1.5rem;
      line-height: 2.3;
    }

    /* ---------- Hands ---------- */
    .hands-wrap {
      display: flex;
      justify-content: center;
      align-items: flex-end;
      gap: clamp(12px, 5vw, 60px);
      margin-top: 14px;
      flex-wrap: nowrap;
    }

    .hands-wrap > div {
      flex: 0 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .hands-wrap svg {
      width: clamp(110px, 22vw, 215px);
      height: auto;
      max-width: 100%;
    }

    .hand-label {
      text-align: center;
      font-size: .68rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: .08em;
      margin-top: 6px;
    }

    .finger {
      fill: var(--keycap);
      stroke: var(--keycap-shadow);
      stroke-width: 1.5;
      transition: fill .12s, stroke .12s;
    }

    .finger.active {
      fill: var(--accent);
      stroke: #c96a1f;
      filter: drop-shadow(0 0 6px var(--accent));
    }

    .crease {
      stroke: var(--keycap-shadow);
      stroke-width: 1;
      opacity: .6;
      fill: none;
    }

    .palm {
      fill: var(--keycap);
      stroke: var(--keycap-shadow);
      stroke-width: 1.5;
    }

    .nail {
      fill: rgba(255, 255, 255, .35);
      stroke: none;
    }

    /* ---------- Free form / Game ---------- */
    .freeform-box {
      font-family: var(--font-mono);
      font-size: 1.15rem;
      line-height: 1.9;
      width: 100%;
      min-height: 180px;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px;
      color: var(--ink);
      resize: vertical;
    }

    .freeform-box:focus {
      outline: 2px solid var(--accent);
    }

    .game-area {
      position: relative;
      height: 200px;
      background: var(--panel-2);
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden;
      transition: height 0.25s ease-in-out;
    }

    .view.game-maximized .game-area {
      height: clamp(440px, 64vh, 680px);
    }

    .game-area .baseline {
      position: absolute;
      bottom: 34px;
      left: 0;
      right: 0;
      border-top: 1px dashed var(--error);
      opacity: .5;
    }

    .game-buffer-bar {
      position: absolute;
      bottom: 6px;
      left: 50%;
      transform: translateX(-50%) translateY(8px);
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 3px 14px;
      display: flex;
      align-items: center;
      gap: 8px;
      z-index: 5;
      box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
      max-width: 90%;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .game-buffer-bar.active {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    .game-buffer-bar.has-deviation {
      border-color: rgba(248, 113, 113, 0.7);
      background: rgba(239, 68, 68, 0.12);
      box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
    }

    .game-buffer-bar .buffer-label {
      font-size: 0.68rem;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .game-buffer-bar .buffer-text {
      font-family: var(--font-mono);
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--accent);
      min-width: 40px;
      letter-spacing: 0.05em;
      display: inline-flex;
      align-items: center;
      gap: 1px;
    }

    .game-buffer-bar .buffer-text .valid-part {
      color: var(--accent);
      font-weight: 800;
    }

    .game-buffer-bar .buffer-text .deviant-part {
      color: #f87171;
      background: rgba(239, 68, 68, 0.25);
      border-radius: 4px;
      padding: 0 4px;
      font-weight: 800;
      text-decoration: underline wavy #ef4444;
    }

    .game-buffer-bar .buffer-text.lang-nepali-trad {
      font-family: 'Noto Sans Devanagari', 'Mangal', var(--font-mono);
      font-size: 1.15rem;
    }

    .game-buffer-bar .buffer-text:empty::before {
      content: 'type word…';
      color: var(--muted);
      font-weight: 400;
      font-style: italic;
      font-size: 0.8rem;
    }

    .falling-word {
      position: absolute;
      font-family: var(--font-mono);
      font-weight: 600;
      font-size: 1rem;
      color: var(--muted);
      background: var(--panel-2);
      padding: 4px 10px;
      border-radius: 6px;
      border: 1px solid var(--border);
      white-space: nowrap;
    }

    .falling-word .typed {
      color: var(--accent-2);
    }

    .falling-word.matching {
      border-color: var(--accent);
      box-shadow: 0 0 10px rgba(255, 145, 66, .4);
    }

    .game-stats-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .lives-stat {
      align-items: flex-start !important;
      text-align: left !important;
      flex: 1;
    }

    .lives-hearts {
      display: flex;
      gap: 1px;
      font-size: 0.65rem;
      align-items: center;
      justify-content: flex-start;
      flex-wrap: nowrap;
      white-space: nowrap;
      min-height: 22px;
      overflow: hidden;
    }

    .lives-hearts .heart {
      transition: transform 0.2s ease, opacity 0.2s ease;
      line-height: 1;
      display: inline-block;
    }

    .lives-hearts .heart.empty {
      opacity: 0.25;
      filter: grayscale(1);
    }

    .game-action-fab {
      position: relative;
      flex-shrink: 0;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
      padding: 0;
      cursor: pointer;
      border: 1px solid var(--border);
      transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .game-action-fab.mode-secondary {
      background: var(--panel-2);
      border-color: var(--border);
      color: var(--ink);
      opacity: 0.9;
    }

    .game-action-fab.mode-secondary:hover {
      border-color: var(--accent);
      color: var(--accent);
      transform: scale(1.06);
    }

    .game-action-fab.mode-secondary:active {
      transform: scale(0.95);
    }
    .game-action-fab.mode-solid {
      background: var(--accent);
      border-color: var(--accent);
      color: #ffffff;
      opacity: 1;
      box-shadow: 0 4px 14px rgba(249, 115, 22, 0.45);
    }

    .game-action-fab.mode-solid:hover {
      transform: scale(1.08);
      box-shadow: 0 6px 18px rgba(249, 115, 22, 0.6);
    }

    .game-action-fab.mode-solid:active {
      transform: scale(0.95);
    }

    /* State 2: Semi-transparent for Pause while actively playing */
    .game-action-fab.mode-pause {
      background: rgba(15, 23, 42, 0.65);
      border-color: var(--border);
      color: var(--ink);
      opacity: 0.55;
      backdrop-filter: blur(4px);
      box-shadow: none;
    }

    .game-action-fab.mode-pause:hover {
      opacity: 1;
      background: var(--accent);
      border-color: var(--accent);
      color: #ffffff;
      transform: scale(1.08);
      box-shadow: 0 4px 14px rgba(249, 115, 22, 0.45);
    }

    .game-action-fab.mode-pause:active {
      transform: scale(0.95);
    }

    .submode-select {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--ink);
      padding: 6px 12px;
      border-radius: 8px;
      font-size: 0.85rem;
      font-weight: 600;
      cursor: pointer;
      outline: none;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .submode-select:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
    }

    /* Ramayan Character Avatars */
    .character-avatar {
      position: absolute;
      bottom: 12px;
      display: flex;
      flex-direction: column;
      align-items: center;
      z-index: 5;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .character-avatar.hidden {
      display: none !important;
    }

    .ram-avatar {
      left: 16px;
    }

    .ravan-avatar {
      right: 16px;
    }

    .char-icon {
      width: 44px;
      height: 44px;
      filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
    }

    .char-name {
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--ink-muted);
      margin-top: 2px;
      letter-spacing: 0.02em;
    }

    /* Parabolic Fiery Ravan Arrow & Ram Counter Arrow */
    .arrow-element {
      position: absolute;
      z-index: 8;
      pointer-events: none;
      transform-origin: center center;
    }

    .ramayan-arrow-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .arrow-svg {
      width: 100%;
      height: 100%;
      display: block;
      overflow: visible;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    }

    .svg-badge-text {
      user-select: none;
      letter-spacing: 0.02em;
      filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
    }

    .arrow-word-badge.matching {
      border-color: #22c55e;
      background: rgba(22, 101, 52, 0.95);
      color: #4ade80;
    }

    .arrow-word-badge .typed {
      color: #4ade80;
      font-weight: 800;
      text-decoration: underline;
    }

    .counter-arrow-graphic {
      font-size: 1.3rem;
      line-height: 1;
      filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.95));
    }

    /* Falling Words Parachute Pod Container */
    .falling-word-pod {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      z-index: 7;
      pointer-events: none;
      transform: translateX(-50%);
    }

    .falling-parachute-wrap {
      margin-bottom: -6px;
      filter: drop-shadow(0 3px 8px rgba(56, 189, 248, 0.45));
      transition: filter 0.15s ease;
    }

    .falling-word-badge {
      font-family: var(--font-mono);
      font-size: 0.95rem;
      font-weight: 700;
      color: #f8fafc;
      background: rgba(15, 23, 42, 0.92);
      border: 1.5px solid #0284c7;
      padding: 4px 10px;
      border-radius: 12px;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 10px rgba(2, 132, 199, 0.3);
      white-space: nowrap;
      text-align: center;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    }

    .falling-word-badge.matching {
      border-color: #38bdf8;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 10px rgba(56, 189, 248, 0.4);
    }

    .falling-word-badge .typed {
      color: #4ade80;
      font-weight: 900;
      text-decoration: underline;
    }

    .clash-spark {
      position: absolute;
      z-index: 12;
      font-size: 1.8rem;
      pointer-events: none;
      animation: floatUpFade 0.4s ease-out forwards;
    }

    /* ---------- Game Visual Effects ---------- */
    @keyframes floatUpFade {
      0% { opacity: 1; transform: translateY(0) scale(1); }
      100% { opacity: 0; transform: translateY(-30px) scale(1.15); }
    }

    .floating-popup {
      position: absolute;
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 1.1rem;
      pointer-events: none;
      z-index: 10;
      animation: floatUpFade 0.6s ease-out forwards;
    }

    .floating-popup.plus-score {
      color: var(--accent-2);
      text-shadow: 0 0 8px rgba(52, 211, 153, .8);
    }

    .floating-popup.minus-life {
      color: var(--error);
      text-shadow: 0 0 8px rgba(248, 113, 113, .8);
    }

    #game-lives.heart-shake {
      animation: heartShake 0.4s ease-in-out;
    }

    .game-hud {
      display: flex;
      gap: 24px;
      margin-bottom: 12px;
    }

    .game-overlay {
      position: absolute;
      inset: 0;
      z-index: 50;
      background: rgba(15, 23, 42, 0.42);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      text-align: center;
      border-radius: 14px;
      padding: 20px;
      transition: opacity 0.25s ease;
    }

    .game-overlay.hidden {
      display: none !important;
    }

    /* ---------- Settings / About ---------- */
    .panel-block {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 22px 24px;
      margin-bottom: 18px;
    }

    .panel-block h2 {
      margin-top: 0;
      font-size: 1.05rem;
    }

    table.scores {
      width: 100%;
      border-collapse: collapse;
      font-family: var(--font-mono);
      font-size: .9rem;
    }

    table.scores th,
    table.scores td {
      text-align: left;
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
    }

    table.scores th {
      color: var(--muted);
      font-weight: 600;
      text-transform: uppercase;
      font-size: .68rem;
      letter-spacing: .06em;
    }

    .about-copy {
      color: var(--ink);
      line-height: 1.7;
    }

    .about-copy .muted {
      color: var(--muted);
    }

    footer {
      text-align: center;
      color: var(--muted);
      font-size: .75rem;
      padding: 30px 0 10px;
    }

    /* ---------- Responsive Layout Rules ---------- */

    @media (max-width: 640px) {
      input, textarea, select {
        font-size: 16px !important;
      }

      .logo-text {
        display: none;
      }

      header.topbar {
        padding: 8px 12px;
      }

      .topbar-stats {
        gap: 10px;
      }

      .topbar-stats .stat .val {
        font-size: 1rem;
      }

      .topbar-stats .stat .lbl {
        font-size: .56rem;
      }

      .stat-reset-btn {
        width: 26px;
        height: 26px;
      }

      .text-display {
        font-size: 1.05rem;
        line-height: 1.9;
      }

      :root {
        --kb-unit: 30px;
        --kb-gap: 4px;
      }

      .key {
        height: 32px;
        font-size: .62rem;
      }

      .key.special {
        font-size: .52rem;
      }

      .hands-wrap {
        gap: 10px;
        flex-wrap: nowrap;
      }

      .hands-wrap svg {
        width: min(135px, 42vw);
        height: auto;
      }

      .stats-row {
        gap: 14px;
      }
    }