    :root {
      --app-shell-width: 716px;
      --app-task-edge-width: var(--app-shell-width);
      --bg: #0f172a;
      --panel: #1e293b;
      --panel2: #334155;
      --text: #f1f5f9;
      --muted: #94a3b8;
      --accent: #38bdf8;
      --accent2: #818cf8;
      --ok: #22c55e;
      --bad: #ef4444;
      --warn: #f59e0b;
      --gold: #fbbf24;
      --silver: #cbd5e1;
      --bronze: #f97316;
    }

    * {
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    html {
      touch-action: manipulation;
      -webkit-text-size-adjust: 100%;
      overscroll-behavior: none;
    }

    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
    }

    body {
      font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, -apple-system, sans-serif;
      background: linear-gradient(135deg, #0f172a, #1e293b);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 16px;
      overflow-x: hidden;
      touch-action: manipulation;
      overscroll-behavior-x: none;
    }

    button,
    input,
    select,
    textarea,
    .btn,
    .tab,
    .chip,
    #play,
    #battle-play {
      touch-action: manipulation;
    }

    .battle-game-screen,
    .battle-game-screen * {
      user-select: none;
      -webkit-user-select: none;
      -ms-user-select: none;
      -webkit-touch-callout: none;
      -webkit-tap-highlight-color: transparent;
    }

    .battle-game-screen img,
    .battle-game-screen svg,
    .battle-game-screen canvas {
      -webkit-user-drag: none;
    }

    .app-header {
      width: 100%;
      max-width: var(--app-shell-width);
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 4px;
      margin: 0 0 6px;
    }

    .switch-user-fab {
      position: absolute;
      top: 0;
      right: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 30px;
      width: 44px;
      padding: 6px 9px;
      border: 1px solid rgba(125, 211, 252, .28);
      border-radius: 999px;
      background: rgba(15, 23, 42, .42);
      color: #bae6fd;
      box-shadow: 0 2px 8px rgba(2, 6, 23, .18);
      font: inherit;
      font-size: 12px;
      font-weight: 900;
      line-height: 1;
      white-space: nowrap;
      cursor: pointer;
      transition: border-color .14s ease, background .14s ease;
    }

    .switch-user-fab:hover {
      border-color: rgba(56, 189, 248, .48);
      background: rgba(14, 116, 144, .58);
    }

    .switch-user-fab:active {
      transform: scale(.98);
    }

    .switch-user-fab[hidden],
    body[data-screen="picker"] .switch-user-fab {
      display: none !important;
    }

    body[data-screen="number-climber"] > .app-header,
    body[data-screen="traffic-light"] > .app-header,
    body[data-screen="quick-draw"] > .app-header,
    body[data-screen="workout"] > .app-header,
    body[data-screen="cat-memory"] > .app-header,
    body[data-screen="quest-play"] > .app-header,
    body[data-screen="reflex-rush"] > .app-header,
    body[data-screen="battle-play"] > .app-header,
    body[data-screen="mole-hunt"] > .app-header {
      display: none !important;
    }

    @media (max-width: 1200px), (hover: none) and (pointer: coarse) {
      body[data-screen="result"] > .app-header,
      body[data-screen="play"] > .app-header {
        display: none !important;
      }
    }

    @media (max-width: 430px) {
      .switch-user-fab {
        min-height: 28px;
        width: 38px;
        padding: 5px 0;
        font-size: 11px;
      }
    }

    h1 {
      margin: 0;
      font-size: clamp(22px, 4vw, 32px);
      letter-spacing: 2px;
      line-height: 1.15;
      text-align: center;
      display: block;
      min-width: 0;
      max-width: 100%;
      background: linear-gradient(90deg, #38bdf8, #a78bfa);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    .app-title-main {
      white-space: nowrap;
    }

    .app-version {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin: 0;
      padding: 3px 8px;
      border: 1px solid rgba(56,189,248,.36);
      border-radius: 999px;
      background: rgba(14,165,233,.12);
      color: #bae6fd;
      font-size: clamp(11px, 2.4vw, 14px);
      font-weight: 900;
      line-height: 1.2;
      letter-spacing: 0;
      white-space: nowrap;
      -webkit-text-fill-color: #bae6fd;
    }

    .sub {
      color: var(--muted);
      margin-bottom: 10px;
      font-size: 14px;
      text-align: center;
    }

    .online-badge {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: min(100%, var(--app-shell-width));
      padding: 8px 12px;
      border-radius: 999px;
      font-size: 12px;
      background: rgba(34, 197, 94, .15);
      color: var(--ok);
      border: 1px solid rgba(34, 197, 94, .3);
      margin-bottom: 8px;
      font-family: monospace;
    }

    body[data-screen="setup"] > .online-badge {
      width: min(100%, var(--app-task-edge-width));
    }

    .online-badge.offline {
      background: rgba(239, 68, 68, .12);
      color: var(--bad);
      border-color: rgba(239, 68, 68, .3);
    }

    .online-badge .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: currentColor;
    }

    .card {
      width: 100%;
      max-width: var(--app-shell-width);
      background: rgba(30, 41, 59, .85);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(148, 163, 184, .15);
      border-radius: 20px;
      padding: 22px;
      box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
    }

    body[data-screen="setup"] > .card {
      max-width: var(--app-task-edge-width);
    }

    .screen {
      display: none;
    }

    .screen.active {
      display: block;
      animation: fade .35s ease;
    }

    @keyframes fade {
      from {
        opacity: 0;
        transform: translateY(8px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      margin-bottom: 18px;
      padding-bottom: 14px;
      border-bottom: 1px solid rgba(148, 163, 184, .15);
      flex-wrap: wrap;
      position: relative;
    }

    .who {
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
    }

    .topbar .who {
      max-width: calc(100% - 58px);
    }

    .who-refresh-btn {
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      border: 0;
      border-radius: 50%;
      padding: 0;
      margin-left: 2px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: url("img/ui/refresh-circle-gpt.png") center / contain no-repeat;
      box-shadow: 0 4px 14px rgba(2,6,23,.34);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      touch-action: none;
    }

    .who-refresh-btn:active {
      transform: translateY(1px) scale(.98);
      filter: brightness(.95);
    }

    .who .av {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      font-weight: 700;
      box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
      position: relative;
    }

    .who .txt .n {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      line-height: 1.2;
      font-size: 16px;
      font-weight: 700;
    }

    .who .txt .s {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      line-height: 1.35;
      font-size: 11px;
      color: var(--muted);
    }

    .who-xp-chip,
    .who-point-chip {
      display: inline-flex;
      align-items: center;
      white-space: nowrap;
      padding: 2px 8px;
      border-radius: 999px;
      background: linear-gradient(135deg, rgba(255,215,107,.24), rgba(93,255,211,.14));
      border: 1px solid rgba(255,215,107,.32);
      color: #ffe08a;
      font-size: 11px;
      font-weight: 800;
      font-variant-numeric: tabular-nums;
    }

    .who-point-meta {
      display: inline-flex;
      align-items: center;
      white-space: nowrap;
      color: #facc15;
      font-size: 11px;
      font-weight: 800;
      font-variant-numeric: tabular-nums;
    }

    .feedback-reply-chip {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border: 1px solid rgba(251, 191, 36, .54);
      border-radius: 999px;
      background: linear-gradient(135deg, rgba(250, 204, 21, .9), rgba(34, 197, 94, .82));
      color: #0f172a;
      padding: 2px 9px;
      font-size: 11px;
      font-weight: 950;
      cursor: pointer;
      box-shadow: 0 0 16px rgba(250, 204, 21, .32);
    }

    .feedback-reply-avatar-dot {
      position: absolute;
      top: -5px;
      right: -6px;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 2px solid #0f172a;
      border-radius: 999px;
      background: #facc15;
      color: #1e293b;
      font-size: 10px;
      font-weight: 950;
      box-shadow: 0 0 14px rgba(250, 204, 21, .75);
    }

    .db-point-line {
      margin-top: 4px;
      color: #facc15;
      font-size: 12px;
      font-weight: 800;
      font-variant-numeric: tabular-nums;
    }

    .db-point-line b {
      color: #fde68a;
      font-size: 14px;
    }

    .topbar .nav {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .nav .tab {
      padding: 8px 12px;
      border-radius: 10px;
      background: var(--panel2);
      color: var(--text);
      border: none;
      cursor: pointer;
      font-size: 13px;
    }

    .nav .tab.active {
      background: linear-gradient(135deg, #0ea5e9, #6366f1);
    }

    .users-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
      gap: 14px;
      margin-bottom: 8px;
    }

    .picker-user-search {
      width: min(100%, 560px);
      margin: 0 auto 8px;
      padding: 10px 12px;
      display: flex;
      align-items: center;
      gap: 8px;
      border-radius: 14px;
      border: 1.5px solid rgba(99,102,241,.34);
      background: rgba(15,23,42,.62);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 22px rgba(15,23,42,.18);
      transition: border-color .16s, box-shadow .16s, background .16s;
    }

    .picker-user-search:focus-within {
      border-color: rgba(99,102,241,.72);
      background: rgba(15,23,42,.74);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 24px rgba(99,102,241,.18);
    }

    .picker-user-search .ic {
      flex: 0 0 auto;
      width: 18px;
      height: 18px;
      color: var(--muted);
    }

    .picker-user-search input {
      flex: 1 1 auto;
      min-width: 0;
      border: 0;
      outline: 0;
      background: transparent;
      color: var(--text);
      font-size: 15px;
      line-height: 1.4;
    }

    .picker-user-search input::placeholder {
      color: var(--muted);
      opacity: .86;
    }

    .picker-search-clear {
      flex: 0 0 auto;
      width: 28px;
      height: 28px;
      border: 0;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: rgba(148,163,184,.18);
      color: var(--text);
      font-size: 18px;
      line-height: 1;
      cursor: pointer;
    }

    .picker-search-clear:active {
      transform: translateY(1px);
    }

    .picker-search-count {
      min-height: 18px;
      margin: 0 0 12px;
      text-align: center;
      color: var(--muted);
      font-size: 12px;
      line-height: 18px;
    }

    .picker-search-empty {
      grid-column: 1 / -1;
    }

    .user-card {
      background: var(--panel2);
      border-radius: 18px;
      padding: 18px 10px;
      text-align: center;
      cursor: pointer;
      border: 3px solid transparent;
      transition: all .15s;
    }

    .user-card:hover {
      transform: translateY(-3px);
      background: #475569;
    }

    .user-card.active {
      border-color: #a78bfa;
      box-shadow: 0 8px 22px rgba(167, 139, 250, .4);
    }

    .user-card .big-av {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 34px;
      margin: 0 auto 8px;
      box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
    }

    .user-card .name {
      font-size: 18px;
      font-weight: 700;
    }

    .user-card .note {
      font-size: 12px;
      color: var(--muted);
      margin-top: 3px;
    }

    .row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }

    .row label {
      flex: 0 0 110px;
      color: var(--muted);
      align-self: center;
      font-size: 15px;
    }

    .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      flex: 1;
    }

    .chip {
      padding: 10px 14px;
      border-radius: 10px;
      background: var(--panel2);
      border: 2px solid transparent;
      color: var(--text);
      cursor: pointer;
      font-size: 15px;
      transition: all .15s;
      user-select: none;
    }

    .chip:hover {
      background: #475569;
    }

    .chip.active {
      background: linear-gradient(135deg, #0ea5e9, #6366f1);
      border-color: #a78bfa;
      box-shadow: 0 4px 14px rgba(99, 102, 241, .45);
    }

    .btn {
      display: inline-block;
      width: 100%;
      padding: 16px;
      border: none;
      border-radius: 14px;
      background: linear-gradient(135deg, #22c55e, #16a34a);
      color: white;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: 2px;
      cursor: pointer;
      box-shadow: 0 6px 20px rgba(34, 197, 94, .35);
      transition: transform .1s;
    }

    .btn:hover {
      transform: translateY(-2px);
    }

    .btn:active {
      transform: translateY(0);
    }

    .btn:disabled {
      opacity: .45;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .btn.alt {
      background: linear-gradient(135deg, #6366f1, #8b5cf6);
      box-shadow: 0 6px 20px rgba(99, 102, 241, .35);
    }

    .btn.small {
      padding: 10px 18px;
      width: auto;
      font-size: 15px;
      letter-spacing: 1px;
    }

    .hud {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 20px;
    }

    .stat {
      background: var(--panel2);
      border-radius: 12px;
      padding: 10px;
      text-align: center;
    }

    .stat .k {
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 2px;
    }

    .stat .v {
      font-size: 22px;
      font-weight: 700;
    }

    .stat.time .v {
      color: var(--accent);
    }

    .stat.right .v {
      color: var(--ok);
    }

    .stat.wrong .v {
      color: var(--bad);
    }

    .stat.streak .v {
      color: var(--warn);
    }

    .question {
      text-align: center;
      font-size: 64px;
      font-weight: 800;
      padding: 30px 10px;
      letter-spacing: 1px;
      background: rgba(15, 23, 42, .6);
      border-radius: 16px;
      margin-bottom: 14px;
      min-height: 140px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-variant-numeric: tabular-nums;
      line-height: 1.08;
      white-space: nowrap;
      overflow: hidden;
      max-width: 100%;
    }

    .question .blank {
      display: inline-block;
      min-width: 1.7em;
      padding: 0 .1em;
      border-bottom: 5px solid var(--accent);
      color: var(--accent);
    }

    .question.ok {
      animation: pop .4s;
      color: var(--ok);
    }

    .question.bad {
      animation: shake .4s;
      color: var(--bad);
    }

    @keyframes pop {
      0% {
        transform: scale(1);
      }

      40% {
        transform: scale(1.08);
      }

      100% {
        transform: scale(1);
      }
    }

    @keyframes shake {

      0%,
      100% {
        transform: translateX(0);
      }

      20% {
        transform: translateX(-10px);
      }

      40% {
        transform: translateX(10px);
      }

      60% {
        transform: translateX(-6px);
      }

      80% {
        transform: translateX(6px);
      }
    }

    .progress {
      height: 8px;
      background: var(--panel2);
      border-radius: 999px;
      overflow: hidden;
      margin-bottom: 14px;
    }

    .progress>div {
      height: 100%;
      background: linear-gradient(90deg, #38bdf8, #a78bfa);
      transition: width .3s;
    }

    .keypad {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      touch-action: none;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }

    .key {
      padding: 22px 0;
      border: none;
      border-radius: 14px;
      background: var(--panel2);
      color: var(--text);
      font-size: 28px;
      font-weight: 700;
      cursor: pointer;
      transition: all .1s;
      font-variant-numeric: tabular-nums;
      touch-action: none;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }

    .key:hover {
      background: #475569;
    }

    .key:active,
    .key.pressed {
      transform: scale(.95);
      background: #38bdf8;
      color: #0f172a;
    }

    .key.action {
      background: #475569;
      font-size: 22px;
    }

    .key.clear {
      background: linear-gradient(135deg, #ef4444, #b91c1c);
      color: white;
    }

    .key.submit {
      background: linear-gradient(135deg, #22c55e, #16a34a);
      color: white;
      font-size: 22px;
    }

    .key.submit:hover {
      background: linear-gradient(135deg, #16a34a, #15803d);
    }

    .key.submit:active,
    .key.submit.pressed {
      background: #22c55e;
      color: #0f172a;
    }

    .row-ctrl {
      display: flex;
      gap: 8px;
      margin-top: 14px;
    }

    .row-ctrl .btn.small {
      flex: 1;
    }

    .row-ctrl .keypad-blank {
      background: #475569;
      box-shadow: none;
      color: transparent;
      cursor: default;
      pointer-events: none;
    }

    .result-big {
      text-align: center;
      padding: 22px 10px;
    }

    .result-big .emoji {
      font-size: 80px;
      line-height: 1;
      margin-bottom: 8px;
    }

    .result-big .title {
      font-size: 28px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .result-big .subr {
      color: var(--muted);
      margin-bottom: 20px;
    }

    .scoreGrid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-bottom: 18px;
    }

    .scoreGrid .stat {
      padding: 14px;
    }

    .scoreGrid .stat .v {
      font-size: 28px;
    }

    .review {
      max-height: 320px;
      overflow-y: auto;
      background: rgba(15, 23, 42, .5);
      border-radius: 12px;
      padding: 10px;
      margin-bottom: 14px;
    }

    .review-item {
      display: grid;
      grid-template-columns: 30px 1fr auto auto;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 8px;
      margin-bottom: 4px;
      font-size: 17px;
      font-variant-numeric: tabular-nums;
    }

    .review-item .qtime {
      font-size: 13px;
      color: var(--muted);
      white-space: nowrap;
    }

    .review-item.wrong {
      background: rgba(239, 68, 68, .15);
      color: #fca5a5;
    }

    .review-item.right {
      background: rgba(34, 197, 94, .1);
      color: #86efac;
    }

    .review-item .tick {
      font-size: 13px;
    }

    .history-list {
      margin-top: 6px;
    }

    .player-records-head {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 14px;
    }

    .player-records-back {
      width: auto;
      white-space: nowrap;
    }

    .player-records-title-wrap {
      min-width: 0;
    }

    .player-records-title {
      font-size: 20px;
      font-weight: 900;
      color: #f8fafc;
    }

    .player-records-sub {
      color: var(--muted);
      font-size: 12px;
      margin-top: 2px;
    }

    .player-records-sub:empty {
      display: none;
    }

    .player-records-profile {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 12px;
      padding: 12px;
      border: 1px solid rgba(148,163,184,.14);
      border-radius: 10px;
      background: rgba(15,23,42,.38);
    }

    .player-records-avatar {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      box-shadow: 0 0 0 2px rgba(15,23,42,.65);
    }

    .player-records-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .player-records-name {
      font-size: 18px;
      font-weight: 900;
      color: #f8fafc;
    }

    .player-records-profile-main {
      min-width: 0;
      flex: 1 1 auto;
    }

    .player-records-name-line {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      line-height: 1.25;
    }

    .player-records-style-line {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      margin-top: 4px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }

    .player-records-muted {
      color: var(--muted);
      font-size: 11px;
    }

    .player-records-xp {
      max-width: 360px;
    }

    .player-summary-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
      gap: 8px;
      margin-bottom: 12px;
    }

    .player-summary-cell {
      padding: 10px;
      border-radius: 8px;
      background: rgba(255,255,255,.055);
      border: 1px solid rgba(148,163,184,.12);
    }

    .player-summary-cell b {
      display: block;
      color: #fde68a;
      font-size: 17px;
      font-variant-numeric: tabular-nums;
    }

    .player-summary-cell span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }

    .player-records-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 6px 0 12px;
    }

    .player-records-tabs button {
      flex: 1 1 auto;
      min-height: 34px;
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 8px;
      background: rgba(15,23,42,.45);
      color: #cbd5e1;
      font-weight: 800;
      cursor: pointer;
    }

    .player-records-tabs button.active {
      color: #111827;
      background: linear-gradient(135deg, #fde68a, #86efac);
      border-color: rgba(253,230,138,.7);
    }

    .player-records-content {
      min-height: 120px;
    }

    .hist-card {
      background: var(--panel2);
      border-radius: 12px;
      margin-bottom: 8px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, .1);
    }

    .hist-head {
      padding: 12px 14px;
      display: grid;
      grid-template-columns: auto 1fr auto auto auto;
      gap: 10px;
      align-items: center;
      cursor: pointer;
      font-size: 14px;
    }

    .hist-head:hover {
      background: #3f516b;
    }

    .hist-head .date {
      color: var(--muted);
      font-size: 12px;
    }

    .hist-head .meta {
      color: var(--muted);
      font-size: 12px;
    }

    .hist-head .acc {
      font-weight: 700;
      font-size: 16px;
    }

    .hist-head .arrow {
      color: var(--muted);
      transition: transform .2s;
    }

    .hist-delete-btn {
      border: 1px solid rgba(248,113,113,.34);
      border-radius: 999px;
      background: rgba(248,113,113,.12);
      color: #fecaca;
      font-size: 12px;
      font-weight: 800;
      padding: 5px 10px;
      cursor: pointer;
      white-space: nowrap;
    }

    .hist-delete-btn:hover {
      background: rgba(248,113,113,.22);
      border-color: rgba(248,113,113,.56);
      color: #fff;
    }

    .hist-card.open .arrow {
      transform: rotate(90deg);
    }

    .hist-body {
      display: none;
      padding: 10px 14px 14px;
      background: rgba(15, 23, 42, .4);
      border-top: 1px solid rgba(148, 163, 184, .1);
    }

    .hist-card.open .hist-body {
      display: block;
      animation: fade .25s;
    }

    .hist-summary {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      font-size: 13px;
      color: var(--muted);
      margin-bottom: 10px;
    }

    .hist-summary span {
      background: rgba(255, 255, 255, .05);
      padding: 4px 8px;
      border-radius: 6px;
    }

    .hist-filter {
      display: flex;
      gap: 6px;
      margin-bottom: 8px;
    }

    .hist-filter button {
      padding: 4px 10px;
      border-radius: 6px;
      background: var(--panel);
      color: var(--muted);
      border: 1px solid rgba(148, 163, 184, .2);
      cursor: pointer;
      font-size: 12px;
    }

    .hist-filter button.active {
      background: var(--accent);
      color: #0f172a;
      border-color: var(--accent);
    }

    .rank-section {
      margin-bottom: 22px;
    }

    .rank-title {
      font-size: 15px;
      font-weight: 700;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--gold);
    }

    .rank-title .desc {
      font-weight: 400;
      color: var(--muted);
      font-size: 12px;
    }

    .rank-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .rank-row {
      display: grid;
      grid-template-columns: 40px auto 1fr auto;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border-radius: 10px;
      background: var(--panel2);
      font-size: 15px;
    }

    .rank-row[data-rank-uid],
    .daily-mini-row[data-rank-uid],
    .quest-rank-chip[data-rank-uid] {
      cursor: pointer;
    }

    .rank-row.gold {
      background: linear-gradient(90deg, rgba(251, 191, 36, .2), var(--panel2));
      border-left: 3px solid var(--gold);
    }

    .rank-row.silver {
      background: linear-gradient(90deg, rgba(203, 213, 225, .12), var(--panel2));
      border-left: 3px solid var(--silver);
    }

    .rank-row.bronze {
      background: linear-gradient(90deg, rgba(249, 115, 22, .15), var(--panel2));
      border-left: 3px solid var(--bronze);
    }

    .rank-medal {
      font-size: 22px;
      text-align: center;
    }

    .rank-av {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }

    .rank-name {
      font-weight: 700;
    }

    .rank-val {
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      color: var(--accent);
    }

    .rank-row.muted {
      opacity: .5;
    }

    .rank-row .nodata {
      color: var(--muted);
      font-size: 13px;
      font-style: italic;
    }

    .empty {
      text-align: center;
      color: var(--muted);
      padding: 30px 10px;
      font-size: 14px;
    }

    .tips {
      font-size: 12px;
      color: var(--muted);
      text-align: center;
      margin-top: 12px;
      line-height: 1.6;
    }

    .signup-panel {
      display: none;
      margin-top: 12px;
    }

    .signup-panel.open {
      display: block;
      animation: fade .25s ease;
    }

    .picker-feedback-line {
      margin: -4px 0 16px;
      padding: 8px 12px;
      border: 1px solid rgba(56,189,248,.18);
      border-radius: 10px;
      background: rgba(15,23,42,.22);
      color: var(--muted);
      font-size: 13px;
      text-align: center;
    }
    .picker-feedback-line button {
      border: 0;
      background: transparent;
      color: #7dd3fc;
      font-weight: 900;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 3px;
    }
    .feedback-modal {
      position: fixed;
      inset: 0;
      z-index: 9200;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(2, 6, 23, .66);
      backdrop-filter: blur(4px);
    }
    .feedback-card {
      width: min(480px, 100%);
      max-height: calc(100vh - 36px);
      overflow: auto;
      border: 1px solid rgba(125,211,252,.24);
      border-radius: 8px;
      background: #0f172a;
      box-shadow: 0 20px 60px rgba(0,0,0,.36);
      padding: 20px;
    }
    .feedback-title {
      color: #e0f2fe;
      font-size: 20px;
      font-weight: 950;
      text-align: center;
    }
    .feedback-sub {
      margin: 7px 0 14px;
      color: #94a3b8;
      font-size: 13px;
      line-height: 1.55;
      text-align: center;
    }
    .feedback-card label {
      display: grid;
      gap: 6px;
      margin-top: 10px;
      color: #cbd5e1;
      font-size: 13px;
      font-weight: 800;
    }
    .feedback-card input,
    .feedback-card select,
    .feedback-card textarea {
      width: 100%;
      border: 1px solid rgba(148,163,184,.28);
      border-radius: 8px;
      background: rgba(15,23,42,.72);
      color: var(--text);
      padding: 10px 12px;
      font-size: 14px;
      outline: none;
    }
    .feedback-card textarea {
      min-height: 112px;
      resize: vertical;
      line-height: 1.55;
    }
    .feedback-card input:focus,
    .feedback-card select:focus,
    .feedback-card textarea:focus {
      border-color: rgba(125,211,252,.72);
      box-shadow: 0 0 0 3px rgba(14,165,233,.16);
    }
    .feedback-code-box {
      display: none;
      margin-top: 12px;
      padding: 10px 12px;
      border: 1px solid rgba(34,197,94,.32);
      border-radius: 8px;
      background: rgba(22,101,52,.18);
      color: #bbf7d0;
      font-size: 13px;
      line-height: 1.55;
    }
    .feedback-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 14px;
    }
    .feedback-reply-card {
      width: min(560px, 100%);
    }
    .feedback-reply-list {
      display: grid;
      gap: 10px;
      margin-top: 12px;
    }
    .feedback-reply-row {
      border: 1px solid rgba(251,191,36,.26);
      border-radius: 8px;
      background: rgba(15,23,42,.46);
      padding: 12px;
    }
    .feedback-reply-row-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
      color: #fde68a;
      font-size: 12px;
      font-weight: 850;
    }
    .feedback-reply-row-meta b {
      color: #fef3c7;
      font-size: 14px;
    }
    .feedback-reply-row-meta span {
      color: #94a3b8;
      font-weight: 700;
    }
    .feedback-reply-user-message,
    .feedback-reply-admin-message {
      color: #cbd5e1;
      font-size: 13px;
      line-height: 1.55;
      word-break: break-word;
    }
    .feedback-reply-user-message {
      margin-bottom: 8px;
      opacity: .72;
    }
    .feedback-reply-admin-message {
      border-left: 3px solid #facc15;
      padding-left: 10px;
      color: #fef9c3;
      font-weight: 850;
    }
    .feedback-admin-list {
      display: grid;
      gap: 10px;
    }
    .admin-panel-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 0 0 16px;
      padding: 6px;
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 14px;
      background: rgba(15,23,42,.34);
    }
    .admin-panel-tab {
      min-width: 96px;
      border: 1px solid rgba(148,163,184,.24);
      border-radius: 10px;
      background: rgba(15,23,42,.56);
      color: var(--text);
      padding: 10px 14px;
      font-size: 14px;
      font-weight: 850;
      cursor: pointer;
    }
    .admin-panel-tab.active {
      border-color: rgba(125,211,252,.72);
      background: linear-gradient(135deg, rgba(14,165,233,.95), rgba(99,102,241,.95));
      color: #fff;
      box-shadow: 0 10px 22px rgba(14,165,233,.18);
    }
    .admin-panel-tab:focus-visible {
      outline: 3px solid rgba(125,211,252,.38);
      outline-offset: 2px;
    }
    .admin-panel-body {
      min-width: 0;
    }

    .challenge-admin-section .info-box {
      line-height: 1.55;
    }

    .challenge-admin-form {
      border: 1px solid rgba(148, 163, 184, .18);
      border-radius: 8px;
      background: rgba(15, 23, 42, .42);
      padding: 14px;
    }

    .challenge-admin-form-title {
      margin-bottom: 10px;
      color: #fde68a;
      font-size: 15px;
      font-weight: 900;
    }

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

    .challenge-admin-grid label {
      display: grid;
      gap: 5px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }

    .challenge-admin-grid input,
    .challenge-admin-grid select {
      min-width: 0;
      width: 100%;
      min-height: 38px;
      border: 1px solid rgba(148, 163, 184, .24);
      border-radius: 8px;
      background: rgba(2, 6, 23, .36);
      color: var(--text);
      padding: 8px 10px;
      font: inherit;
      font-size: 13px;
    }

    .challenge-admin-grid input:disabled {
      opacity: .55;
    }

    .challenge-admin-check {
      display: flex !important;
      grid-template-columns: auto 1fr;
      align-items: center;
      gap: 8px !important;
      min-height: 38px;
      padding: 8px 10px;
      border: 1px solid rgba(148, 163, 184, .18);
      border-radius: 8px;
      background: rgba(2, 6, 23, .22);
    }

    .challenge-admin-check input {
      width: auto;
      min-height: 0;
      margin: 0;
    }

    .challenge-admin-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .challenge-admin-list {
      display: grid;
      gap: 8px;
    }

    .challenge-admin-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 12px;
      border: 1px solid rgba(148, 163, 184, .18);
      border-radius: 8px;
      background: rgba(15, 23, 42, .44);
    }

    .challenge-admin-row.inactive {
      opacity: .65;
    }

    .challenge-admin-row-main {
      min-width: 0;
    }

    .challenge-admin-row-title {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      color: #f8fafc;
      font-size: 14px;
      font-weight: 900;
    }

    .challenge-admin-row-title b {
      color: #fde68a;
      font-size: 12px;
    }

    .challenge-admin-row-meta {
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }

    .challenge-admin-row-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 6px;
    }

    @media (max-width: 720px) {
      .challenge-admin-grid {
        grid-template-columns: 1fr 1fr;
      }

      .challenge-admin-row {
        grid-template-columns: 1fr;
      }

      .challenge-admin-row-actions {
        justify-content: flex-start;
      }
    }

    @media (max-width: 460px) {
      .challenge-admin-grid {
        grid-template-columns: 1fr;
      }
    }

    .announcement-admin-section .info-box {
      line-height: 1.6;
    }

    .announcement-admin-form {
      border: 1px solid rgba(251, 191, 36, .28);
      border-radius: 8px;
      background: linear-gradient(135deg, rgba(120, 53, 15, .24), rgba(15, 23, 42, .5));
      padding: 14px;
    }

    .announcement-admin-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 220px;
      gap: 10px;
      align-items: end;
    }

    .announcement-admin-grid label {
      display: grid;
      gap: 5px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }

    .announcement-admin-grid input,
    .announcement-admin-grid textarea {
      min-width: 0;
      width: 100%;
      border: 1px solid rgba(148, 163, 184, .24);
      border-radius: 8px;
      background: rgba(2, 6, 23, .42);
      color: var(--text);
      padding: 9px 10px;
      font: inherit;
      font-size: 14px;
    }

    .announcement-admin-grid textarea {
      min-height: 116px;
      resize: vertical;
      line-height: 1.55;
    }

    .announcement-admin-body-field {
      grid-column: 1 / -1;
    }

    .announcement-admin-list {
      display: grid;
      gap: 8px;
    }

    .announcement-admin-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 12px;
      border: 1px solid rgba(251, 191, 36, .24);
      border-radius: 8px;
      background: rgba(15, 23, 42, .46);
    }

    .announcement-admin-row.inactive,
    .announcement-admin-row.expired {
      opacity: .68;
    }

    .announcement-admin-row-main {
      min-width: 0;
    }

    .announcement-admin-row-title {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      color: #f8fafc;
      font-size: 15px;
      font-weight: 900;
    }

    .announcement-admin-row-title b {
      color: #fde68a;
      font-size: 12px;
    }

    .announcement-admin-row-meta,
    .announcement-admin-row-body {
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }

    .announcement-admin-row-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 6px;
    }

    .announcement-popup-overlay {
      position: fixed;
      inset: 0;
      z-index: 12000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(2, 6, 23, .72);
      backdrop-filter: blur(10px);
    }

    .announcement-popup-overlay.active {
      display: flex;
    }

    .announcement-popup-card {
      --announcement-bg: url("/assets/img/ui/announcement-bg-image2.png");
      position: relative;
      width: min(960px, 94vw);
      aspect-ratio: 16 / 9;
      overflow: hidden;
      border-radius: 8px;
      border: 1px solid rgba(253, 230, 138, .8);
      box-shadow: 0 28px 80px rgba(0, 0, 0, .55), 0 0 44px rgba(251, 191, 36, .26);
      isolation: isolate;
    }

    .announcement-popup-card::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -2;
      background-image: var(--announcement-bg);
      background-position: center;
      background-size: cover;
    }

    .announcement-popup-card::after {
      content: "";
      position: absolute;
      inset: 12% 13% 9%;
      z-index: -1;
      border-radius: 8px;
      background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .52), rgba(255, 248, 220, .22) 58%, rgba(255, 255, 255, 0) 78%);
      pointer-events: none;
    }

    .announcement-popup-shine {
      position: absolute;
      inset: 0;
      background: linear-gradient(115deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, .16) 62%, rgba(255, 255, 255, 0));
      pointer-events: none;
      mix-blend-mode: screen;
    }

    .announcement-popup-content {
      position: absolute;
      inset: 17% 18% 12%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      text-align: center;
      color: #482707;
    }

    .announcement-popup-kicker {
      color: #0f766e;
      font-size: 15px;
      font-weight: 900;
      letter-spacing: 0;
    }

    .announcement-popup-content h2 {
      margin: 0;
      color: #7c2d12;
      font-size: 32px;
      line-height: 1.12;
      font-weight: 950;
      letter-spacing: 0;
      text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
    }

    .announcement-popup-body {
      max-height: 46%;
      overflow: auto;
      padding: 0 8px;
      color: #3b2608;
      font-size: 30px;
      line-height: 1.35;
      font-weight: 900;
      text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
    }

    .announcement-popup-error {
      min-height: 18px;
      color: #b91c1c;
      font-size: 13px;
      font-weight: 800;
    }

    .announcement-popup-confirm {
      min-width: 132px;
      min-height: 44px;
      border: 1px solid rgba(120, 53, 15, .24);
      border-radius: 8px;
      background: linear-gradient(135deg, #facc15, #d97706);
      color: #3b1d03;
      font-size: 18px;
      font-weight: 950;
      cursor: pointer;
      box-shadow: 0 10px 18px rgba(146, 64, 14, .24);
    }

    .announcement-popup-confirm:disabled {
      opacity: .7;
      cursor: wait;
    }

    @media (max-width: 720px) {
      .announcement-admin-grid,
      .announcement-admin-row {
        grid-template-columns: 1fr;
      }

      .announcement-admin-row-actions {
        justify-content: flex-start;
      }

      .announcement-popup-card {
        width: min(96vw, 620px);
        min-height: 520px;
        aspect-ratio: auto;
      }

      .announcement-popup-card::before {
        background-size: cover;
      }

      .announcement-popup-content {
        inset: 18% 12% 12%;
      }

      .announcement-popup-content h2 {
        font-size: 27px;
      }

      .announcement-popup-body {
        max-height: 52%;
        font-size: 25px;
      }
    }
    .feedback-admin-notice {
      border: 1px solid rgba(251,191,36,.55);
      border-radius: 14px;
      background: linear-gradient(135deg, rgba(120,53,15,.78), rgba(30,41,59,.82));
      box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 24px rgba(251,191,36,.12);
      margin-bottom: 14px;
      padding: 14px;
    }
    .feedback-admin-notice-kicker {
      color: #fde68a;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: .08em;
      margin-bottom: 7px;
    }
    .feedback-admin-notice-head {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      color: #f8fafc;
      font-size: 13px;
      margin-bottom: 8px;
    }
    .feedback-admin-notice-head b {
      color: #fff7ed;
      font-size: 15px;
    }
    .feedback-admin-notice-head span {
      border: 1px solid rgba(253,230,138,.24);
      border-radius: 999px;
      background: rgba(15,23,42,.28);
      color: #fde68a;
      padding: 3px 8px;
    }
    .feedback-admin-notice-message {
      color: #fff7ed;
      font-size: 15px;
      font-weight: 700;
      line-height: 1.6;
      white-space: pre-wrap;
    }
    .feedback-admin-item {
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 10px;
      background: rgba(15,23,42,.44);
      padding: 12px;
    }
    .feedback-admin-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 8px;
    }
    .feedback-admin-message,
    .feedback-admin-reply {
      white-space: pre-wrap;
      color: #e2e8f0;
      font-size: 13px;
      line-height: 1.55;
    }
    .feedback-admin-reply {
      margin-top: 8px;
      color: #bbf7d0;
    }
    .feedback-admin-item textarea {
      width: 100%;
      min-height: 70px;
      margin-top: 10px;
      padding: 9px 10px;
      border-radius: 8px;
      border: 1px solid rgba(148,163,184,.24);
      background: rgba(2,6,23,.38);
      color: var(--text);
      resize: vertical;
    }
    .presence-admin-section h3 {
      margin: 0 0 10px;
      font-size: 15px;
      color: #e2e8f0;
    }
    .presence-filter-panel {
      border: 1px solid rgba(148,163,184,.18);
      background: rgba(15,23,42,.36);
      border-radius: 8px;
      padding: 12px;
    }
    .presence-filter-row {
      display: flex;
      flex-wrap: wrap;
      align-items: end;
      gap: 10px;
    }
    .presence-range-buttons {
      display: inline-flex;
      gap: 6px;
      padding: 4px;
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 8px;
      background: rgba(2,6,23,.24);
    }
    .presence-range-buttons button {
      border: 0;
      border-radius: 6px;
      padding: 8px 12px;
      color: #cbd5e1;
      background: transparent;
      font-weight: 700;
      cursor: pointer;
    }
    .presence-range-buttons button.active {
      color: #082f49;
      background: #67e8f9;
    }
    .presence-filter-row label {
      display: grid;
      gap: 4px;
      color: var(--muted);
      font-size: 12px;
      min-width: 160px;
    }
    .presence-filter-row select {
      min-height: 36px;
      border-radius: 8px;
      border: 1px solid rgba(148,163,184,.26);
      background: rgba(15,23,42,.72);
      color: var(--text);
      padding: 0 10px;
    }
    .presence-summary-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 10px;
      margin-bottom: 14px;
    }
    .presence-summary-grid > div {
      border: 1px solid rgba(148,163,184,.18);
      background: rgba(15,23,42,.42);
      border-radius: 8px;
      padding: 12px;
      min-width: 0;
    }
    .presence-summary-grid b {
      display: block;
      color: #67e8f9;
      font-size: 24px;
      line-height: 1.05;
    }
    .presence-summary-grid span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      margin-top: 4px;
    }
    .presence-admin-split {
      display: grid;
      grid-template-columns: 1fr;
      gap: 14px;
      margin-top: 14px;
    }
    .presence-admin-split > div {
      min-width: 0;
      overflow: hidden;
    }
    .presence-table-wrap {
      overflow-x: auto;
      max-width: 100%;
    }
    .presence-admin-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 0;
      table-layout: fixed;
      font-size: 12px;
    }
    .presence-table-wrap .presence-admin-table {
      min-width: 760px;
    }
    .presence-admin-table th,
    .presence-admin-table td {
      border-bottom: 1px solid rgba(148,163,184,.16);
      padding: 8px 7px;
      text-align: left;
      vertical-align: top;
      overflow-wrap: anywhere;
    }
    .presence-admin-table th {
      color: #93c5fd;
      font-weight: 700;
      background: rgba(15,23,42,.38);
      position: sticky;
      top: 0;
    }
    .presence-hour-chart {
      height: 180px;
      display: grid;
      grid-template-columns: repeat(24, minmax(0, 1fr));
      align-items: end;
      gap: 3px;
      border: 1px solid rgba(148,163,184,.16);
      border-radius: 8px;
      padding: 12px 8px 22px;
      background: rgba(15,23,42,.32);
      overflow: hidden;
    }
    .presence-hour {
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      align-items: center;
      gap: 3px;
      min-width: 0;
      color: var(--muted);
      font-size: 10px;
      position: relative;
    }
    .presence-hour span {
      display: none;
    }
    .presence-hour:nth-child(1) span,
    .presence-hour:nth-child(7) span,
    .presence-hour:nth-child(13) span,
    .presence-hour:nth-child(19) span,
    .presence-hour:nth-child(24) span {
      display: block;
    }
    .presence-hour i {
      display: block;
      width: 100%;
      max-width: 12px;
      min-height: 3px;
      border-radius: 4px 4px 0 0;
      background: linear-gradient(180deg,#67e8f9,#2563eb);
    }
    .presence-hour b {
      position: absolute;
      bottom: -17px;
      color: #e2e8f0;
      font-size: 9px;
      font-weight: 700;
    }
    .presence-current-hour {
      margin-top: 12px;
      border: 1px solid rgba(148,163,184,.16);
      border-radius: 8px;
      background: rgba(15,23,42,.26);
      padding: 10px;
    }
    .presence-current-hour-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 8px;
    }
    .presence-current-hour-head h3 {
      margin: 0;
    }
    .presence-current-hour-head span {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
    }
    .presence-battle-stats {
      margin-top: 14px;
      border: 1px solid rgba(148,163,184,.16);
      border-radius: 8px;
      background: rgba(15,23,42,.26);
      padding: 12px;
    }
    .presence-battle-summary {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px;
    }
    .presence-battle-summary > div {
      border: 1px solid rgba(148,163,184,.16);
      border-radius: 8px;
      background: rgba(2,6,23,.24);
      padding: 10px;
    }
    .presence-battle-summary b {
      display: block;
      color: #fde68a;
      font-size: 22px;
      line-height: 1.05;
    }
    .presence-battle-summary span {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 12px;
    }
    .presence-session-details {
      margin-top: 14px;
      border: 1px solid rgba(148,163,184,.16);
      border-radius: 8px;
      padding: 10px 12px;
      background: rgba(15,23,42,.28);
    }
    .presence-session-details summary {
      cursor: pointer;
      font-weight: 700;
      color: #e2e8f0;
    }
    .presence-admin-note {
      color: var(--muted);
      font-size: 12px;
      margin-top: 10px;
    }
    @media (max-width: 760px) {
      .presence-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .presence-battle-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .presence-admin-split {
        grid-template-columns: 1fr;
      }
    }

    .signup-grid {
      display: grid;
      grid-template-columns: 1fr 1fr auto auto;
      gap: 8px;
    }

    .db-row {
      display: grid;
      grid-template-columns: auto 1fr auto auto;
      gap: 10px;
      align-items: center;
      padding: 10px 12px;
      border-radius: 10px;
      background: var(--panel2);
      margin-bottom: 6px;
    }

    code {
      background: rgba(255, 255, 255, .08);
      padding: 1px 5px;
      border-radius: 4px;
      font-size: 12px;
    }

    .info-box {
      background: rgba(56, 189, 248, .1);
      border: 1px solid rgba(56, 189, 248, .3);
      border-radius: 12px;
      padding: 14px;
      margin-bottom: 16px;
      font-size: 13px;
      line-height: 1.7;
    }

    @media (max-width:480px) {
      .row label {
        flex: 0 0 100%;
        margin-bottom: 4px;
      }

      .hud {
        grid-template-columns: repeat(2, 1fr);
      }

      .key {
        font-size: 24px;
        padding: 18px 0;
      }

      .hist-head {
        grid-template-columns: 1fr auto auto auto;
      }

      .hist-head .date,
      .hist-head .meta {
        grid-column: 1/-1;
      }

      .signup-grid {
        grid-template-columns: 1fr;
      }

      .today-stats {
        grid-template-columns: repeat(2, 1fr);
      }

      .daily-head,
      .daily-actions {
        flex-direction: column;
      }

      .achv-grid {
        grid-template-columns: repeat(2, 1fr);
      }

      .chart-canvas {
        height: 160px;
      }

      .countdown-number {
        font-size: 80px;
      }
    }

    /* ===== hide top header on result screen so bottom buttons reachable ===== */
    @media (max-width: 1200px), (hover: none) and (pointer: coarse) {
      body[data-screen="result"] > h1,
      body[data-screen="result"] > .sub,
      body[data-screen="result"] > #onlineBadge,
      body[data-screen="result"] > #presenceStrip {
        display: none !important;
      }
    }

    /* ===== full-viewport play screen on touch devices ===== */
    @media (max-width: 1200px), (hover: none) and (pointer: coarse) {
      body[data-screen="play"] {
        overscroll-behavior: none;
        touch-action: manipulation;
      }
      body[data-screen="play"] {
        overflow: hidden;
        padding: 0;
        height: 100svh;
        min-height: 100svh;
        justify-content: flex-start;
      }
      body[data-screen="play"] > h1,
      body[data-screen="play"] > .sub,
      body[data-screen="play"] > #onlineBadge,
      body[data-screen="play"] > #presenceStrip {
        display: none !important;
      }
      body[data-screen="play"] > .card {
        max-width: 100vw;
        width: 100vw;
        height: 100svh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 8px 10px env(safe-area-inset-bottom, 8px);
        display: flex;
        flex-direction: column;
      }
      body[data-screen="play"] > .card > #play.screen.active {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        gap: 8px;
      }
      body[data-screen="play"] #play .hud {
        margin-bottom: 0;
        flex: 0 0 auto;
        gap: 6px;
      }
      body[data-screen="play"] #play .hud .stat {
        padding: 6px 4px;
      }
      body[data-screen="play"] #play .hud .stat .v {
        font-size: 18px;
      }
      body[data-screen="play"] #play .hud .stat .k {
        font-size: 11px;
      }
      body[data-screen="play"] #play .progress {
        margin-bottom: 0;
        flex: 0 0 auto;
      }
      body[data-screen="play"] #play .question {
        margin-bottom: 0;
        min-height: 0;
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px 10px;
        font-size: 54px;
        letter-spacing: 0;
        line-height: 1.05;
        white-space: nowrap;
      }
      body[data-screen="play"] #play .keypad {
        flex: 0 0 auto;
        height: min(50svh, 480px);
        max-width: 460px;
        width: 100%;
        align-self: center;
        min-height: 0;
        gap: 8px;
      }
      body[data-screen="play"] #play .key {
        padding: 0;
        height: 100%;
        min-height: 0;
        font-size: clamp(24px, 6vw, 34px);
      }
      body[data-screen="play"] #play .row-ctrl {
        margin-top: 0;
        flex: 0 0 auto;
        max-width: 460px;
        width: 100%;
        align-self: center;
      }
    }

    /* ===== focused answer mode on every viewport ===== */
    body[data-screen="play"] {
      overflow: hidden;
      padding: 0;
      height: 100svh;
      min-height: 100svh;
      justify-content: flex-start;
      overscroll-behavior: none;
      touch-action: manipulation;
    }

    body[data-screen="play"] > .app-header,
    body[data-screen="play"] > h1,
    body[data-screen="play"] > .sub,
    body[data-screen="play"] > #onlineBadge,
    body[data-screen="play"] > #presenceStrip,
    body[data-screen="play"] > .switch-user-fab {
      display: none !important;
    }

    body[data-screen="play"] > .card {
      max-width: 100vw;
      width: 100vw;
      height: 100svh;
      border-radius: 0;
      border: none;
      box-shadow: none;
      padding: 8px 10px env(safe-area-inset-bottom, 8px);
      display: flex;
      flex-direction: column;
    }

    body[data-screen="play"] > .card > #play.screen.active {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
      gap: 8px;
    }

    body[data-screen="play"] #play .hud {
      margin-bottom: 0;
      flex: 0 0 auto;
      gap: 6px;
    }

    body[data-screen="play"] #play .hud .stat {
      padding: 6px 4px;
    }

    body[data-screen="play"] #play .hud .stat .v {
      font-size: 18px;
    }

    body[data-screen="play"] #play .hud .stat .k {
      font-size: 11px;
    }

    body[data-screen="play"] #play .progress {
      margin-bottom: 0;
      flex: 0 0 auto;
    }

    body[data-screen="play"] #play .question {
      margin-bottom: 0;
      min-height: 0;
      flex: 1 1 auto;
      padding: 16px 10px;
      font-size: 54px;
      letter-spacing: 0;
      line-height: 1.05;
    }

    body[data-screen="play"] #play .keypad {
      flex: 0 0 auto;
      height: min(50svh, 480px);
      max-width: min(760px, calc(100vw - 20px));
      width: 100%;
      align-self: center;
      min-height: 0;
      gap: 8px;
    }

    body[data-screen="play"] #play .key {
      padding: 0;
      height: 100%;
      min-height: 0;
      font-size: clamp(24px, 6vw, 34px);
    }

    body[data-screen="play"] #play .row-ctrl {
      margin-top: 0;
      flex: 0 0 auto;
      max-width: min(760px, calc(100vw - 20px));
      width: 100%;
      align-self: center;
    }

    @media (max-width: 520px) {
      body[data-screen="play"] #play .question {
        font-size: 34px;
        padding-left: 4px;
        padding-right: 4px;
      }

      body[data-screen="play"] #play .question .blank {
        min-width: 1.35em;
        border-bottom-width: 3px;
      }
    }

    @media (max-width: 380px) {
      body[data-screen="play"] #play .question {
        font-size: 30px;
      }
    }

    /* ===== draft / scratchpad overlay ===== */
    .draft-overlay {
      display: none;
      position: fixed !important;
      inset: 0 !important;
      width: auto !important;
      height: auto !important;
      background: #fafafa;
      z-index: 9998;
      touch-action: none;
      overscroll-behavior: contain;
      overflow: hidden;
      user-select: none;
      -webkit-user-select: none;
      -ms-user-select: none;
      -webkit-touch-callout: none;
    }
    .draft-overlay.active { display: block; }
    .draft-overlay *,
    body[data-screen="quest-play"] #quest-play,
    body[data-screen="quest-play"] #quest-play * {
      user-select: none;
      -webkit-user-select: none;
      -ms-user-select: none;
      -webkit-touch-callout: none;
    }
    .draft-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      background: #fafafa;
      touch-action: none;
      cursor: crosshair;
    }
    .draft-close {
      position: fixed !important;
      top: auto !important;
      left: 12px !important;
      right: auto !important;
      bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
      z-index: 10000;
      background: #0ea5e9 !important;
      color: #fff !important;
      box-shadow: 0 6px 18px rgba(0,0,0,.25) !important;
    }
    .draft-clear {
      position: fixed !important;
      top: auto !important;
      left: auto !important;
      right: 12px !important;
      bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
      z-index: 10000;
      background: #ef4444 !important;
      color: #fff !important;
      box-shadow: 0 6px 18px rgba(0,0,0,.25) !important;
    }

    /* ===== countdown overlay ===== */
    .countdown-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(15, 23, 42, .94);
      z-index: 9999;
      align-items: center;
      justify-content: center;
      flex-direction: column;
    }

    .countdown-number {
      font-size: clamp(80px, 20vw, 140px);
      font-weight: 900;
      color: var(--accent);
      animation: countPop .28s ease;
      text-shadow: 0 0 60px rgba(56, 189, 248, .5);
    }

    .countdown-go {
      color: var(--ok) !important;
    }

    @keyframes countPop {
      0% {
        transform: scale(2.5);
        opacity: 0;
      }

      50% {
        transform: scale(1.05);
        opacity: 1;
      }

      100% {
        transform: scale(1);
        opacity: 1;
      }
    }

    /* ===== combo fire ===== */
    .combo-fire {
      position: fixed;
      top: 50%;
      font-size: clamp(40px, 10vw, 80px);
      z-index: 999;
      pointer-events: none;
      animation: comboFireAnim .8s ease-out forwards;
      text-shadow: 0 0 30px rgba(245, 158, 11, .8);
    }

    .combo-fire.left {
      left: 10%;
      transform: translate(-50%, -50%);
    }

    .combo-fire.right {
      right: 10%;
      transform: translate(50%, -50%);
    }

    @keyframes comboFireAnim {
      0% {
        transform: scale(0.5) translateY(20px) rotate(-10deg);
        opacity: 0;
      }

      30% {
        transform: scale(1.5) translateY(0) rotate(5deg);
        opacity: 1;
      }

      100% {
        transform: scale(1) translateY(-60px) rotate(0);
        opacity: 0;
      }
    }

    /* ===== confetti ===== */
    .confetti-canvas {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 9998;
      display: none;
    }

    /* ===== today stats ===== */
    .today-stats {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-bottom: 18px;
    }

    .ts-item {
      background: var(--panel2);
      border-radius: 12px;
      padding: 12px 8px;
      text-align: center;
    }

    .ts-icon {
      font-size: 20px;
      margin-bottom: 2px;
    }

    .ts-label {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 4px;
    }

    .ts-val {
      font-size: 18px;
      font-weight: 700;
      color: var(--accent);
    }

    .ts-val.up {
      color: var(--ok);
    }

    .ts-val.down {
      color: var(--bad);
    }

    .weak-hint {
      background: rgba(245, 158, 11, .1);
      border: 1px solid rgba(245, 158, 11, .3);
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 14px;
      font-size: 13px;
      color: var(--warn);
      display: none;
    }

    .daily-challenge-card {
      background: linear-gradient(135deg, rgba(14, 165, 233, .14), rgba(99, 102, 241, .16));
      border: 1px solid rgba(99, 102, 241, .28);
      border-radius: 16px;
      padding: 16px;
      box-shadow: 0 12px 24px rgba(15, 23, 42, .18);
    }

    .challenge-mission-zone {
      margin-bottom: 14px;
    }

    .challenge-mission-shell {
      border: 1px solid rgba(251, 191, 36, .38);
      border-radius: 8px;
      background:
        linear-gradient(135deg, rgba(15, 23, 42, .78), rgba(30, 41, 59, .72)),
        linear-gradient(90deg, rgba(251, 191, 36, .16), rgba(34, 197, 94, .09), rgba(56, 189, 248, .10));
      padding: 14px;
      box-shadow: 0 12px 26px rgba(15, 23, 42, .2);
    }

    .challenge-mission-shell.empty-state {
      border-color: rgba(148, 163, 184, .22);
      background: rgba(15, 23, 42, .38);
    }

    .challenge-mission-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 10px;
    }

    .challenge-mission-kicker {
      color: #fde68a;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: .08em;
    }

    .challenge-mission-heading {
      margin-top: 2px;
      color: #f8fafc;
      font-size: 18px;
      font-weight: 900;
      line-height: 1.2;
    }

    .challenge-mission-refresh {
      width: 34px;
      height: 34px;
      border: 1px solid rgba(148, 163, 184, .24);
      border-radius: 50%;
      background: rgba(15, 23, 42, .62);
      color: #e0f2fe;
      font-size: 20px;
      font-weight: 900;
      cursor: pointer;
    }

    .challenge-mission-list {
      display: grid;
      gap: 8px;
    }

    .challenge-mission-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 12px;
      border: 1px solid rgba(148, 163, 184, .18);
      border-radius: 8px;
      background: rgba(15, 23, 42, .48);
    }

    .challenge-mission-row.claimable {
      border-color: rgba(34, 197, 94, .48);
      background: linear-gradient(135deg, rgba(20, 83, 45, .34), rgba(15, 23, 42, .46));
    }

    .challenge-mission-row.claimed,
    .challenge-mission-row.expired {
      opacity: .78;
    }

    .challenge-mission-main {
      min-width: 0;
    }

    .challenge-mission-title {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      color: #f8fafc;
      font-size: 15px;
      font-weight: 900;
      line-height: 1.25;
    }

    .challenge-mission-reward {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      background: rgba(251, 191, 36, .18);
      border: 1px solid rgba(251, 191, 36, .28);
      color: #fde68a;
      font-size: 12px;
      font-weight: 900;
      white-space: nowrap;
    }

    .challenge-mission-meta,
    .challenge-mission-progress {
      margin-top: 5px;
      color: #cbd5e1;
      font-size: 12px;
      line-height: 1.45;
    }

    .challenge-mission-progress {
      color: #bbf7d0;
    }

    .challenge-mission-success-list {
      display: grid;
      justify-items: start;
      gap: 6px;
      margin-top: 8px;
      color: #d9f99d;
      font-size: 12px;
      line-height: 1.4;
    }

    .challenge-mission-success-toggle {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 28px;
      padding: 4px 10px;
      border: 1px solid rgba(74, 222, 128, .28);
      border-radius: 999px;
      background: rgba(34, 197, 94, .12);
      color: #fde68a;
      font: inherit;
      font-weight: 900;
      white-space: nowrap;
      cursor: pointer;
    }

    .challenge-mission-success-toggle b {
      color: #dcfce7;
      font-size: 11px;
      font-weight: 900;
    }

    .challenge-mission-success-toggle::after {
      content: "▾";
      color: #bbf7d0;
      font-size: 11px;
      transition: transform .16s ease;
    }

    .challenge-mission-success-toggle[aria-expanded="true"]::after {
      transform: rotate(180deg);
    }

    .challenge-mission-success-names {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 5px;
      min-width: 0;
    }

    .challenge-mission-success-names[hidden] {
      display: none;
    }

    .challenge-mission-success-names span {
      display: inline-flex;
      align-items: center;
      min-height: 22px;
      padding: 2px 7px;
      border-radius: 999px;
      background: rgba(34, 197, 94, .14);
      border: 1px solid rgba(74, 222, 128, .2);
      color: #dcfce7;
      font-weight: 900;
    }

    .challenge-mission-side {
      display: grid;
      gap: 8px;
      justify-items: end;
      min-width: 118px;
    }

    .challenge-mission-time {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }

    .challenge-mission-time-label {
      color: #d1fae5;
      font-size: 12px;
      font-weight: 900;
      white-space: nowrap;
    }

    .challenge-mission-countdown {
      padding: 4px 8px;
      border-radius: 999px;
      background: rgba(2, 6, 23, .38);
      border: 1px solid rgba(125, 211, 252, .22);
      color: #bae6fd;
      font-size: 12px;
      font-weight: 900;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    .challenge-mission-btn {
      min-width: 108px;
      box-shadow: none;
    }

    .challenge-mission-btn.claim {
      background: linear-gradient(135deg, #22c55e, #16a34a);
      color: #052e16;
    }

    @media (max-width: 560px) {
      .challenge-mission-row {
        grid-template-columns: 1fr;
      }

      .challenge-mission-side {
        display: flex;
        justify-content: space-between;
        align-items: center;
        justify-items: stretch;
        min-width: 0;
      }

      .challenge-mission-btn {
        min-width: 102px;
      }
    }

    .daily-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 10px;
    }

    .daily-title {
      font-size: 20px;
      font-weight: 800;
      color: #e0f2fe;
    }

    .daily-sub {
      font-size: 12px;
      color: var(--muted);
      margin-top: 2px;
    }

    .daily-status {
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(148, 163, 184, .16);
      border: 1px solid rgba(148, 163, 184, .2);
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .daily-status.done {
      background: rgba(34, 197, 94, .15);
      border-color: rgba(34, 197, 94, .28);
      color: #86efac;
    }

    .daily-summary {
      font-size: 18px;
      font-weight: 800;
      color: #f8fafc;
      margin-bottom: 6px;
    }

    .daily-note {
      font-size: 13px;
      color: #dbeafe;
      margin-bottom: 12px;
    }

    .daily-mini-title {
      display: flex;
      align-items: center;
      gap: 7px;
      margin: 2px 0 8px;
      color: #fde68a;
      font-size: 13px;
      font-weight: 900;
      letter-spacing: .04em;
    }

    .daily-mini-title::after {
      content: "";
      flex: 1;
      height: 1px;
      border-radius: 999px;
      background: linear-gradient(90deg, rgba(253, 230, 138, .55), rgba(56, 189, 248, .35), transparent);
    }

    .daily-mini-title-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: linear-gradient(135deg, rgba(251, 191, 36, .28), rgba(14, 165, 233, .16));
      border: 1px solid rgba(253, 230, 138, .32);
    }

    .daily-mini-board {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 7px;
      margin-bottom: 12px;
      padding: 10px;
      border-radius: 16px;
      border: 1px solid rgba(125, 211, 252, .28);
      background:
        radial-gradient(circle at 8% 0%, rgba(251, 191, 36, .18), transparent 34%),
        radial-gradient(circle at 94% 100%, rgba(34, 211, 238, .16), transparent 38%),
        linear-gradient(135deg, rgba(15, 23, 42, .52), rgba(30, 41, 59, .32));
      overflow: hidden;
    }

    .daily-mini-board::before {
      content: "";
      position: absolute;
      inset: 0 auto 0 0;
      width: 4px;
      background: linear-gradient(180deg, #fde68a, #22d3ee, #a78bfa);
      opacity: .86;
    }

    .daily-mini-row {
      position: relative;
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      min-height: 48px;
      padding: 9px 12px;
      border-radius: 13px;
      border: 1px solid rgba(148, 163, 184, .18);
      background: linear-gradient(135deg, rgba(15, 23, 42, .64), rgba(30, 41, 59, .42));
      font-size: 14px;
    }

    .daily-mini-row.rank-1 {
      border-color: rgba(251, 191, 36, .55);
      background: linear-gradient(135deg, rgba(251, 191, 36, .24), rgba(20, 83, 45, .26) 46%, rgba(15, 23, 42, .48));
    }

    .daily-mini-row.rank-2 {
      border-color: rgba(226, 232, 240, .42);
      background: linear-gradient(135deg, rgba(226, 232, 240, .18), rgba(14, 165, 233, .12), rgba(15, 23, 42, .5));
    }

    .daily-mini-row.rank-3 {
      border-color: rgba(251, 146, 60, .45);
      background: linear-gradient(135deg, rgba(251, 146, 60, .2), rgba(99, 102, 241, .12), rgba(15, 23, 42, .5));
    }

    .daily-mini-row.mine {
      border-color: rgba(34, 197, 94, .55);
      background: linear-gradient(135deg, rgba(34, 197, 94, .18), rgba(20, 184, 166, .12), rgba(15, 23, 42, .46));
    }

    .daily-mini-row .medal {
      display: flex;
      justify-content: center;
    }

    .daily-mini-row .medal-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background: rgba(15, 23, 42, .42);
      border: 1px solid rgba(148, 163, 184, .24);
      color: #e0f2fe;
      font-size: 16px;
      font-weight: 900;
      line-height: 1;
    }

    .daily-mini-row.rank-1 .medal-icon {
      background: linear-gradient(135deg, #fde68a, #f59e0b);
      color: #3b2600;
      border-color: rgba(254, 243, 199, .72);
    }

    .daily-mini-row.rank-2 .medal-icon {
      background: linear-gradient(135deg, #f8fafc, #94a3b8);
      color: #0f172a;
      border-color: rgba(248, 250, 252, .72);
    }

    .daily-mini-row.rank-3 .medal-icon {
      background: linear-gradient(135deg, #fed7aa, #c2410c);
      color: #fff7ed;
      border-color: rgba(254, 215, 170, .68);
    }

    .daily-mini-row .name {
      display: flex;
      align-items: center;
      gap: 7px;
      min-width: 0;
      font-weight: 800;
      color: #f8fafc;
    }

    .daily-mini-row .rank-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .daily-you {
      flex: none;
      padding: 2px 6px;
      border-radius: 999px;
      background: rgba(34, 197, 94, .18);
      border: 1px solid rgba(34, 197, 94, .34);
      color: #bbf7d0;
      font-size: 11px;
      font-weight: 900;
    }

    .daily-mini-row .score {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-variant-numeric: tabular-nums;
      font-weight: 800;
      white-space: nowrap;
    }

    .daily-acc,
    .daily-time {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 24px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid rgba(125, 211, 252, .2);
      background: rgba(15, 23, 42, .36);
    }

    .daily-acc {
      color: #86efac;
    }

    .daily-time {
      color: #67e8f9;
    }

    @media (max-width: 520px) {
      .daily-mini-row {
        grid-template-columns: 32px minmax(0, 1fr) max-content;
        gap: 8px;
        align-items: center;
        padding: 8px 9px;
      }

      .daily-mini-row .medal-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
      }

      .daily-mini-row .name {
        gap: 6px;
      }

      .daily-mini-row .score {
        grid-column: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 5px;
        font-size: 13px;
      }

      .daily-acc,
      .daily-time {
        min-height: 22px;
        padding: 2px 6px;
      }
    }

    .daily-empty {
      padding: 14px 12px;
      border-radius: 12px;
      text-align: center;
      color: var(--muted);
      background: rgba(15, 23, 42, .28);
      font-size: 13px;
    }

    .daily-actions {
      display: flex;
      gap: 8px;
    }

    .daily-actions .btn.small {
      flex: 1;
    }

    #dailyStartBtn.btn.small {
      min-height: 54px;
      padding: 14px 18px;
      border: 2px solid rgba(254, 243, 199, .9);
      background: linear-gradient(135deg, #fde047, #f59e0b 54%, #fb7185);
      color: #111827;
      font-size: 18px;
      font-weight: 950;
      letter-spacing: .08em;
      box-shadow: 0 0 0 1px rgba(251, 191, 36, .24), 0 10px 24px rgba(245, 158, 11, .34);
    }

    #dailyStartBtn.btn.small:hover {
      transform: translateY(-2px) scale(1.01);
    }

    #dailyStartBtn.btn.small:disabled {
      border-color: rgba(148, 163, 184, .28);
      background: rgba(71, 85, 105, .72);
      color: rgba(226, 232, 240, .72);
      opacity: 1;
    }

    #dailyRankBtn.btn.small {
      min-height: 48px;
      border: 1px solid rgba(148, 163, 184, .32);
      color: #e2e8f0;
      font-weight: 800;
    }

    .hist-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-right: 8px;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(251, 191, 36, .16);
      border: 1px solid rgba(251, 191, 36, .26);
      color: #fde68a;
      font-size: 11px;
      font-weight: 800;
    }

    .daily-rank-meta {
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 400;
    }

    .rank-more,
    .daily-rank-more {
      margin-top: 10px;
    }

    .rank-more summary,
    .daily-rank-more summary {
      min-height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(56, 189, 248, .24);
      border-radius: 12px;
      background: rgba(56, 189, 248, .1);
      color: #bae6fd;
      font-size: 13px;
      font-weight: 900;
      cursor: pointer;
      list-style: none;
      user-select: none;
    }

    .rank-more summary::-webkit-details-marker,
    .daily-rank-more summary::-webkit-details-marker {
      display: none;
    }

    .rank-more summary::after,
    .daily-rank-more summary::after {
      content: "＋";
      margin-left: 8px;
      color: #38bdf8;
      font-weight: 950;
    }

    .rank-more[open] summary::after,
    .daily-rank-more[open] summary::after {
      content: "－";
    }

    .rank-extra,
    .daily-rank-extra {
      margin-top: 8px;
    }

    .rank-row.daily-focus {
      border: 1px solid rgba(56, 189, 248, .28);
      box-shadow: 0 0 0 1px rgba(56, 189, 248, .12);
    }

    .weak-btn {
      display: none;
      width: 100%;
      padding: 14px;
      border: none;
      border-radius: 14px;
      background: linear-gradient(135deg, #f59e0b, #d97706);
      color: white;
      font-size: 17px;
      font-weight: 700;
      letter-spacing: 1px;
      cursor: pointer;
      margin-bottom: 10px;
      box-shadow: 0 6px 20px rgba(245, 158, 11, .3);
      transition: transform .1s;
    }

    .weak-btn:hover {
      transform: translateY(-2px);
    }

    .weak-btn:active {
      transform: translateY(0);
    }

    /* ===== charts ===== */
    .chart-section {
      margin-bottom: 24px;
    }

    .chart-title {
      font-size: 14px;
      font-weight: 700;
      color: var(--accent);
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .chart-wrap {
      background: rgba(15, 23, 42, .5);
      border-radius: 14px;
      padding: 14px;
      border: 1px solid rgba(148, 163, 184, .1);
    }

    .chart-canvas {
      width: 100%;
      height: 200px;
      display: block;
    }

    .chart-filter {
      display: flex;
      gap: 6px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    .chart-filter button {
      padding: 6px 14px;
      border-radius: 8px;
      background: var(--panel2);
      color: var(--muted);
      border: 1px solid rgba(148, 163, 184, .15);
      cursor: pointer;
      font-size: 13px;
      transition: all .15s;
    }

    .chart-filter button.active {
      background: linear-gradient(135deg, #0ea5e9, #6366f1);
      color: white;
      border-color: transparent;
    }

    .no-data-chart {
      height: 200px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--muted);
      font-size: 14px;
    }

    /* ===== achievements ===== */
    .achv-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
      gap: 12px;
    }

    .achv-card {
      background: var(--panel2);
      border-radius: 16px;
      padding: 16px 12px;
      text-align: center;
      border: 2px solid transparent;
      transition: all .2s;
      position: relative;
      overflow: hidden;
    }

    .achv-card.unlocked {
      border-color: rgba(251, 191, 36, .4);
      background: linear-gradient(135deg, rgba(251, 191, 36, .08), var(--panel2));
    }

    .achv-card.unlocked:hover {
      transform: translateY(-3px);
      box-shadow: 0 8px 20px rgba(251, 191, 36, .2);
    }

    .achv-card.unlocked.title-selectable {
      cursor: pointer;
    }

    .achv-card.selected-title {
      border-color: rgba(56, 189, 248, .85);
      box-shadow: 0 0 0 2px rgba(56, 189, 248, .28), 0 8px 20px rgba(56, 189, 248, .16);
    }

    .achv-card.locked {
      opacity: .4;
      filter: grayscale(.7);
    }

    .achv-card .achv-icon {
      font-size: 40px;
      margin-bottom: 6px;
    }

    .achv-card .achv-name {
      font-size: 14px;
      font-weight: 700;
      margin-bottom: 4px;
    }

    .achv-card .achv-desc {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.4;
    }

    .achv-card .achv-date {
      font-size: 10px;
      color: var(--gold);
      margin-top: 6px;
    }

    .achv-card .achv-prog {
      font-size: 10px;
      color: var(--muted);
      margin-top: 6px;
    }

    .achv-card .achv-title-action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 24px;
      margin-top: 8px;
      padding: 3px 9px;
      border-radius: 999px;
      border: 1px solid rgba(56, 189, 248, .35);
      background: rgba(56, 189, 248, .14);
      color: #7dd3fc;
      font-size: 11px;
      font-weight: 800;
    }

    .achv-card.selected-title .achv-title-action {
      border-color: rgba(34, 197, 94, .4);
      background: rgba(34, 197, 94, .16);
      color: #86efac;
    }

    .achv-summary {
      display: flex;
      gap: 12px;
      justify-content: center;
      flex-wrap: wrap;
      margin-bottom: 18px;
      font-size: 14px;
    }

    .achv-summary span {
      background: var(--panel2);
      padding: 8px 16px;
      border-radius: 10px;
    }

    .achv-popup {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(15, 23, 42, .88);
      z-index: 9999;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      cursor: pointer;
    }

    .achv-popup-inner {
      text-align: center;
      animation: achvIn .5s ease;
    }

    @keyframes achvIn {
      0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
      }

      60% {
        transform: scale(1.1) rotate(2deg);
        opacity: 1;
      }

      100% {
        transform: scale(1) rotate(0);
        opacity: 1;
      }
    }

    .achv-popup .achv-pop-icon {
      font-size: 80px;
      margin-bottom: 8px;
    }

    .achv-popup .achv-pop-label {
      font-size: 14px;
      color: var(--gold);
      margin-bottom: 4px;
      letter-spacing: 3px;
      font-weight: 700;
    }

    .achv-popup .achv-pop-name {
      font-size: 28px;
      font-weight: 800;
      margin-bottom: 8px;
    }

    .achv-popup .achv-pop-desc {
      font-size: 14px;
      color: var(--muted);
      margin-bottom: 24px;
    }

    .mission-reward-overlay {
      position: fixed;
      inset: 0;
      z-index: 9997;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background:
        radial-gradient(circle at 50% 16%, rgba(251, 191, 36, .22), transparent 34%),
        radial-gradient(circle at 18% 72%, rgba(20, 184, 166, .18), transparent 30%),
        rgba(2, 6, 23, .78);
      backdrop-filter: blur(10px);
    }

    .mission-reward-overlay.active {
      display: flex;
      animation: missionRewardFade .22s ease both;
    }

    .mission-reward-modal {
      width: min(420px, 100%);
      position: relative;
      overflow: hidden;
      border-radius: 18px;
      border: 1px solid rgba(251, 191, 36, .5);
      background:
        linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(2, 6, 23, .96)),
        radial-gradient(circle at 50% 0%, rgba(251, 191, 36, .18), transparent 45%);
      color: #f8fafc;
      padding: 24px 22px 22px;
      text-align: center;
      box-shadow:
        0 28px 70px rgba(0, 0, 0, .58),
        0 0 48px rgba(251, 191, 36, .24);
      animation: missionRewardPop .52s cubic-bezier(.2, 1.25, .28, 1) both;
    }

    .mission-reward-modal::before,
    .mission-reward-modal::after {
      content: "";
      position: absolute;
      inset: auto;
      width: 118px;
      height: 118px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(56, 189, 248, .2), transparent 68%);
      pointer-events: none;
    }

    .mission-reward-modal::before {
      left: -34px;
      top: 34px;
    }

    .mission-reward-modal::after {
      right: -38px;
      bottom: 38px;
      background: radial-gradient(circle, rgba(244, 114, 182, .18), transparent 68%);
    }

    .mission-reward-overlay.notice .mission-reward-modal {
      border-color: rgba(125, 211, 252, .42);
      box-shadow: 0 28px 70px rgba(0, 0, 0, .52), 0 0 38px rgba(56, 189, 248, .18);
    }

    .mission-reward-overlay.error .mission-reward-modal {
      border-color: rgba(248, 113, 113, .48);
      box-shadow: 0 28px 70px rgba(0, 0, 0, .52), 0 0 38px rgba(248, 113, 113, .18);
    }

    .mission-reward-close {
      position: absolute;
      top: 12px;
      right: 12px;
      z-index: 3;
      width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      border: 1px solid rgba(226, 232, 240, .18);
      border-radius: 50%;
      background: rgba(15, 23, 42, .72);
      color: #e2e8f0;
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
    }

    .mission-reward-shine {
      position: absolute;
      inset: -42% -20% auto;
      height: 220px;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
      transform: rotate(-12deg) translateX(-70%);
      animation: missionRewardShine 1.4s ease .18s both;
      pointer-events: none;
    }

    .mission-reward-art {
      position: relative;
      z-index: 1;
      width: 164px;
      height: 164px;
      object-fit: cover;
      border-radius: 50%;
      margin: 2px auto 12px;
      display: block;
      border: 1px solid rgba(251, 191, 36, .42);
      box-shadow:
        0 0 0 7px rgba(251, 191, 36, .08),
        0 18px 36px rgba(0, 0, 0, .34);
    }

    .mission-reward-kicker {
      position: relative;
      z-index: 1;
      color: #fde68a;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: 0;
    }

    .mission-reward-title {
      position: relative;
      z-index: 1;
      margin-top: 4px;
      color: #f8fafc;
      font-size: 24px;
      font-weight: 900;
      line-height: 1.2;
      overflow-wrap: anywhere;
    }

    .mission-reward-points {
      position: relative;
      z-index: 1;
      margin: 14px auto 8px;
      width: min(260px, 100%);
      min-height: 72px;
      display: grid;
      place-items: center;
      border-radius: 8px;
      border: 1px solid rgba(251, 191, 36, .42);
      background:
        linear-gradient(135deg, rgba(251, 191, 36, .24), rgba(34, 197, 94, .14)),
        rgba(15, 23, 42, .58);
      color: #fef3c7;
      font-size: 40px;
      font-weight: 1000;
      line-height: 1;
      font-variant-numeric: tabular-nums;
      text-shadow: 0 4px 16px rgba(251, 191, 36, .38);
    }

    .mission-reward-overlay.notice .mission-reward-points,
    .mission-reward-overlay.error .mission-reward-points {
      color: #e0f2fe;
      font-size: 24px;
      text-shadow: none;
    }

    .mission-reward-overlay.error .mission-reward-points {
      color: #fecaca;
      border-color: rgba(248, 113, 113, .32);
      background: rgba(127, 29, 29, .24);
    }

    .mission-reward-sub {
      position: relative;
      z-index: 1;
      color: #cbd5e1;
      font-size: 14px;
      line-height: 1.55;
      overflow-wrap: anywhere;
    }

    .mission-reward-total {
      position: relative;
      z-index: 1;
      margin: 12px auto 0;
      min-height: 28px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      max-width: 100%;
      padding: 5px 10px;
      border-radius: 999px;
      border: 1px solid rgba(125, 211, 252, .24);
      background: rgba(2, 6, 23, .34);
      color: #bae6fd;
      font-size: 12px;
      font-weight: 900;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }

    .mission-reward-total:empty {
      display: none;
    }

    .mission-reward-ok {
      position: relative;
      z-index: 1;
      width: auto;
      min-width: 132px;
      margin-top: 16px;
      background: linear-gradient(135deg, #fbbf24, #22c55e);
      color: #052e16;
      box-shadow: 0 12px 28px rgba(34, 197, 94, .22);
    }

    .mission-reward-overlay.error .mission-reward-ok {
      background: linear-gradient(135deg, #f87171, #fb923c);
      color: #450a0a;
    }

    @keyframes missionRewardFade {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    @keyframes missionRewardPop {
      0% { opacity: 0; transform: translateY(18px) scale(.9); }
      64% { opacity: 1; transform: translateY(-3px) scale(1.02); }
      100% { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes missionRewardShine {
      from { transform: rotate(-12deg) translateX(-70%); }
      to { transform: rotate(-12deg) translateX(72%); }
    }

    @media (max-width: 430px) {
      .mission-reward-overlay {
        padding: 12px;
      }

      .mission-reward-modal {
        padding: 20px 16px 18px;
      }

      .mission-reward-art {
        width: 132px;
        height: 132px;
      }

      .mission-reward-title {
        font-size: 21px;
      }

      .mission-reward-points {
        min-height: 64px;
        font-size: 34px;
      }
    }

    /* ===== tips page ===== */
    .tips-intro {
      background: linear-gradient(135deg, rgba(56, 189, 248, .18), rgba(129, 140, 248, .18));
      border: 1px solid rgba(56, 189, 248, .3);
      border-radius: 14px;
      padding: 14px 18px;
      margin-bottom: 18px;
      font-size: 14px;
      line-height: 1.7;
      color: var(--text);
    }

    .tips-section {
      background: var(--panel2);
      border-radius: 14px;
      padding: 16px 18px;
      margin-bottom: 14px;
    }

    .tips-section h3 {
      margin: 0 0 12px;
      font-size: 18px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tips-section .tip-item {
      background: rgba(15, 23, 42, .5);
      border-left: 3px solid var(--accent);
      border-radius: 8px;
      padding: 10px 14px;
      margin-bottom: 10px;
    }

    .tips-section .tip-item:last-child {
      margin-bottom: 0;
    }

    .tips-section .tip-name {
      font-weight: 700;
      color: var(--accent);
      margin-bottom: 4px;
      font-size: 14px;
    }

    .tips-section .tip-body {
      font-size: 13.5px;
      line-height: 1.7;
      color: var(--text);
    }

    .tips-section .tip-body code {
      background: rgba(56, 189, 248, .15);
      color: var(--gold);
      padding: 1px 6px;
      border-radius: 4px;
      font-family: "Consolas", "Courier New", monospace;
      font-size: 13px;
    }

    .tips-section .tip-body .arrow {
      color: var(--muted);
      margin: 0 4px;
    }

    .tips-section .practice-btn {
      display: inline-block;
      margin-top: 10px;
      padding: 6px 14px;
      background: linear-gradient(135deg, var(--accent), var(--accent2));
      border: none;
      border-radius: 8px;
      color: #0f172a;
      font-weight: 700;
      font-size: 13px;
      cursor: pointer;
      transition: transform .15s;
    }

    .tips-section .practice-btn:hover {
      transform: translateY(-1px);
    }

    .tips-train .tip-item {
      border-left-color: var(--gold);
    }

    .tips-train .tip-name {
      color: var(--gold);
    }

    /* ===== weakness ===== */
    .weak-section {
      margin-top: 24px;
    }

    .weak-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 10px;
      margin-bottom: 16px;
    }

    .weak-card {
      background: var(--panel2);
      border-radius: 12px;
      padding: 14px 10px;
      text-align: center;
    }

    .weak-card .wk-label {
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 4px;
    }

    .weak-card .wk-val {
      font-size: 22px;
      font-weight: 700;
    }

    .weak-card .wk-val.good {
      color: var(--ok);
    }

    .weak-card .wk-val.mid {
      color: var(--warn);
    }

    .weak-card .wk-val.bad {
      color: var(--bad);
    }

    .weak-top-errors {
      margin-top: 12px;
    }

    .weak-err-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      background: rgba(239, 68, 68, .08);
      border-radius: 8px;
      margin-bottom: 4px;
      font-size: 14px;
    }

    .weak-err-item .we-q {
      flex: 1;
    }

    .weak-err-item .we-count {
      background: var(--bad);
      color: white;
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 700;
      min-width: 36px;
      text-align: center;
    }
    /* ===================== Upgrade: themes ===================== */
    body.theme-sakura   { --bg:#1a0b1f; --panel:#2c1433; --panel2:#3d1d47; --accent:#f472b6; --accent2:#ec4899; }
    body.theme-ocean    { --bg:#07223d; --panel:#0f3460; --panel2:#154672; --accent:#60a5fa; --accent2:#2dd4bf; }
    body.theme-forest   { --bg:#0a1f10; --panel:#14301a; --panel2:#1d4324; --accent:#4ade80; --accent2:#a3e635; }
    body.theme-retro    { --bg:#1c0a2a; --panel:#2d1141; --panel2:#3f1d58; --accent:#c084fc; --accent2:#fbbf24; }
    body.theme-aurora   { --bg:#081321; --panel:#0d2438; --panel2:#11334d; --accent:#22d3ee; --accent2:#a78bfa; }
    body.theme-citrus   { --bg:#101807; --panel:#1f2f0f; --panel2:#304413; --accent:#bef264; --accent2:#facc15; }
    body.theme-berry    { --bg:#1d1020; --panel:#331a31; --panel2:#17364a; --accent:#fb7185; --accent2:#38bdf8; }
    body { transition: background-color .6s ease; }

    /* ===================== Upgrade: animated bg ===================== */
    #bg-particles {
      position: fixed; inset: 0; width: 100%; height: 100%;
      z-index: -1; pointer-events: none; opacity: .55;
    }
    body::before {
      content: "";
      position: fixed; inset: -20%;
      background:
        radial-gradient(ellipse at 20% 30%, rgba(99,102,241,.22), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(236,72,153,.18), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(34,211,238,.15), transparent 55%);
      z-index: -2;
    }
    body.theme-sakura::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(236,72,153,.25), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(244,114,182,.18), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(253,164,175,.16), transparent 55%);
    }
    body.theme-ocean::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(59,130,246,.25), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(45,212,191,.2), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(34,197,255,.16), transparent 55%);
    }
    body.theme-forest::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(74,222,128,.22), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(163,230,53,.18), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(20,184,166,.16), transparent 55%);
    }
    body.theme-retro::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(192,132,252,.28), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(251,191,36,.22), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(236,72,153,.18), transparent 55%);
    }
    body.theme-aurora::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(34,211,238,.25), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(167,139,250,.22), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(52,211,153,.15), transparent 55%);
    }
    body.theme-citrus::before {
      background:
        radial-gradient(ellipse at 18% 28%, rgba(190,242,100,.22), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(250,204,21,.20), transparent 50%),
        radial-gradient(ellipse at 50% 92%, rgba(45,212,191,.14), transparent 55%);
    }
    body.theme-berry::before {
      background:
        radial-gradient(ellipse at 20% 30%, rgba(251,113,133,.24), transparent 50%),
        radial-gradient(ellipse at 82% 72%, rgba(56,189,248,.20), transparent 50%),
        radial-gradient(ellipse at 48% 92%, rgba(216,180,254,.14), transparent 55%);
    }
    @keyframes bgShift {
      0%   { transform: translate(0, 0) rotate(0deg); }
      100% { transform: translate(-3%, -2%) rotate(12deg); }
    }

    /* ===================== Upgrade: rank rows shimmer ===================== */
    .rank-row.gold, .rank-row.silver, .rank-row.bronze { position: relative; overflow: hidden; }
    .rank-row.gold {
      background: linear-gradient(100deg, rgba(251,191,36,.35), rgba(217,119,6,.18) 45%, var(--panel2) 85%);
      border: 1px solid rgba(251,191,36,.4);
      box-shadow: 0 0 24px rgba(251,191,36,.25), inset 0 1px 0 rgba(255,255,255,.15);
    }
    .rank-row.silver {
      background: linear-gradient(100deg, rgba(229,231,235,.25), rgba(148,163,184,.15) 45%, var(--panel2) 85%);
      border: 1px solid rgba(203,213,225,.35);
      box-shadow: 0 0 18px rgba(203,213,225,.18), inset 0 1px 0 rgba(255,255,255,.12);
    }
    .rank-row.bronze {
      background: linear-gradient(100deg, rgba(245,158,11,.28), rgba(161,98,7,.15) 45%, var(--panel2) 85%);
      border: 1px solid rgba(245,158,11,.35);
      box-shadow: 0 0 18px rgba(245,158,11,.18), inset 0 1px 0 rgba(255,255,255,.1);
    }
    .rank-row.gold::after, .rank-row.silver::after, .rank-row.bronze::after {
      content: ""; position: absolute; top: 0; left: -60%;
      width: 50%; height: 100%;
      background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.5) 50%, transparent 80%);
      transform: skewX(-20deg);
      animation: rankShine 4.5s ease-in-out infinite;
      pointer-events: none;
    }
    .rank-row.silver::after { animation-delay: .8s; }
    .rank-row.bronze::after { animation-delay: 1.6s; }
    @keyframes rankShine {
      0%   { left: -60%; }
      55%  { left: 120%; }
      100% { left: 120%; }
    }
    .rank-row.gold .rank-medal   { text-shadow: 0 0 12px rgba(251,191,36,.7); }
    .rank-row.silver .rank-medal { text-shadow: 0 0 10px rgba(203,213,225,.6); }
    .rank-row.bronze .rank-medal { text-shadow: 0 0 10px rgba(245,158,11,.6); }
    .rank-row.gold .rank-av   { box-shadow: 0 0 0 2px rgba(251,191,36,.8), 0 0 16px rgba(251,191,36,.6); animation: pulseGold 2s ease-in-out infinite; }
    .rank-row.silver .rank-av { box-shadow: 0 0 0 2px rgba(203,213,225,.7), 0 0 12px rgba(203,213,225,.5); }
    .rank-row.bronze .rank-av { box-shadow: 0 0 0 2px rgba(245,158,11,.7), 0 0 12px rgba(245,158,11,.5); }
    @keyframes pulseGold {
      0%, 100% { box-shadow: 0 0 0 2px rgba(251,191,36,.8), 0 0 16px rgba(251,191,36,.5); }
      50%      { box-shadow: 0 0 0 3px rgba(251,191,36,1),   0 0 28px rgba(251,191,36,.8); }
    }

    /* ===================== Upgrade: level badge / title chip / frames ===================== */
    .lv-badge {
      position: absolute; right: -4px; bottom: -4px;
      background: linear-gradient(135deg,#fbbf24,#f97316);
      color: #111; font-size: 10px; font-weight: 800;
      padding: 2px 5px; border-radius: 8px;
      border: 1.5px solid rgba(15,23,42,.85);
      box-shadow: 0 2px 6px rgba(0,0,0,.4);
      line-height: 1; letter-spacing: .3px; min-width: 20px; text-align: center;
      font-variant-numeric: tabular-nums;
    }
    .title-chip {
      display: inline-flex; align-items: center; gap: 3px;
      font-size: 11px; font-weight: 700;
      padding: 2px 7px; border-radius: 999px;
      background: linear-gradient(135deg, rgba(251,191,36,.25), rgba(236,72,153,.25));
      border: 1px solid rgba(251,191,36,.35);
      color: #fde68a; white-space: nowrap;
    }
    .trinket-chip {
      display: inline-block; font-size: 14px; margin-left: 4px;
      filter: drop-shadow(0 2px 3px rgba(0,0,0,.5));
    }

    /* avatar frames */
    .av,
    .big-av,
    .rank-av,
    .closet-frame-preview {
      position: relative;
      isolation: isolate;
      overflow: visible;
      --frame-size: 2px;
      --frame-inset: -3px;
      --frame-glow: 18px;
    }
    .big-av {
      --frame-size: 3px;
      --frame-inset: -4px;
      --frame-glow: 28px;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-neon,
    .rank-row .rank-av.frame-neon {
      box-shadow: 0 0 0 var(--frame-size) #22d3ee, 0 0 var(--frame-glow) rgba(34,211,238,.7);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-rainbow,
    .rank-row .rank-av.frame-rainbow {
      box-shadow: 0 0 0 var(--frame-size) rgba(255,255,255,.16);
      background-clip: padding-box;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-rainbow::before {
      content:""; position:absolute; inset:var(--frame-inset); border-radius:50%;
      background: conic-gradient(#ef4444,#fbbf24,#22c55e,#38bdf8,#a78bfa,#ec4899,#ef4444);
      z-index:-1; animation: spinRing 6s linear infinite;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-starry,
    .rank-row .rank-av.frame-starry {
      box-shadow: 0 0 0 var(--frame-size) #a78bfa, 0 0 var(--frame-glow) rgba(167,139,250,.7);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-gold,
    .rank-row .rank-av.frame-gold {
      box-shadow: 0 0 0 var(--frame-size) #fbbf24, 0 0 var(--frame-glow) rgba(251,191,36,.6);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-flame,
    .rank-row .rank-av.frame-flame {
      box-shadow: 0 0 0 var(--frame-size) #ef4444, 0 0 var(--frame-glow) rgba(239,68,68,.6);
      animation: pulseFrame 1.8s ease-in-out infinite;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-ice,
    .rank-row .rank-av.frame-ice {
      box-shadow: 0 0 0 var(--frame-size) #67e8f9, 0 0 var(--frame-glow) rgba(103,232,249,.55);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-leaf,
    .rank-row .rank-av.frame-leaf {
      box-shadow: 0 0 0 var(--frame-size) #4ade80, 0 0 var(--frame-glow) rgba(74,222,128,.55);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-shadow,
    .rank-row .rank-av.frame-shadow {
      box-shadow: 0 0 0 var(--frame-size) #94a3b8, 0 0 var(--frame-glow) rgba(15,23,42,.95), 0 0 calc(var(--frame-glow) * .7) rgba(148,163,184,.35);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-diamond,
    .rank-row .rank-av.frame-diamond {
      box-shadow: 0 0 0 var(--frame-size) #e0f2fe, 0 0 var(--frame-glow) rgba(125,211,252,.78), inset 0 0 10px rgba(255,255,255,.18);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-crown,
    .rank-row .rank-av.frame-crown {
      box-shadow: 0 0 0 var(--frame-size) #fde047, 0 0 var(--frame-glow) rgba(250,204,21,.72), 0 -3px 12px rgba(251,113,133,.35);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-matrix,
    .rank-row .rank-av.frame-matrix {
      box-shadow: 0 0 0 var(--frame-size) #22c55e, 0 0 var(--frame-glow) rgba(34,197,94,.65);
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-matrix::before {
      content:""; position:absolute; inset:calc(var(--frame-inset) - 2px); border-radius:50%;
      border:1px dashed rgba(190,242,100,.85);
      z-index:-1; animation: spinRing 10s linear infinite;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-prism,
    .rank-row .rank-av.frame-prism {
      box-shadow: 0 0 0 var(--frame-size) rgba(255,255,255,.18);
      background-clip: padding-box;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-prism::before {
      content:""; position:absolute; inset:var(--frame-inset); border-radius:50%;
      background: conic-gradient(#f8fafc,#38bdf8,#a78bfa,#fb7185,#facc15,#f8fafc);
      z-index:-1; animation: spinRing 7s linear infinite reverse;
    }
    :is(.av, .big-av, .rank-av, .closet-frame-preview).frame-solar,
    .rank-row .rank-av.frame-solar {
      box-shadow: 0 0 0 var(--frame-size) #f97316, 0 0 var(--frame-glow) rgba(249,115,22,.62), 0 0 calc(var(--frame-glow) * .85) rgba(250,204,21,.36);
      animation: pulseFrame 2.2s ease-in-out infinite;
    }
    @keyframes spinRing   { to { transform: rotate(360deg); } }
    @keyframes pulseFrame {
      0%,100% { filter: brightness(1); }
      50%     { filter: brightness(1.3); }
    }

    /* ===================== Upgrade: XP bar / LV UP ===================== */
    .xp-wrap {
      display: flex; align-items: center; gap: 8px;
      margin-top: 4px; font-size: 11px; color: var(--muted);
    }
    .xp-bar {
      flex: 1; height: 8px; border-radius: 999px;
      background: rgba(148,163,184,.15);
      overflow: hidden; position: relative;
    }
    .xp-bar .fill {
      position: absolute; left: 0; top: 0; height: 100%;
      background: linear-gradient(90deg, #fbbf24, #f472b6, #a78bfa);
      background-size: 200% 100%;
      width: 0%;
      transition: width .9s cubic-bezier(.33,1.2,.5,1);
      animation: xpShine 3s linear infinite;
    }
    @keyframes xpShine {
      0%   { background-position: 0% 0; }
      100% { background-position: 200% 0; }
    }
    .lvup-overlay {
      position: fixed; inset: 0; display: none;
      z-index: 60; pointer-events: none;
      align-items: center; justify-content: center;
    }
    .lvup-overlay.active { display: flex; animation: lvupBg .2s ease; }
    .lvup-overlay::before {
      content: ""; position: absolute; inset: 0;
      background: radial-gradient(circle at center, rgba(251,191,36,.35), transparent 55%);
    }
    .lvup-text {
      position: relative;
      font-size: clamp(60px, 12vw, 120px);
      font-weight: 900; letter-spacing: 6px;
      background: linear-gradient(135deg,#fde68a,#fbbf24,#f97316,#f472b6);
      -webkit-background-clip: text; background-clip: text; color: transparent;
      text-shadow: 0 0 40px rgba(251,191,36,.5);
      animation: lvupPop 1.6s cubic-bezier(.2,1.4,.4,1) forwards;
    }
    .lvup-sub {
      position: absolute; top: 60%; font-size: 22px; color: #fde68a;
      font-weight: 700; letter-spacing: 3px;
      animation: lvupSub 1.6s ease forwards; opacity: 0;
    }
    @keyframes lvupPop {
      0%   { transform: scale(.3) rotate(-15deg); opacity: 0; }
      30%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
      55%  { transform: scale(1) rotate(0deg); }
      85%  { transform: scale(1); opacity: 1; }
      100% { transform: scale(1.05); opacity: 0; }
    }
    @keyframes lvupSub {
      0%   { opacity: 0; transform: translateY(20px); }
      30%  { opacity: 1; transform: translateY(0); }
      85%  { opacity: 1; }
      100% { opacity: 0; transform: translateY(-10px); }
    }
    @keyframes lvupBg { from { opacity: 0 } to { opacity: 1 } }

    /* ===================== Upgrade: cheer buttons ===================== */
    .cheer-btns {
      display: flex; gap: 4px; align-items: center; margin-left: auto;
    }
    .cheer-btn {
      background: rgba(148,163,184,.12); border: none;
      width: 28px; height: 28px; border-radius: 50%;
      font-size: 14px; cursor: pointer; line-height: 1;
      display: inline-flex; align-items: center; justify-content: center;
      transition: transform .15s ease, background .2s ease;
    }
    .cheer-btn:hover, .cheer-btn:focus {
      transform: scale(1.25); background: rgba(251,191,36,.25);
    }
    .cheer-fly {
      position: fixed; z-index: 55; pointer-events: none;
      font-size: 32px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
      will-change: transform, opacity;
    }
    .cheer-toast {
      position: fixed; top: 18px; left: 50%;
      transform: translateX(-50%);
      padding: 10px 18px; border-radius: 999px;
      background: linear-gradient(135deg, rgba(251,191,36,.95), rgba(236,72,153,.95));
      color: #1c0a2a; font-weight: 800; font-size: 14px;
      box-shadow: 0 6px 20px rgba(0,0,0,.35); z-index: 70;
      animation: toastIn .5s cubic-bezier(.3,1.4,.4,1), toastOut .5s ease 3.5s forwards;
    }
    @keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } }
    @keyframes toastOut { to   { opacity: 0; transform: translateX(-50%) translateY(-20px); } }
    .feedback-reply-toast {
      position: fixed;
      top: 18px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 80;
      display: flex;
      align-items: center;
      gap: 12px;
      max-width: min(92vw, 420px);
      padding: 10px 12px 10px 16px;
      border: 1px solid rgba(254, 243, 199, .64);
      border-radius: 999px;
      background: linear-gradient(135deg, rgba(250, 204, 21, .96), rgba(34, 197, 94, .94));
      color: #0f172a;
      box-shadow: 0 10px 28px rgba(0,0,0,.36), 0 0 20px rgba(250,204,21,.24);
      animation: toastIn .35s cubic-bezier(.3,1.4,.4,1);
    }
    .feedback-reply-toast div {
      display: grid;
      gap: 1px;
      min-width: 0;
    }
    .feedback-reply-toast b {
      font-size: 14px;
      font-weight: 950;
      white-space: nowrap;
    }
    .feedback-reply-toast span {
      font-size: 11px;
      font-weight: 800;
      opacity: .78;
    }
    .feedback-reply-toast button {
      flex: 0 0 auto;
      border: 0;
      border-radius: 999px;
      background: rgba(15, 23, 42, .9);
      color: #fef3c7;
      padding: 7px 11px;
      font-size: 12px;
      font-weight: 900;
      cursor: pointer;
    }
    .user-card .cheer-dot {
      position: absolute; top: 8px; right: 8px;
      background: #ef4444; color: #fff; font-size: 10px;
      font-weight: 800; padding: 2px 6px; border-radius: 999px;
      box-shadow: 0 0 10px rgba(239,68,68,.7);
      animation: pulseDot 1.8s ease-in-out infinite;
    }
    @keyframes pulseDot {
      0%,100% { box-shadow: 0 0 6px rgba(239,68,68,.5); }
      50%     { box-shadow: 0 0 14px rgba(239,68,68,1); }
    }

    /* ===================== Upgrade: checkin strip ===================== */
    .presence-strip {
      width: min(100%, var(--app-shell-width));
      box-sizing: border-box;
      margin: 0 auto 14px;
      padding: 8px 12px;
      background: linear-gradient(100deg, rgba(16,185,129,.12), rgba(56,189,248,.1));
      border: 1px solid rgba(16,185,129,.25);
      border-radius: 14px;
    }
    body[data-screen="picker"] > #presenceStrip {
      display: none !important;
    }
    body[data-screen="setup"] > #presenceStrip {
      width: min(100%, var(--app-task-edge-width));
    }
    .presence-head {
      display: flex; align-items: center; gap: 8px;
      font-size: 12px; color: var(--muted); margin-bottom: 8px;
    }
    .presence-head .dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: #22c55e; box-shadow: 0 0 6px #22c55e;
      animation: presencePulse 1.6s ease-in-out infinite;
    }
    .presence-head .count { color: #86efac; font-weight: 700; }
    @keyframes presencePulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50%      { opacity: .5; transform: scale(.8); }
    }
    .presence-list {
      display: flex; flex-wrap: wrap; gap: 8px;
    }
    .presence-pill {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 6px 10px;
      background: rgba(15,23,42,.55);
      border: 1px solid rgba(148,163,184,.2);
      border-radius: 999px;
      font-size: 13px; line-height: 1;
      color: inherit;
      font-family: inherit;
      cursor: pointer;
    }
    button.presence-pill { appearance: none; }
    .presence-pill:hover,
    .rank-row[data-rank-uid]:hover,
    .daily-mini-row[data-rank-uid]:hover,
    .quest-rank-chip[data-rank-uid]:hover {
      filter: brightness(1.08);
    }
    .presence-pill.mine { border-color: rgba(56,189,248,.6); background: rgba(14,165,233,.15); }
    .presence-pill .av {
      width: 22px; height: 22px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      font-size: 13px;
      box-shadow: 0 0 0 2px rgba(15,23,42,.6);
    }
    .presence-pill .nm { font-weight: 700; color: #e2e8f0; }
    .presence-pill .where { color: #a3e635; font-size: 11px; padding-left: 4px; border-left: 1px solid rgba(148,163,184,.25); }
    .presence-pill.idle .where { color: #cbd5e1; }
    .presence-pill.playing .where { color: #fbbf24; }
    .presence-empty { font-size: 12px; color: var(--muted); padding: 4px 0; }

    .daily-math-tip-card {
      display: grid;
      gap: 6px;
      margin-bottom: 12px;
      padding: 14px 16px;
      border: 1px solid rgba(56,189,248,.28);
      border-radius: 8px;
      background:
        linear-gradient(100deg, rgba(14,165,233,.14), rgba(251,191,36,.11)),
        rgba(15,23,42,.52);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    }
    .daily-math-tip-title {
      color: #fef3c7;
      font-size: 16px;
      font-weight: 900;
    }
    .daily-math-tip-name {
      color: #f8fafc;
      font-size: 18px;
      font-weight: 950;
      line-height: 1.25;
    }
    .daily-math-tip-body {
      color: #cbd5e1;
      font-size: 16px;
      line-height: 1.6;
    }

    .checkin-strip {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 14px; margin-bottom: 12px;
      background: linear-gradient(100deg, rgba(251,191,36,.12), rgba(236,72,153,.1));
      border: 1px solid rgba(251,191,36,.25);
      border-radius: 14px; cursor: pointer;
      transition: transform .15s ease;
    }
    .checkin-strip:hover { transform: translateY(-1px); }
    .checkin-strip .flame { font-size: 20px; filter: drop-shadow(0 0 8px rgba(251,191,36,.8)); }
    .checkin-strip .val   { font-size: 18px; font-weight: 800; color: #fde68a; font-variant-numeric: tabular-nums; }
    .checkin-strip .lbl   { font-size: 12px; color: var(--muted); }
    .checkin-strip .expand { margin-left: auto; font-size: 11px; color: var(--muted); }
    .checkin-heatmap {
      display: grid; grid-template-columns: repeat(14, 1fr);
      gap: 4px; margin: 10px 0 16px 0;
      padding: 14px; border-radius: 14px;
      background: rgba(15,23,42,.5);
      border: 1px solid rgba(148,163,184,.15);
    }
    .heat-cell {
      aspect-ratio: 1; border-radius: 4px;
      background: rgba(148,163,184,.08);
    }
    .heat-cell.l1 { background: rgba(251,191,36,.25); }
    .heat-cell.l2 { background: rgba(251,191,36,.5); }
    .heat-cell.l3 { background: rgba(251,146,60,.7); }
    .heat-cell.l4 { background: linear-gradient(135deg,#fbbf24,#f97316); box-shadow: 0 0 6px rgba(251,191,36,.6); }
    .heat-cell.today { outline: 2px solid #38bdf8; outline-offset: 1px; }

    /* ===================== Upgrade: cinematic result ===================== */
    #result.active .result-big .emoji {
      animation: emojiDrop 1s cubic-bezier(.3,1.4,.4,1) both;
      display: inline-block;
    }
    @keyframes emojiDrop {
      0%  { transform: translateY(-120px) scale(.4) rotate(-20deg); opacity: 0; }
      60% { transform: translateY(10px) scale(1.2) rotate(8deg); opacity: 1; }
      80% { transform: translateY(-4px) scale(1) rotate(-3deg); }
      100%{ transform: translateY(0) scale(1) rotate(0); }
    }
    #result.active .result-big .title {
      animation: titleFade .8s ease .2s both;
    }
    @keyframes titleFade {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    #result.tone-gold   { background: linear-gradient(180deg, rgba(251,191,36,.08), transparent 60%); }
    #result.tone-silver { background: linear-gradient(180deg, rgba(129,140,248,.08), transparent 60%); }
    #result.tone-bronze { background: linear-gradient(180deg, rgba(239,68,68,.06), transparent 60%); }
    .result-xp {
      margin: 18px 0 6px;
      padding: 14px 16px; border-radius: 14px;
      background: linear-gradient(100deg, rgba(251,191,36,.1), rgba(167,139,250,.08));
      border: 1px solid rgba(251,191,36,.2);
    }
    .result-xp .row1 { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
    .result-xp .lv-label { font-weight: 800; color: #fde68a; font-size: 15px; }
    .result-xp .xp-gain { color: #a3e635; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
    .result-xp .xp-bar { height: 12px; }
    .result-actions {
      margin: 12px 0 16px;
    }

    /* ===================== Upgrade: chest modal ===================== */
    .chest-overlay {
      position: fixed; inset: 0; display: none; z-index: 65;
      align-items: center; justify-content: center;
      background: rgba(4,8,18,.85); backdrop-filter: blur(6px);
    }
    .chest-overlay.active { display: flex; animation: fade .3s ease; }
    .chest-box {
      background: linear-gradient(180deg, #1e293b, #0f172a);
      border: 1px solid rgba(148,163,184,.2);
      border-radius: 22px; padding: 30px;
      max-width: 92vw; width: 360px; text-align: center;
      position: relative;
      box-shadow: 0 24px 60px rgba(0,0,0,.6);
    }
    .chest-box.tier-gold   { border-color: rgba(251,191,36,.6); box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 48px rgba(251,191,36,.35); }
    .chest-box.tier-silver { border-color: rgba(203,213,225,.55); box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 36px rgba(203,213,225,.25); }
    .chest-box.tier-bronze { border-color: rgba(245,158,11,.55); box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 28px rgba(245,158,11,.2); }
    .chest-emoji {
      font-size: 96px; line-height: 1;
      filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
      animation: chestShake .4s ease-in-out 4 alternate;
      display: inline-block;
    }
    .chest-emoji.opening { animation: chestBurst .9s cubic-bezier(.3,1.4,.4,1) both; }
    @keyframes chestShake {
      from { transform: translateX(-6px) rotate(-4deg); }
      to   { transform: translateX(6px) rotate(4deg); }
    }
    @keyframes chestBurst {
      0%  { transform: scale(1); }
      40% { transform: scale(1.3) rotate(12deg); filter: brightness(2); }
      70% { transform: scale(.7) rotate(-8deg); opacity: .3; }
      100%{ transform: scale(0) rotate(0); opacity: 0; }
    }
    .chest-title { font-size: 13px; color: var(--muted); margin-top: 8px; }
    .chest-subtitle { font-size: 22px; font-weight: 800; color: #fde68a; margin: 4px 0 12px; }
    .reward-card {
      display: none; margin: 14px 0; padding: 18px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(251,191,36,.18), rgba(236,72,153,.14));
      border: 1px solid rgba(251,191,36,.3);
      animation: rewardFlip .8s cubic-bezier(.3,1.4,.4,1) both;
    }
    .reward-card.show { display: block; }
    .reward-card .rw-icon { font-size: 56px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
    .reward-card .rw-name { font-size: 18px; font-weight: 800; color: #fde68a; }
    .reward-card .rw-kind { font-size: 12px; color: var(--muted); margin-top: 4px; }
    @keyframes rewardFlip {
      0%  { transform: perspective(600px) rotateY(90deg); opacity: 0; }
      60% { transform: perspective(600px) rotateY(-8deg); opacity: 1; }
      100%{ transform: perspective(600px) rotateY(0); }
    }

    /* ===================== Upgrade: closet (theme/frame/trinket picker) ===================== */
    .closet-section { margin-bottom: 16px; }
    .closet-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--accent); }
    .closet-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
      gap: 8px;
    }
    .closet-item {
      padding: 10px; border-radius: 12px;
      background: rgba(15,23,42,.5);
      border: 1px solid rgba(148,163,184,.18);
      text-align: center; cursor: pointer;
      transition: transform .15s ease, border-color .15s ease;
      font-size: 22px;
    }
    .closet-item:hover { transform: translateY(-2px); border-color: var(--accent); }
    .closet-item.equipped {
      border-color: #fbbf24; background: rgba(251,191,36,.12);
      box-shadow: 0 0 12px rgba(251,191,36,.3);
    }
    .closet-item .cl-label { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
    .closet-item .cl-rarity {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-top: 4px;
      padding: 2px 5px;
      border-radius: 999px;
      border: 1px solid rgba(251,191,36,.35);
      background: rgba(251,191,36,.12);
      color: #fde68a;
      font-size: 10px;
      font-weight: 800;
      line-height: 1.1;
    }
    .closet-item .cl-rarity-zero {
      border-color: rgba(255,43,214,.72);
      background: linear-gradient(135deg, rgba(255,43,214,.24), rgba(34,211,238,.18));
      color: #fff7ed;
      box-shadow: 0 0 12px rgba(255,43,214,.35);
    }
    .closet-item.locked { opacity: .35; cursor: not-allowed; }
    .closet-item-theme,
    .closet-item-frame {
      display: grid;
      justify-items: center;
      gap: 6px;
      min-height: 104px;
      padding: 12px 8px;
      font-size: 13px;
      font-weight: 800;
    }
    .closet-name {
      display: block;
      line-height: 1.2;
      word-break: keep-all;
    }
    .closet-theme-swatch {
      display: grid;
      place-items: center;
      width: 48px;
      height: 48px;
      border-radius: 16px;
      background:
        radial-gradient(circle at 24% 20%, var(--swatch-b), transparent 36%),
        linear-gradient(135deg, var(--swatch-a), var(--swatch-c));
      box-shadow: 0 10px 22px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.22);
    }
    .closet-theme-swatch span {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: conic-gradient(var(--swatch-a), var(--swatch-b), var(--swatch-c), var(--swatch-a));
      border: 2px solid rgba(255,255,255,.38);
      box-shadow: 0 0 12px rgba(255,255,255,.22);
    }
    .closet-frame-preview {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(135deg,#38bdf8,#6366f1);
      color: #fff;
      font-size: 16px;
      font-weight: 900;
    }

    /* ================= Battle / 對戰廳 ================= */
    .battle-card { padding: 18px 20px; }
    .battle-lobby-head {
      display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
      margin-bottom: 14px;
    }
    .battle-lobby-head .title { font-size: 22px; font-weight: 900; color: #fde68a; }
    .battle-lobby-head .room-code {
      margin-left: auto;
      padding: 8px 14px;
      font-family: 'Courier New', monospace;
      font-size: 28px; letter-spacing: 6px;
      background: linear-gradient(135deg, rgba(14,165,233,.2), rgba(99,102,241,.2));
      border: 2px dashed #0ea5e9;
      border-radius: 10px;
      font-weight: 900;
      color: #e0f2fe;
      cursor: copy;
    }
    .battle-lobby-head .room-code .hint { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0; font-family: system-ui; }
    .battle-invite-btn {
      min-height: 44px;
      padding: 10px 18px;
      border: 1px solid rgba(250,204,21,.76);
      border-radius: 8px;
      background: linear-gradient(135deg, #f59e0b, #16a34a);
      color: #fff;
      font-size: 15px;
      font-weight: 950;
      letter-spacing: 0;
      box-shadow: 0 10px 24px rgba(245,158,11,.24), 0 0 0 2px rgba(250,204,21,.16);
    }
    .battle-invite-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 14px 28px rgba(245,158,11,.3), 0 0 0 3px rgba(250,204,21,.2);
    }
    .battle-invite-btn-primary {
      min-width: 156px;
    }
    .battle-invite-btn-inline {
      min-height: 38px;
      padding: 8px 14px;
      font-size: 13px;
      flex: 0 0 auto;
    }
    .battle-guest-panel {
      display: grid;
      gap: 12px;
      padding: 16px;
      border: 1px solid rgba(125,211,252,.24);
      border-radius: 8px;
      background: linear-gradient(135deg, rgba(15,23,42,.68), rgba(30,41,59,.5));
    }
    .battle-guest-kicker {
      color: #fde68a;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: 0;
    }
    .battle-guest-title {
      color: #f8fafc;
      font-size: 20px;
      font-weight: 950;
      line-height: 1.2;
    }
    .battle-guest-sub {
      color: #a7b4c7;
      font-size: 13px;
      line-height: 1.45;
    }
    .battle-guest-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
    }
    .battle-guest-row input {
      width: 100%;
      min-width: 0;
      padding: 12px 14px;
      border: 1px solid rgba(148,163,184,.32);
      border-radius: 8px;
      background: rgba(2,6,23,.42);
      color: #f8fafc;
      font-size: 16px;
      outline: none;
    }
    .battle-guest-row input:focus {
      border-color: rgba(56,189,248,.7);
      box-shadow: 0 0 0 3px rgba(56,189,248,.14);
    }
    .battle-guest-account-btn {
      justify-self: start;
    }
    @media (max-width: 520px) {
      .battle-lobby-head .room-code {
        margin-left: 0;
        width: 100%;
        text-align: center;
      }
      .battle-invite-btn {
        width: 100%;
      }
      .battle-guest-row {
        grid-template-columns: 1fr;
      }
    }

    .battle-reflex-leaderboard {
      margin: 0 0 12px;
      padding: 12px;
      border: 1px solid rgba(125,211,252,.22);
      border-radius: 8px;
      background: rgba(15,23,42,.44);
    }
    .battle-reflex-leaderboard-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
    }
    .battle-reflex-leaderboard-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex: 0 0 auto;
      flex-wrap: wrap;
    }
    .battle-reflex-leaderboard-title {
      color: #fde68a;
      font-size: 16px;
      font-weight: 950;
      line-height: 1.2;
    }
    .battle-reflex-leaderboard-sub {
      margin-top: 3px;
      color: #a7b4c7;
      font-size: 11px;
      font-weight: 700;
      line-height: 1.35;
    }
    .battle-reflex-grid-tabs {
      display: inline-flex;
      flex: 0 0 auto;
      gap: 3px;
      padding: 3px;
      border: 1px solid rgba(148,163,184,.22);
      border-radius: 8px;
      background: rgba(2,6,23,.32);
    }
    .battle-reflex-grid-tabs button {
      min-width: 48px;
      min-height: 30px;
      padding: 5px 9px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #cbd5e1;
      font-size: 12px;
      font-weight: 900;
      cursor: pointer;
    }
    .battle-reflex-grid-tabs button.active {
      background: linear-gradient(135deg, rgba(14,165,233,.74), rgba(37,99,235,.78));
      color: #fff;
      box-shadow: 0 0 0 1px rgba(125,211,252,.24);
    }
    .battle-reflex-create-btn {
      min-height: 36px;
      padding: 7px 11px;
      border: 1px solid rgba(250,204,21,.42);
      border-radius: 8px;
      background: linear-gradient(135deg, rgba(245,158,11,.88), rgba(14,165,233,.82));
      color: #fff;
      font-size: 12px;
      font-weight: 950;
      white-space: nowrap;
      cursor: pointer;
      box-shadow: 0 8px 18px rgba(14,165,233,.16);
    }
    .battle-reflex-create-btn:disabled {
      opacity: .58;
      cursor: wait;
    }
    .battle-reflex-rank-list {
      display: grid;
      gap: 7px;
    }
    .battle-reflex-rank-row {
      display: grid;
      grid-template-columns: 28px 34px minmax(0, 1fr) auto;
      align-items: center;
      gap: 8px;
      min-height: 48px;
      padding: 7px 9px;
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 8px;
      background: rgba(30,41,59,.44);
    }
    .battle-reflex-rank-no {
      color: #fde68a;
      font-size: 14px;
      font-weight: 950;
      text-align: center;
      font-variant-numeric: tabular-nums;
    }
    .battle-reflex-rank-av {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      font-size: 17px;
      flex: 0 0 auto;
    }
    .battle-reflex-rank-av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .battle-reflex-rank-main {
      min-width: 0;
    }
    .battle-reflex-rank-name {
      color: #f8fafc;
      font-size: 13px;
      font-weight: 900;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .battle-reflex-rank-meta {
      margin-top: 2px;
      color: #9fb0c6;
      font-size: 11px;
      font-weight: 700;
      line-height: 1.3;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .battle-reflex-rank-ms {
      color: #67e8f9;
      font-size: 18px;
      font-weight: 950;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .battle-reflex-rank-empty,
    .battle-reflex-rank-error {
      padding: 12px 10px;
      border: 1px dashed rgba(148,163,184,.22);
      border-radius: 8px;
      color: var(--muted);
      text-align: center;
      font-size: 12px;
      font-weight: 800;
      background: rgba(2,6,23,.18);
    }
    .battle-reflex-rank-error {
      margin-bottom: 8px;
      color: #fecaca;
      border-color: rgba(248,113,113,.28);
      background: rgba(127,29,29,.16);
    }
    .battle-reflex-rank-more {
      margin-top: 8px;
    }
    .battle-reflex-rank-more summary {
      min-height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(56,189,248,.24);
      border-radius: 8px;
      background: rgba(56,189,248,.1);
      color: #bae6fd;
      font-size: 12px;
      font-weight: 950;
      cursor: pointer;
      list-style: none;
      user-select: none;
    }
    .battle-reflex-rank-more summary::-webkit-details-marker {
      display: none;
    }
    .battle-reflex-rank-more summary::after {
      content: "⌄";
      margin-left: 8px;
      color: #38bdf8;
      font-weight: 950;
    }
    .battle-reflex-rank-more[open] summary::after {
      content: "⌃";
    }
    .battle-reflex-rank-extra {
      margin-top: 7px;
    }
    @media (max-width: 520px) {
      .battle-reflex-leaderboard-head {
        align-items: flex-start;
        flex-direction: column;
      }
      .battle-reflex-leaderboard-actions {
        width: 100%;
        justify-content: space-between;
      }
      .battle-reflex-grid-tabs button {
        min-width: 44px;
        padding-left: 7px;
        padding-right: 7px;
      }
      .battle-reflex-create-btn {
        flex: 1 1 130px;
      }
      .battle-reflex-rank-row {
        grid-template-columns: 24px 30px minmax(0, 1fr) auto;
        gap: 7px;
        padding-left: 7px;
        padding-right: 7px;
      }
      .battle-reflex-rank-av {
        width: 30px;
        height: 30px;
      }
      .battle-reflex-rank-ms {
        font-size: 16px;
      }
    }

    .battle-settings-panel {
      display: grid;
      gap: 12px;
      margin-bottom: 12px;
      padding: 14px;
      border: 1px solid rgba(56,189,248,.18);
      border-radius: 12px;
      background: linear-gradient(135deg, rgba(15,23,42,.52), rgba(30,41,59,.38));
    }
    .battle-section-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      color: #bae6fd;
      font-size: 13px;
      font-weight: 900;
    }
    .battle-section-head small {
      color: #c4b5fd;
      font-size: 11px;
      font-weight: 800;
    }
    .battle-mode-grid {
      display: grid; grid-template-columns: 1fr; gap: 8px;
    }
    .battle-mode-card {
      padding: 11px 12px;
      background: rgba(30,41,59,.56);
      border: 1.5px solid rgba(148,163,184,.22);
      border-radius: 12px;
      cursor: pointer;
      transition: all .15s ease;
    }
    .battle-mode-card:hover { transform: translateY(-2px); }
    .battle-mode-card.active {
      border-color: rgba(251,191,36,.82);
      background: linear-gradient(135deg, rgba(251,191,36,.16), rgba(30,41,59,.58));
      box-shadow: 0 0 0 2px rgba(251,191,36,.18);
    }
    .battle-mode-card.disabled { opacity: .4; cursor: not-allowed; }
    .battle-mode-card .mname { font-size: 15px; font-weight: 800; color: #facc15; margin-bottom: 4px; }
    .battle-mode-card .mdesc { font-size: 11px; color: #b6c2d4; line-height: 1.4; }

    .battle-config-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
    .battle-config-row .lbl { font-size: 12px; color: var(--muted); min-width: 60px; }
    .battle-config-list {
      display: grid;
      gap: 8px;
    }
    .battle-config-item {
      display: grid;
      grid-template-columns: minmax(86px, 110px) minmax(0, 1fr);
      align-items: center;
      gap: 10px;
      min-height: 46px;
      padding: 8px 10px;
      border: 1px solid rgba(148,163,184,.18);
      border-radius: 10px;
      background: rgba(15,23,42,.36);
    }
    .battle-config-item .lbl {
      color: #a7f3d0;
      font-size: 13px;
      font-weight: 900;
    }
    .battle-config-item select {
      width: 100%;
      min-height: 36px;
      padding: 7px 34px 7px 12px;
      border: 1px solid rgba(125,211,252,.24);
      border-radius: 9px;
      background: rgba(30,41,59,.92);
      color: #dbeafe;
      color-scheme: dark;
      font-size: 14px;
      font-weight: 800;
      outline: none;
    }
    .battle-config-item select:focus {
      border-color: rgba(125,211,252,.72);
      box-shadow: 0 0 0 3px rgba(14,165,233,.16);
    }
    .battle-config-item select:disabled {
      opacity: .72;
      color: #bac8dc;
    }
    .battle-config-item select option {
      background: #1e293b;
      color: #dbeafe;
    }
    .battle-config-item-stack {
      align-items: start;
    }
    .battle-check-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
      gap: 8px;
    }
    .battle-check-pill {
      position: relative;
      display: grid;
      gap: 3px;
      min-height: 72px;
      padding: 10px 12px;
      border: 1px solid rgba(148,163,184,.22);
      border-radius: 12px;
      background: rgba(15,23,42,.58);
      color: #dbeafe;
      cursor: pointer;
      transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease, background .12s ease;
    }
    .battle-check-pill:hover {
      transform: translateY(-1px);
      border-color: rgba(125,211,252,.44);
    }
    .battle-check-pill.checked {
      border-color: rgba(34,197,94,.58);
      background: linear-gradient(180deg, rgba(9,33,19,.9), rgba(11,31,18,.72));
      box-shadow: 0 0 0 1px rgba(34,197,94,.18), 0 10px 22px rgba(0,0,0,.22);
    }
    .battle-check-pill:has(input:checked) {
      border-color: rgba(34,197,94,.58);
      background: linear-gradient(180deg, rgba(9,33,19,.9), rgba(11,31,18,.72));
      box-shadow: 0 0 0 1px rgba(34,197,94,.18), 0 10px 22px rgba(0,0,0,.22);
    }
    .battle-check-pill.disabled {
      opacity: .72;
      cursor: not-allowed;
    }
    .battle-check-pill input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: inherit;
    }
    .battle-check-pill-label {
      font-size: 14px;
      font-weight: 900;
      color: #f8fafc;
    }
    .battle-check-pill small {
      color: #b6c2d4;
      font-size: 11px;
      line-height: 1.4;
    }

    .battle-room-change-notice {
      position: fixed;
      left: 50%;
      z-index: 10020;
      width: min(420px, calc(100vw - 28px));
      opacity: 0;
      pointer-events: none;
      padding: 14px 46px 14px 16px;
      border: 1px solid rgba(125,211,252,.34);
      border-radius: 8px;
      background: rgba(15, 23, 42, .96);
      color: #e0f2fe;
      box-shadow: 0 14px 34px rgba(0,0,0,.34);
      transition: opacity .18s ease, transform .18s ease;
    }
    .battle-room-change-notice.is-center {
      top: 50%;
      transform: translate(-50%, calc(-50% + 12px));
    }
    .battle-room-change-notice.is-top {
      top: 14px;
      width: min(380px, calc(100vw - 28px));
      padding: 10px 13px;
      transform: translate(-50%, -10px);
      pointer-events: none;
    }
    .battle-room-change-notice.show {
      opacity: 1;
      pointer-events: auto;
    }
    .battle-room-change-notice.is-center.show {
      transform: translate(-50%, -50%);
    }
    .battle-room-change-notice.is-top.show {
      transform: translate(-50%, 0);
      pointer-events: none;
    }
    .battle-room-change-title {
      color: #fde68a;
      font-size: 15px;
      font-weight: 900;
      margin-bottom: 8px;
    }
    .battle-room-change-notice.is-top .battle-room-change-title {
      margin-bottom: 4px;
      font-size: 13px;
    }
    .battle-room-change-list {
      display: grid;
      gap: 5px;
      font-size: 13px;
      font-weight: 800;
      line-height: 1.45;
    }
    .battle-room-change-notice.is-top .battle-room-change-list {
      gap: 2px;
      font-size: 12px;
    }
    .battle-room-change-close {
      position: absolute;
      top: 8px;
      right: 9px;
      width: 30px;
      height: 30px;
      border: 0;
      border-radius: 50%;
      background: rgba(148,163,184,.16);
      color: #e2e8f0;
      cursor: pointer;
      font-size: 20px;
      line-height: 1;
    }

    .battle-players {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
      gap: 8px;
      margin-bottom: 14px;
    }
    .battle-players-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin: 10px 0 6px;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
    }
    .battle-player-slot {
      display: flex; align-items: center; gap: 8px;
      min-width: 0;
      padding: 8px 9px;
      background: rgba(15,23,42,.5);
      border: 1px solid rgba(148,163,184,.2);
      border-radius: 8px;
    }
    .battle-player-slot.host { border-color: #fbbf24; }
    .battle-player-slot.empty { opacity: .5; border-style: dashed; justify-content: center; font-size: 12px; color: var(--muted); }
    .battle-player-slot .av {
      width: 30px; height: 30px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      flex: 0 0 auto;
      overflow: hidden;
      font-size: 18px;
    }
    .battle-player-slot .av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .battle-player-slot .pname {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 700;
      color: #e2e8f0;
      font-size: 13px;
    }
    .battle-player-slot .crown { margin-left: auto; font-size: 16px; }
    .battle-player-slot.offline { opacity: .5; }

    .battle-room-chat {
      margin: 0 0 12px;
      padding: 10px;
      border: 1px solid rgba(148,163,184,.24);
      border-radius: 8px;
      background: rgba(15,23,42,.42);
    }
    .battle-chat-log {
      min-height: 74px;
      max-height: 132px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 2px 2px 8px;
    }
    .battle-chat-empty {
      color: var(--muted);
      font-size: 12px;
      text-align: center;
      padding: 24px 0 14px;
    }
    .battle-chat-empty.battle-chat-tip {
      text-align: left;
      padding: 12px 12px 13px;
      border: 1px solid rgba(56,189,248,.22);
      border-radius: 8px;
      background:
        linear-gradient(100deg, rgba(14,165,233,.12), rgba(251,191,36,.08)),
        rgba(2,6,23,.26);
    }
    .battle-chat-tip-kicker {
      color: #bae6fd;
      font-size: 11px;
      font-weight: 850;
      margin-bottom: 4px;
    }
    .battle-chat-tip-name {
      color: #fef3c7;
      font-size: 13px;
      font-weight: 950;
      margin-bottom: 3px;
    }
    .battle-chat-tip-body {
      color: #cbd5e1;
      font-size: 12px;
      line-height: 1.45;
    }
    .battle-chat-msg {
      display: grid;
      grid-template-columns: 30px minmax(0, 1fr);
      gap: 8px;
      align-items: start;
    }
    .battle-chat-av {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      font-size: 17px;
      flex: 0 0 auto;
    }
    .battle-chat-av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .battle-chat-bubble {
      min-width: 0;
      color: #dbeafe;
      font-size: 13px;
      line-height: 1.45;
      overflow-wrap: anywhere;
    }
    .battle-chat-name {
      display: inline;
      color: #fde68a;
      font-weight: 900;
      margin-right: 4px;
    }
    .battle-chat-text {
      display: inline;
      color: #e2e8f0;
      white-space: pre-wrap;
    }
    .battle-chat-form {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
      border-top: 1px solid rgba(148,163,184,.16);
      padding-top: 8px;
    }
    .battle-chat-form input {
      min-width: 0;
      width: 100%;
      padding: 10px 12px;
      border: 1px solid rgba(148,163,184,.28);
      border-radius: 8px;
      background: rgba(15,23,42,.72);
      color: #e2e8f0;
      font-size: 14px;
      outline: none;
    }
    .battle-chat-form input:focus {
      border-color: rgba(56,189,248,.72);
      box-shadow: 0 0 0 2px rgba(56,189,248,.14);
    }

    @media (min-width: 760px) {
      .battle-players {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }

    .battle-join-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
    .battle-join-row input {
      padding: 10px 14px;
      font-family: 'Courier New', monospace;
      font-size: 20px; letter-spacing: 4px;
      background: rgba(15,23,42,.7);
      border: 1px solid rgba(148,163,184,.3);
      border-radius: 10px;
      color: #e0f2fe;
      text-transform: uppercase;
      width: 140px;
      text-align: center;
    }

    .battle-open-head {
      margin: 18px 0 8px;
      font-size: 13px;
      font-weight: 800;
      color: #fde68a;
    }
    .battle-open-rooms {
      display: grid;
      gap: 8px;
      margin-bottom: 12px;
    }
    .battle-room-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      width: 100%;
      padding: 12px 14px;
      border: 1px solid rgba(148,163,184,.22);
      border-radius: 10px;
      background: rgba(15,23,42,.55);
      color: #e2e8f0;
      cursor: pointer;
      text-align: left;
      transition: transform .15s ease, border-color .15s ease, background .15s ease;
    }
    .battle-room-row:hover {
      transform: translateY(-1px);
      border-color: rgba(251,191,36,.55);
      background: rgba(30,41,59,.72);
    }
    .battle-room-row:disabled {
      opacity: .55;
      cursor: not-allowed;
      transform: none;
    }
    .battle-room-main {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }
    .battle-room-title {
      font-size: 15px;
      font-weight: 800;
      color: #f8fafc;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .battle-room-meta {
      font-size: 12px;
      color: var(--muted);
    }
    .battle-room-join {
      flex: 0 0 auto;
      padding: 7px 12px;
      border-radius: 999px;
      background: linear-gradient(135deg,#0ea5e9,#2563eb);
      color: #fff;
      font-size: 12px;
      font-weight: 900;
    }
    .battle-room-empty {
      padding: 14px;
      border: 1px dashed rgba(148,163,184,.25);
      border-radius: 10px;
      color: var(--muted);
      text-align: center;
      font-size: 13px;
      background: rgba(15,23,42,.35);
    }

    .battle-action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

    /* battle play */
    .battle-play-wrap {
      display: flex; flex-direction: column;
      min-height: 100svh;
      padding: 10px 12px env(safe-area-inset-bottom, 10px);
      gap: 10px;
      max-width: 760px; margin: 0 auto;
    }
    .battle-players-bar {
      display: flex; gap: 6px; overflow-x: auto;
      padding: 4px 0;
    }
    .battle-pill {
      display: inline-flex; align-items: center; gap: 6px;
      max-width: 128px;
      padding: 5px 8px;
      background: rgba(15,23,42,.65);
      border: 1.5px solid rgba(148,163,184,.25);
      border-radius: 999px;
      font-size: 12px;
      flex: 0 0 auto;
      transition: all .2s ease;
    }
    .battle-pill.mine { border-color: #0ea5e9; background: rgba(14,165,233,.15); }
    .battle-pill.eliminated { opacity: .35; filter: grayscale(.8); text-decoration: line-through; }
    .battle-pill.answered { border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.25); }
    .battle-pill .av {
      width: 22px; height: 22px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      overflow: hidden;
      font-size: 13px;
    }
    .battle-pill .av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .battle-pill .nm {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 700;
      color: #e2e8f0;
    }
    .battle-pill .sc {
      margin-left: 4px;
      padding-left: 6px;
      border-left: 1px solid rgba(148,163,184,.3);
      color: #fde68a; font-weight: 800;
      font-variant-numeric: tabular-nums;
    }

    .battle-timer-bar {
      height: 6px; background: rgba(15,23,42,.5);
      border-radius: 3px; overflow: hidden;
    }
    .battle-timer-bar .fill {
      height: 100%; width: 100%;
      background: linear-gradient(90deg, #22c55e, #fbbf24, #ef4444);
      transition: width .15s linear;
    }
    /* elim mode countdown urgency: flashes red when <= 3s left */
    .battle-time-urgent {
      color: #ef4444 !important;
      animation: battleTimeUrgent .5s ease-in-out infinite alternate;
    }
    @keyframes battleTimeUrgent {
      from { transform: scale(1); text-shadow: 0 0 0 rgba(239,68,68,0); }
      to   { transform: scale(1.15); text-shadow: 0 0 12px rgba(239,68,68,.7); }
    }

    .battle-hud { margin-bottom: 0 !important; }

    .battle-top-controls {
      width: 100%;
      max-width: 360px;
      align-self: center;
      margin: 2px auto 0;
      gap: 8px;
    }
    .battle-top-controls #battleNegBtn {
      flex: 0 0 88px;
    }
    .battle-top-controls #battleQuitBtn {
      flex: 1 1 auto;
    }

    .battle-buzz-countdown,
    .battle-buzz-collect,
    .battle-buzz-reveal {
      min-height: 1.4em;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
      letter-spacing: 0;
    }
    .battle-buzz-countdown span {
      color: #fde68a;
      font-size: clamp(72px, 18vw, 140px);
      line-height: .9;
      font-weight: 900;
      text-shadow: 0 0 24px rgba(251,191,36,.28);
    }
    .battle-buzz-countdown small,
    .battle-buzz-collect small,
    .battle-buzz-reveal small {
      color: #93c5fd;
      font-size: 16px;
      font-weight: 800;
    }
    .battle-buzz-reveal strong {
      color: #86efac;
      font-size: clamp(34px, 8vw, 64px);
      line-height: 1.05;
      font-weight: 900;
      text-shadow: 0 0 22px rgba(34,197,94,.22);
    }
    .battle-buzz-collect .expr {
      color: #e5e7eb;
      font-size: clamp(42px, 8vw, 62px);
      line-height: 1.05;
      font-weight: 900;
      letter-spacing: 0;
    }

    .battle-result-head {
      text-align: center; margin-bottom: 14px;
    }
    .battle-result-head .trophy { font-size: 48px; }
    .battle-result-head .winner { font-size: 22px; font-weight: 900; color: #fde68a; margin-top: 4px; }
    .battle-result-head .subt { color: var(--muted); font-size: 13px; }

    .battle-result-list {
      display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px;
    }
    .battle-result-row {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 14px;
      background: rgba(15,23,42,.5);
      border: 1px solid rgba(148,163,184,.2);
      border-radius: 12px;
    }
    .battle-result-row.rank-1 {
      border-color: #fbbf24;
      background: linear-gradient(100deg, rgba(251,191,36,.2), rgba(251,191,36,.05));
    }
    .battle-result-row .medal { font-size: 20px; width: 28px; text-align: center; }
    .battle-result-row .av {
      width: 32px; height: 32px; border-radius: 50%;
      display: inline-flex; align-items: center; justify-content: center;
      overflow: hidden;
      font-size: 18px;
    }
    .battle-result-row .av img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .battle-result-row .pname { font-weight: 800; color: #e2e8f0; flex: 1; }
    .battle-result-row .sc { font-size: 20px; font-weight: 900; color: #fde68a; font-variant-numeric: tabular-nums; }
    .battle-result-row.reflex {
      display: grid;
      grid-template-columns: 28px 32px minmax(0, 1fr);
      align-items: center;
      gap: 8px 10px;
    }
    .battle-result-row.reflex .pname { min-width: 0; }
    .battle-result-reflex-stats {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 6px;
    }
    .battle-result-reflex-stat {
      min-width: 0;
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 6px;
      padding: 7px 9px;
      border-radius: 8px;
      border: 1px solid rgba(148,163,184,.24);
      background: rgba(15,23,42,.48);
      font-variant-numeric: tabular-nums;
    }
    .battle-result-reflex-stat .label {
      color: #94a3b8;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
    }
    .battle-result-reflex-stat .value {
      color: #fde68a;
      font-size: 15px;
      font-weight: 900;
      white-space: nowrap;
    }
    .battle-result-reflex-stat.challenge {
      border-color: rgba(251,191,36,.38);
      background: rgba(120,53,15,.18);
    }
    .battle-result-reflex-detail {
      grid-column: 1 / -1;
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      color: #cbd5e1;
      font-size: 11px;
      line-height: 1.2;
    }
    .battle-result-reflex-chip {
      display: inline-flex;
      align-items: center;
      min-height: 22px;
      padding: 3px 7px;
      border-radius: 8px;
      border: 1px solid rgba(148,163,184,.26);
      background: rgba(15,23,42,.46);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .battle-result-reflex-chip.hit {
      color: #bbf7d0;
      border-color: rgba(34,197,94,.34);
      background: rgba(22,101,52,.2);
    }
    .battle-result-reflex-chip.invalid {
      color: #fecaca;
      border-color: rgba(248,113,113,.34);
      background: rgba(127,29,29,.2);
    }
    .battle-result-reflex-empty { color: var(--muted); }
    @media (max-width: 520px) {
      .battle-result-reflex-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .battle-result-reflex-stat { padding: 7px 8px; }
    }
    .battle-result-row.out .pname::after { content: "（淘汰）"; color: var(--muted); font-weight: normal; font-size: 11px; margin-left: 4px; }

    @media (max-width: 720px), (hover: none) and (pointer: coarse) {
      body[data-screen="battle-play"] {
        overscroll-behavior: none;
        touch-action: manipulation;
        overflow: hidden;
        padding: 0;
        height: 100svh;
        min-height: 100svh;
        justify-content: flex-start;
      }
      body[data-screen="battle-play"] > h1,
      body[data-screen="battle-play"] > .sub,
      body[data-screen="battle-play"] > #onlineBadge,
      body[data-screen="battle-play"] > #presenceStrip { display: none !important; }
      body[data-screen="battle-play"] > .card {
        max-width: 100vw; width: 100vw;
        height: 100svh;
        border-radius: 0; border: none; box-shadow: none;
        padding: 8px 10px env(safe-area-inset-bottom, 8px);
        display: flex;
        flex-direction: column;
      }
      body[data-screen="battle-play"] > .card > #battle-play.screen.active {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        gap: 0;
      }
      /* flatten the wrap — no extra padding, no min-height:100svh,
         so it inherits the card's bounded height cleanly */
      body[data-screen="battle-play"] #battle-play > .battle-play-wrap {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        max-width: 100vw;
        margin: 0;
        padding: 0;
        gap: 6px;
        overflow: hidden;
      }
      body[data-screen="battle-play"] .battle-players-bar,
      body[data-screen="battle-play"] .battle-timer-bar,
      body[data-screen="battle-play"] .battle-hud {
        flex: 0 0 auto;
      }
      body[data-screen="battle-play"] .battle-players-bar {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        grid-template-rows: repeat(2, auto);
        gap: 4px 6px;
        max-height: 68px;
        overflow-x: auto;
      }
      body[data-screen="battle-play"] .battle-pill {
        max-width: 112px;
        padding: 4px 7px;
        font-size: 11px;
      }
      body[data-screen="battle-play"] .battle-pill .av {
        width: 20px;
        height: 20px;
        font-size: 12px;
      }
      body[data-screen="battle-play"] #battleQBox {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        font-size: clamp(40px, 10vw, 80px);
        letter-spacing: 1px;
        line-height: 1.05;
        white-space: nowrap;
        margin: 0;
      }
      body[data-screen="battle-play"] #battleKeypad {
        flex: 0 0 auto;
        height: min(42svh, 400px);
        max-width: 460px;
        width: 100%;
        align-self: center;
        gap: 6px;
      }
      body[data-screen="battle-play"] #battleKeypad .key {
        padding: 0;
        height: 100%;
        min-height: 0;
        font-size: clamp(22px, 5.5vw, 32px);
      }
      /* row-ctrl pinned to bottom of wrap, always reachable */
      body[data-screen="battle-play"] .battle-play-wrap > .row-ctrl {
        flex: 0 0 auto;
        max-width: 460px;
        width: 100%;
        align-self: center;
        margin-top: 2px;
      }
    }

    /* ===== desktop battle-play: fixed-size layout (no flex-stretch jumping) ===== */
    @media (min-width: 721px) and (hover: hover) and (pointer: fine) {
      .battle-play-wrap {
        min-height: unset;
        max-width: 640px;
        margin: 0 auto;
        gap: 8px;
        padding: 14px 20px 18px;
      }
      /* question box: fixed height so layout never jumps between
         buzz countdown numbers and actual math questions */
      #battleQBox {
        height: 180px;
        min-height: 180px;
        max-height: 180px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 56px;
        letter-spacing: 1px;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        background: rgba(15,23,42,.55);
        border: 1px solid rgba(148,163,184,.12);
        border-radius: 18px;
        margin: 0;
      }
      /* buzz countdown number: fixed size on desktop */
      .battle-buzz-countdown span {
        font-size: 90px;
      }
      /* keypad: fixed pixel size, calculator-style */
      #battleKeypad {
        max-width: 460px;
        width: 100%;
        align-self: center;
        gap: 8px;
      }
      #battleKeypad .key {
        height: 58px;
        padding: 0;
        border-radius: 10px;
        font-size: 24px;
      }
      #battleKeypad .key.submit { font-size: 20px; }
      .battle-play-wrap > .row-ctrl {
        max-width: 360px;
        width: 100%;
        align-self: center;
        margin-top: 2px;
        gap: 8px;
      }
      .battle-play-wrap > .row-ctrl #battleNegBtn {
        flex: 0 0 88px;
      }
      .battle-play-wrap > .row-ctrl #battleQuitBtn {
        flex: 1 1 auto;
      }
      .battle-play-wrap > .row-ctrl .btn.small {
        min-height: 40px;
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 14px;
      }
    }

#whoBox1 .av, #whoBox1 .big-av { cursor: pointer; transition: transform 0.2s; }
#whoBox1 .av:active, #whoBox1 .big-av:active { transform: scale(0.95); }
#whoBox1 .av:hover::after, #whoBox1 .big-av:hover::after { content: '✎'; position: absolute; bottom:-4px; right:-4px; background:var(--primary); color:#fff; font-size:12px; padding:2px 6px; border-radius:10px; border:2px solid var(--panel); }

/* 8-Player Buzz Reveal Board */
.buzz-reveal-board {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92vw;
  max-width: 480px;
  max-height: 85svh;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: popInModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: normal;
  line-height: normal;
  letter-spacing: normal;
  color: #f1f5f9;
}

.buzz-reveal-header {
  text-align: center;
  margin-bottom: 16px;
  flex: 0 0 auto;
}

.buzz-reveal-header h3 {
  margin: 0;
  font-size: clamp(22px, 6vw, 28px);
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.buzz-reveal-header .qidx {
  display: inline-block;
  font-size: 14px;
  color: #94a3b8;
  margin-left: 8px;
  font-weight: normal;
}

.buzz-reveal-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 0 1 auto;
  padding: 4px;
  width: 100%;
}

.buzz-reveal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.buzz-reveal-row.winner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.15));
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

.buzz-reveal-row.correct .time {
  color: #4ade80;
}

.buzz-reveal-row.wrong {
  opacity: 0.6;
}

.buzz-reveal-row.wrong .time {
  color: #f87171;
}

.buzz-reveal-row .rank {
  font-weight: 900;
  width: 24px;
  text-align: center;
  font-size: 16px;
}

.buzz-reveal-row .av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.buzz-reveal-row .av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.buzz-reveal-row .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
  color: #e2e8f0;
  font-size: 16px;
  text-align: left;
}

.buzz-reveal-row .time {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 16px;
}

.buzz-reveal-row .status {
  font-size: 16px;
}

@keyframes popInModal {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}


/* ========== Number Climber ========== */

/* -- 全裝置全螢幕基礎 (桌面 + 手機統一) -- */
body[data-screen="number-climber"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100svh;
  min-height: 100svh;
  justify-content: flex-start;
  overscroll-behavior: none;
}
body[data-screen="number-climber"] > h1,
body[data-screen="number-climber"] > .sub,
body[data-screen="number-climber"] > #onlineBadge,
body[data-screen="number-climber"] > #presenceStrip { display: none !important; }
body[data-screen="number-climber"] > .card {
  max-width: 100vw !important; width: 100vw !important;
  height: 100svh !important;
  border-radius: 0 !important; border: none !important; box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

#number-climber.active {
  display: flex !important;
  flex-direction: column;
  background: linear-gradient(180deg, #0c1222 0%, #0f1a2e 40%, #162032 100%);
  color: var(--text);
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  height: 100svh;
  background-image: url('img/house_bg.jpg?v=1');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  position: relative;
}
#number-climber.active::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(12,18,34,0.85) 0%, rgba(15,26,46,0.5) 40%, rgba(22,32,50,0.85) 100%);
  pointer-events: none;
  z-index: 0;
}

.nc-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}


/* --- Header: 狀態欄 + 離開按鈕 --- */
.nc-header {
  position: relative; z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nc-status-bar {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.nc-status-text {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255,255,255,0.75);
  line-height: 1.4;
}
.nc-status-text b { color: #fff; }
.nc-status-win { color: var(--gold, #fbbf24) !important; font-weight: 700; }

.nc-quit-btn {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 8px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.nc-quit-btn:active { opacity: 0.8; }

/* --- Timer Bar --- */
.nc-timer-bar {
  position: relative; z-index: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.nc-timer-bar .fill {
  height: 100%;
  background: var(--accent, #38bdf8);
  transition: width 0.15s linear;
  border-radius: 0 2px 2px 0;
}

/* --- Tracks (主遊戲區域，佔滿剩餘空間) --- */
.nc-tracks {
  position: relative; z-index: 1;
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 48px 8px 24px;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.nc-track {
  flex: 1;
  max-width: 72px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  cursor: default;
}

.nc-track-rail {
  position: absolute;
  bottom: 22px;
  top: 0;
  width: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.25);
  border-left: 1px solid rgba(255,255,255,0.2);
  border-right: 1px solid rgba(255,255,255,0.2);
}
.nc-track.is-me .nc-track-rail {
  background: rgba(56,189,248,0.15);
  box-shadow: 0 0 10px rgba(56,189,248,0.2);
  border-color: rgba(56,189,248,0.3);
}

.nc-climber {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.nc-climber-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.15);
}
.nc-climber-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.nc-track.is-me .nc-climber-avatar {
  border-color: var(--accent, #38bdf8);
  box-shadow: 0 0 10px rgba(56,189,248,0.35);
}
.nc-climber-avatar.is-frozen {
  filter: hue-rotate(180deg) brightness(1.2) grayscale(0.4);
  box-shadow: 0 0 15px rgba(186,230,253,0.8);
  border-color: rgba(186,230,253,0.8);
}
.nc-effect-bomb {
  position: fixed;
  font-size: 48px;
  transform: translate(-50%, -50%) scale(0.1);
  pointer-events: none;
  z-index: 99999;
}
@keyframes ncBombBoom {
  0%   { transform: scale(0.1); opacity: 0; }
  15%  { transform: scale(2); opacity: 1; }
  40%  { transform: scale(1.6); opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}
@keyframes ncShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px) rotate(-5deg); }
  40%  { transform: translateX(6px) rotate(5deg); }
  60%  { transform: translateX(-4px) rotate(-3deg); }
  80%  { transform: translateX(4px) rotate(3deg); }
}

.nc-climber-floor {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 2px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.65);
  padding: 2px 6px;
  border-radius: 6px;
}

.nc-track-name {
  position: absolute;
  bottom: 2px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 68px;
  text-align: center;
  color: rgba(255,255,255,0.45);
}
.nc-track.is-me .nc-track-name {
  color: var(--accent, #38bdf8);
  font-weight: 700;
}

/* 攻擊目標可選 */
.nc-target-selectable { cursor: pointer; }
.nc-target-selectable .nc-climber-avatar {
  animation: nc-pulse 0.8s ease-in-out infinite alternate;
  border-color: #ef4444 !important;
}
@keyframes nc-pulse {
  from { box-shadow: 0 0 4px rgba(239,68,68,0.3); }
  to   { box-shadow: 0 0 14px rgba(239,68,68,0.7); }
}

/* --- Controls / Deck --- */
.nc-controls {
  position: relative; z-index: 1;
  flex-shrink: 0;
  padding: 6px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}

.nc-deck {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.nc-waiting {
  text-align: center;
  color: var(--muted);
  padding: 12px;
  font-size: 14px;
}

.nc-card {
  flex: 1;
  max-width: 140px;
  padding: 10px 6px;
  border-radius: 14px;
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  transition: transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nc-card:active { transform: scale(0.93); }

.nc-card-icon { font-size: 18px; }
.nc-card-label { font-size: 20px; font-weight: 900; line-height: 1.1; }
.nc-card-type { font-size: 10px; opacity: 0.7; }

.nc-card-move   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.nc-card-risk   { background: linear-gradient(135deg, #f59e0b, #b45309); }
.nc-card-save   { background: linear-gradient(135deg, #10b981, #047857); }
.nc-card-attack { background: linear-gradient(135deg, #ef4444, #991b1b); }

.nc-attack-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  color: #fca5a5;
  font-size: 14px;
  font-weight: 700;
  animation: nc-blink 1s ease-in-out infinite alternate;
}
@keyframes nc-blink {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}
.nc-cancel-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  cursor: pointer;
  font-size: 13px;
}

/* ========== 顛倒紅綠燈 (Traffic Light) ========== */
body[data-screen="traffic-light"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100svh;
  min-height: 100svh;
  justify-content: flex-start;
  overscroll-behavior: none;
}
body[data-screen="traffic-light"] > h1,
body[data-screen="traffic-light"] > .sub,
body[data-screen="traffic-light"] > #onlineBadge,
body[data-screen="traffic-light"] > #presenceStrip { display: none !important; }
body[data-screen="traffic-light"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100svh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
#traffic-light.screen.active {
  display: flex !important;
  min-height: 0;
  height: 100svh;
  background: linear-gradient(180deg, #0b1220 0%, #101827 54%, #162033 100%);
  color: #e5e7eb;
  overflow: hidden;
  position: relative;
}
.tl-wrap {
  width: min(100vw, 640px);
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: max(8px, env(safe-area-inset-top, 8px)) 12px max(10px, env(safe-area-inset-bottom, 10px));
  gap: 6px;
}
.tl-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2,6,23,0.5);
  pointer-events: auto;
}
.tl-intro-overlay.show {
  display: flex;
}
.tl-intro-overlay.counting {
  background: transparent;
  pointer-events: none;
}
.tl-intro-card {
  width: min(420px, 88vw);
  padding: 18px 18px 20px;
  border-radius: 8px;
  border: 1px solid rgba(125,211,252,0.32);
  background: rgba(15,23,42,0.94);
  box-shadow: 0 18px 46px rgba(0,0,0,0.42);
  text-align: center;
}
.tl-intro-count {
  color: #fde68a;
  font-size: 48px;
  line-height: 0.95;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(250,204,21,0.36);
}
.tl-intro-overlay.counting .tl-intro-count {
  font-size: 86px;
}
.tl-intro-title {
  margin-top: 10px;
  color: #e0f2fe;
  font-size: 18px;
  font-weight: 950;
}
.tl-intro-rule {
  margin-top: 10px;
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 800;
  text-align: left;
}
.tl-intro-rule > div {
  padding: 5px 0;
  border-top: 1px solid rgba(148,163,184,0.14);
}
.tl-intro-rule > div:first-child {
  border-top: 0;
}
.tl-intro-rule .headline {
  color: #f8fafc;
  font-size: 17px;
  font-weight: 950;
  text-align: center;
}
.tl-ready-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
}
.tl-ready-btn:disabled {
  opacity: 0.58;
  cursor: default;
}
.tl-ready-meta {
  margin-top: 8px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}
.battle-ready-summary {
  margin-bottom: 7px;
}
.battle-ready-list,
.qd-ready-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.battle-ready-chip,
.qd-ready-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 999px;
  background: rgba(15,23,42,0.62);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
}
.battle-ready-chip b,
.qd-ready-chip b {
  color: #fde68a;
  font-size: 13px;
  line-height: 1;
}
.battle-ready-chip span,
.qd-ready-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.battle-ready-chip em,
.qd-ready-chip em {
  color: #cbd5e1;
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}
.battle-ready-chip.is-ready,
.qd-ready-chip.is-ready {
  border-color: rgba(34,197,94,0.52);
  background: rgba(22,101,52,0.5);
  color: #dcfce7;
}
.battle-ready-chip.is-ready b,
.battle-ready-chip.is-ready em,
.qd-ready-chip.is-ready b,
.qd-ready-chip.is-ready em {
  color: #86efac;
}
.battle-ready-chip.not-ready,
.qd-ready-chip.not-ready {
  border-color: rgba(251,191,36,0.36);
}
.battle-ready-chip.offline {
  opacity: 0.56;
}
.cm-ready-meta .battle-ready-chip {
  background: rgba(255,255,255,0.78);
  color: #134e4a;
}
.cm-ready-meta .battle-ready-chip.is-ready {
  background: rgba(220,252,231,0.92);
  color: #166534;
}
.cm-ready-meta .battle-ready-chip.not-ready {
  background: rgba(254,243,199,0.92);
  color: #854d0e;
}
.battle-config-checkbox .battle-toggle-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}
.battle-config-checkbox-stack {
  align-items: flex-start;
}
.battle-toggle-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.battle-toggle-hint {
  color: #93a3b8;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}
.battle-config-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #22c55e;
}
.tl-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 72px 54px;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}
.tl-status {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(15,23,42,0.72);
  border-radius: 8px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-quit-btn {
  min-width: 0;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}
.tl-meta {
  display: none;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
}
.tl-pill,
.tl-time {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(125,211,252,0.24);
  background: rgba(8,47,73,0.42);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 900;
}
.tl-time {
  color: #fde68a;
  border-color: rgba(251,191,36,0.28);
  background: rgba(69,26,3,0.36);
  font-variant-numeric: tabular-nums;
}
.tl-stage {
  flex: 0 0 auto;
  min-height: 104px;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(30,41,59,0.76));
  box-shadow: inset 0 -14px 30px rgba(0,0,0,0.18);
}
.tl-stage.tl-switching {
  display: flex;
  justify-content: center;
  position: relative;
}
.tl-stage.tl-switching .tl-light-stack {
  margin: 0;
}
.tl-light-stack {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0 auto;
  padding: 9px;
  border-radius: 14px;
  background: linear-gradient(180deg, #111827, #020617);
  border: 2px solid #334155;
  box-shadow: inset 0 0 18px rgba(0,0,0,0.8), 0 14px 24px rgba(0,0,0,0.28);
}
.tl-lamp {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #1f2937;
  box-shadow: inset 0 0 18px rgba(0,0,0,0.9);
  opacity: 0.16;
  transition: background 0.12s ease-out, box-shadow 0.12s ease-out, opacity 0.12s ease-out;
}
.tl-light-stack[data-signal="red"] .tl-lamp-red {
  background: #ef4444;
  box-shadow: 0 0 28px rgba(239,68,68,0.78), inset 0 -8px 12px rgba(127,29,29,0.45);
  opacity: 1;
}
.tl-light-stack[data-signal="green"] .tl-lamp-green {
  background: #22c55e;
  box-shadow: 0 0 28px rgba(34,197,94,0.78), inset 0 -8px 12px rgba(20,83,45,0.45);
  opacity: 1;
}
.tl-light-stack[data-signal="yellow"] .tl-lamp {
  background: #facc15;
  box-shadow: 0 0 26px rgba(250,204,21,0.72), inset 0 -8px 12px rgba(113,63,18,0.42);
  opacity: 1;
}
.tl-light-stack[data-signal="pregame"] .tl-lamp {
  background: #facc15;
  box-shadow: 0 0 22px rgba(250,204,21,0.56), inset 0 -8px 12px rgba(113,63,18,0.42);
  opacity: 1;
}
.tl-command {
  display: none;
  min-width: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 950;
  color: #f8fafc;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 4px 18px rgba(0,0,0,0.45);
}
.tl-stage.tl-switching .tl-command {
  display: block;
  position: absolute;
  left: calc(50% + 50px);
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  max-width: calc(50% - 58px);
  text-align: left;
  white-space: nowrap;
}
.tl-stage[data-signal="red"] .tl-command { color: #fecaca; }
.tl-stage[data-signal="green"] .tl-command { color: #bbf7d0; }
.tl-stage[data-signal="yellow"] .tl-command { color: #fde68a; }
.tl-stage[data-signal="pregame"] .tl-command {
  color: #e0f2fe;
  font-size: 16px;
  line-height: 1.35;
}
.tl-tracks {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  padding: 2px 2px 4px;
}
.tl-track {
  flex: 0 0 clamp(42px, calc((100% - 28px) / var(--tl-player-count, 1)), 78px);
  min-width: 42px;
  max-width: 78px;
  padding: 4px 2px;
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 8px;
  background: rgba(15,23,42,0.58);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tl-track.self {
  border-color: rgba(56,189,248,0.45);
  background: rgba(8,47,73,0.38);
}
.tl-track.locked {
  border-color: rgba(248,113,113,0.45);
}
.tl-place {
  color: #fde68a;
  font-weight: 900;
  text-align: center;
}
.tl-road {
  position: relative;
  flex: 1 1 auto;
  width: min(100%, 54px);
  min-height: 190px;
  margin: 0;
  align-self: center;
  border-radius: 8px;
  background: linear-gradient(90deg, #334155 0 47%, #475569 47% 53%, #334155 53% 100%);
  overflow: visible;
}
.tl-road::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 50%;
  border-left: 2px dashed rgba(255,255,255,0.28);
  transform: translateX(-50%);
}
.tl-finish,
.tl-start {
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 1;
  color: rgba(226,232,240,0.78);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  pointer-events: none;
}
.tl-finish { top: 6px; }
.tl-start {
  bottom: 6px;
}
.tl-car {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: bottom 0.22s ease-out;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
  z-index: 2;
}
.tl-car-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 78px;
  margin-bottom: -8px;
  padding: 2px 6px 2px 2px;
  border-radius: 999px;
  background: rgba(2,6,23,0.82);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.34);
  position: relative;
  z-index: 2;
}
.tl-car-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 15px;
}
.tl-car-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.tl-car-id {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 38px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}
.tl-car-body {
  font-size: 28px;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.tl-car-taunt {
  margin-bottom: -4px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #facc15;
  color: #451a03;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.28);
  z-index: 3;
}
.tl-car-taunt-red {
  background: #ef4444;
  color: #fff;
  font-size: 20px;
  text-shadow: 0 2px 5px rgba(0,0,0,0.35);
}
.tl-car-taunt-horn {
  background: #facc15;
  color: #422006;
  font-size: 24px;
}
.tl-car-distance {
  margin-top: -1px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(15,23,42,0.82);
  border: 1px solid rgba(148,163,184,0.22);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.tl-track-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #94a3b8;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
}
.tl-message {
  flex: 0 0 auto;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(2,6,23,0.58);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.tl-controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tl-action {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}
.tl-action:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.tl-action:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}
.tl-throttle {
  background: linear-gradient(135deg, #16a34a, #15803d);
}
.tl-brake {
  background: linear-gradient(135deg, #ef4444, #991b1b);
}
.tl-controls.tl-normal-mode {
  grid-template-columns: 1fr;
}
.tl-controls.tl-normal-mode .tl-brake {
  display: none;
}
.tl-empty {
  padding: 16px;
  color: #94a3b8;
  text-align: center;
}
@media (max-width: 520px) {
  .tl-wrap { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .tl-header {
    grid-template-columns: minmax(0, 1fr) 66px 58px 48px;
    gap: 4px;
  }
  .tl-status,
  .tl-pill,
  .tl-time {
    min-height: 30px;
    padding-left: 5px;
    padding-right: 5px;
    font-size: 11px;
  }
  .tl-quit-btn { height: 30px; font-size: 12px; }
  .tl-stage {
    min-height: 88px;
    grid-template-columns: 66px minmax(0, 1fr);
    padding: 7px;
    gap: 6px;
  }
  .tl-light-stack {
    width: 58px;
    height: 58px;
    padding: 8px;
  }
  .tl-command { font-size: 19px; }
  .tl-stage.tl-switching .tl-command {
    left: calc(50% + 42px);
    max-width: calc(50% - 48px);
    font-size: 17px;
  }
  .tl-stage[data-signal="pregame"] .tl-command { font-size: 36px; }
  .tl-track { min-width: 40px; }
  .tl-action { min-height: 54px; font-size: 18px; }
}
@media (max-height: 680px) {
  .tl-stage { min-height: 82px; }
  .tl-light-stack { height: 56px; width: 56px; }
  .tl-road { min-height: 154px; }
  .tl-track { padding: 3px 1px; }
  .tl-track-foot { display: none; }
  .tl-action { min-height: 48px; }
}

/* ========== 拔刀斬 (Quick Draw) ========== */
body[data-screen="quick-draw"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100svh;
  min-height: 100svh;
  justify-content: flex-start;
  overscroll-behavior: none;
  background: #070b0f !important;
}
body[data-screen="quick-draw"] > h1,
body[data-screen="quick-draw"] > .sub,
body[data-screen="quick-draw"] > #onlineBadge,
body[data-screen="quick-draw"] > #presenceStrip {
  display: none !important;
}
body[data-screen="quick-draw"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100svh !important;
  max-height: 100svh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #070b0f !important;
  backdrop-filter: none !important;
  display: flex !important;
  flex-direction: column !important;
}
#quick-draw {
  background: #070b0f;
  color: #eef0ea;
  overflow: hidden;
  padding: 0;
  width: 100%;
}
#quick-draw.screen.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100svh;
  max-height: 100svh;
}
#qdStage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 22%, rgba(103,232,249,0.14), transparent 34%),
    linear-gradient(180deg, rgba(4,8,14,0.08), rgba(2,6,12,0.28) 72%, rgba(0,0,0,0.58)),
    url("img/quickdraw/bg_dojo_hq.webp") center/cover no-repeat;
  box-shadow: inset 0 -90px 140px rgba(0,0,0,0.55), inset 0 70px 120px rgba(0,0,0,0.24);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#quick-draw,
#qdStage,
#qdStage * {
  -webkit-touch-callout: none;
}
#qdBlackout {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(15,23,42,0.22), rgba(0,0,0,0.72) 62%, #000 100%),
    url("img/quickdraw/bg_dark_hq.webp") center/cover no-repeat,
    #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 5;
}
#qdCharRow {
  position: absolute;
  inset: auto 0 4.4% 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 4px;
  padding: 0 4%;
  z-index: 2;
}
.qd-char {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.95;
  flex: 0 1 auto;
  min-width: 0;
}
.qd-char::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: min(120px, 92%);
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.62), rgba(0,0,0,0.2) 52%, transparent 74%);
  filter: blur(3px);
  transform: translateX(-50%) scaleX(1.22);
  z-index: -1;
}
.qd-char::after {
  content: "";
  position: absolute;
  inset: -7% -26% 13%;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.96);
  background:
    radial-gradient(ellipse at 50% 38%, rgba(134,239,172,0.34) 0 20%, rgba(45,212,191,0.22) 38%, rgba(34,197,94,0.1) 58%, transparent 76%),
    radial-gradient(ellipse at 50% 70%, rgba(34,197,94,0.22), transparent 66%);
}
.qd-char .qd-shadow-body {
  position: relative;
  z-index: 1;
  height: 28dvh;
  max-height: 286px;
  min-height: 150px;
  width: auto;
  filter:
    drop-shadow(0 11px 12px rgba(0,0,0,0.58))
    drop-shadow(0 0 12px rgba(34,211,238,0.18));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.qd-char.spec { opacity: 0.25; }
.qd-char.dead { opacity: 0.72; transform: translateY(13px) scale(0.94); }
.qd-char.fouled .qd-shadow-body {
  filter:
    drop-shadow(0 0 12px rgba(248,113,113,0.78))
    drop-shadow(0 8px 10px rgba(0,0,0,0.55));
}
.qd-char.winner {
  transform: translateY(-10px) scale(1.12);
  filter: drop-shadow(0 0 24px rgba(251,191,36,0.72));
}
.qd-char.charging .qd-shadow-body,
.qd-char.glowing .qd-shadow-body {
  filter:
    drop-shadow(0 0 20px rgba(34,197,94,0.86))
    drop-shadow(0 0 34px rgba(45,212,191,0.42))
    drop-shadow(0 12px 12px rgba(0,0,0,0.48));
}
.qd-char.charging::after,
.qd-char.glowing::after {
  opacity: 1;
  transform: scale(1);
}
.qd-avatar-mask {
  --qd-avatar-size: clamp(30px, 5dvh, 50px);
  position: absolute;
  z-index: 4;
  top: 7.4%;
  left: 45.5%;
  width: var(--qd-avatar-size);
  height: var(--qd-avatar-size);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translate(-50%, 0);
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,0.16), transparent 42%),
    rgba(8, 13, 24, 0.96);
  border: 2px solid rgba(226,232,240,0.86);
  box-shadow:
    0 0 0 2px rgba(2,6,23,0.72),
    0 0 15px rgba(34,211,238,0.42),
    0 7px 14px rgba(0,0,0,0.36);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.qd-avatar-mask img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}
.qd-avatar-mask span {
  font-size: calc(var(--qd-avatar-size) * 0.58);
  line-height: 1;
}
.qd-char.self .qd-avatar-mask {
  border-color: #fde68a;
  box-shadow:
    0 0 0 2px rgba(113,63,18,0.78),
    0 0 18px rgba(251,191,36,0.54),
    0 7px 14px rgba(0,0,0,0.36);
}
.qd-char.pose-idle .qd-avatar-mask {
  --qd-avatar-size: clamp(24px, 4dvh, 38px);
  top: 8.8%;
}
.qd-char.charging .qd-avatar-mask,
.qd-char.glowing .qd-avatar-mask {
  border-color: #86efac;
  box-shadow:
    0 0 0 2px rgba(6,78,59,0.72),
    0 0 10px rgba(34,197,94,0.48);
}
.qd-char.pose-attack .qd-avatar-mask {
  top: 8.2%;
  left: 45.8%;
}
.qd-char.pose-dead .qd-avatar-mask {
  top: 22.4%;
  left: 38.6%;
}
.qd-char .qd-wins {
  position: relative;
  z-index: 2;
  font-size: 11px;
  color: #fbbf24;
  letter-spacing: 2px;
  margin-top: 2px;
}

/* 信號層 */
#qdSignal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
#qdVfx {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  padding: clamp(58px, 10svh, 112px) 12px 12px;
  pointer-events: none;
  z-index: 13;
}
.qd-signal-img {
  width: 38dvmin;
  height: 38dvmin;
  max-width: 380px;
  max-height: 380px;
  animation: qdSignalPop 0.15s ease-out;
  filter:
    drop-shadow(0 0 28px rgba(248,113,113,0.72))
    drop-shadow(0 18px 28px rgba(0,0,0,0.36));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.qd-center-prompt {
  padding: 18px 24px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,13,7,0.82), rgba(17,24,39,0.72));
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  text-align: center;
  max-width: min(82vw, 420px);
  animation: qdPromptPop 0.18s ease-out;
}
.qd-center-prompt .main {
  font-size: clamp(24px, 4.8vw, 42px);
  font-weight: 900;
  letter-spacing: 1px;
  color: #fef3c7;
}
.qd-center-prompt .sub {
  margin-top: 8px;
  font-size: 13px;
  color: #d1d5db;
}
.qd-center-prompt.ready {
  border-color: rgba(34,197,94,0.42);
  background: linear-gradient(180deg, rgba(7,21,11,0.88), rgba(11,31,18,0.76));
  box-shadow: 0 0 26px rgba(34,197,94,0.24), 0 18px 50px rgba(0,0,0,0.35);
}
.qd-center-prompt.ready .main {
  color: #86efac;
  text-shadow: 0 0 18px rgba(34,197,94,0.45);
}
.qd-center-prompt.mode {
  min-width: min(82vw, 460px);
  border-color: rgba(251,191,36,0.35);
  background: linear-gradient(180deg, rgba(26,15,5,0.9), rgba(17,24,39,0.82));
  box-shadow: 0 0 30px rgba(251,191,36,0.14), 0 18px 50px rgba(0,0,0,0.4);
}
.qd-center-prompt.mode .eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(251,191,36,0.16);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}
.qd-center-prompt.mode .main {
  color: #fff7ed;
}
.qd-center-prompt.mode .chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.qd-center-prompt.mode .chips span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(148,163,184,0.18);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
}
.qd-round-result {
  width: min(88vw, 420px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(10,13,7,0.92), rgba(17,24,39,0.88));
  box-shadow: 0 18px 48px rgba(0,0,0,0.42);
  padding: 16px 16px 14px;
  animation: qdPromptPop 0.16s ease-out;
}
.qd-round-result-head {
  text-align: center;
  margin-bottom: 12px;
}
.qd-round-result-title {
  font-size: 22px;
  font-weight: 900;
  color: #fef3c7;
}
.qd-round-result-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #fbbf24;
}
.qd-round-board {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  transform-origin: top center;
  box-sizing: border-box;
  width: min(calc(100vw - 24px), 720px);
  max-width: 720px;
  max-height: none;
  overflow: visible;
  z-index: 14;
  animation: qdPromptPop 0.16s ease-out;
}
.qd-round-board .buzz-reveal-header {
  margin-bottom: 10px;
}
.qd-round-board .qd-round-summary {
  margin-top: 8px;
  color: #fbbf24;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}
.qd-round-board .buzz-reveal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  overflow: visible;
  padding: 0;
}
.qd-round-board.qd-many-rows .buzz-reveal-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.qd-round-board .buzz-reveal-row {
  gap: 8px;
  padding: 8px 9px;
  font-size: 14px;
  min-width: 0;
}
.qd-round-board.qd-many-rows .buzz-reveal-row {
  gap: 6px;
  padding: 7px 8px;
}
.qd-round-board.qd-many-rows .buzz-reveal-row .av {
  width: 26px;
  height: 26px;
  font-size: 14px;
}
.qd-round-board .buzz-reveal-row .name {
  min-width: 0;
  font-size: 14px;
}
.qd-round-board.qd-many-rows .buzz-reveal-row .name {
  font-size: 13px;
}
.qd-round-board .buzz-reveal-row .time,
.qd-round-board .buzz-reveal-row .status {
  flex: 0 0 auto;
  font-size: 14px;
}
.qd-round-board.qd-many-rows .buzz-reveal-row .time,
.qd-round-board.qd-many-rows .buzz-reveal-row .status {
  font-size: 13px;
}
.qd-final-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  pointer-events: auto;
}
.qd-back-room-btn {
  pointer-events: auto;
  min-height: 40px;
  border: 1px solid rgba(251,191,36,0.5);
  border-radius: 8px;
  padding: 9px 18px;
  background: linear-gradient(180deg, rgba(251,191,36,0.24), rgba(180,83,9,0.22));
  color: #fef3c7;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}
.qd-back-room-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.qd-round-board .buzz-reveal-row.self .name {
  color: #86efac;
}
.qd-round-board .buzz-reveal-row.no_shot {
  opacity: 0.72;
}
.qd-round-board .buzz-reveal-row.foul {
  opacity: 0.58;
}
.qd-round-board .buzz-reveal-row.foul .time,
.qd-round-board .buzz-reveal-row.foul .status {
  color: #f87171;
}
.qd-round-board .buzz-reveal-row.no_shot .time,
.qd-round-board .buzz-reveal-row.no_shot .status {
  color: #cbd5e1;
}
.qd-round-result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qd-round-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.qd-round-row.winner {
  background: rgba(251,191,36,0.14);
  border-color: rgba(251,191,36,0.42);
  box-shadow: inset 0 0 0 1px rgba(251,191,36,0.12);
}
.qd-round-row.self .qd-round-name {
  color: #86efac;
}
.qd-round-row.muted {
  opacity: 0.82;
}
.qd-round-place {
  font-size: 18px;
  font-weight: 900;
  color: #fde68a;
}
.qd-round-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}
.qd-round-time {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: #e5e7eb;
}
@keyframes qdPromptPop {
  0%   { transform: translateY(10px) scale(0.96); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes qdSignalPop {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
body[data-qd-phase="trigger"]:not([data-qd-rule="blind"]) #qdStage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255,255,255,0), rgba(255,255,255,0.82), rgba(255,255,255,0)),
    radial-gradient(circle at 50% 50%, rgba(255,244,214,0.72), rgba(251,113,133,0.14) 44%, transparent 70%);
  opacity: 0.85;
  animation: qdFlash 0.25s ease-out forwards;
  z-index: 9;
  pointer-events: none;
}
body[data-qd-phase="blind_trigger"] #qdStage::before {
  content: none !important;
  display: none !important;
}
@keyframes qdFlash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* TENSION 期心跳脈動 */
body[data-qd-phase="tension"] #qdStage {
  animation: qdPulse 0.9s infinite;
}
@keyframes qdPulse {
  0%, 100% { filter: brightness(0.8); }
  50%      { filter: brightness(1.05); }
}

/* 顏色鈕（color 模式） */
#qdColorBtns {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}
.qd-color-btn {
  position: absolute;
  background: radial-gradient(circle at 50% 46%, rgba(255,255,255,0.12), rgba(15,23,42,0.58));
  border: 2px solid rgba(255,255,255,0.58);
  border-radius: 50%;
  padding: 4px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.12s, border-color 0.12s;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 14px 24px rgba(0,0,0,0.34), inset 0 0 18px rgba(255,255,255,0.1);
}
.qd-color-btn:active {
  transform: translate(-50%, -50%) scale(0.88);
  border-color: rgba(255,255,255,0.9);
}
.qd-color-red { box-shadow: 0 0 28px rgba(248,113,113,0.46), 0 14px 24px rgba(0,0,0,0.34); }
.qd-color-blue { box-shadow: 0 0 28px rgba(56,189,248,0.46), 0 14px 24px rgba(0,0,0,0.34); }
.qd-color-green { box-shadow: 0 0 28px rgba(52,211,153,0.46), 0 14px 24px rgba(0,0,0,0.34); }
.qd-color-btn img {
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* 假信號（落葉/烏鴉） */
#qdFakeouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}
.qd-fakeout {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  animation: qdFakeFloat 1.5s linear forwards;
}
.qd-fakeout img { width: 64px; height: auto; }
.qd-fakeout-leaf img { filter: drop-shadow(0 0 10px rgba(251,191,36,0.45)); width: 72px; }
.qd-fakeout-crow img { filter: drop-shadow(0 0 14px rgba(2,6,23,0.95)); width: 92px; }
.qd-fakeout-question img {
  width: 86px;
  filter: drop-shadow(0 0 18px rgba(168,85,247,0.72));
}
.qd-fakeout-wind {
  width: 140px;
  height: 48px;
  pointer-events: none;
}
.qd-fakeout-wind .qd-fake-line {
  display: block;
  width: 100%;
  height: 7px;
  margin-bottom: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(191,219,254,0.9), rgba(255,255,255,0));
  box-shadow: 0 0 12px rgba(191,219,254,0.32);
}
.qd-fakeout-flash {
  inset: 0;
  pointer-events: none;
  animation: qdFakeFlash 0.32s ease-out forwards;
}
.qd-fakeout-flash .qd-fake-flash-core {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.72), rgba(255,255,255,0.18) 34%, rgba(255,255,255,0) 66%),
    linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.42), rgba(255,255,255,0));
}
@keyframes qdFakeFloat {
  0%   { opacity: 0; transform: translate(-30px, -20px) rotate(-10deg); }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translate(80px, 120px) rotate(30deg); }
}
@keyframes qdFakeFlash {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

/* HUD */
#qdHud {
  flex: 0 0 auto;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 38dvh;
  overflow-y: auto;
}
.qd-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#qdPhaseLabel {
  font-size: 16px;
  font-weight: bold;
  color: #fef3c7;
}
.qd-quit-btn {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
#qdScoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
}
.qd-sb-row {
  display: flex;
  gap: 6px;
  color: #cbd5e1;
}
.qd-sb-row.self .nm { color: #fde68a; font-weight: bold; }
.qd-sb-row .wn { color: #fbbf24; }

/* 錦標賽賽程圖 */
#qdBracket {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 4px;
  border-top: 1px dashed rgba(255,255,255,0.15);
}
.qd-br-round {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}
.qd-br-title {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}
.qd-br-match {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
}
.qd-br-match.active {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.12);
  color: #fde68a;
}

/* RESOLUTION 刀光 */
body[data-qd-phase="resolution"] #qdStage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("img/quickdraw/vfx_slash.svg") center/contain no-repeat;
  opacity: 0;
  animation: qdSlash 0.58s cubic-bezier(.12,.74,.18,1) forwards;
  z-index: 11;
  pointer-events: none;
}
@keyframes qdSlash {
  0%   { opacity: 0; transform: scale(1.32) rotate(-7deg); filter: brightness(1.7); }
  20%  { opacity: 1; }
  52%  { opacity: 0.92; }
  100% { opacity: 0; transform: scale(0.92) rotate(5deg); filter: brightness(1); }
}

/* 手機橫螢幕時角色縮小 */
@media (max-height: 500px) {
  .qd-char .qd-shadow-body { height: 30dvh; }
  .qd-signal-img { width: 30dvmin; height: 30dvmin; }
}

/* ============================================================
   Mumu Pink Bunny Theme 🐰
   ============================================================ */

/* Immersive mode — hide site header when on workout screen */
body[data-screen="workout"] > h1,
body[data-screen="workout"] > .sub,
body[data-screen="workout"] > #onlineBadge,
body[data-screen="workout"] > #presenceStrip {
  display: none !important;
}
body[data-screen="workout"] {
  padding: 0 !important;
  background-color: #fff8f0 !important;
}
body[data-screen="workout"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  border-radius: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: none;
}
body[data-screen="workout"]::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #fff8f0 0%, #ffeef4 60%, #ffe4f0 100%);
  z-index: -1;
}
/* Hand-drawn doodle overlay (subtle hearts) */
body[data-screen="workout"]::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 154, 181, 0.18) 0 4px, transparent 5px),
    radial-gradient(circle at 88% 24%, rgba(255, 182, 213, 0.22) 0 6px, transparent 7px),
    radial-gradient(circle at 22% 78%, rgba(255, 200, 220, 0.18) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 88%, rgba(255, 154, 181, 0.18) 0 4px, transparent 5px);
  background-size: 360px 360px;
  background-repeat: repeat;
}

