    /* ── GAME SCREEN ── */
    #game-screen {
      position: relative;
      width: 100vw;
      flex: 1;
      overflow: hidden;
    }

    canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
    }

    /* HUD */
    #hud {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 20;
      padding: 10px 12px;
      padding-top: max(10px, env(safe-area-inset-top, 10px));
      display: flex;
      align-items: center;
      gap: 8px;
      background: linear-gradient(180deg, rgba(9, 30, 60, .58) 0%, rgba(9, 30, 60, .18) 70%, transparent 100%);
    }

    .coinbox {
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--ink);
      background: var(--glass-strong);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      padding: 7px 13px;
      border-radius: 20px;
      box-shadow: 0 4px 18px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 200, 61, .25) inset;
      font-family: var(--display);
      font-weight: 800;
      font-size: 18px;
      border: 1.5px solid rgba(255, 200, 61, .55);
    }

    .coinbox .c {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      font-size: 11px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 60%, var(--gold-d));
      box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .2);
    }

    .petbadge {
      display: flex;
      align-items: center;
      gap: 7px;
      color: #fff;
      background: rgba(13, 42, 78, 0.92);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      padding: 5px 11px 5px 5px;
      border-radius: 20px;
      border: 1px solid rgba(135, 195, 255, .20);
      box-shadow: 0 8px 32px rgba(0, 12, 32, .55), 0 2px 8px rgba(0, 12, 32, .35);
    }

    .petbadge .av {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      background: linear-gradient(135deg, #ffe0b2, #ffb74d);
      box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
      flex-shrink: 0;
      line-height: 1;
      overflow: hidden;
    }

    .petbadge .pn {
      font-family: var(--display);
      font-weight: 800;
      font-size: 14px;
      line-height: 1.1;
    }

    .petbadge .pn small {
      display: inline-block;
      font-family: var(--body);
      font-weight: 600;
      font-size: 10px;
      color: rgba(255, 255, 255, .75);
      background: rgba(0, 0, 0, .32);
      border-radius: 6px;
      padding: 1px 5px;
      margin-top: 2px;
    }

    .hud-spacer {
      flex: 1;
    }

    .iconbtn {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      color: var(--ink);
      background: var(--glass-strong);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
      font-size: 19px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border-strong);
      cursor: pointer;
      transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
    }

    .iconbtn:hover {
      border-color: var(--violet);
      box-shadow: var(--glow-violet);
    }

    .iconbtn:active {
      transform: scale(.88);
    }

    /* STATS — sits inside bottom container */
    #stats {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 5px;
      width: 100%;
      max-height: 100px;
      opacity: 1;
      transition: max-height .3s ease, opacity .3s ease, transform .3s ease;
    }

    #stats.hidden {
      max-height: 0;
      opacity: 0;
      pointer-events: none;
      transform: translateY(10px);
      overflow: hidden;
    }

    .stat {
      background: var(--glass-strong);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 12px;
      padding: 6px 6px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
      border: 1px solid var(--border);
    }

    .stat .lab {
      display: flex;
      align-items: center;
      gap: 3px;
      font-family: var(--display);
      font-weight: 700;
      font-size: 11.5px;
      color: var(--ink-muted);
      letter-spacing: 0.2px;
    }

    .stat .bar {
      margin-top: 5px;
      height: 8px;
      border-radius: 6px;
      background: rgba(255, 255, 255, .12);
      overflow: hidden;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
    }

    .stat .fill {
      height: 100%;
      border-radius: 6px;
      transition: width .5s cubic-bezier(.3, 1, .4, 1);
    }

    .stat.health .fill {
      background: linear-gradient(90deg, #ff9999, #f44336);
      box-shadow: 0 0 6px rgba(244, 67, 54, .4);
    }

    .stat.hunger .fill {
      background: linear-gradient(90deg, #ffd76a, #ff9800);
      box-shadow: 0 0 6px rgba(255, 152, 0, .4);
    }

    .stat.happy .fill {
      background: linear-gradient(90deg, #86e09f, #43c46b);
      box-shadow: 0 0 6px rgba(67, 196, 107, .4);
    }

    .stat.clean .fill {
      background: linear-gradient(90deg, #86ccf5, #42a5f5);
      box-shadow: 0 0 6px rgba(66, 165, 245, .4);
    }

    .stat.rest .fill {
      background: linear-gradient(90deg, #c084fc, #9333ea);
      box-shadow: 0 0 6px rgba(147, 51, 234, .4);
    }

    .actbtn {
      background: linear-gradient(160deg, #ffe27a, var(--gold-d));
      color: #4a3408;
      font-family: var(--display);
      font-size: 14px;
      font-weight: 800;
      padding: 0 18px;
      height: 40px;
      border-radius: 20px;
      box-shadow: 0 4px 0 #b87d0e, 0 6px 16px rgba(0, 0, 0, .2);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      border: 2.5px solid rgba(255, 255, 255, .6);
      cursor: pointer;
      transition: transform .12s var(--ease-bounce), box-shadow .12s;
      pointer-events: auto;
      letter-spacing: 0.3px;
    }

    .actbtn:active {
      transform: translateY(3px);
      box-shadow: 0 1px 0 #b87d0e, 0 2px 8px rgba(0, 0, 0, .15);
    }

    /* BOTTOM CONTAINER */
    #bottom-container {
      position: absolute;
      bottom: calc(10px + env(safe-area-inset-bottom, 0px));
      left: 10px;
      right: 10px;
      z-index: 22;
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 10px;
      pointer-events: none;
    }

    #bottom-container>* {
      pointer-events: auto;
    }

    .nav-arrow-btn {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      font-size: 20px;
      color: white;
      background: linear-gradient(145deg, #5fbde8, #3a96d0);
      box-shadow: 0 4px 0 #2274a5, 0 6px 16px rgba(0, 0, 0, .25);
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2.5px solid rgba(255, 255, 255, .5);
      transition: transform .12s, box-shadow .12s;
      flex-shrink: 0;
      cursor: pointer;
    }

    .nav-arrow-btn:active {
      transform: translateY(3px);
      box-shadow: 0 1px 0 #2274a5, 0 2px 8px rgba(0, 0, 0, .2);
    }

    #stats-area {
      display: flex;
      flex-direction: column;
      align-items: center;
      flex: 1;
      min-width: 0;
    }

    .stats-toggle-btn {
      background: var(--glass-strong);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--border-strong);
      color: var(--ink);
      font-family: var(--display);
      font-size: 12px;
      font-weight: 800;
      padding: 6px 12px;
      border-radius: 16px;
      margin-bottom: 6px;
      box-shadow: var(--shadow-sm);
      display: flex;
      align-items: center;
      gap: 4px;
      transition: transform .1s var(--ease-out), border-color var(--dur-fast) var(--ease-out);
      cursor: pointer;
    }

    .stats-toggle-btn:active {
      transform: scale(.95);
    }

    /* ENTER prompt — floats above the shop storefront */
    #enter-now {
      position: absolute;
      left: 50%;
      top: 26%;
      transform: translateX(-50%) scale(0);
      z-index: 21;
      background: linear-gradient(145deg, #6ed68a, var(--green-d));
      color: #fff;
      font-family: var(--display);
      font-weight: 900;
      font-size: 16px;
      padding: 12px 24px;
      border-radius: 24px;
      box-shadow: 0 5px 0 #2e7a3c, 0 8px 24px rgba(0, 0, 0, .28);
      border: 2.5px solid rgba(255, 255, 255, .45);
      display: flex;
      align-items: center;
      gap: 8px;
      transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), top .3s ease;
      white-space: nowrap;
    }

    #game-screen.stats-hidden #enter-now {
      top: 22%;
    }

    #enter-now.show {
      transform: translateX(-50%) scale(1);
    }

    #enter-now:active {
      transform: translateX(-50%) translateY(4px) scale(.98);
      box-shadow: 0 1px 0 #2e7a3c, 0 4px 12px rgba(0, 0, 0, .2);
    }

    /* INSIDE-SHOP top bar */
    #inside-bar {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 22;
      padding: 10px 12px;
      padding-top: max(10px, env(safe-area-inset-top, 10px));
      display: none;
      align-items: center;
      gap: 10px;
      background: none;
    }

    #inside-bar.show {
      display: flex;
    }

    .leavebtn {
      background: var(--glass-strong);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: var(--ink);
      font-family: var(--display);
      font-weight: 800;
      font-size: 14px;
      padding: 9px 16px;
      border-radius: 20px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      min-height: 42px;
      border: 2px solid rgba(255, 255, 255, .7);
      transition: transform .12s var(--ease-bounce);
    }

    .leavebtn:active {
      transform: scale(.92);
    }

    #inside-title {
      flex: 1;
      text-align: center;
      color: #fff;
      font-family: var(--display);
      font-weight: 800;
      font-size: 17px;
      text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
      letter-spacing: 0.2px;
    }

    /* ── STORE NAME BANNER ── drops in from the top on store entry */
    #store-banner {
      position: absolute;
      top: 60px;
      left: 50%;
      z-index: 24;
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 10px 22px;
      border-radius: 999px;
      background: linear-gradient(135deg, var(--gold), var(--gold-d));
      color: var(--on-accent);
      font-family: var(--display);
      font-weight: 800;
      font-size: 17px;
      letter-spacing: .2px;
      max-width: 82vw;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      box-shadow: 0 10px 26px rgba(0, 0, 0, .26);
      border: 2px solid rgba(255, 255, 255, .6);
      opacity: 0;
      pointer-events: none;
      transform: translateX(-50%) translateY(-26px) scale(.96);
      transition: transform .4s var(--ease-out), opacity .4s var(--ease-out);
    }

    #store-banner.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0) scale(1);
    }

    #store-banner .sb-ico {
      font-size: 19px;
      line-height: 1;
    }

    @media (prefers-reduced-motion: reduce) {
      #store-banner {
        transition: opacity .2s linear;
      }
    }

    /* ── DYNAMIC ISLAND ── */
    #dynamic-island {
      position: absolute;
      top: 68px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 35;
      background: rgba(13, 42, 78, 0.90);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(135, 195, 255, .16);
      border-radius: 30px;
      box-shadow: 0 12px 40px rgba(0, 12, 32, .55), 0 2px 8px rgba(0, 12, 32, .35);
      overflow: hidden;
      transition:
        border-radius .45s cubic-bezier(.32, 1, .32, 1),
        box-shadow .45s cubic-bezier(.32, 1, .32, 1);
      will-change: transform;
    }

    #dynamic-island.notif-show {
      border-radius: 22px;
      box-shadow: 0 16px 48px rgba(0, 12, 32, .62), 0 4px 16px rgba(0, 12, 32, .4);
    }

    /* Warning state — red gradient on the message area only; taskbar stays blue and full-width */
    #dynamic-island.warn-show {
      border-radius: 22px;
      /* no width / background / border override — island keeps its blue colour and natural width */
    }

    #dynamic-island.warn-show #di-notif {
      max-height: 140px;
      opacity: 1;
      padding: 16px 22px 18px;
      font-size: 20px;
      line-height: 1.25;
      font-weight: 900;
      color: #fff;
      letter-spacing: .01em;
      text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
      white-space: normal;
      word-break: break-word;
      background: linear-gradient(135deg, #d81810, #9b0a06);
      border-radius: 0 0 20px 20px;
      box-shadow: 0 6px 30px rgba(230, 30, 30, .6);
      border-top: 1px solid rgba(255, 120, 120, .35);
    }

    #di-notif {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 0 18px;
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      font-family: var(--body);
      font-weight: 600;
      font-size: 13px;
      color: rgba(238, 244, 255, .92);
      line-height: 1.4;
      white-space: normal;
      transition:
        max-height .42s cubic-bezier(.32, 1, .32, 1),
        opacity .28s ease,
        padding .42s cubic-bezier(.32, 1, .32, 1);
    }

    #dynamic-island.notif-show #di-notif {
      max-height: 80px;
      opacity: 1;
      padding: 10px 18px 14px;
    }

    #di-notif .cdog {
      font-size: 18px;
      flex-shrink: 0;
      opacity: .85;
    }

    @media (prefers-reduced-motion: reduce) {

      #dynamic-island,
      #di-notif {
        transition: none;
      }
    }

    .float {
      position: absolute;
      z-index: 50;
      font-family: var(--display);
      font-weight: 800;
      font-size: 22px;
      pointer-events: none;
      animation: floatup 1.1s ease-out forwards;
      text-shadow: 0 2px 4px rgba(0, 0, 0, .25);
    }

    @keyframes floatup {
      0% {
        opacity: 1;
        transform: translateY(0) scale(.8);
      }

      30% {
        transform: translateY(-14px) scale(1.1);
      }

      100% {
        opacity: 0;
        transform: translateY(-60px) scale(1);
      }
    }

    #wipe {
      position: absolute;
      inset: 0;
      z-index: 55;
      background: #1a2233;
      transform: scaleY(0);
      transform-origin: bottom;
      pointer-events: none;
    }

    #wipe.in {
      animation: wipein .28s forwards;
    }

    #wipe.out {
      animation: wipeout .28s forwards;
    }

    @keyframes wipein {
      from {
        transform: scaleY(0);
        transform-origin: bottom;
      }

      to {
        transform: scaleY(1);
        transform-origin: bottom;
      }
    }

    @keyframes wipeout {
      from {
        transform: scaleY(1);
        transform-origin: top;
      }

      to {
        transform: scaleY(0);
        transform-origin: top;
      }
    }

    /* MENU PANEL inside shop */
    #menu-panel {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 30;
      display: none;
      flex-direction: column;
      max-height: 64%;
      background: linear-gradient(180deg, rgba(255, 247, 236, .0), var(--panel-soft) 14%);
    }

    #menu-panel.show {
      display: flex;
    }

    .menu-list {
      padding: 14px 14px calc(env(safe-area-inset-bottom, 0) + 16px);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 11px;
    }

    .menu-card {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface);
      border-radius: 20px;
      padding: 11px;
      box-shadow: var(--shadow-sm);
      border: 3px solid transparent;
    }

    .menu-card .pic {
      width: 60px;
      height: 60px;
      border-radius: 15px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 34px;
      background: linear-gradient(135deg, rgba(56, 189, 248, .22), rgba(56, 225, 240, .14));
      box-shadow: inset 0 0 0 1px var(--border);
    }

    .menu-card .info {
      flex: 1;
      min-width: 0;
    }

    .menu-card .nm {
      font-family: var(--display);
      font-weight: 800;
      font-size: 15px;
      display: flex;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap;
    }

    .tag {
      font-weight: 600;
      font-size: 11px;
      padding: 2px 8px;
      border-radius: 8px;
    }

    .tag.need {
      background: #ffe2e2;
      color: #d84545;
    }

    .tag.want {
      background: #e6e1ff;
      color: #6d5ad8;
    }

    .menu-card .ds {
      font-size: 12px;
      color: var(--ink-muted);
      margin-top: 2px;
    }

    .menu-card .fx {
      display: flex;
      gap: 6px;
      margin-top: 5px;
      flex-wrap: wrap;
    }

    .fxpill {
      font-family: var(--display);
      font-weight: 700;
      font-size: 10.5px;
      padding: 3px 7px;
      border-radius: 9px;
      background: rgba(56, 225, 240, .14);
      color: #8FECF6;
    }

    .menu-card .buy {
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
    }

    .price {
      font-family: var(--display);
      font-weight: 800;
      font-size: 14px;
      color: var(--gold);
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .price .c {
      width: 15px;
      height: 15px;
      border-radius: 50%;
      background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 60%, var(--gold-d));
    }

    .buybtn {
      background: linear-gradient(180deg, #7fe08f, var(--green-d));
      color: #fff;
      font-family: var(--display);
      font-weight: 800;
      font-size: 13px;
      padding: 9px 16px;
      border-radius: 14px;
      box-shadow: 0 4px 0 rgba(0, 0, 0, .12);
    }

    .buybtn:active {
      transform: translateY(2px);
      box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
    }

    .menu-card.cant {
      opacity: .55;
      filter: grayscale(.4);
    }

    .menu-card.cant .buybtn {
      background: #c2c9d4;
      box-shadow: none;
    }

    .cant-note {
      font-size: 10px;
      color: #d84545;
      font-weight: 700;
      font-family: var(--display);
    }

    .menu-head {
      padding: 14px 16px 4px;
      display: flex;
      align-items: flex-end;
      gap: 10px;
    }

    .menu-head h3 {
      font-family: var(--display);
      font-weight: 800;
      font-size: 18px;
      color: var(--ink);
    }

    .menu-head .sub {
      font-size: 12px;
      color: var(--ink-subtle);
      font-weight: 500;
    }

    .menu-head .purse {
      margin-left: auto;
      color: var(--ink);
      background: var(--surface-2);
      border: 2px solid rgba(255, 200, 61, .5);
      border-radius: 14px;
      padding: 6px 12px;
      font-family: var(--display);
      font-weight: 800;
      font-size: 15px;
      display: flex;
      align-items: center;
      gap: 6px;
      box-shadow: var(--shadow-sm);
    }

    .menu-head .purse .c {
      width: 17px;
      height: 17px;
      border-radius: 50%;
      background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 60%, var(--gold-d));
    }

    .goal {
      margin: 6px 14px 0;
      background: linear-gradient(135deg, var(--surface-2), rgba(255, 200, 61, .06));
      border-radius: 18px;
      padding: 12px;
      box-shadow: var(--shadow-sm);
      border: 2px dashed rgba(255, 200, 61, .55);
    }

    .goal .gh {
      display: flex;
      align-items: center;
      gap: 9px;
      font-family: var(--display);
      font-weight: 800;
      font-size: 14px;
    }

    .goal .gh .gp {
      margin-left: auto;
      font-size: 13px;
      color: var(--gold);
    }

    .goal .gbar {
      margin-top: 8px;
      height: 13px;
      border-radius: 8px;
      background: rgba(255, 255, 255, .1);
      overflow: hidden;
    }

    .goal .gfill {
      height: 100%;
      border-radius: 8px;
      background: linear-gradient(90deg, #ffd96b, var(--gold-d));
      transition: width .5s;
    }

    .goal .gsub {
      font-size: 11px;
      color: var(--ink-subtle);
      margin-top: 6px;
      font-weight: 600;
    }

    .goal .savebtns {
      margin-top: 9px;
      display: flex;
      gap: 8px;
    }

    /* OVERLAYS (Job & Profile) */
    .overlay {
      position: absolute;
      inset: 0;
      z-index: 40;
      display: none;
      align-items: flex-end;
      background: rgba(10, 18, 30, .55);
      backdrop-filter: blur(3px);
    }

    .overlay.open {
      display: flex;
      animation: fade .25s;
    }

    @keyframes fade {
      from {
        opacity: 0
      }

      to {
        opacity: 1
      }
    }

    .sheet {
      width: 100%;
      max-height: 80%;
      background: var(--panel-soft);
      border-radius: 28px 28px 0 0;
      box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      animation: slideup .35s cubic-bezier(.2, 1, .3, 1);
    }

    @keyframes slideup {
      from {
        transform: translateY(100%)
      }

      to {
        transform: translateY(0)
      }
    }

    .sheet-head {
      position: relative;
      padding: 18px;
      color: #fff;
      background: linear-gradient(135deg, #6fd07f, #3E9E4E);
    }

    .sheet-head h2 {
      font-family: var(--display);
      font-weight: 800;
      font-size: 22px;
    }

    .sheet-head p {
      font-weight: 500;
      font-size: 13px;
      opacity: .92;
      margin-top: 3px;
    }

    .sheet-head .closeb {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: rgba(255, 255, 255, .25);
      color: #fff;
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .job-body {
      padding: 20px;
      text-align: center;
    }

    /* TOP NAV BAR — lives inside #dynamic-island, no own positioning */
    .top-nav-bar {
      display: flex;
      gap: 4px;
      padding: 4px;
    }

    .top-nav-btn {
      border: none;
      background: transparent;
      padding: 6px 14px;
      border-radius: 20px;
      font-family: var(--display);
      font-size: 13px;
      font-weight: 700;
      color: var(--ink-muted);
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
    }

    .top-nav-btn:hover {
      color: var(--ink);
    }

    .top-nav-btn.active {
      background: linear-gradient(135deg, var(--violet), var(--violet-d));
      color: white;
      box-shadow: var(--glow-violet);
    }

    .top-nav-btn:active {
      transform: scale(0.95);
    }

    /* WORK / RANKS TABS — full screen above nav */
    #tab-work,
    #tab-ai,
    #tab-leaderboard {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      padding-top: 120px;
      padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
      overflow-y: auto;
      background: var(--panel-soft);
      display: none;
      flex-direction: column;
    }

    #tab-work.tab-active,
    #tab-ai.tab-active,
    #tab-leaderboard.tab-active {
      display: flex;
    }

    /* Work tab: lift the scene canvas above the panel so the pet companion shows at
       the bottom. The canvas is transparent except for the pet, and click-through so
       the work UI stays interactive. */
    #game-screen.companion-mode #scene {
      z-index: 1;
      pointer-events: none;
    }

    .work-wrap {
      padding: 16px 16px 24px;
    }

    .work-balance-hero {
      background: linear-gradient(135deg, var(--green), var(--green-d));
      border-radius: 20px;
      padding: 20px;
      color: #fff;
      margin-bottom: 18px;
      box-shadow: var(--shadow);
    }

    .work-balance-hero .wb-label {
      font-size: 12px;
      opacity: .85;
      margin-bottom: 6px;
      font-weight: 600;
    }

    .work-balance-hero .wb-amount {
      font-size: 34px;
      font-weight: 800;
      letter-spacing: -.03em;
    }

    .work-balance-hero .wb-hint {
      font-size: 11px;
      opacity: .75;
      margin-top: 8px;
      line-height: 1.4;
    }

    .work-section-title {
      font-size: 14px;
      font-weight: 900;
      color: var(--ink);
      margin-bottom: 12px;
    }

    .work-job-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .work-job-card {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface);
      border-radius: 18px;
      padding: 14px;
      box-shadow: var(--shadow-sm);
      border: 2px solid rgba(91, 190, 107, .2);
      transition: all .2s;
      text-align: left;
    }

    .work-job-card:active {
      transform: scale(.98);
    }

    .work-job-card:hover {
      border-color: var(--green);
      box-shadow: 0 4px 16px rgba(91, 190, 107, .2);
    }

    .work-job-card .wj-icon {
      font-size: 28px;
      flex-shrink: 0;
      width: 40px;
      text-align: center;
    }

    .work-job-card .wj-body {
      flex: 1;
      min-width: 0;
    }

    .work-job-card .wj-title {
      font-size: 15px;
      font-weight: 800;
      color: var(--ink);
      margin-bottom: 2px;
      font-family: var(--display);
    }

    .work-job-card .wj-desc {
      font-size: 12px;
      color: var(--ink-muted);
      line-height: 1.35;
      font-weight: 600;
    }

    .work-job-card .wj-pay {
      background: rgba(91, 190, 107, .15);
      color: var(--green-d);
      border-radius: 10px;
      padding: 5px 10px;
      font-size: 13px;
      font-weight: 800;
      font-family: var(--display);
      flex-shrink: 0;
    }

    .room-back-btn {
      background: rgba(91, 190, 107, .15);
      color: var(--green-d);
      border: none;
      border-radius: 12px;
      padding: 8px 14px;
      font-size: 13px;
      font-weight: 800;
      cursor: pointer;
      font-family: var(--display);
    }

    .edu-score-badge {
      background: linear-gradient(135deg, var(--green), var(--green-d));
      color: white;
      border-radius: 12px;
      padding: 5px 14px;
      font-size: 13px;
      font-weight: 800;
      font-family: var(--display);
    }

    .edu-streak {
      background: #FFF5EB;
      color: var(--red);
      border-radius: 12px;
      padding: 5px 12px;
      font-size: 13px;
      font-weight: 800;
      border: 2px solid rgba(255, 107, 107, .2);
      font-family: var(--display);
    }

    .edu-question-card {
      background: var(--surface);
      border-radius: 18px;
      padding: 18px;
      box-shadow: var(--shadow-sm);
      margin-bottom: 12px;
      border: 2px solid rgba(91, 190, 107, .3);
    }

    .edu-q-label {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--ink-subtle);
      margin-bottom: 8px;
    }

    .edu-q-text {
      font-size: 16px;
      font-weight: 700;
      color: var(--ink);
      line-height: 1.4;
      margin-bottom: 14px;
    }

    .edu-q-passage {
      font-size: 13px;
      color: var(--ink-muted);
      background: var(--panel-soft);
      border-radius: 10px;
      padding: 10px 12px;
      margin-bottom: 12px;
      line-height: 1.55;
      border: 1px solid rgba(91, 190, 107, .2);
    }

    .edu-opts {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .edu-opt {
      padding: 12px 15px;
      border-radius: 13px;
      border: 2px solid rgba(91, 190, 107, .25);
      background: var(--surface);
      font-size: 14px;
      font-weight: 600;
      text-align: left;
      color: var(--ink);
      transition: all .18s;
      cursor: pointer;
    }

    .edu-opt.correct {
      background: #E8F5E9;
      border-color: #4CAF50;
      color: #1B5E20;
    }

    .edu-opt.wrong {
      background: #FFEBEE;
      border-color: #EF5350;
      color: #B71C1C;
    }

    .edu-opt:disabled {
      pointer-events: none;
    }

    .edu-feedback {
      margin-top: 10px;
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 13px;
      font-weight: 600;
      display: none;
    }

    .edu-feedback.show {
      display: block;
    }

    .edu-feedback.ok {
      background: #E8F5E9;
      color: #2E7D32;
    }

    .edu-feedback.bad {
      background: #FFEBEE;
      color: #C62828;
    }

    .edu-next-btn {
      margin-top: 10px;
      width: 100%;
      background: linear-gradient(135deg, var(--green), var(--green-d));
      color: white;
      border: none;
      border-radius: 12px;
      padding: 13px;
      font-size: 14px;
      font-weight: 800;
      display: none;
      box-shadow: 0 4px 14px rgba(91, 190, 107, .3);
      cursor: pointer;
      font-family: var(--display);
    }

    .edu-next-btn.show {
      display: block;
    }

    /* TYPEABLE ANSWER (math) */
    .edu-input-row {
      display: flex;
      gap: 8px;
      align-items: stretch;
    }

    .edu-input {
      flex: 1;
      padding: 12px 15px;
      border-radius: 13px;
      border: 2px solid rgba(91, 190, 107, .35);
      background: var(--surface);
      font-size: 16px;
      font-weight: 700;
      color: var(--ink);
      font-family: var(--body);
      outline: none;
      transition: border-color .18s, box-shadow .18s;
    }

    .edu-input:focus {
      border-color: var(--green);
      box-shadow: 0 0 0 3px rgba(91, 190, 107, .18);
    }

    .edu-input.correct {
      background: #E8F5E9;
      border-color: #4CAF50;
      color: #1B5E20;
    }

    .edu-input.wrong {
      background: #FFEBEE;
      border-color: #EF5350;
      color: #B71C1C;
    }

    .edu-submit-btn {
      background: linear-gradient(135deg, var(--green), var(--green-d));
      color: white;
      border: none;
      border-radius: 13px;
      padding: 0 20px;
      font-size: 14px;
      font-weight: 800;
      cursor: pointer;
      font-family: var(--display);
      box-shadow: 0 4px 12px rgba(91, 190, 107, .28);
    }

    .edu-submit-btn:disabled {
      opacity: .5;
      cursor: default;
    }

    /* QUESTION TIMER */
    .edu-timer {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 14px;
    }

    .edu-timer-bar {
      flex: 1;
      height: 8px;
      border-radius: 6px;
      background: rgba(91, 190, 107, .15);
      overflow: hidden;
    }

    .edu-timer-fill {
      height: 100%;
      width: 100%;
      border-radius: 6px;
      background: linear-gradient(90deg, var(--green), var(--green-d));
      transform-origin: left center;
      transition: transform 1s linear, background .3s;
    }

    .edu-timer-fill.low {
      background: linear-gradient(90deg, #FFB347, var(--red));
    }

    .edu-timer-num {
      font-size: 13px;
      font-weight: 800;
      color: var(--ink-subtle);
      font-family: var(--display);
      min-width: 34px;
      text-align: right;
      font-variant-numeric: tabular-nums;
    }

    /* WORK SELECTOR */
    .ws-selector {
      display: flex;
      flex-direction: column;
      gap: 22px;
    }

    .ws-selector-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 4px;
    }

    .ws-selector-title {
      font-size: 20px;
      font-weight: 900;
      color: var(--ink);
      font-family: var(--display);
    }

    .ws-selector-sub {
      font-size: 12px;
      color: var(--ink-muted);
      font-weight: 600;
      margin-top: 2px;
    }

    .ws-section-label {
      font-size: 11px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--ink-subtle);
      margin-bottom: 10px;
    }

    .ws-chips {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ws-chip {
      flex: 1;
      min-width: 80px;
      padding: 12px 10px;
      border-radius: 16px;
      border: 2px solid rgba(91, 190, 107, .2);
      background: var(--surface);
      font-family: var(--display);
      font-size: 13px;
      font-weight: 800;
      color: var(--ink-muted);
      cursor: pointer;
      text-align: center;
      transition: all .18s;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .ws-chip .ws-chip-icon {
      font-size: 22px;
      line-height: 1;
    }

    .ws-chip:active {
      transform: scale(.96);
    }

    .ws-chip.selected {
      background: linear-gradient(135deg, var(--violet), var(--violet-d));
      border-color: var(--violet);
      color: #fff;
      box-shadow: var(--glow-violet);
    }

    .ws-confirm-btn {
      width: 100%;
      padding: 15px;
      border-radius: 16px;
      border: none;
      background: linear-gradient(135deg, var(--green), var(--green-d));
      color: #fff;
      font-family: var(--display);
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 4px 16px rgba(91, 190, 107, .3);
      transition: opacity .2s, transform .12s;
      opacity: .45;
      pointer-events: none;
    }

    .ws-confirm-btn.ready {
      opacity: 1;
      pointer-events: auto;
    }

    .ws-confirm-btn:active {
      transform: scale(.98);
    }

    .ws-reselect-btn {
      background: rgba(91, 190, 107, .12);
      color: var(--green-d);
      border: none;
      border-radius: 12px;
      padding: 7px 13px;
      font-size: 12px;
      font-weight: 800;
      cursor: pointer;
      font-family: var(--display);
      transition: background .15s;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .ws-reselect-btn:active {
      background: rgba(91, 190, 107, .25);
    }

    .ws-badge-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }

    .ws-badge {
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 800;
      font-family: var(--display);
      text-transform: uppercase;
      letter-spacing: .04em;
    }

    .ws-badge.grade {
      background: rgba(124, 77, 255, .15);
      color: var(--violet-d, #5c35c9);
    }

    .ws-badge.subject {
      background: rgba(91, 190, 107, .15);
      color: var(--green-d);
    }



    /* PANEL TABS — the leaderboard's list styling. These class names are the
       Reports tab's, kept because the Ranks list was always built out of them;
       the tab itself is gone. */
    .reports-wrap {
      padding: 20px;
    }

    .reports-title {
      font-size: 16px;
      font-weight: 900;
      margin-bottom: 12px;
      color: var(--ink);
      font-family: var(--display);
    }

    .reports-section-label {
      font-size: 12px;
      font-weight: 800;
      color: var(--ink-muted);
      text-transform: uppercase;
      letter-spacing: .06em;
      padding: 0 2px 8px;
    }

    .tx-row {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--surface);
      border-radius: 14px;
      padding: 12px;
      margin-bottom: 8px;
      box-shadow: var(--shadow-sm);
    }

    .tx-icon-wrap {
      width: 38px;
      height: 38px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .tx-type {
      font-size: 13px;
      font-weight: 800;
      color: var(--ink);
    }

    .tx-date {
      font-size: 10px;
      color: #9aa3b0;
      font-weight: 600;
    }

    .tx-amount {
      font-size: 14px;
      font-weight: 800;
      flex-shrink: 0;
    }

    .tx-amount.income {
      color: var(--green);
    }