.mumu-container {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, #ffe4ee 0%, transparent 38%),
    radial-gradient(circle at 82% 28%, #ffeef4 0%, transparent 40%),
    radial-gradient(circle at 50% 95%, #ffe0ec 0%, transparent 42%),
    linear-gradient(180deg, #fff8f0 0%, #ffeef4 60%, #ffe4f0 100%);
  padding: 0;
  margin: 0;
  color: #6b3148;
}
#workout.screen.active {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}
.mumu-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 20px;
  background: rgba(255, 245, 250, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 182, 213, 0.4);
}
.mumu-header {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
.mumu-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.mumu-title-emoji {
  font-size: 34px;
  flex-shrink: 0;
  line-height: 1;
}
.mumu-title-text {
  font-size: 24px;
  font-weight: 800;
  color: #9d2667;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mumu-header-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mumu-pill-btn {
  background: rgba(255, 255, 255, 0.8);
  color: #9d2667;
  border: 1px solid rgba(255, 122, 168, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 122, 168, 0.15);
  transition: transform 0.15s, background 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mumu-btn-emoji { font-size: 14px; line-height: 1; }
.mumu-back-btn .mumu-btn-emoji { font-size: 16px; }
.mumu-back-btn { display: inline-flex; align-items: center; gap: 6px; }
.mumu-pill-btn:hover {
  transform: translateY(-1px);
  background: #fff;
}
.mumu-back-btn {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 122, 168, 0.4);
  transition: transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.mumu-back-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 122, 168, 0.55); }
.mumu-back-btn:active { transform: translateY(0); }
.mumu-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.mumu-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}
.mumu-stat-card {
  background: linear-gradient(135deg, #fff, #fff5fa);
  border: 1px solid rgba(255, 182, 213, 0.5);
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(255, 122, 168, 0.14);
  transition: transform 0.2s;
}
.mumu-stat-card:hover { transform: translateY(-2px); }
.mumu-stat-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--mc, #ff7aa8);
  margin-top: 6px;
}
.mumu-stat-val span { font-size: 15px; font-weight: normal; margin-left: 2px; }
.mumu-stat-label { font-size: 14px; color: #c26a9b; margin-top: 6px; font-weight: 600; }
.mumu-card {
  background: linear-gradient(135deg, #fff 0%, #fff8fb 100%);
  border: 1px solid rgba(255, 182, 213, 0.4);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 10px 32px rgba(255, 122, 168, 0.12);
  position: relative;
}
.mumu-card-title { font-size: 19px; font-weight: 800; color: #9d2667; letter-spacing: 0.3px; }
.mumu-card-sub { font-size: 14px; color: #c26a9b; margin: 6px 0 14px; line-height: 1.5; }
.mumu-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.mumu-link-btn {
  background: none; border: none; color: #c26a9b;
  text-decoration: underline; font-size: 13px; cursor: pointer;
}
.mumu-link-btn:hover { color: #9d2667; }
.mumu-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.mumu-check:hover { transform: translateX(2px); }
.mumu-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.mumu-day-card {
  border-radius: 22px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mumu-day-today { order: -1; grid-column: 1 / -1; }
.mumu-today-badge {
  position: absolute; top: 0; right: 0;
  color: #fff; font-size: 11px; font-weight: 800;
  padding: 5px 14px; border-bottom-left-radius: 14px; letter-spacing: 1px;
}
.mumu-day-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 10px;
}
.mumu-day-title { font-size: 17px; font-weight: 800; line-height: 1.35; flex: 1; min-width: 0; }
.mumu-edit-btn {
  background: rgba(255, 182, 213, 0.3);
  border: 1px solid rgba(255, 122, 168, 0.3);
  color: #9d2667;
  border-radius: 10px;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  transition: background 0.15s;
}
.mumu-edit-btn:hover { background: rgba(255, 182, 213, 0.55); }
.mumu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 182, 213, 0.3);
  border-radius: 16px;
  transition: background 0.2s;
}
.mumu-item-readonly { padding: 10px 12px; background: transparent; border: none; }
.mumu-item-counts { display: flex; gap: 8px; flex-shrink: 0; }
.mumu-count-today, .mumu-count-total {
  min-width: 50px;
  padding: 6px 8px;
  border-radius: 12px;
  text-align: center;
  background: rgba(255, 182, 213, 0.18);
  border: 1px solid rgba(255, 182, 213, 0.35);
}
.mumu-count-today.mumu-count-on {
  background: linear-gradient(135deg, #ff7aa8, #ff8fb8);
  border-color: #ff5590;
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 122, 168, 0.4);
}
.mumu-count-today.mumu-count-on .mumu-count-label,
.mumu-count-today.mumu-count-on .mumu-count-num { color: #fff; }
.mumu-count-label { font-size: 11px; color: #c26a9b; line-height: 1; letter-spacing: 0.5px; }
.mumu-count-num { font-size: 18px; font-weight: 800; color: #9d2667; line-height: 1.1; margin-top: 3px; }
.mumu-item-name {
  flex: 1; min-width: 0;
  font-size: 15px; color: #6b3148; line-height: 1.45;
  word-break: break-word;
}
.mumu-item-btns { display: flex; gap: 4px; flex-shrink: 0; }
.mumu-cnt-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: none;
  font-size: 18px; font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.mumu-cnt-plus {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  box-shadow: 0 3px 10px rgba(255, 122, 168, 0.35);
}
.mumu-cnt-plus:hover { transform: translateY(-1px) scale(1.05); }
.mumu-cnt-plus:active { transform: scale(0.95); }
.mumu-cnt-minus {
  background: rgba(255, 182, 213, 0.3);
  color: #9d2667;
  border: 1px solid rgba(255, 122, 168, 0.3);
}
.mumu-cnt-minus:hover:not(:disabled) { background: rgba(255, 182, 213, 0.55); }
.mumu-cnt-minus:disabled { opacity: 0.35; cursor: not-allowed; }
.mumu-drop { font-size: 22px; transition: all 0.2s; }
.mumu-progress {
  height: 10px;
  background: rgba(255, 182, 213, 0.25);
  border-radius: 999px;
  overflow: hidden;
}
.mumu-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff7aa8, #ff5590, #f472b6);
  transition: width 0.4s cubic-bezier(.4,2,.3,1);
  border-radius: 999px;
}
.mumu-cup-btn {
  width: 48px; height: 48px;
  border-radius: 14px;
  border: 2px solid rgba(255, 122, 168, 0.3);
  background: #fff;
  color: #9d2667;
  font-size: 22px; font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
}
.mumu-cup-btn:hover { transform: translateY(-2px); }
.mumu-cup-btn:active { transform: scale(0.92); }
.mumu-cup-plus {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 122, 168, 0.4);
}
.mumu-done .mumu-card-title {
  background: linear-gradient(90deg, #f59e0b, #ff7aa8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: mumuShine 2s linear infinite;
}
@keyframes mumuShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
.mumu-stars { display: flex; gap: 6px; margin: 10px 0; justify-content: center; }
.mumu-star {
  background: none; border: none;
  font-size: 32px; cursor: pointer;
  transition: transform 0.15s;
  padding: 4px;
}
.mumu-star:hover { transform: scale(1.2) rotate(-8deg); }
.mumu-note {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 182, 213, 0.5);
  background: rgba(255, 255, 255, 0.75);
  color: #5a2a3f;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.mumu-note:focus {
  outline: none;
  border-color: #ff7aa8;
  box-shadow: 0 0 0 3px rgba(255, 122, 168, 0.18);
}
.mumu-mood-history {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.mumu-mood-past {
  flex: 0 0 180px;
  background: rgba(255, 182, 213, 0.15);
  border: 1px solid rgba(255, 182, 213, 0.35);
  border-radius: 14px;
  padding: 10px 12px;
  scroll-snap-align: start;
}
.mumu-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 122, 168, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999999;
  padding: 20px;
  animation: mumuFadeIn 0.2s ease;
}
@keyframes mumuFadeIn { from { opacity: 0; } to { opacity: 1; } }
.mumu-modal {
  background: linear-gradient(135deg, #fff 0%, #fff8fb 100%);
  border-radius: 24px;
  max-width: 520px; width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(255, 122, 168, 0.35);
  animation: mumuPopIn 0.25s cubic-bezier(.4,2,.3,1);
}
@keyframes mumuPopIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mumu-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(255, 182, 213, 0.3);
}
.mumu-modal-body { padding: 18px 24px; overflow-y: auto; flex: 1; }
.mumu-modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(255, 182, 213, 0.3);
}
.mumu-item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.mumu-item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  background: rgba(255, 182, 213, 0.1);
  border-radius: 12px;
}
.mumu-move-col { display: flex; flex-direction: column; gap: 2px; }
.mumu-move-col .mumu-icon-btn { width: 22px; height: 22px; font-size: 10px; }
.mumu-item-input {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 182, 213, 0.5);
  background: #fff;
  color: #5a2a3f;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.mumu-item-input:focus {
  outline: none;
  border-color: #ff7aa8;
  box-shadow: 0 0 0 3px rgba(255, 122, 168, 0.18);
}
.mumu-icon-btn {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 182, 213, 0.4);
  background: #fff;
  color: #9d2667;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0;
  transition: background 0.15s;
}
.mumu-icon-btn:hover:not(:disabled) { background: rgba(255, 182, 213, 0.2); }
.mumu-icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.mumu-icon-btn.mumu-del { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.mumu-icon-btn.mumu-del:hover { background: rgba(239, 68, 68, 0.1); }
.mumu-add-btn {
  width: 100%;
  padding: 12px;
  background: rgba(255, 182, 213, 0.2);
  border: 2px dashed rgba(255, 122, 168, 0.45);
  border-radius: 12px;
  color: #9d2667;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.mumu-add-btn:hover { background: rgba(255, 182, 213, 0.4); }
.mumu-btn-primary {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 122, 168, 0.4);
}
.mumu-btn-primary:hover { transform: translateY(-1px); }
.mumu-btn-ghost {
  background: transparent;
  color: #9d2667;
  border: 1px solid rgba(255, 182, 213, 0.5);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
}
.mumu-btn-ghost:hover { background: rgba(255, 182, 213, 0.15); }

/* Mood history list */
.mumu-mood-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mumu-mood-entry {
  background: rgba(255, 182, 213, 0.12);
  border: 1px solid rgba(255, 182, 213, 0.3);
  border-radius: 14px;
  padding: 12px 14px;
}
.mumu-mood-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* Totals modal */
.mumu-totals-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255, 182, 213, 0.2), rgba(255, 228, 240, 0.4));
  border-radius: 14px;
  text-align: center;
}
.mumu-totals-big {
  font-size: 24px;
  font-weight: 800;
  color: #ff5590;
  line-height: 1.1;
}
.mumu-totals-lbl {
  font-size: 11px;
  color: #c26a9b;
  margin-top: 4px;
}
.mumu-totals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mumu-totals-row {
  position: relative;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mumu-totals-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(255, 122, 168, 0.25), rgba(255, 122, 168, 0.08));
  z-index: 0;
  border-radius: 10px;
}
.mumu-totals-name {
  flex: 1;
  min-width: 0;
  color: #5a2a3f;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  z-index: 1;
  word-break: break-word;
}
.mumu-totals-count {
  font-size: 16px;
  font-weight: 800;
  color: #9d2667;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .mumu-sticky { padding: 12px 14px; }
  .mumu-body { padding: 16px; gap: 18px; }
  .mumu-card { padding: 20px; border-radius: 22px; }
  .mumu-header { gap: 8px; }
  .mumu-title-emoji { font-size: 28px; }
  .mumu-title-text { font-size: 18px; }
  .mumu-header-btns { gap: 5px; }
  .mumu-pill-btn { padding: 8px 10px; font-size: 12px; }
  .mumu-pill-btn .mumu-btn-label { display: none; }
  .mumu-pill-btn .mumu-btn-emoji { font-size: 16px; }
  .mumu-back-btn { padding: 8px 12px; font-size: 12px; }
  .mumu-back-btn .mumu-btn-label { font-size: 12px; }
  .mumu-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .mumu-stat-val { font-size: 24px; }
  .mumu-item { flex-wrap: wrap; padding: 12px 14px; }
  .mumu-item-name { order: 3; flex-basis: 100%; margin-top: 6px; }
  .mumu-section-ribbon { writing-mode: horizontal-tb; padding: 8px 14px !important; min-height: 0 !important; flex-direction: row !important; justify-content: center; }
  .mumu-section-ribbon .mumu-ribbon-text { writing-mode: horizontal-tb; letter-spacing: 1px; }
}
@media (max-width: 400px) {
  .mumu-title-text { font-size: 16px; }
  .mumu-title-emoji { font-size: 22px; }
  .mumu-title { gap: 6px; }
  .mumu-back-btn { padding: 7px 10px; }
  .mumu-back-btn .mumu-btn-label { font-size: 11px; }
}

/* ============================================================
   Mumu — New cute components (mascots, ribbons, checklist)
   ============================================================ */

/* Pill-shaped section title (gradient) */
.mumu-pill-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1.5px;
  box-shadow: 0 8px 22px rgba(255, 122, 168, 0.35);
  position: relative;
}
.mumu-pill-title::before,
.mumu-pill-title::after {
  content: "💕";
  font-size: 18px;
  opacity: 0.9;
}

/* Section wrapper with vertical ribbon (like reference image) */
.mumu-section {
  display: flex;
  align-items: stretch;
  gap: 18px;
  position: relative;
}
.mumu-section > .mumu-card {
  flex: 1;
  min-width: 0;
}
.mumu-section-ribbon {
  flex: 0 0 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 0;
  background: linear-gradient(180deg, #ff8fb8, #ff7aa8);
  color: #fff;
  border-radius: 28px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 4px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  box-shadow: 0 8px 22px rgba(255, 122, 168, 0.32);
  min-height: 200px;
}
.mumu-section-ribbon .mumu-ribbon-emoji {
  writing-mode: horizontal-tb;
  font-size: 26px;
  letter-spacing: normal;
}

/* Mascot in card corner */
.mumu-mascot-corner {
  position: absolute;
  top: -14px;
  right: -8px;
  width: 72px;
  height: 72px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  pointer-events: none;
  transform: rotate(8deg);
  filter: drop-shadow(0 4px 8px rgba(255, 122, 168, 0.25));
  z-index: 2;
}
.mumu-mascot-corner.is-bunny { background-image: url('img/mumu/bunny-head.svg'); }
.mumu-mascot-corner.is-bear  { background-image: url('img/mumu/bear-head.svg'); }
.mumu-mascot-corner.is-girl  {
  background-image: url('img/mumu/girl-bun.svg');
  width: 80px; height: 96px; top: -22px;
}
.mumu-mascot-corner.is-heart {
  background-image: url('img/mumu/heart-balloon.svg');
  width: 56px; height: 88px; top: -20px;
  animation: mumuFloat 4s ease-in-out infinite;
}
@keyframes mumuFloat {
  0%, 100% { transform: rotate(8deg) translateY(0); }
  50% { transform: rotate(-4deg) translateY(-6px); }
}

/* Tip banner (like 小提醒 sticker in reference) */
.mumu-tip-banner {
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed rgba(255, 122, 168, 0.45);
  border-radius: 22px;
  padding: 16px 20px;
  color: #6b3148;
  font-size: 14px;
  line-height: 1.7;
  position: relative;
  box-shadow: 0 6px 18px rgba(255, 122, 168, 0.1);
}
.mumu-tip-banner-title {
  font-size: 15px;
  font-weight: 800;
  color: #9d2667;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mumu-tip-banner ul { margin: 0; padding-left: 22px; }
.mumu-tip-banner li { margin: 4px 0; }

/* Pep talk card (給努力的你) */
.mumu-pep-talk {
  background: linear-gradient(135deg, #fff 0%, #fff0f6 100%);
  border: 2px solid rgba(255, 122, 168, 0.35);
  border-radius: 24px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}
.mumu-pep-talk-title {
  font-size: 17px;
  font-weight: 800;
  color: #9d2667;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mumu-pep-talk-body {
  font-size: 14px;
  color: #6b3148;
  line-height: 1.7;
  flex: 1;
}
.mumu-pep-talk textarea {
  width: 100%;
  flex: 1;
  min-height: 80px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 182, 213, 0.5);
  background: rgba(255, 255, 255, 0.9);
  color: #6b3148;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.6;
}
.mumu-pep-talk textarea:focus {
  outline: none;
  border-color: #ff7aa8;
  box-shadow: 0 0 0 3px rgba(255, 122, 168, 0.18);
}

/* Section divider with heart */
.mumu-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: #ff7aa8;
}
.mumu-section-divider::before,
.mumu-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 122, 168, 0.4), transparent);
}

/* Goal chips */
.mumu-week-goals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 18px;
}
.mumu-goal-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 122, 168, 0.4);
  color: #9d2667;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 122, 168, 0.12);
}
.mumu-goal-chip .emoji { font-size: 18px; }

/* Daily checklist module */
.mumu-checklist {
  background: linear-gradient(135deg, #fff 0%, #fff8fb 100%);
  border: 2px solid rgba(255, 122, 168, 0.3);
  border-radius: 30px;
  padding: 28px 24px;
  box-shadow: 0 12px 36px rgba(255, 122, 168, 0.14);
  position: relative;
  overflow: hidden;
}
.mumu-checklist-head {
  text-align: center;
  margin-bottom: 18px;
  position: relative;
}
.mumu-checklist-sub {
  font-size: 15px;
  color: #c26a9b;
  margin-top: 10px;
  font-weight: 600;
}
.mumu-checklist-scroll {
  overflow-x: auto;
  margin: 0 -8px;
  padding: 0 8px 12px;
  -webkit-overflow-scrolling: touch;
}
.mumu-checklist-scroll::-webkit-scrollbar { height: 8px; }
.mumu-checklist-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 122, 168, 0.4);
  border-radius: 999px;
}
.mumu-checklist-table {
  display: grid;
  /* Date | 4 workouts | protein | hydration */
  grid-template-columns: 80px repeat(4, minmax(80px, 1fr)) minmax(80px, 1fr) minmax(96px, 1fr);
  gap: 8px;
  min-width: 620px;
}
.mumu-cl-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 182, 213, 0.3);
  border-radius: 14px;
  min-height: 56px;
  text-align: center;
}
.mumu-cl-cell.is-header {
  background: linear-gradient(135deg, rgba(255, 200, 220, 0.5), rgba(255, 228, 240, 0.5));
  border: 1px solid rgba(255, 122, 168, 0.3);
  font-weight: 800;
  color: #9d2667;
  font-size: 13px;
  line-height: 1.3;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
}
.mumu-cl-cell.is-header .mumu-cl-head-emoji { font-size: 20px; }
.mumu-cl-cell.is-header .mumu-cl-head-sub { font-size: 11px; font-weight: 600; color: #c26a9b; }
.mumu-cl-cell.is-date {
  font-weight: 800;
  color: #9d2667;
  font-size: 15px;
  background: rgba(255, 240, 247, 0.8);
  position: sticky;
  left: 0;
  z-index: 2;
}
.mumu-cl-row.is-today .mumu-cl-cell {
  border-color: #ff7aa8;
  background: rgba(255, 240, 247, 0.85);
  box-shadow: inset 0 0 0 1px rgba(255, 122, 168, 0.25);
}
.mumu-cl-row.is-today .mumu-cl-cell.is-date {
  background: linear-gradient(135deg, #ff7aa8, #ff8fb8);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 122, 168, 0.35);
}
.mumu-cl-row.is-today .mumu-cl-cell.is-date::after {
  content: "⭐";
  margin-left: 4px;
}
.mumu-cl-row.is-future .mumu-cl-cell { opacity: 0.55; }
/* Make rows display contents so the grid spans across */
.mumu-cl-row { display: contents; }

.mumu-check-cell {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 122, 168, 0.45);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: transparent;
  transition: all 0.15s;
  padding: 0;
}
.mumu-check-cell:hover { transform: scale(1.08); border-color: #ff7aa8; }
.mumu-check-cell.is-on {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  color: #fff;
  border-color: #ff5590;
  box-shadow: 0 4px 12px rgba(255, 122, 168, 0.4);
}
.mumu-check-cell.is-multi {
  width: auto;
  min-width: 44px;
  border-radius: 14px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: #9d2667;
}
.mumu-check-cell.is-multi.is-on { color: #fff; }

.mumu-mood-cell {
  display: inline-flex;
  gap: 6px;
}
.mumu-mood-cell button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 182, 213, 0.4);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.mumu-mood-cell button:hover { transform: scale(1.1); }
.mumu-mood-cell button.is-on {
  background: linear-gradient(135deg, #ffd1e0, #ffb3cf);
  border-color: #ff7aa8;
  box-shadow: 0 3px 10px rgba(255, 122, 168, 0.3);
  transform: scale(1.1);
}

/* Week footer (3 columns: goals + reward + letter) */
.mumu-week-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.mumu-mini-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: #6b3148;
  transition: background 0.15s;
}
.mumu-mini-check:hover { background: rgba(255, 240, 247, 0.85); }
.mumu-mini-check .box {
  width: 22px; height: 22px;
  border-radius: 8px;
  border: 2px solid rgba(255, 122, 168, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  flex-shrink: 0;
}
.mumu-mini-check.is-on .box {
  background: linear-gradient(135deg, #ff7aa8, #ff5590);
  border-color: #ff5590;
  color: #fff;
  font-weight: 800;
}
.mumu-mini-check.is-on .label { text-decoration: line-through; opacity: 0.7; }

/* Collapsible details menu */
.mumu-collapse {
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.mumu-collapse.is-collapsed { max-height: 0; }
.mumu-collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(255, 122, 168, 0.4);
  border-radius: 999px;
  color: #9d2667;
  font-size: 14px;
  font-weight: 700;
  margin: 0 auto;
  transition: all 0.2s;
}
.mumu-collapse-toggle:hover {
  background: #fff;
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  .mumu-section { flex-direction: column; gap: 10px; }
  .mumu-section-ribbon {
    flex: 0 0 auto;
    flex-direction: row;
    writing-mode: horizontal-tb;
    min-height: 0;
    padding: 10px 18px;
    border-radius: 999px;
    letter-spacing: 2px;
    align-self: center;
  }
  .mumu-section-ribbon .mumu-ribbon-emoji { font-size: 20px; }
  .mumu-pill-title { font-size: 18px; padding: 10px 22px; letter-spacing: 1px; }
  .mumu-checklist { padding: 22px 14px; border-radius: 24px; }
  .mumu-mascot-corner { width: 56px; height: 56px; top: -10px; right: -4px; }
  .mumu-mascot-corner.is-girl { width: 60px; height: 72px; top: -16px; }
  .mumu-mascot-corner.is-heart { width: 44px; height: 70px; top: -16px; }
}

/* Mobile-first: tight checklist that fits iPhone 17 (393px) without horizontal scroll */
@media (max-width: 480px) {
  .mumu-checklist { padding: 20px 8px; }
  .mumu-checklist-scroll { margin: 0 -2px; padding: 0 2px 10px; overflow-x: hidden; }
  .mumu-checklist-table {
    grid-template-columns: 42px repeat(4, minmax(0, 1fr)) 46px 50px;
    gap: 4px;
    min-width: 0;
    width: 100%;
  }
  .mumu-cl-cell {
    padding: 5px 1px;
    min-height: 48px;
    border-radius: 10px;
    overflow: hidden;
  }
  .mumu-cl-cell.is-header {
    font-size: 10px;
    min-height: 58px;
    padding: 5px 1px;
    line-height: 1.15;
  }
  .mumu-cl-cell.is-header .mumu-cl-head-emoji { font-size: 14px; }
  .mumu-cl-cell.is-header .mumu-cl-head-sub { font-size: 9px; }
  .mumu-cl-cell.is-date { font-size: 12px; padding: 5px 0; }
  .mumu-check-cell { width: 26px; height: 26px; font-size: 12px; border-width: 1.5px; }
  .mumu-check-cell.is-multi { min-width: 30px; padding: 0 3px; font-size: 10px; height: 26px; }
  .mumu-mood-cell { gap: 2px; }
  .mumu-mood-cell button { width: 20px; height: 20px; font-size: 11px; border-width: 1px; }
  .mumu-week-goals { gap: 8px; margin: 12px 0 14px; }
  .mumu-goal-chip { padding: 8px 12px; font-size: 13px; }
  .mumu-goal-chip .emoji { font-size: 15px; }
  .mumu-week-footer { gap: 14px; margin-top: 18px; }
  .mumu-pep-talk { padding: 18px 18px; min-height: 110px; }
  .mumu-pep-talk-title { font-size: 15px; margin-bottom: 8px; }
  .mumu-pill-title { font-size: 16px; padding: 9px 18px; letter-spacing: 1px; }
  .mumu-pill-title::before, .mumu-pill-title::after { font-size: 14px; }
  .mumu-checklist-sub { font-size: 13px; }
  .mumu-tip-banner { padding: 14px 16px; font-size: 13px; }
  .mumu-collapse-toggle { padding: 9px 16px; font-size: 13px; }
}

/* ===================== Quest Hall ===================== */
.quest-hall-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px 8px;
}

.quest-hall-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.quest-status-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid rgba(116,245,223,.22);
  border-radius: 999px;
  background: rgba(15,23,42,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 20px rgba(0,0,0,.14);
}

.quest-status-tab {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(226,232,240,.82);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.quest-status-tab.active {
  color: #082f49;
  background: linear-gradient(135deg, #67e8f9, #fbbf24);
  box-shadow: 0 8px 18px rgba(34,211,238,.18);
}

.quest-status-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(148,163,184,.16);
  color: #dff7ff;
  text-align: center;
  font-size: 12px;
}

.quest-status-tab.active .quest-status-count {
  background: rgba(8,47,73,.16);
  color: #082f49;
}

.quest-hall-sub { color: var(--muted); font-size: 13px; }

.quest-hall-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 8px 16px 4px;
}

.quest-hall-guide-card {
  background: linear-gradient(180deg, rgba(41,54,72,.96), rgba(28,38,53,.98));
  border: 1px solid rgba(116,245,223,.16);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
}

.quest-hall-guide-title {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
  color: #e9fff8;
}

.quest-hall-guide-card p {
  margin: 0;
  color: rgba(234,243,255,.82);
  font-size: 13px;
  line-height: 1.7;
}

.quest-leaderboard {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 20px 2px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,215,107,.24);
  background:
    linear-gradient(90deg, rgba(255,215,107,.13), rgba(93,255,211,.07)),
    rgba(15,23,42,.32);
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
}

.quest-leaderboard-head {
  flex: 0 0 auto;
  margin: 0;
}

.quest-leaderboard-title {
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  color: #ffd76b;
}

.quest-rank-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow: visible;
}

.quest-rank-top {
  flex: 1 1 auto;
  align-content: center;
}

.quest-rank-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: max-content;
  max-width: 150px;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
}

.quest-rank-chip.rank-1 {
  border-color: rgba(255,215,107,.52);
  background: linear-gradient(90deg, rgba(255,215,107,.24), rgba(255,255,255,.06));
  box-shadow: 0 0 18px rgba(255,215,107,.12);
}

.quest-rank-chip.rank-2 {
  border-color: rgba(207,216,232,.34);
}

.quest-rank-chip.rank-3 {
  border-color: rgba(245,158,11,.34);
}

.quest-rank-medal {
  font-size: 14px;
  font-weight: 800;
}

.quest-rank-name {
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 12px;
  color: #f8fafc;
}

.quest-rank-count {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(93,255,211,.14);
  color: #9fffe7;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.quest-rank-perfect {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,215,107,.14);
  color: #ffe28a;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.quest-rank-empty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.quest-rank-more {
  flex: 1 0 100%;
  margin-top: 6px;
}

.quest-rank-more summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,215,107,.24);
  border-radius: 10px;
  background: rgba(255,215,107,.08);
  color: #ffe28a;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.quest-rank-more summary::-webkit-details-marker {
  display: none;
}

.quest-rank-more summary::after {
  content: "＋";
  margin-left: 8px;
}

.quest-rank-more[open] summary::after {
  content: "－";
}

.quest-rank-more[open] summary {
  margin-bottom: 6px;
}

.quest-rank-extra {
  margin-top: 6px;
  flex-wrap: wrap;
  overflow-x: visible;
}

.quest-list { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 10px; }
.quest-empty { text-align: center; color: var(--muted); padding: 30px 16px; }

.quest-all-done-empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 6px 0 18px;
  padding: 34px 18px 38px;
  border-radius: 22px;
  border: 1px solid rgba(116, 245, 223, .28);
  background:
    radial-gradient(circle at 50% 12%, rgba(251, 191, 36, .18), transparent 34%),
    linear-gradient(135deg, rgba(9, 64, 45, .92), rgba(15, 23, 42, .9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 22px 50px rgba(0,0,0,.18);
  color: #eafff7;
}

.quest-all-done-art {
  width: 180px;
  max-width: 58%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,.28));
}

.quest-all-done-title {
  color: #ffffff;
  font-size: 44px;
  line-height: 1.08;
  font-weight: 1000;
  text-shadow: 0 2px 18px rgba(45, 212, 191, .28);
}

.quest-all-done-sub {
  max-width: 520px;
  color: #b9f6e2;
  font-size: 15px;
  line-height: 1.7;
}

.quest-all-done-action {
  min-height: 42px;
  margin-top: 4px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 215, 107, .42);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(251, 191, 36, .95), rgba(94, 234, 212, .9));
  color: #083344;
  font: inherit;
  font-size: 14px;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(45, 212, 191, .16);
}

.quest-all-done-action:hover {
  transform: translateY(-1px);
}

/* ===================== Idiom Quiz ===================== */
.idiom-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, .8fr);
  gap: 16px;
  align-items: stretch;
  padding: 6px 2px 16px;
}

.idiom-kicker {
  color: #fbbf24;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.idiom-hero h2,
.idiom-finish h2,
.idiom-question-wrap h2,
.idiom-result h2 {
  margin: 4px 0 8px;
  color: #f8fafc;
  font-size: 26px;
  letter-spacing: 0;
}

.idiom-hero p,
.idiom-question-wrap p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.6;
}

.idiom-stats,
.idiom-finish-grid,
.idiom-hud,
.idiom-answer-grid {
  display: grid;
  gap: 10px;
}

.idiom-stats {
  grid-template-columns: repeat(3, 1fr);
}

.idiom-stat,
.idiom-finish-grid > div,
.idiom-hud > div,
.idiom-answer-grid > div {
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(15, 23, 42, .44);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}

.idiom-stat b,
.idiom-finish-grid b,
.idiom-hud b {
  display: block;
  color: #67e8f9;
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.idiom-stat span,
.idiom-finish-grid span,
.idiom-hud span,
.idiom-answer-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.idiom-panel,
.idiom-play,
.idiom-result,
.idiom-finish {
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(15, 23, 42, .35);
  border-radius: 16px;
  padding: 16px;
}

.idiom-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.idiom-mode,
.idiom-segment button {
  border: 1px solid rgba(148, 163, 184, .22);
  color: #dbeafe;
  background: rgba(30, 41, 59, .92);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
}

.idiom-mode.active,
.idiom-segment button.active {
  color: #082f49;
  background: linear-gradient(135deg, #67e8f9, #fbbf24);
  border-color: transparent;
}

.idiom-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.idiom-config-stack {
  display: grid;
  gap: 14px;
}

.idiom-config-grid label,
.idiom-config-stack label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 900;
}

.idiom-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.idiom-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.idiom-toggle {
  border: 1px solid rgba(148, 163, 184, .22);
  color: #dbeafe;
  background: rgba(30, 41, 59, .92);
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.idiom-toggle span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(226, 232, 240, .65);
  display: inline-block;
}

.idiom-toggle.active {
  color: #ecfeff;
  border-color: rgba(103, 232, 249, .55);
  background: rgba(14, 116, 144, .38);
}

.idiom-toggle.active span {
  border-color: #67e8f9;
  background: radial-gradient(circle, #67e8f9 0 45%, transparent 50%);
}

.idiom-start {
  margin-top: 18px;
}

.idiom-error {
  margin-top: 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, .14);
  border: 1px solid rgba(239, 68, 68, .28);
  border-radius: 10px;
  padding: 10px 12px;
}

.idiom-hud {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.idiom-question-wrap {
  border: 1px solid rgba(251, 191, 36, .24);
  background: rgba(251, 191, 36, .08);
  border-radius: 14px;
  padding: 16px;
}

.idiom-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.idiom-meta span {
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
}

.idiom-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.idiom-option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(30, 41, 59, .86);
  color: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.idiom-option:hover {
  border-color: rgba(103, 232, 249, .5);
  background: rgba(14, 116, 144, .26);
}

.idiom-options-review .idiom-option {
  cursor: default;
}

.idiom-options-review .idiom-option:hover {
  border-color: rgba(148, 163, 184, .18);
  background: rgba(30, 41, 59, .86);
}

.idiom-option.correct {
  border-color: rgba(34, 197, 94, .55);
  background: rgba(22, 101, 52, .35);
}

.idiom-option.correct span {
  background: #86efac;
  color: #052e16;
}

.idiom-option.wrong {
  border-color: rgba(248, 113, 113, .55);
  background: rgba(127, 29, 29, .34);
}

.idiom-option.wrong span {
  background: #fca5a5;
  color: #450a0a;
}

.idiom-option.dim {
  opacity: .48;
}

.idiom-option span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #082f49;
  background: #67e8f9;
  font-weight: 900;
}

.idiom-option b {
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.idiom-result-head,
.idiom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.idiom-result-head span {
  color: #052e16;
  background: #86efac;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 900;
}

.idiom-result.bad .idiom-result-head span {
  color: #450a0a;
  background: #fca5a5;
}

.idiom-answer-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}

.idiom-answer-grid p {
  margin: 6px 0 0;
  color: #f8fafc;
  line-height: 1.55;
}

.idiom-explain {
  color: #e0f2fe;
  background: rgba(14, 165, 233, .12);
  border: 1px solid rgba(14, 165, 233, .24);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.65;
  margin-bottom: 14px;
}

.idiom-explain-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.idiom-explain-row {
  color: #e0f2fe;
  background: rgba(14, 165, 233, .12);
  border: 1px solid rgba(14, 165, 233, .24);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.65;
}

.idiom-result.ok .idiom-explain-row {
  background: rgba(34, 197, 94, .10);
  border-color: rgba(34, 197, 94, .22);
}

.idiom-explain-label {
  color: #67e8f9;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 3px;
}

.idiom-result.ok .idiom-explain-label {
  color: #86efac;
}

.idiom-explain-text {
  color: #f8fafc;
  overflow-wrap: anywhere;
}

.idiom-context {
  color: #cbd5e1;
  background: rgba(15, 23, 42, .36);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  padding: 10px 12px;
}

.idiom-context summary {
  cursor: pointer;
  color: #67e8f9;
  font-weight: 900;
}

.idiom-context p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.idiom-finish {
  text-align: center;
}

.idiom-finish-grid {
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0;
}

.idiom-review-list {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

.idiom-review-item {
  border: 1px solid rgba(148, 163, 184, .18);
  background: rgba(15, 23, 42, .34);
  border-radius: 12px;
  padding: 12px;
}

.idiom-review-item h3 {
  margin: 0 0 10px;
  color: #f8fafc;
  font-size: 20px;
}

@media (max-width: 720px) {
  .idiom-hero,
  .idiom-config-grid,
  .idiom-answer-grid {
    grid-template-columns: 1fr;
  }

  .idiom-stats,
  .idiom-hud,
  .idiom-finish-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .idiom-panel,
  .idiom-play,
  .idiom-result,
  .idiom-finish {
    padding: 14px;
  }
}

@media (max-width: 430px) {
  .idiom-stats,
  .idiom-hud,
  .idiom-finish-grid {
    grid-template-columns: 1fr;
  }

  .idiom-option {
    grid-template-columns: 32px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
.quest-hall-guide { grid-template-columns: 1fr; }
.quest-leaderboard {
    display: block;
    margin: 10px 16px 2px;
    padding: 9px 10px;
  }
  .quest-leaderboard-head {
    padding: 0;
    margin-bottom: 7px;
  }
  .quest-leaderboard-title {
    font-size: 13px;
  }
  .quest-rank-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: visible;
  }
  .quest-rank-chip {
    min-width: 0;
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    gap: 7px;
    padding: 6px 9px;
    border-radius: 10px;
  }
  .quest-rank-name {
    flex: 1 1 auto;
    max-width: none;
    font-size: 12px;
  }
  .quest-rank-count {
    margin-left: auto;
    padding: 2px 7px;
    font-size: 11px;
  }
  .quest-rank-perfect {
    padding: 2px 7px;
    font-size: 11px;
  }
  .quest-rank-medal {
    width: 20px;
    text-align: center;
    font-size: 13px;
  }
}

.quest-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--card, #1d2431);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 14px 16px;
  cursor: pointer; transition: transform .12s ease, background .15s ease;
  color: inherit; font: inherit;
}
.quest-item:hover { background: rgba(255,255,255,.06); transform: translateY(-1px); }
.quest-item.done { opacity: .64; text-decoration: none; }
.quest-list.showing-done .quest-item.done { opacity: .86; }
.quest-item.done .quest-progress-fill { background: #5dd39e; }
.quest-item-icon { font-size: 28px; flex: 0 0 auto; }
.quest-item-main { flex: 1 1 auto; min-width: 0; }
.quest-item-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.quest-item-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #c4f1ff;
  background: rgba(93,255,211,.12);
  border: 1px solid rgba(93,255,211,.22);
}
.quest-item-reward,
.quest-reward-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  color: #ffe08a;
  background: linear-gradient(135deg, rgba(255,215,107,.22), rgba(245,158,11,.12));
  border: 1px solid rgba(255,215,107,.38);
  box-shadow: 0 0 12px rgba(255,215,107,.12);
}
.quest-item-title .badge-new { color: gold; font-size: 12px; font-weight: 600; }
.quest-item-sub { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.quest-progress { display: flex; align-items: center; gap: 10px; }
.quest-progress-bar { flex: 1 1 auto; height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.quest-progress-fill { height: 100%; background: linear-gradient(90deg, #6cf, #5dd); transition: width .3s ease; }
.quest-progress-label { font-size: 13px; color: #ffd76b; font-weight: 700; flex: 0 0 auto; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.quest-item.done .quest-progress-label { color: var(--muted); font-weight: 500; text-shadow: none; }
.quest-progress-right { margin-top: 4px; }
.quest-progress-right .quest-progress-bar { height: 6px; }
.quest-fill-right { background: linear-gradient(90deg, #5dd39e, #ffd76b); }
.quest-right-label { color: #5dd39e; }
.quest-item.done .quest-right-label { color: var(--muted); }

@media (max-width: 760px) {
  body[data-screen="quest-hall"] {
    align-items: stretch;
    padding-left: max(6px, env(safe-area-inset-left, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
  }

  body[data-screen="quest-hall"] > .card {
    width: 100%;
    max-width: none;
    padding: 10px 8px 18px;
    border-radius: 14px;
  }

  body[data-screen="quest-hall"] .topbar {
    margin-bottom: 12px;
  }

  .quest-hall-header {
    gap: 8px;
    padding: 10px 8px 6px;
  }

  .quest-hall-header h2 {
    font-size: 21px;
  }

  .quest-status-tabs {
    gap: 3px;
    padding: 3px;
  }

  .quest-status-tab {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .quest-hall-guide {
    gap: 8px;
    padding: 6px 4px;
  }

  .quest-hall-guide-card {
    border-radius: 12px;
    padding: 12px;
  }

  .quest-list {
    gap: 8px;
    padding: 10px 4px 18px;
  }

  .quest-item {
    gap: 10px;
    padding: 12px 10px;
    border-radius: 12px;
  }

  .quest-item-icon {
    width: 32px;
    text-align: center;
    font-size: 24px;
  }

  .quest-item-title {
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.25;
  }

  .quest-item-title > span:first-child {
    flex: 1 1 138px;
    min-width: 0;
  }

  .quest-item-sub {
    margin: 4px 0 8px;
  }

  .quest-progress {
    gap: 8px;
  }

  .quest-progress-label {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .quest-progress {
    flex-wrap: wrap;
  }

  .quest-progress-bar {
    flex: 1 1 100%;
  }

  .quest-progress-label {
    margin-left: auto;
  }
}

/* ========== Cat Cafe Memory ========== */
body[data-screen="cat-memory"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100vh;
  min-height: 100vh;
  height: 100svh;
  min-height: 100svh;
  height: var(--app-vh, 100vh);
  min-height: var(--app-vh, 100vh);
  background: #fff6e8 !important;
  overscroll-behavior: none;
}
body[data-screen="cat-memory"] > h1,
body[data-screen="cat-memory"] > .sub,
body[data-screen="cat-memory"] > #onlineBadge,
body[data-screen="cat-memory"] > #presenceStrip {
  display: none !important;
}
body[data-screen="cat-memory"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  height: 100svh !important;
  min-height: 100svh !important;
  max-height: 100svh !important;
  height: var(--app-vh, 100vh) !important;
  min-height: var(--app-vh, 100vh) !important;
  max-height: var(--app-vh, 100vh) !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
}
#cat-memory.screen.active {
  display: flex !important;
  flex: 1 1 auto;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  height: 100svh;
  max-height: 100svh;
  height: var(--app-vh, 100vh);
  max-height: var(--app-vh, 100vh);
  width: 100%;
}
.cm-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  color: #51342b;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.1) 42%, rgba(180,107,70,0.1) 100%),
    linear-gradient(135deg, #fff6e8 0%, #f7dfbf 46%, #cfeee4 100%);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
body.cm-ios-browser-ui[data-screen="cat-memory"] .cm-wrap {
  padding-bottom: 0;
  padding-bottom: var(--cat-memory-browser-bottom, 0px);
}
.cm-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(255,255,255,0.34) 18% 19%, transparent 19% 100%),
    linear-gradient(180deg, rgba(104,161,142,0.16) 0 1px, transparent 1px 100%);
  background-size: 190px 100%, 100% 48px;
  opacity: 0.48;
}
.cm-header {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 250, 240, 0.88);
  border-bottom: 1px solid rgba(146, 91, 54, 0.18);
  box-shadow: 0 6px 18px rgba(109, 65, 40, 0.08);
}
#cat-memory.cm-finished .cm-header {
  z-index: 12;
}
.cm-title {
  font-size: 19px;
  font-weight: 900;
  color: #7c3f2b;
  white-space: nowrap;
}
.cm-status,
.cm-round,
.cm-timer {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid rgba(146,91,54,0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.62);
  color: #68402f;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.cm-status {
  justify-content: flex-start;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cm-timer {
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}
.cm-quit-btn {
  min-height: 34px;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  background: #8b5e3c;
  color: #fff8ed;
  font-weight: 900;
  cursor: pointer;
}
.cm-score-strip {
  position: relative;
  z-index: 3;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(136px, max-content);
  gap: 8px;
  overflow-x: auto;
  padding: 9px 12px;
  background: rgba(255,248,236,0.72);
  border-bottom: 1px solid rgba(146,91,54,0.12);
  scrollbar-width: thin;
}
.cm-score-pill {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  min-width: 136px;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid rgba(146,91,54,0.16);
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
  box-shadow: 0 5px 12px rgba(112,72,42,0.07);
}
.cm-score-pill.self {
  border-color: rgba(20,184,166,0.42);
  box-shadow: 0 0 0 2px rgba(20,184,166,0.12), 0 5px 12px rgba(112,72,42,0.07);
}
.cm-score-pill.offline { opacity: 0.55; }
.cm-score-pill.out {
  opacity: 0.62;
  filter: grayscale(0.35);
}
.cm-score-avatar {
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 17px;
}
.cm-score-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.cm-score-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
  color: #51342b;
}
.cm-score-main {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: stretch;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #14b8a6;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.cm-score-sub {
  grid-column: 2;
  color: #8a6251;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.cm-playfield {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 10px 12px 12px;
  overflow: hidden;
}
.cm-window {
  position: absolute;
  left: 50%;
  top: 12px;
  width: min(760px, calc(100% - 32px));
  height: 42%;
  transform: translateX(-50%);
  z-index: -1;
  border: 1px solid rgba(89,143,126,0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255,255,255,0.54) 49% 51%, transparent 51%),
    linear-gradient(180deg, transparent 49%, rgba(255,255,255,0.54) 49% 51%, transparent 51%),
    linear-gradient(180deg, #c9edf0 0%, #eaf8e8 54%, #fff7db 100%);
  box-shadow: inset 0 -24px 50px rgba(84,142,123,0.18), 0 12px 22px rgba(112,72,42,0.08);
  overflow: hidden;
}
.cm-plant {
  position: absolute;
  bottom: 0;
  width: 66px;
  height: 76px;
  background:
    linear-gradient(180deg, #d7855a 0 62%, #9b5838 62% 100%);
  border-radius: 8px 8px 5px 5px;
}
.cm-plant::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: -42px;
  height: 58px;
  background:
    linear-gradient(135deg, transparent 0 28%, #6fbf8f 28% 55%, transparent 55%),
    linear-gradient(45deg, transparent 0 26%, #4fa976 26% 55%, transparent 55%),
    linear-gradient(180deg, transparent 0 38%, #7ac79b 38% 70%, transparent 70%);
}
.cm-plant-left { left: 24px; }
.cm-plant-right { right: 24px; transform: scaleX(-1); }
.cm-sequence {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  width: min(760px, 100%);
  min-height: 58px;
  margin: 0 auto;
}
.cm-seq-card {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(146,91,54,0.16);
  border-radius: 8px;
  background: rgba(255,255,255,0.78);
  color: #5b392c;
  box-shadow: 0 8px 16px rgba(112,72,42,0.07);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.cm-seq-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.2;
}
.cm-seq-card.active {
  transform: translateY(-3px);
  border-color: rgba(20,184,166,0.62);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(20,184,166,0.16), 0 10px 20px rgba(112,72,42,0.1);
}
.cm-seq-card.hidden {
  background: rgba(255,252,246,0.64);
  color: #9b6d55;
  border-style: dashed;
}
.cm-seq-card.hidden.done {
  border-style: solid;
  border-color: rgba(20,184,166,0.28);
  color: #0f766e;
}
.cm-seq-card.dir-up { --cm-mini-paw-color: #2fb8a8; --cm-card-dir-color: #0f766e; }
.cm-seq-card.dir-down { --cm-mini-paw-color: #e9b13f; --cm-card-dir-color: #9a5d00; }
.cm-seq-card.dir-left { --cm-mini-paw-color: #73bce3; --cm-card-dir-color: #1d6f9c; }
.cm-seq-card.dir-right { --cm-mini-paw-color: #de5d7d; --cm-card-dir-color: #a8274d; }
.cm-card-cue {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}
.cm-mini-paw {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-block;
  --cm-mini-paw-rot: 0deg;
  --cm-mini-paw-scale: 1;
  transform: rotate(var(--cm-mini-paw-rot)) scale(var(--cm-mini-paw-scale));
  transform-origin: center;
}
.cm-mini-paw.paw-up { --cm-mini-paw-rot: 0deg; }
.cm-mini-paw.paw-down { --cm-mini-paw-rot: 180deg; }
.cm-mini-paw.paw-left { --cm-mini-paw-rot: -90deg; }
.cm-mini-paw.paw-right { --cm-mini-paw-rot: 90deg; }
.cm-mini-paw::before,
.cm-mini-paw::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--cm-mini-paw-color, #f4a7a8);
}
.cm-mini-paw::before {
  left: 6px;
  bottom: 2px;
  width: 14px;
  height: 12px;
}
.cm-mini-paw::after {
  left: 2px;
  top: 3px;
  width: 20px;
  height: 8px;
  box-shadow:
    0 -1px 0 var(--cm-mini-paw-color, #f4a7a8),
    -5px 4px 0 -1px var(--cm-mini-paw-color, #f4a7a8),
    5px 4px 0 -1px var(--cm-mini-paw-color, #f4a7a8);
}
.cm-card-dir {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(146,91,54,0.22);
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--cm-card-dir-color, #5b392c);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(112,72,42,0.12);
}
.cm-mascot-stage {
  position: relative;
  z-index: 1;
  align-self: center;
  justify-self: center;
  width: min(470px, 88%);
  height: min(470px, 100%);
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: transform 0.14s ease;
}
.cm-mascot-stage::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8px;
  height: 28px;
  border-radius: 50%;
  background: rgba(104,70,43,0.17);
  filter: blur(2px);
}
.cm-mascot-stage img {
  position: relative;
  z-index: 2;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 12px 16px rgba(104,70,43,0.18));
  transform-origin: 50% 86%;
}
.cm-mascot-stage.pose-up img {
  animation: cmPoseUp var(--cm-pose-ms, 220ms) ease;
}
.cm-mascot-stage.pose-down img {
  animation: cmPoseDown var(--cm-pose-ms, 220ms) ease;
}
.cm-mascot-stage.pose-left img {
  animation: cmPoseLeft var(--cm-pose-ms, 220ms) ease;
}
.cm-mascot-stage.pose-right img {
  animation: cmPoseRight var(--cm-pose-ms, 220ms) ease;
}
.cm-mascot-stage.pose-fall img {
  animation: cmPoseFall 420ms cubic-bezier(.18,.84,.22,1);
}
.cm-counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: 19%;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.18) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #b97955 0%, #925437 100%);
  background-size: 86px 100%, 100% 100%;
  border-top: 7px solid #e5a66f;
}
.cm-message {
  position: relative;
  z-index: 2;
  width: min(760px, 100%);
  min-height: 40px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(146,91,54,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
  color: #68402f;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}
.cm-wrong-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: min(420px, calc(100% - 32px));
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border: 2px solid rgba(222,93,125,0.4);
  border-radius: 8px;
  background: rgba(255,250,246,0.96);
  color: #8a2448;
  box-shadow: 0 16px 34px rgba(112,72,42,0.2);
  font-size: 20px;
  font-weight: 950;
  line-height: 1.28;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.96);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.cm-wrong-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.cm-paw-controls {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  width: min(560px, 100%);
  justify-self: center;
  gap: 9px;
  padding: 10px 12px 12px;
  background: rgba(255,248,236,0.9);
  border-top: 1px solid rgba(146,91,54,0.16);
}
.cm-paw-btn {
  --paw-bg: #fffaf2;
  --paw-line: rgba(146,91,54,0.2);
  --paw-pad: #f59aae;
  --paw-toe: #f9bdc9;
  min-width: 0;
  min-height: 82px;
  display: grid;
  grid-template-rows: 48px auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  border: 1px solid var(--paw-line);
  border-radius: 8px;
  background: var(--paw-bg);
  color: #5b392c;
  box-shadow: 0 8px 18px rgba(112,72,42,0.08);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}
.cm-paw-btn:active:not(:disabled),
.cm-paw-btn.pressed {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 4px 12px rgba(112,72,42,0.08), 0 0 0 4px rgba(20,184,166,0.13);
  filter: brightness(1.05) saturate(1.08);
}
.cm-paw-btn.pressed .cm-paw-shape {
  animation: cmPawPress 0.18s ease;
}
.cm-paw-btn:disabled {
  cursor: default;
  filter: saturate(0.62);
  opacity: 0.72;
}
.cm-paw-btn.pressed:disabled {
  opacity: 1;
  filter: brightness(1.05) saturate(1.08);
}
.cm-paw-btn.cm-up { --paw-pad: #2fb8a8; --paw-toe: #6bd4c6; }
.cm-paw-btn.cm-down { --paw-pad: #e9b13f; --paw-toe: #f6cd68; }
.cm-paw-btn.cm-left { --paw-pad: #73bce3; --paw-toe: #9ad4f1; }
.cm-paw-btn.cm-right { --paw-pad: #de5d7d; --paw-toe: #f18aa1; }
.cm-paw-btn.cm-up { grid-area: up; }
.cm-paw-btn.cm-down { grid-area: down; }
.cm-paw-btn.cm-left { grid-area: left; }
.cm-paw-btn.cm-right { grid-area: right; }
.cm-paw-shape {
  position: relative;
  width: 54px;
  height: 48px;
  display: inline-block;
  --paw-scale: 1;
  transform: scale(var(--paw-scale));
  transform-origin: center center;
}
.cm-paw-shape i,
.cm-paw-shape b {
  position: absolute;
  display: block;
  background: var(--paw-toe);
  border: 2px solid rgba(116,68,48,0.12);
}
.cm-paw-shape i {
  width: 13px;
  height: 16px;
  border-radius: 50%;
  top: 4px;
}
.cm-paw-shape i:nth-child(1) { left: 5px; transform: rotate(-17deg); }
.cm-paw-shape i:nth-child(2) { left: 17px; top: 0; }
.cm-paw-shape i:nth-child(3) { right: 17px; top: 0; }
.cm-paw-shape i:nth-child(4) { right: 5px; transform: rotate(17deg); }
.cm-paw-shape b {
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 27px;
  border-radius: 48% 48% 44% 44%;
  background: var(--paw-pad);
}
.cm-paw-label {
  max-width: 100%;
  padding: 0 4px 7px;
  color: #543226;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
.cm-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255,255,255,0.74), rgba(255,246,232,0.38) 32%, rgba(92,58,38,0.3) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.cm-intro-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.cm-intro-card {
  width: min(390px, 100%);
  padding: 22px;
  border: 1px solid rgba(146,91,54,0.2);
  border-radius: 8px;
  background: rgba(255,250,241,0.96);
  box-shadow: 0 22px 48px rgba(104,70,43,0.23);
  text-align: center;
}
.cm-intro-count {
  width: 104px;
  height: 104px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fce7c8, #ffffff);
  border: 2px solid rgba(146,91,54,0.16);
  color: #7c3f2b;
  font-size: 28px;
  font-weight: 950;
  box-shadow: inset 0 -10px 22px rgba(214,140,90,0.14), 0 10px 22px rgba(112,72,42,0.14);
}
.cm-intro-overlay.counting .cm-intro-count {
  color: #0f766e;
  font-size: 50px;
  animation: cmCountdownPop 0.72s ease infinite;
}
.cm-intro-title {
  margin-top: 14px;
  color: #7c3f2b;
  font-size: 22px;
  font-weight: 950;
}
.cm-intro-rule {
  margin-top: 12px;
  color: #68402f;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 850;
  text-align: left;
}
.cm-intro-rule > div {
  padding: 5px 0;
  border-top: 1px solid rgba(146,91,54,0.13);
}
.cm-intro-rule > div:first-child {
  border-top: 0;
}
.cm-result-show .cm-intro-card {
  width: min(520px, calc(100vw - 32px));
}
.cm-result-show .cm-intro-count {
  display: none;
}
.cm-result-show .cm-intro-title {
  margin-top: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.05;
  color: #7c2d12;
  letter-spacing: 0;
}
.cm-result-show .cm-ready-btn {
  width: auto;
  min-width: 128px;
  min-height: 38px;
  margin: 14px auto 0;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid #ef4444;
  color: #0f766e;
  box-shadow: 0 4px 10px rgba(112,72,42,0.1);
}
.cm-result-show .cm-intro-rule {
  text-align: initial;
}
.cm-result-list {
  display: grid;
  gap: 7px;
}
.cm-result-row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(146,91,54,0.14);
  background: rgba(255,255,255,0.72);
}
.cm-result-row.self {
  border-color: rgba(20,184,166,0.44);
  box-shadow: 0 0 0 2px rgba(20,184,166,0.1);
}
.cm-result-row.out {
  opacity: 0.62;
  filter: grayscale(0.35);
}
.cm-result-rank {
  color: #9a3412;
  font-size: 14px;
  font-weight: 950;
  text-align: center;
}
.cm-result-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cm-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cm-result-name,
.cm-result-stat {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-result-name {
  color: #5b392c;
  font-size: 14px;
  font-weight: 950;
}
.cm-result-stat {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}
.cm-ready-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 15px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15,118,110,0.22);
}
.cm-ready-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.cm-ready-btn:disabled {
  opacity: 0.58;
  cursor: default;
  box-shadow: none;
}
.cm-ready-meta {
  margin-top: 8px;
  color: #0f766e;
  font-size: 13px;
  font-weight: 900;
}
@keyframes cmPoseUp {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-12px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes cmPoseDown {
  0% { transform: scale(1); }
  45% { transform: translateY(9px) scale(1.04, 0.96); }
  100% { transform: scale(1); }
}
@keyframes cmPoseLeft {
  0% { transform: rotate(0deg); }
  45% { transform: rotate(-4deg) translateX(-8px); }
  100% { transform: rotate(0deg); }
}
@keyframes cmPoseRight {
  0% { transform: rotate(0deg); }
  45% { transform: rotate(4deg) translateX(8px); }
  100% { transform: rotate(0deg); }
}
@keyframes cmPoseFall {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  42% { transform: translateY(16px) rotate(-8deg) scale(1.03); }
  100% { transform: translateY(8px) rotate(-3deg) scale(1); }
}
@keyframes cmPawPress {
  0% { transform: scale(var(--paw-scale)); }
  45% { transform: scale(calc(var(--paw-scale) * 0.86)) translateY(3px); }
  100% { transform: scale(var(--paw-scale)); }
}
@keyframes cmCountdownPop {
  0% { transform: scale(0.92); }
  45% { transform: scale(1.05); }
  100% { transform: scale(0.92); }
}
@media (max-width: 720px) {
  .cm-header {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 8px;
  }
  .cm-title { font-size: 17px; }
  .cm-round { display: none; }
  .cm-status,
  .cm-timer {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 12px;
  }
  .cm-quit-btn {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
  }
  .cm-score-strip {
    padding: 7px 8px;
    grid-auto-columns: minmax(122px, max-content);
  }
  .cm-score-pill {
    min-width: 122px;
    padding: 6px 7px;
  }
  .cm-score-main {
    min-width: 30px;
    font-size: 14px;
  }
  .cm-playfield {
    padding: 8px;
  }
  .cm-sequence {
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
    gap: 6px;
  }
  .cm-seq-card {
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 6px 7px;
  }
  .cm-seq-card strong {
    font-size: 12px;
  }
  .cm-mini-paw {
    --cm-mini-paw-scale: 0.85;
  }
  .cm-mascot-stage {
    width: min(360px, 92%);
    min-height: 220px;
  }
  .cm-message {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 13px;
  }
  .cm-paw-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }
  .cm-paw-btn {
    min-height: 58px;
    grid-template-rows: 34px auto;
  }
  .cm-paw-shape {
    --paw-scale: 0.72;
  }
  .cm-paw-label {
    font-size: 12px;
    padding-bottom: 5px;
  }
  .cm-intro-overlay {
    padding: 14px;
  }
  .cm-intro-card {
    padding: 17px;
  }
  .cm-intro-count {
    width: 84px;
    height: 84px;
    font-size: 23px;
  }
  .cm-intro-overlay.counting .cm-intro-count {
    font-size: 42px;
  }
  .cm-intro-title {
    font-size: 19px;
  }
  .cm-intro-rule {
    font-size: 13px;
  }
}
@media (max-height: 650px) {
  .cm-score-strip {
    display: none;
  }
  .cm-sequence {
    min-height: 44px;
  }
  .cm-seq-card {
    min-height: 44px;
  }
  .cm-mascot-stage {
    min-height: 190px;
  }
  .cm-paw-btn {
    min-height: 50px;
    grid-template-rows: 28px auto;
  }
  .cm-paw-shape {
    --paw-scale: 0.62;
  }
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-score-strip {
  display: none;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-header {
  padding: 6px 8px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-playfield {
  padding: 6px 8px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-sequence {
  min-height: 42px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-seq-card {
  min-height: 42px;
  padding: 5px 7px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-mascot-stage {
  width: min(320px, 88%);
  min-height: 160px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-message {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-paw-controls {
  gap: 5px;
  padding: 6px 8px 8px;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-paw-btn {
  min-height: 50px;
  grid-template-rows: 28px auto;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-paw-shape {
  --paw-scale: 0.62;
}
body.cm-compact-browser-ui[data-screen="cat-memory"] .cm-paw-label {
  font-size: 12px;
  padding-bottom: 4px;
}
@media (max-device-height: 760px) {
  body[data-screen="cat-memory"] .cm-wrap {
    padding-bottom: 152px;
    padding-bottom: calc(144px + env(safe-area-inset-bottom, 0px));
  }
  body[data-screen="cat-memory"] .cm-score-strip {
    display: none;
  }
  body[data-screen="cat-memory"] .cm-header {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 5px;
    padding: 5px 7px;
  }
  body[data-screen="cat-memory"] .cm-title {
    font-size: 16px;
  }
  body[data-screen="cat-memory"] .cm-round {
    display: none;
  }
  body[data-screen="cat-memory"] .cm-status,
  body[data-screen="cat-memory"] .cm-timer {
    min-height: 28px;
    padding: 3px 7px;
    font-size: 12px;
  }
  body[data-screen="cat-memory"] .cm-quit-btn {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }
  body[data-screen="cat-memory"] .cm-playfield {
    padding: 5px 8px;
  }
  body[data-screen="cat-memory"] .cm-window {
    top: 8px;
    height: 36%;
  }
  body[data-screen="cat-memory"] .cm-sequence {
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 5px;
    min-height: 38px;
  }
  body[data-screen="cat-memory"] .cm-seq-card {
    min-height: 38px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 4px;
    padding: 4px 6px;
  }
  body[data-screen="cat-memory"] .cm-seq-card strong {
    font-size: 11px;
  }
  body[data-screen="cat-memory"] .cm-card-cue {
    width: 24px;
    height: 24px;
  }
  body[data-screen="cat-memory"] .cm-mini-paw {
    --cm-mini-paw-scale: 0.72;
  }
  body[data-screen="cat-memory"] .cm-mascot-stage {
    width: min(250px, 76%);
    height: min(250px, 100%);
    min-height: 120px;
  }
  body[data-screen="cat-memory"] .cm-counter {
    height: 16%;
    border-top-width: 5px;
  }
  body[data-screen="cat-memory"] .cm-message {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
  }
  body[data-screen="cat-memory"] .cm-paw-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      ". up ."
      "left down right";
    width: min(420px, 100%);
    gap: 5px;
    padding: 6px 8px 7px;
  }
  body[data-screen="cat-memory"] .cm-paw-btn {
    min-height: 44px;
    grid-template-rows: 24px auto;
    gap: 1px;
  }
  body[data-screen="cat-memory"] .cm-paw-shape {
    --paw-scale: 0.52;
  }
  body[data-screen="cat-memory"] .cm-paw-label {
    font-size: 11px;
    line-height: 1.1;
    padding-bottom: 3px;
  }
}

/* Play screen */
body[data-screen="quest-play"] {
  padding: 0 !important;
  height: var(--app-vh, 100dvh);
  min-height: var(--app-vh, 100dvh);
  overflow: hidden !important;
  justify-content: flex-start;
  overscroll-behavior: none;
}
body[data-screen="quest-play"] > h1,
body[data-screen="quest-play"] > .sub,
body[data-screen="quest-play"] > #onlineBadge,
body[data-screen="quest-play"] > #presenceStrip {
  display: none !important;
}
body[data-screen="quest-play"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: var(--app-vh, 100dvh) !important;
  min-height: var(--app-vh, 100dvh) !important;
  max-height: var(--app-vh, 100dvh) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
#quest-play.screen { padding: 0; }
#quest-play.screen.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  animation: none;
}
.quest-play-header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-width: 0;
}
.quest-play-header .btn.small {
  padding: 8px 12px;
  font-size: 13px;
  min-height: 36px;
}
.quest-play-title { display: none; }
.quest-play-progress {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(93,255,211,.28);
  background: rgba(93,255,211,.12);
  color: #bfffee;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.quest-play-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
  height: auto;
  overflow: hidden;
}
.quest-question-big {
  font-size: clamp(1rem, 2.4vw, 1.28rem);
  font-weight: 600;
  text-align: left;
  line-height: 1.6;
  letter-spacing: normal;
  margin: 0;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  border-left: 3px solid #6cf;
  width: 100%;
  max-width: 680px;
  min-height: clamp(120px, 24vh, 200px);
  max-height: clamp(120px, 24vh, 200px);
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.draft-question-banner {
  position: absolute; top: 8px; left: 8px; right: 8px;
  z-index: 10001;
  padding: 10px 14px;
  background: rgba(15,23,42,.92);
  color: #f8fafc;
  border-radius: 10px;
  border-left: 3px solid #6cf;
  font-size: 14px; line-height: 1.6;
  max-height: 35vh; overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: auto;
}
.qhc-row.wrong .qhc-q { color: #ffd76b; }
.quest-answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
}
.quest-answer-row #qpDraft {
  flex: 0 0 auto;
}
.quest-answer-row #qpNeg {
  flex: 0 0 54px;
  background: #475569;
  box-shadow: none;
}
.quest-play-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
}
.quest-play-actions .btn {
  flex: 1 1 0;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 38px;
}
.quest-answer-display {
  flex: 1 1 auto;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  background: rgba(255,255,255,.06);
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 44px;
  letter-spacing: 2px;
}
.quest-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 460px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.quest-numpad .qp-key {
  min-height: 62px;
  padding: 0;
}
.quest-numpad .qp-key.action {
  background: #475569;
  color: #fff;
  font-size: 22px;
}
.quest-numpad .qp-key-submit {
  min-height: 62px;
}

@media (max-width: 640px) {
  body[data-screen="quest-play"] .quest-play-header {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  body[data-screen="quest-play"] .quest-play-header .btn.small {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
  }
  body[data-screen="quest-play"] .quest-play-progress {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
  }
  .quest-play-body {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .quest-question-big {
    min-height: clamp(96px, 20svh, 156px);
    max-height: clamp(96px, 20svh, 156px);
    font-size: 16px;
    padding: 10px 12px;
    line-height: 1.5;
  }
  .quest-answer-display {
    font-size: 22px;
    min-height: 42px;
  }
  body[data-screen="quest-play"] .quest-numpad .qp-key {
    min-height: 56px;
    font-size: 24px;
  }
}

@media (max-height: 620px) {
  body[data-screen="quest-play"] .quest-play-body {
    gap: 6px;
    padding-top: 6px;
  }
  body[data-screen="quest-play"] .quest-question-big {
    min-height: 82px;
    max-height: 118px;
    font-size: 15px;
    line-height: 1.42;
    padding: 8px 10px;
  }
  body[data-screen="quest-play"] .quest-answer-display {
    min-height: 38px;
    padding: 5px 10px;
    font-size: 20px;
  }
  body[data-screen="quest-play"] .quest-play-actions .btn {
    min-height: 34px;
    padding: 6px 8px;
  }
  body[data-screen="quest-play"] .quest-numpad {
    gap: 6px;
  }
  body[data-screen="quest-play"] .quest-numpad .qp-key {
    min-height: 42px;
    padding: 0;
    font-size: 20px;
    border-radius: 10px;
  }
  body[data-screen="quest-play"] .quest-numpad .qp-key-submit {
    min-height: 42px;
    font-size: 18px;
  }
}

.quest-summary {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 32px 16px; text-align: center;
}
.quest-summary-title { font-size: 28px; font-weight: 800; }
.quest-summary.perfect .quest-summary-title {
  color: #ffd76b;
  text-shadow: 0 0 18px rgba(255,215,107,.26);
}
.quest-summary-row { font-size: 16px; }
.quest-summary-stats {
  width: min(100%, 460px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(93,255,211,.22);
  background: linear-gradient(135deg, rgba(93,255,211,.12), rgba(74,144,226,.08));
  color: inherit;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.quest-summary-stats:hover {
  transform: translateY(-1px);
  border-color: rgba(93,255,211,.42);
  background: linear-gradient(135deg, rgba(93,255,211,.18), rgba(74,144,226,.12));
}
.quest-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.26);
}
.quest-summary-stat small {
  font-size: 12px;
  color: var(--muted);
}
.quest-summary-stat b {
  font-size: 20px;
  font-weight: 800;
}
.quest-summary-hint {
  font-size: 12px;
  color: var(--muted);
}
.quest-summary-reward-card {
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,215,107,.38);
  background:
    radial-gradient(circle at 16% 20%, rgba(255,215,107,.22), transparent 34%),
    linear-gradient(135deg, rgba(15,23,42,.74), rgba(20,83,45,.26));
  color: #f8fafc;
  box-shadow: 0 16px 34px rgba(0,0,0,.28), 0 0 22px rgba(255,215,107,.12);
  text-align: left;
}
.quest-summary-reward-art {
  width: 78px;
  height: 78px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,215,107,.38);
  box-shadow: 0 0 0 5px rgba(255,215,107,.08), 0 10px 22px rgba(0,0,0,.28);
}
.quest-summary-reward-main {
  min-width: 0;
}
.quest-summary-reward-label {
  color: #fde68a;
  font-size: 12px;
  font-weight: 900;
}
.quest-summary-reward-total {
  margin-top: 2px;
  color: #fef3c7;
  font-size: 30px;
  font-weight: 1000;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 18px rgba(255,215,107,.24);
}
.quest-summary-reward-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.quest-summary-reward-breakdown span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(125,211,252,.22);
  background: rgba(2,6,23,.34);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.quest-summary-reward-breakdown b {
  color: #bbf7d0;
  font-weight: 1000;
}
@media (max-width: 460px) {
  .quest-summary-reward-card {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .quest-summary-reward-art {
    width: 62px;
    height: 62px;
  }
  .quest-summary-reward-total {
    font-size: 24px;
  }
  .quest-summary-reward-breakdown span {
    font-size: 11px;
    padding: 3px 7px;
  }
}
.quest-summary-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }

/* History (錯題本) */
.quest-history-summary { display: flex; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.qhs-card {
  flex: 1 1 100px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px 8px; text-align: center;
}
.qhs-num { font-size: 22px; font-weight: 800; color: var(--accent, #5dd); }
.qhs-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

.quest-hist-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  margin: 10px 0;
  overflow: hidden;
}
.quest-hist-card.focused {
  border-color: rgba(93,255,211,.55);
  box-shadow: 0 0 0 1px rgba(93,255,211,.24), 0 12px 32px rgba(0,0,0,.18);
}
.quest-hist-card.perfect {
  border-color: rgba(255,215,107,.36);
  background:
    linear-gradient(135deg, rgba(255,215,107,.12), rgba(56,189,248,.06)),
    rgba(255,255,255,.04);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 10px 28px rgba(0,0,0,.16);
}
.qhc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
}
.qhc-title { font-weight: 700; font-size: 15px; flex: 1 1 auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qhc-meta { color: var(--muted); font-size: 12px; }
.qhc-toggle { color: var(--muted); }
.quest-perfect-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(255,215,107,.34), rgba(244,114,182,.22));
  border: 1px solid rgba(255,232,153,.62);
  color: #fff3bf;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(255,215,107,.2), inset 0 1px 0 rgba(255,255,255,.22);
}
.perfect-record-card {
  border-color: rgba(255,215,107,.28);
}
.qhc-body { padding: 0 14px 12px; }
.qhc-row { padding: 8px 0; border-top: 1px dashed rgba(255,255,255,.08); }
.qhc-row.wrong { background: rgba(255,80,80,.06); margin: 0 -14px; padding: 8px 14px; }
.qhc-q { font-weight: 600; font-size: 14px; }
.qhc-a { font-size: 13px; color: var(--muted); margin-top: 2px; }
.qhc-correct { display: inline-block; margin-left: 8px; color: #ff8a8a; font-weight: 600; }
.quest-explain-actions {
  margin-top: 8px;
}
.quest-explain-btn {
  border: 1px solid rgba(93,255,211,.38);
  border-radius: 999px;
  background: rgba(93,255,211,.12);
  color: #c8fff3;
  font-size: 12px;
  font-weight: 850;
  padding: 6px 11px;
  cursor: pointer;
}
.quest-explain-btn:hover:not(:disabled) {
  background: rgba(93,255,211,.2);
  border-color: rgba(93,255,211,.58);
}
.quest-explain-btn:disabled {
  cursor: wait;
  opacity: .72;
}
.quest-explain-box {
  margin-top: 8px;
}
.quest-explain-box.collapsed {
  display: none;
}
.quest-explain-text {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.24);
  background: #050505;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.7;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 24px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.1);
}
.quest-explain-diagram {
  box-sizing: border-box;
  width: 100%;
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.28);
  background: #000;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.65;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 24px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.1);
}
.quest-explain-html-diagram {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 160px;
  height: 190px;
  margin: 10px 0 0;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 8px;
  background: #000;
  color-scheme: dark;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.1);
}
.quest-explain-loading {
  color: #e5e7eb;
  font-size: 14px;
  line-height: 1.62;
  white-space: pre-wrap;
}
.quest-explain-error {
  color: #fecaca;
  font-size: 13px;
  line-height: 1.5;
}

.quest-perfect-record-card {
  border-color: rgba(255,215,107,.46);
  background:
    radial-gradient(circle at top left, rgba(255,215,107,.22), transparent 34%),
    linear-gradient(135deg, rgba(255,215,107,.12), rgba(56,189,248,.08) 52%, rgba(244,114,182,.1)),
    rgba(15,23,42,.72);
  box-shadow: 0 14px 34px rgba(0,0,0,.24), inset 0 0 0 1px rgba(255,255,255,.05);
}
.quest-perfect-record-card .perfect-record-head {
  min-height: 62px;
}
.quest-perfect-record-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #f8fafc;
}
.perfect-record-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,247,237,.95), rgba(251,191,36,.85));
  color: #422006;
  font-size: 20px;
  box-shadow: 0 0 22px rgba(255,215,107,.32);
}
.perfect-record-title {
  flex: 0 0 auto;
  color: #ffe69d;
  font-size: 15px;
  font-weight: 950;
  text-shadow: 0 0 14px rgba(255,215,107,.22);
}
.perfect-record-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e0f2fe;
  font-size: 13px;
  font-weight: 800;
}
.perfect-record-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #f59e0b);
  color: #422006 !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: 0;
  box-shadow: 0 0 18px rgba(245,158,11,.22);
}
.quest-perfect-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.quest-perfect-detail-row {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(2,6,23,.28);
}
.quest-perfect-detail-q {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}
.quest-perfect-detail-a {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
}
.quest-perfect-detail-a span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
}
.quest-perfect-detail-empty {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* Admin Modal */
.quest-admin-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 99999;
  display: flex; align-items: stretch; justify-content: center;
  padding: 10px;
}
.quest-admin-card {
  background: var(--bg, #131825);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  width: min(1560px, calc(100vw - 20px));
  height: calc(100vh - 20px);
  max-height: none;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.quest-admin-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid rgba(255,255,255,.08);
  flex: 0 0 auto;
}
.quest-admin-head h3 { margin: 0; flex: 1 1 auto; }
.quest-admin-body { padding: 18px 22px 24px; overflow: auto; flex: 1 1 auto; }
.quest-admin-inline {
  margin-top: 12px;
}
.quest-admin-inline .qa-section:last-child {
  margin-bottom: 0;
}
.qa-section { margin-bottom: 20px; }
.qa-section h4 { margin: 0 0 8px; font-size: 15px; }
.qa-help { color: var(--muted); font-size: 12px; line-height: 1.5; margin: -2px 0 8px; }
.qa-batch-section {
  border: 1px solid rgba(93, 211, 158, .25);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(93, 211, 158, .08), rgba(99, 102, 241, .05));
}
.qa-batch-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
}
.qa-publish-box {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.qa-publish-title { font-weight: 800; color: #e8fff5; }
.qa-publish-box label { color: var(--muted); font-size: 13px; }
.qa-schedule-panel {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.qa-time-list { display: flex; flex-direction: column; gap: 6px; }
.qa-time-row { display: flex; gap: 8px; align-items: center; }
.qa-time-row input { max-width: 160px; }
.qa-pack-list { display: flex; flex-direction: column; gap: 6px; }
.qa-pack-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border-radius: 8px;
}
.qa-pack-title { flex: 1 1 auto; font-size: 14px; }
.qa-pack-meta { color: var(--muted); font-size: 12px; }
.qa-pack-btns { display: flex; gap: 6px; }
.qa-twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .qa-twocol { grid-template-columns: 1fr; } }
.qa-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.qa-label input, .qa-label textarea {
  width: 100%; box-sizing: border-box;
  background: rgba(0,0,0,.25);
  color: inherit;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.qa-label textarea { font-family: ui-monospace, "JetBrains Mono", monospace; resize: vertical; }
#qaBatchQuestions, #qaBatchAnswers { min-height: 46vh; line-height: 1.55; }
.qa-actions { display: flex; gap: 8px; margin: 8px 0; }
.qa-preview { margin-top: 8px; }
.qa-preview .qa-error { color: #ff8a8a; background: rgba(255,80,80,.08); padding: 10px; border-radius: 8px; }
.qa-preview .qa-error ul { margin: 6px 0 0 16px; padding: 0; }
.qa-preview .qa-ok { color: #5dd39e; padding: 6px 0; font-size: 14px; }
.qa-prev-row { display: flex; gap: 10px; padding: 4px 0; font-family: ui-monospace, monospace; font-size: 13px; }
.qa-prev-row span:nth-child(1) { color: var(--muted); flex: 0 0 auto; }
.qa-prev-row span:nth-child(2) { flex: 1 1 auto; }
.qa-prev-row span:nth-child(3) { color: var(--accent, #5dd); flex: 0 0 auto; }
.qa-batch-row span:nth-child(1) { color: #e8fff5; flex: 1 1 auto; }
.qa-batch-row span:nth-child(2) { flex: 0 0 auto; color: var(--muted); }

@media (max-width: 760px) {
  .quest-admin-modal { padding: 8px; }
  .quest-admin-card {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }
  .qa-batch-grid { grid-template-columns: 1fr 1fr; }
  .qa-schedule-panel { grid-template-columns: 1fr; }
  #qaBatchQuestions, #qaBatchAnswers { min-height: 34vh; }
}

@media (max-width: 520px) {
  .qa-batch-grid { grid-template-columns: 1fr; }
  .qa-actions { flex-wrap: wrap; }
  .qa-prev-row { flex-wrap: wrap; }
}

/* ========== Reflex Rush ========== */
body[data-screen="reflex-rush"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100svh;
  min-height: 100svh;
  justify-content: flex-start;
  overscroll-behavior: none;
}
body[data-screen="reflex-rush"] > h1,
body[data-screen="reflex-rush"] > .sub,
body[data-screen="reflex-rush"] > #onlineBadge,
body[data-screen="reflex-rush"] > #presenceStrip { display: none !important; }
body[data-screen="reflex-rush"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100svh !important;
  max-height: 100svh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
#reflex-rush.screen.active {
  display: flex !important;
  min-height: 0;
  height: 100svh;
  max-height: 100svh;
  color: #f8fafc;
  overflow: hidden;
  position: relative;
  animation: none !important;
  background:
    linear-gradient(180deg, rgba(2,6,23,0.28), rgba(5,11,31,0.22) 42%, rgba(2,6,23,0.5)),
    url("/assets/img/reflex/reflex-arena.jpg?v=1") center / cover no-repeat,
    linear-gradient(135deg, #0f172a, #14532d 48%, #7c2d12);
  touch-action: none;
}
#reflex-rush.screen.active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 14%, rgba(56,189,248,0.18), transparent 26%),
    radial-gradient(circle at 84% 18%, rgba(250,204,21,0.18), transparent 25%),
    linear-gradient(180deg, rgba(15,23,42,0.04), rgba(2,6,23,0.4));
}
.rr-wrap {
  width: 100%;
  max-width: min(1120px, 100vw);
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  padding: max(8px, env(safe-area-inset-top, 8px)) 10px max(10px, env(safe-area-inset-bottom, 10px));
  gap: 8px;
}
.rr-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(112px, 1.1fr) minmax(110px, 1.2fr) minmax(120px, 1fr) 54px;
  grid-template-areas: "title status round quit";
  align-items: center;
  gap: 6px;
  min-height: 36px;
  position: relative;
  z-index: 30;
}
.rr-title,
.rr-status,
.rr-round,
.rr-timer {
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(2,6,23,0.64);
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.14);
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-title {
  grid-area: title;
  justify-content: flex-start;
  padding: 0 10px;
  color: #fde68a;
  font-size: 16px;
}
.rr-status {
  grid-area: status;
  color: #bbf7d0;
  font-size: 12px;
}
.rr-round {
  grid-area: round;
  color: #bae6fd;
  font-size: 12px;
}
.rr-timer {
  grid-area: timer;
  display: none !important;
  color: #fef3c7;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.rr-quit-btn {
  grid-area: quit;
  min-width: 0;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}
.rr-score-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
  overflow: visible;
}
.rr-score-pill {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px 24px minmax(0, 1fr) auto;
  grid-template-areas:
    "rank avatar name score"
    "rank avatar meta meta";
  align-items: center;
  gap: 2px 6px;
  min-height: 42px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15,23,42,0.56);
}
.rr-score-pill.self {
  border-color: rgba(34,211,238,0.68);
  background: rgba(8,47,73,0.56);
}
.rr-score-pill.offline { opacity: .56; }
.rr-rank { grid-area: rank; color: #fde68a; font-size: 12px; font-weight: 950; text-align: center; }
.rr-avatar {
  grid-area: avatar;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 14px;
}
.rr-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rr-player-name {
  grid-area: name;
  min-width: 0;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-player-score {
  grid-area: score;
  color: #fef08a;
  font-size: 14px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}
.rr-player-meta {
  grid-area: meta;
  min-width: 0;
  color: #cbd5e1;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  align-items: center;
}
.rr-board {
  min-height: 0;
  width: min(92vw, 72svh, 720px);
  aspect-ratio: 1 / 1;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vw, 16px);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(2,6,23,0.38);
  box-shadow: inset 0 0 60px rgba(15,23,42,0.35), 0 16px 46px rgba(0,0,0,0.28);
}
.rr-board-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--rr-cols, 3), minmax(0, 1fr));
  gap: clamp(7px, 1.4vw, 14px);
}
.rr-tile {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: rgba(226,232,240,0.5);
  background:
    linear-gradient(180deg, rgba(148,163,184,0.14), rgba(15,23,42,0.46)),
    rgba(15,23,42,0.66);
  box-shadow: inset 0 -12px 22px rgba(0,0,0,0.22);
  font-size: clamp(18px, 4.2svh, 42px);
  font-weight: 950;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .08s ease, box-shadow .08s ease;
}
.rr-tile:not(.disabled):active { transform: scale(.96); }
.rr-tile.disabled,
.rr-tile[aria-disabled="true"] { cursor: default; }
.rr-tile.active {
  color: #052e16;
  border-color: rgba(255,255,255,0.82);
  filter: saturate(1.28);
  animation: rr-target-pulse .48s ease-in-out infinite alternate;
}
.rr-tile.kind-hit.tone-green {
  background: radial-gradient(circle, #dcfce7 0%, #22c55e 42%, #166534 100%);
  box-shadow: 0 0 34px rgba(34,197,94,0.74), inset 0 -18px 28px rgba(5,46,22,0.28);
}
.rr-tile.kind-hit.tone-cyan {
  background: radial-gradient(circle, #cffafe 0%, #22d3ee 42%, #155e75 100%);
  box-shadow: 0 0 34px rgba(34,211,238,0.74), inset 0 -18px 28px rgba(8,47,73,0.28);
}
.rr-tile.kind-hit.tone-amber {
  background: radial-gradient(circle, #fef9c3 0%, #facc15 45%, #92400e 100%);
  box-shadow: 0 0 34px rgba(250,204,21,0.74), inset 0 -18px 28px rgba(120,53,15,0.26);
}
.rr-tile.kind-hit.tone-violet {
  background: radial-gradient(circle, #ede9fe 0%, #a78bfa 45%, #5b21b6 100%);
  box-shadow: 0 0 34px rgba(167,139,250,0.7), inset 0 -18px 28px rgba(46,16,101,0.26);
}
.rr-tile.kind-trap,
.rr-tile.kind-trap.tone-red {
  color: #fff7ed;
  background: radial-gradient(circle, #fecaca 0%, #ef4444 42%, #7f1d1d 100%);
  box-shadow: 0 0 36px rgba(239,68,68,0.78), inset 0 -18px 28px rgba(69,10,10,0.34);
}
.rr-tile-core {
  display: inline-flex;
  pointer-events: none;
  width: clamp(36px, 8svh, 74px);
  height: clamp(36px, 8svh, 74px);
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
}
.rr-message {
  display: none;
}
.rr-tap-feedback {
  position: fixed;
  left: var(--rr-feedback-x, 50vw);
  top: var(--rr-feedback-y, 50vh);
  z-index: 2147483001;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(140px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  box-shadow: none;
  font-size: clamp(12px, 2svh, 17px);
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  transform: translate(-50%, calc(-100% - 42px));
  animation: rr-tap-feedback-pop .82s ease-out forwards;
}
.rr-tap-feedback.hit {
  color: #bbf7d0;
  text-shadow: 0 1px 4px rgba(2,6,23,0.75), 0 0 10px rgba(34,197,94,0.34);
}
.rr-tap-feedback.miss {
  color: #fecaca;
  text-shadow: 0 1px 4px rgba(2,6,23,0.75), 0 0 10px rgba(239,68,68,0.34);
}
.rr-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2,6,23,0.58);
  backdrop-filter: blur(5px);
  pointer-events: none;
}
.rr-intro-overlay.show { display: flex; }
.rr-intro-card {
  width: min(420px, calc(100vw - 28px));
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(15,23,42,0.9);
  box-shadow: 0 20px 60px rgba(0,0,0,0.38);
  padding: 20px;
  text-align: center;
  pointer-events: auto;
}
.rr-intro-count {
  color: #facc15;
  font-size: clamp(38px, 9vw, 72px);
  line-height: 1;
  font-weight: 1000;
  margin-bottom: 8px;
}
.rr-intro-title {
  color: #f8fafc;
  font-size: 22px;
  font-weight: 950;
  margin-bottom: 8px;
}
.rr-intro-rule {
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.45;
  min-height: 40px;
  margin-bottom: 14px;
}
.rr-ready-btn {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #fff;
  font-size: 17px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(14,165,233,0.24);
}
.rr-ready-btn:disabled {
  cursor: default;
  opacity: .62;
  box-shadow: none;
}
.rr-ready-meta {
  margin-top: 10px;
  color: #bae6fd;
  font-size: 12px;
  font-weight: 850;
}
@keyframes rr-target-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}
@keyframes rr-tap-feedback-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 30px)) scale(.96);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 42px)) scale(1);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 56px)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 68px)) scale(.98);
  }
}
@media (max-width: 720px) {
  .rr-header {
    grid-template-columns: minmax(92px, 1fr) minmax(96px, 1fr) 48px;
    grid-template-areas:
      "title status quit"
      "round round round";
    min-height: 72px;
  }
  .rr-round { min-height: 28px; }
  .rr-score-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rr-score-pill { min-height: 38px; }
  .rr-board { width: min(94vw, 62svh); }
  .rr-message { min-height: 34px; font-size: 13px; }
}
@media (max-width: 430px) {
  .rr-wrap { padding-left: 7px; padding-right: 7px; gap: 6px; }
  .rr-score-strip { gap: 4px; }
  .rr-score-pill { padding: 4px 5px; grid-template-columns: 16px 22px minmax(0, 1fr) auto; }
  .rr-avatar { width: 22px; height: 22px; }
  .rr-player-meta { font-size: 9px; }
  .rr-board { width: min(96vw, 58svh); padding: 7px; }
  .rr-board-grid { gap: 6px; }
}

/* ========== Tianwei Mole Hunt ========== */
body[data-screen="mole-hunt"] {
  padding: 0 !important;
  overflow: hidden !important;
  height: 100svh;
  min-height: 100svh;
  justify-content: flex-start;
  overscroll-behavior: none;
}
body[data-screen="mole-hunt"] > h1,
body[data-screen="mole-hunt"] > .sub,
body[data-screen="mole-hunt"] > #onlineBadge,
body[data-screen="mole-hunt"] > #presenceStrip { display: none !important; }
body[data-screen="mole-hunt"] > .card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100svh !important;
  max-height: 100svh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
#mole-hunt.screen.active {
  display: flex !important;
  min-height: 0;
  height: 100svh;
  max-height: 100svh;
  color: #f8fafc;
  overflow: hidden;
  position: relative;
  animation: none !important;
  background:
    linear-gradient(180deg, rgba(3,24,16,0.12), rgba(12,34,20,0.08) 38%, rgba(58,32,15,0.22)),
    url("/assets/img/molehunt/garden-stage.webp") center / cover no-repeat,
    linear-gradient(180deg, #a7f3d0, #6b3f1e);
  touch-action: none;
}
#mole-hunt.screen.active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 12%, rgba(255,255,255,0.22), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(253,224,71,0.16), transparent 28%),
    linear-gradient(180deg, rgba(2,6,23,0.08), rgba(2,6,23,0.28));
}
.mh-wrap {
  width: 100%;
  max-width: min(1180px, 100vw);
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  padding: max(8px, env(safe-area-inset-top, 8px)) 10px max(10px, env(safe-area-inset-bottom, 10px));
  gap: 8px;
}
.mh-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(132px, 1.05fr) minmax(150px, 1.45fr) 78px 54px;
  grid-template-areas: "title status time quit";
  align-items: center;
  gap: 6px;
  min-height: 36px;
  position: relative;
  z-index: 30;
}
.mh-title,
.mh-status,
.mh-time {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(10,32,24,0.74);
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.12);
}
.mh-title {
  grid-area: title;
  min-width: 0;
  justify-content: flex-start;
  padding: 0 10px;
  color: #fef3c7;
  font-size: 16px;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mh-status {
  grid-area: status;
  min-width: 0;
  justify-content: center;
  padding: 0 8px;
  color: #d9f99d;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mh-time {
  grid-area: time;
  min-width: 0;
  justify-content: center;
  color: #fde68a;
  font-size: 13px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}
.mh-quit-btn {
  grid-area: quit;
  min-width: 0;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}
.mh-score-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
  overflow: visible;
  padding: 1px 0 2px;
}
.mh-score-pill {
  min-width: 0;
  display: grid;
  grid-template-columns: 16px 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15,23,42,0.5);
}
.mh-score-pill.self {
  border-color: rgba(56,189,248,0.58);
  background: rgba(8,47,73,0.48);
}
.mh-rank {
  color: #fde68a;
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}
.mh-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 14px;
}
.mh-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.mh-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
}
.mh-score {
  min-width: 20px;
  color: #fef3c7;
  font-size: 17px;
  font-weight: 950;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mh-board {
  --mh-cols: 3;
  --mh-rows: 3;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--mh-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--mh-rows), minmax(0, 1fr));
  align-content: stretch;
  gap: clamp(8px, 2.2vw, 14px);
  padding: clamp(8px, 2.2vw, 16px);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255,246,196,0.22), transparent 34%),
    radial-gradient(ellipse at 50% 100%, rgba(92,51,22,0.36), rgba(92,51,22,0.04) 54%, transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.17), rgba(255,255,255,0.06)),
    rgba(65, 37, 18, 0.12);
  box-shadow:
    inset 0 18px 34px rgba(255,255,255,0.11),
    inset 0 -24px 36px rgba(58,36,18,0.24),
    0 16px 36px rgba(29,38,18,0.22);
  backdrop-filter: blur(1.5px) saturate(1.08);
}
.mh-hole {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-radius: 8px;
  overflow: visible;
}
.mh-dirt {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 5%;
  height: 33%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 48% 34%, rgba(255,230,172,0.26) 0 15%, transparent 34%),
    radial-gradient(ellipse at 50% 30%, #a36d3b 0 23%, #6b3f20 52%, #2d1a10 100%);
  border: 2px solid rgba(61,32,15,0.58);
  box-shadow:
    inset 0 10px 18px rgba(255,255,255,0.14),
    inset 0 -8px 18px rgba(23,12,6,0.34),
    0 8px 14px rgba(0,0,0,0.28);
}
.mh-hole.active .mh-dirt {
  box-shadow: inset 0 10px 18px rgba(255,255,255,0.12), 0 0 0 3px rgba(250,204,21,0.2), 0 8px 12px rgba(0,0,0,0.28);
}
.mh-hole.cue::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 35%;
  width: 42px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 0;
  background:
    linear-gradient(72deg, transparent 0 43%, #020617 44% 58%, transparent 59%) left bottom / 14px 28px no-repeat,
    linear-gradient(0deg, transparent 0 16%, #020617 17% 100%) center bottom / 6px 26px no-repeat,
    linear-gradient(-72deg, transparent 0 43%, #020617 44% 58%, transparent 59%) right bottom / 14px 28px no-repeat;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,0.34));
  pointer-events: none;
}
.mh-mole-btn {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 4%;
  height: 104%;
  z-index: 2;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transform: translateY(9%);
}
.mh-mole-btn::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 18%;
  bottom: 8%;
  z-index: 0;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(ellipse at 50% 68%, rgba(52,30,14,0.34), transparent 54%),
    radial-gradient(circle at 50% 32%, rgba(255,255,255,0.36), rgba(254,243,199,0.18) 44%, rgba(15,23,42,0) 72%);
  filter: blur(0.6px);
  pointer-events: none;
}
.mh-mole-btn:disabled {
  cursor: default;
  opacity: 1;
}
.mh-mole-btn img {
  position: relative;
  z-index: 4;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1 !important;
  filter:
    drop-shadow(0 0 5px rgba(255,255,255,0.38))
    drop-shadow(0 12px 10px rgba(43,24,10,0.46))
    saturate(1.12)
    contrast(1.04)
    brightness(1.04);
  transition: transform 0.08s ease-out, filter 0.08s ease-out;
}
.mh-normal img {
  transform: translateY(-2%) scale(1.06);
  filter:
    drop-shadow(0 0 7px rgba(255,237,213,0.5))
    drop-shadow(0 12px 10px rgba(43,24,10,0.45))
    saturate(1.12)
    contrast(1.05)
    brightness(1.04);
}
.mh-gold img {
  filter:
    drop-shadow(0 0 8px rgba(255,247,173,0.82))
    drop-shadow(0 0 18px rgba(250,204,21,0.9))
    drop-shadow(0 12px 10px rgba(43,24,10,0.42))
    saturate(1.28)
    contrast(1.09)
    brightness(1.08);
  transform: translateY(-3%) scale(1.08);
}
.mh-bomb img {
  filter:
    drop-shadow(0 0 10px rgba(248,113,113,0.58))
    drop-shadow(0 12px 10px rgba(43,24,10,0.46))
    saturate(1.08)
    contrast(1.06)
    brightness(1.02);
}
.mh-fake img {
  transform: translateY(-1%) scale(1.05);
  filter:
    drop-shadow(0 0 8px rgba(251,191,36,0.38))
    drop-shadow(0 12px 10px rgba(43,24,10,0.5))
    saturate(1.08)
    contrast(1.08)
    brightness(1.03);
}
.mh-mole-btn:active:not(:disabled) img {
  transform: translateY(12%) scale(0.92);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.28)) brightness(1.12);
}
.mh-mole-btn.local-hit::after {
  display: none;
}
.mh-mole-btn.hit-exit {
  pointer-events: none;
  animation: mhHitExit 0.12s ease-in forwards;
}
.mh-hole.pending .mh-dirt {
  outline: 2px solid rgba(56,189,248,0.36);
}
.mh-hole.resolved .mh-mole-btn img {
  opacity: 1;
  transform: translateY(16%) scale(0.9);
}
.mh-hole.hit-only .mh-dirt,
.mh-hole.pending .mh-dirt {
  box-shadow: inset 0 10px 18px rgba(255,255,255,0.12), 0 0 0 3px rgba(56,189,248,0.2), 0 8px 12px rgba(0,0,0,0.28);
}
.mh-boss {
  left: -18%;
  right: -18%;
  bottom: -10%;
  height: 136%;
}
.mh-bomb,
.mh-fake {
  left: -8%;
  right: -8%;
  bottom: 1%;
  height: 112%;
}
.mh-mole-art {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 2%;
  bottom: 2%;
  z-index: 3;
  display: none;
  pointer-events: none;
  filter:
    drop-shadow(0 0 5px rgba(255,255,255,0.48))
    drop-shadow(0 13px 10px rgba(0,0,0,0.55));
}
.mh-mole-art::before {
  content: "";
  position: absolute;
  left: 13%;
  right: 13%;
  bottom: 4%;
  height: 82%;
  border-radius: 46% 46% 42% 42% / 44% 44% 56% 56%;
  border: 5px solid #fff7ed;
  background:
    radial-gradient(circle at 36% 30%, rgba(255,255,255,0.35) 0 10%, transparent 11%),
    radial-gradient(circle at 50% 62%, rgba(255,255,255,0.18) 0 31%, transparent 32%),
    linear-gradient(180deg, #b98356 0%, #8b5a36 46%, #5a321f 100%);
  box-shadow: inset 0 10px 18px rgba(255,255,255,0.18), inset 0 -14px 18px rgba(45,24,12,0.28);
}
.mh-mole-art::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 0;
  height: 18%;
  border-radius: 50%;
  background: rgba(30,18,10,0.45);
  filter: blur(1px);
}
.mh-mole-eye {
  position: absolute;
  z-index: 4;
  top: 39%;
  width: 9%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #030712;
  border: 2px solid rgba(255,255,255,0.88);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.8);
}
.mh-mole-eye.left { left: 37%; }
.mh-mole-eye.right { right: 37%; }
.mh-mole-nose {
  position: absolute;
  z-index: 4;
  left: 45%;
  top: 53%;
  width: 10%;
  height: 8%;
  border-radius: 50%;
  background: #fb7185;
  border: 2px solid #7f1d1d;
}
.mh-mole-mouth {
  position: absolute;
  z-index: 4;
  left: 44%;
  top: 65%;
  width: 12%;
  height: 8%;
  border-bottom: 4px solid #2a1712;
  border-radius: 0 0 999px 999px;
}
.mh-mole-mark {
  position: absolute;
  z-index: 5;
  display: none;
}
.mh-gold .mh-mole-art::before {
  border-color: #fff7ad;
  background:
    radial-gradient(circle at 36% 30%, rgba(255,255,255,0.55) 0 12%, transparent 13%),
    radial-gradient(circle at 50% 62%, rgba(255,255,255,0.24) 0 31%, transparent 32%),
    linear-gradient(180deg, #fff176 0%, #facc15 46%, #d97706 100%);
  box-shadow: 0 0 18px rgba(250,204,21,0.65), inset 0 10px 18px rgba(255,255,255,0.24);
}
.mh-gold .mh-mole-mark {
  display: block;
  left: 35%;
  top: 4%;
  width: 30%;
  height: 22%;
  background: #fef08a;
  clip-path: polygon(0 95%, 16% 28%, 36% 68%, 50% 12%, 65% 68%, 84% 28%, 100% 95%);
  border-bottom: 4px solid #b45309;
}
.mh-bomb .mh-mole-art::before {
  border-color: #fecaca;
  background:
    radial-gradient(circle at 36% 30%, rgba(255,255,255,0.34) 0 10%, transparent 11%),
    linear-gradient(180deg, #64748b 0%, #1f2937 52%, #020617 100%);
  box-shadow: 0 0 16px rgba(248,113,113,0.54), inset 0 8px 16px rgba(255,255,255,0.18);
}
.mh-bomb .mh-mole-mark {
  display: block;
  right: 23%;
  top: 0;
  width: 20%;
  height: 20%;
  background: #facc15;
  clip-path: polygon(50% 0, 62% 35%, 100% 22%, 72% 50%, 100% 78%, 62% 66%, 50% 100%, 38% 66%, 0 78%, 28% 50%, 0 22%, 38% 35%);
}
.mh-fake .mh-mole-art::before {
  border-color: #fee2e2;
  border-radius: 12px 12px 18px 18px;
  background:
    repeating-linear-gradient(0deg, rgba(127,74,31,0.18) 0 8px, transparent 8px 18px),
    linear-gradient(180deg, #f1c27d 0%, #d6a15c 55%, #9a6330 100%);
}
.mh-fake .mh-mole-mouth {
  border-bottom: 0;
  border-top: 4px solid #2a1712;
  border-radius: 999px 999px 0 0;
}
.mh-boss .mh-mole-art {
  left: 0;
  right: 0;
  top: -4%;
  bottom: -2%;
}
.mh-boss .mh-mole-art::before {
  border-color: #fed7aa;
  background:
    radial-gradient(circle at 36% 30%, rgba(255,255,255,0.3) 0 10%, transparent 11%),
    radial-gradient(circle at 50% 62%, rgba(255,255,255,0.14) 0 31%, transparent 32%),
    linear-gradient(180deg, #c08457 0%, #7c3f24 48%, #2f160e 100%);
  box-shadow: 0 0 18px rgba(251,146,60,0.55), inset 0 10px 18px rgba(255,255,255,0.14);
}
.mh-boss .mh-mole-eye {
  background: #ef4444;
  border-color: #111827;
}
.mh-point {
  position: absolute;
  right: 3%;
  top: 9%;
  min-width: 30px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(2,6,23,0.82);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fef3c7;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mh-gold .mh-point {
  background: #facc15;
  color: #422006;
  box-shadow: 0 0 14px rgba(250,204,21,0.62);
}
.mh-bomb .mh-point,
.mh-fake .mh-point {
  background: #dc2626;
  color: #fff;
}
.mh-hit-effects {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  overflow: visible;
}
.mh-click-effect-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: visible;
}
.mh-hit-effect {
  --hit-color: #38bdf8;
  --hit-x: 50vw;
  --hit-y: 50vh;
  position: absolute;
  left: var(--hit-x);
  top: var(--hit-y);
  display: grid;
  grid-template-columns: 24px auto;
  grid-template-areas:
    "avatar bang"
    "name name";
  align-items: center;
  gap: 2px 4px;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: mhHitFade 0.82s ease-out forwards;
}
.mh-hit-effect.self {
  filter: drop-shadow(0 0 8px rgba(56,189,248,0.58));
}
.mh-hit-effect.other {
  filter: drop-shadow(0 0 7px rgba(250,204,21,0.42));
}
.mh-money-burst {
  --money-x: 50vw;
  --money-y: 50vh;
  position: fixed;
  left: var(--money-x);
  top: var(--money-y);
  z-index: 10000;
  pointer-events: none;
  overflow: visible;
}
.mh-money-piece {
  --mx: 0px;
  --my: -80px;
  --mr: 180deg;
  --ms: 1;
  --md: 0s;
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(.5);
  opacity: 0;
  animation: mhMoneySpray .96s cubic-bezier(.15,.78,.2,1) var(--md) forwards;
  will-change: transform, opacity;
}
.mh-money-piece.coin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #92400e;
  background:
    radial-gradient(circle at 34% 28%, #fff7ad 0 18%, transparent 20%),
    radial-gradient(circle at 50% 50%, #fde68a 0 31%, #facc15 32% 64%, #d97706 65%);
  color: #78350f;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 0 10px rgba(250,204,21,0.78), inset 0 -2px 0 rgba(120,53,15,0.22);
}
.mh-money-piece.bill {
  width: 25px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid #047857;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.58) 0 18%, transparent 20%),
    linear-gradient(135deg, #bbf7d0, #22c55e 52%, #15803d);
  box-shadow: 0 0 10px rgba(34,197,94,0.46);
}
.mh-money-piece.bill::before,
.mh-money-piece.bill::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(6,95,70,0.66);
  border-radius: 2px;
}
.mh-target-effect {
  --target-x: 50vw;
  --target-y: 50vh;
  position: fixed;
  left: var(--target-x);
  top: var(--target-y);
  z-index: 10000;
  pointer-events: none;
  overflow: visible;
}
.mh-target-effect::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(.35);
  opacity: .8;
  animation: mhEffectRing .48s ease-out forwards;
}
.mh-target-core {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 42px;
  height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(.42);
  opacity: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(15,23,42,0.72);
  animation: mhEffectCore .62s cubic-bezier(.16,.82,.22,1) forwards;
}
.mh-target-piece {
  --tx: 0px;
  --ty: -70px;
  --tr: 180deg;
  --ts: 1;
  --td: 0s;
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0;
  animation: mhEffectPiece .82s cubic-bezier(.14,.78,.2,1) var(--td) forwards;
  will-change: transform, opacity;
}
.mh-target-effect-normal::before {
  border: 3px solid rgba(251,191,36,0.8);
  box-shadow: 0 0 18px rgba(251,191,36,0.38);
}
.mh-target-effect-normal .mh-target-core {
  background: linear-gradient(180deg, #f59e0b, #92400e);
  border: 2px solid #fef3c7;
}
.mh-target-piece.dirt {
  width: 12px;
  height: 10px;
  border-radius: 48% 52% 55% 45%;
  background: linear-gradient(180deg, #b45309, #5a2e13);
  box-shadow: inset 0 2px 0 rgba(255,237,213,0.24);
}
.mh-target-piece.star {
  width: 16px;
  height: 16px;
  background: #fef08a;
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 55%, 79% 91%, 50% 69%, 21% 91%, 32% 55%, 2% 35%, 39% 34%);
  filter: drop-shadow(0 0 8px rgba(250,204,21,0.76));
}
.mh-target-effect-fake::before {
  border: 3px solid rgba(180,83,9,0.72);
  box-shadow: 0 0 16px rgba(120,53,15,0.32);
}
.mh-target-effect-fake .mh-target-core {
  background: linear-gradient(180deg, #d97706, #7c2d12);
  border: 2px solid #fef3c7;
}
.mh-target-piece.splinter {
  width: 8px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(90deg, #7c2d12, #d97706 45%, #fbbf24 54%, #92400e);
  box-shadow: 0 0 6px rgba(146,64,14,0.32);
}
.mh-target-piece.nail {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f8fafc, #64748b 48%, #1f2937);
  box-shadow: 0 0 8px rgba(15,23,42,0.52);
}
.mh-target-effect-bomb::before {
  border: 4px solid rgba(254,202,202,0.85);
  background: radial-gradient(circle, rgba(248,113,113,0.4), transparent 62%);
  box-shadow: 0 0 28px rgba(248,113,113,0.9), 0 0 52px rgba(251,146,60,0.46);
}
.mh-target-effect-bomb .mh-target-core {
  min-width: 48px;
  background: radial-gradient(circle at 38% 28%, #fef3c7, #f97316 38%, #dc2626 72%, #7f1d1d);
  border: 2px solid #fee2e2;
  box-shadow: 0 0 24px rgba(248,113,113,0.76);
}
.mh-target-piece.spark {
  width: 18px;
  height: 18px;
  background: #facc15;
  clip-path: polygon(50% 0, 60% 35%, 100% 22%, 70% 50%, 100% 78%, 60% 65%, 50% 100%, 40% 65%, 0 78%, 30% 50%, 0 22%, 40% 35%);
  filter: drop-shadow(0 0 10px rgba(251,191,36,0.86));
}
.mh-target-piece.smoke {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100,116,139,0.78), rgba(30,41,59,0.28) 68%, transparent);
  filter: blur(.5px);
}
.mh-target-effect-boss::before {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(248,113,113,0.52);
  box-shadow: 0 0 12px rgba(220,38,38,0.36), 0 0 20px rgba(124,58,237,0.2);
}
.mh-target-effect-boss .mh-target-core {
  min-width: 44px;
  height: 28px;
  background: linear-gradient(180deg, #7f1d1d, #1e1b4b);
  border: 2px solid #fecaca;
  color: #fecaca;
  font-size: 14px;
  box-shadow: 0 0 8px rgba(248,113,113,0.34);
}
.mh-target-piece.boss-spark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fecaca, #ef4444 48%, #7f1d1d);
  box-shadow: 0 0 6px rgba(239,68,68,0.46);
}
.mh-target-piece.slash {
  width: 4px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fecaca, #ef4444 52%, #7f1d1d);
  box-shadow: 0 0 6px rgba(248,113,113,0.38);
}
@keyframes mhEffectRing {
  0% { transform: translate(-50%, -50%) scale(.25); opacity: .85; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}
@keyframes mhEffectCore {
  0% { transform: translate(-50%, -50%) scale(.42); opacity: 0; }
  18% { opacity: 1; }
  62% { transform: translate(-50%, -112%) scale(1.06); opacity: 1; }
  100% { transform: translate(-50%, -154%) scale(.82); opacity: 0; }
}
@keyframes mhEffectPiece {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) scale(.35) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  74% { opacity: 1; }
  100% {
    transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(var(--ts)) rotate(var(--tr));
    opacity: 0;
  }
}
@keyframes mhMoneySpray {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) scale(.38) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  72% { opacity: 1; }
  100% {
    transform: translate(-50%, -50%) translate(var(--mx), var(--my)) scale(var(--ms)) rotate(var(--mr));
    opacity: 0;
  }
}
.mh-hit-avatar {
  grid-area: avatar;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.72);
  background: var(--hit-color);
  color: #fff;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
}
.mh-hit-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}
.mh-hit-bang {
  grid-area: bang;
  color: #fef3c7;
  font-size: 20px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(30,41,59,0.8), 0 0 10px rgba(250,204,21,0.72);
  line-height: 1;
}
.mh-hit-name {
  grid-area: name;
  max-width: 62px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(15,23,42,0.72);
  color: #e0f2fe;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mh-message {
  flex: 0 0 auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(2,6,23,0.58);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}
.mh-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2,6,23,0.48);
  pointer-events: none;
}
.mh-intro-overlay.show {
  display: flex;
  pointer-events: auto;
}
.mh-intro-card {
  width: min(430px, 88vw);
  padding: 18px 18px 20px;
  border-radius: 8px;
  border: 1px solid rgba(250,204,21,0.32);
  background: rgba(15,23,42,0.94);
  box-shadow: 0 18px 46px rgba(0,0,0,0.42);
  text-align: center;
}
.mh-intro-count {
  color: #fde68a;
  font-size: 72px;
  line-height: 0.95;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(250,204,21,0.36);
}
.mh-intro-title {
  margin-top: 10px;
  color: #dcfce7;
  font-size: 20px;
  font-weight: 950;
}
.mh-intro-rule {
  margin-top: 10px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 800;
  text-align: left;
}
.mh-intro-rule > div {
  padding: 5px 0;
  border-top: 1px solid rgba(148,163,184,0.14);
}
.mh-intro-rule > div:first-child {
  border-top: 0;
}
.mh-ready-btn {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
}
.mh-ready-btn:disabled {
  opacity: 0.58;
  cursor: default;
}
.mh-ready-meta {
  margin-top: 8px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}
@keyframes mhPop {
  from { transform: translateY(42%) scale(0.86); opacity: 0; }
  to { transform: translateY(9%) scale(1); opacity: 1; }
}
@keyframes mhHitRing {
  from { transform: scale(0.72); opacity: 0.9; }
  to { transform: scale(1.28); opacity: 0; }
}
@keyframes mhHitExit {
  from { transform: translateY(9%) scale(1); opacity: 1; }
  to { transform: translateY(54%) scale(0.74); opacity: 0; }
}
@keyframes mhHitFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -72%) scale(0.94); }
}
@media (max-width: 540px) {
  .mh-wrap { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .mh-header {
    grid-template-columns: minmax(0, 1fr) 58px 48px;
    grid-template-areas:
      "title time quit"
      "status status status";
    gap: 4px;
  }
  .mh-title { font-size: 13px; padding: 0 7px; }
  .mh-status { font-size: 11px; padding: 0 5px; }
  .mh-time { font-size: 12px; }
  .mh-quit-btn { height: 32px; font-size: 11px; }
  .mh-score-strip { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 4px; }
  .mh-score-pill {
    grid-template-columns: 15px 24px minmax(0, 1fr) auto;
    min-height: 31px;
    padding: 3px 5px;
    gap: 4px;
  }
  .mh-avatar { width: 22px; height: 22px; font-size: 12px; }
  .mh-name { font-size: 11px; }
  .mh-score { font-size: 15px; min-width: 20px; }
  .mh-board { gap: 7px; padding: 8px 6px; }
  .mh-point { font-size: 10px; min-width: 26px; padding: 2px 5px; }
  .mh-message { min-height: 31px; font-size: 12px; padding: 6px 8px; }
  .mh-intro-count { font-size: 64px; }
  .mh-intro-title { font-size: 18px; }
  .mh-intro-rule { font-size: 13px; }
}
@media (max-height: 680px) {
  .mh-score-strip { grid-auto-columns: minmax(80px, 1fr); }
  .mh-score-pill { min-height: 29px; }
  .mh-board { gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .mh-message { min-height: 29px; padding-top: 5px; padding-bottom: 5px; }
}

.user-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}
.user-auth-card {
  width: min(360px, 100%);
  padding: 22px;
  border: 1px solid rgba(120, 53, 15, 0.22);
  border-radius: 8px;
  background: #fffaf3;
  box-shadow: 0 18px 50px rgba(30, 41, 59, 0.24);
}
.user-auth-title {
  color: #7c2d12;
  font-size: 22px;
  font-weight: 950;
  text-align: center;
}
.user-auth-sub {
  margin-top: 8px;
  color: #7f6a55;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}
.user-auth-input {
  width: 100%;
  margin-top: 18px;
  padding: 13px 14px;
  border: 2px solid #fed7aa;
  border-radius: 8px;
  background: #fff;
  color: #431407;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  outline: none;
}
.user-auth-input:focus {
  border-color: #fb923c;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22);
}
.user-auth-error {
  min-height: 20px;
  margin-top: 8px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}
.user-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
