  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page-bg);
    color: var(--page-fg);
  }

  /* ----- Theme palettes ----- */
  body[data-theme="color"] {
    --page-bg: #EFE4B0; --page-fg: #222; --search-border: #555;
    --header-bg: #161616; --header-fg: #fff;
    --simon-bg: #15171c; --ij-bg: #111;
    --panel-bg: #fffaf0; --panel-fg: #222; --panel-sub: #f0e8d4;
    --sim-dim-filter: brightness(0.5); --sim-lit-filter: brightness(1.3);
    --title-fill: red; --title-stroke: #7b2ff2;
    --btn-red: #d62b2b; --btn-red-h: #b81f1f;
    --btn-green: #5e9c3a; --btn-green-h: #4d8330;
    --btn-blue: #2f6fb0; --btn-blue-h: #245a90;
    --gbtn: #c94b4b; --gbtn-h: #b03c3c;
    --gcard: #c4443c; --gcard-h: #ab372f; --gcard-out: #6b21c9;
    --set-btn: #555a66; --set-btn-h: #444955;
    --ij-title: #2f9fd0; --simon-title: #b96bff;
  }
  body[data-theme="dark"] {
    --page-bg: #15171c; --page-fg: #e8e8e8; --search-border: #555;
    --header-bg: #0c0d10; --header-fg: #fff;
    --simon-bg: #0e0f13; --ij-bg: #000;
    --panel-bg: #232730; --panel-fg: #eee; --panel-sub: #2e3340;
    --sim-dim-filter: brightness(0.42) saturate(0.8); --sim-lit-filter: brightness(0.9) saturate(0.85);
    --title-fill: #cf8181; --title-stroke: #9a7ae0;
    --btn-red: #a85454; --btn-red-h: #8e4444;
    --btn-green: #557f43; --btn-green-h: #496b39;
    --btn-blue: #3a6a96; --btn-blue-h: #2f5578;
    --gbtn: #a85a5a; --gbtn-h: #8f4b4b;
    --gcard: #9e4038; --gcard-h: #86332c; --gcard-out: #7b4fd0;
    --set-btn: #4c515c; --set-btn-h: #3e424c;
    --ij-title: #5f93b5; --simon-title: #9a82c2;
  }
  body[data-theme="light"] {
    --page-bg: #f4f4ef; --page-fg: #222; --search-border: #aaa;
    --header-bg: #e9e9ee; --header-fg: #222;
    --simon-bg: #e7e8ee; --ij-bg: #dcdcdc;
    --panel-bg: #ffffff; --panel-fg: #222; --panel-sub: #eef0f4;
    --sim-dim-filter: brightness(0.62); --sim-lit-filter: brightness(1.25);
    --title-fill: red; --title-stroke: #7b2ff2;
    --btn-red: #d62b2b; --btn-red-h: #b81f1f;
    --btn-green: #5e9c3a; --btn-green-h: #4d8330;
    --btn-blue: #2f6fb0; --btn-blue-h: #245a90;
    --gbtn: #c94b4b; --gbtn-h: #b03c3c;
    --gcard: #c4443c; --gcard-h: #ab372f; --gcard-out: #6b21c9;
    --set-btn: #555a66; --set-btn-h: #444955;
    --ij-title: #2f9fd0; --simon-title: #b96bff;
  }

  /* ===================== HOME SCREEN ===================== */
  #menuScreen {
    background-color: var(--page-bg);
    min-height: 100vh;
    padding: 40px 20px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
  }
  h1.title {
    position: relative;
    font-size: 80px;
    font-weight: 800;
    color: var(--title-fill);
    -webkit-text-stroke: 3px var(--title-stroke);
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: 2px;
  }
  h1.title .logo {
    position: absolute;
    right: 100%;              /* sit just left of the title, without shifting it */
    top: 50%;
    transform: translateY(-50%);
    margin-right: 18px;
    height: 84px;
    width: auto;
  }
  p.welcome { font-size: 22px; color: var(--page-fg); text-align: center; margin-bottom: 28px; }
  .search-wrap { width: 100%; max-width: 500px; margin-bottom: 36px; }
  #search {
    width: 100%; padding: 14px 18px; font-size: 18px;
    border: 2px solid var(--search-border); border-radius: 10px; outline: none;
  }
  #search:focus { border-color: blue; }
  .games {
    width: 100%; max-width: 1020px; display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px; align-content: flex-start;
  }
  .special-row {
    width: 100%; max-width: 1020px; display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px; margin-bottom: 22px;
  }
  .special-btn {
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding: 12px; border: none; border-radius: 16px;
    background-color: #6a3ad6; color: #fff; cursor: pointer;
    box-shadow: 0 3px 0 rgba(0,0,0,0.22);
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 10px; line-height: 1.7; letter-spacing: 0.5px; min-height: 3em;
    text-shadow: -1.5px 0 #3f1f8a, 1.5px 0 #3f1f8a, 0 -1.5px #3f1f8a, 0 1.5px #3f1f8a, -1.5px -1.5px #3f1f8a, 1.5px -1.5px #3f1f8a, -1.5px 1.5px #3f1f8a, 1.5px 1.5px #3f1f8a;
  }
  .special-btn:hover { background-color: #7d4ee6; transform: translateY(-3px); box-shadow: 0 7px 15px rgba(0,0,0,0.22); }
  .game-btn {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 14px 14px 16px; border: none; border-radius: 20px;
    background-color: var(--gcard); color: #fff; cursor: pointer;
    box-shadow: 0 3px 0 rgba(0,0,0,0.18);
    transition: transform 0.1s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  }
  .game-btn:hover { background-color: var(--gcard-h); transform: translateY(-3px); box-shadow: 0 7px 15px rgba(0,0,0,0.22); }
  .gb-label {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 11px; line-height: 1.7; letter-spacing: 0.5px; color: #fff;
    text-align: center; word-break: break-word; width: 100%;
    min-height: 3.4em; display: flex; align-items: center; justify-content: center;
    text-shadow: -1.5px 0 var(--gcard-out), 1.5px 0 var(--gcard-out), 0 -1.5px var(--gcard-out), 0 1.5px var(--gcard-out), -1.5px -1.5px var(--gcard-out), 1.5px -1.5px var(--gcard-out), -1.5px 1.5px var(--gcard-out), 1.5px 1.5px var(--gcard-out);
  }
  .gb-thumb {
    width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden;
    display: block; background: #000; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
  }
  .gb-thumb svg { display: block; width: 100%; height: 100%; }
  @media (max-width: 720px) {
    .games { gap: 12px; }
    .game-btn { padding: 9px 9px 11px; border-radius: 14px; gap: 7px; }
    .gb-label { font-size: 8px; line-height: 1.6; min-height: 3.2em; letter-spacing: 0; }
    .gb-thumb { border-radius: 9px; }
    .special-row { gap: 12px; margin-bottom: 12px; }
    .special-btn { padding: 9px; border-radius: 12px; font-size: 8px; min-height: 2.8em; }
  }
  #topBtns { position: fixed; top: 14px; right: 14px; display: flex; gap: 10px; z-index: 5; }
  #settingsBtn, #langBtn {
    background: var(--set-btn); color: #fff; border: none; padding: 10px 16px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #langBtn { font-size: 20px; line-height: 1; padding: 9px 13px; }
  #settingsBtn:hover, #langBtn:hover { background: var(--set-btn-h); }
  .copyright { position: fixed; bottom: 10px; left: 12px; color: var(--page-fg); font-size: 13px; }
  .version   { position: fixed; bottom: 10px; right: 12px; color: var(--page-fg); font-size: 15px; }

  /* ===================== GAME SCREEN ===================== */
  #gameScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #header {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 20px; gap: 20px; color: var(--header-fg); flex: 0 0 auto;
  }
  #menuBtn {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #menuBtn:hover { background: var(--btn-red-h); }
  #pauseBtn {
    background: var(--btn-blue); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #pauseBtn:hover { background: var(--btn-blue-h); }
  #gameTitle { color: var(--ij-title); font-size: 26px; font-weight: bold; letter-spacing: 0.5px; }
  #stats { margin-left: auto; display: flex; gap: 32px; font-size: 20px; font-weight: bold; }
  #stage { position: relative; flex: 1 1 auto; }
  canvas { display: block; }
  #touchControls {
    position: absolute; left: 0; right: 0; bottom: 16px;
    display: none; justify-content: space-between; align-items: flex-end;
    padding: 0 20px; pointer-events: none;
  }
  #touchControls .tc-group { display: flex; gap: 16px; pointer-events: auto; }
  .tc-btn {
    width: 76px; height: 76px; border-radius: 50%;
    background: rgba(35,35,35,0.45); color: #fff; border: 2px solid rgba(255,255,255,0.55);
    font-size: 36px; font-weight: bold; cursor: pointer; touch-action: none; user-select: none;
    display: flex; align-items: center; justify-content: center;
  }
  .tc-btn:active { background: rgba(35,35,35,0.72); transform: scale(0.95); }
  .tc-jump { width: 88px; height: 88px; background: rgba(58,58,214,0.5); border-color: rgba(150,150,255,0.7); }

  .overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center;
    color: #fff; background: rgba(0,0,0,0.6); gap: 16px; padding: 20px;
  }
  .overlay h2 { font-size: 46px; }
  .overlay p { font-size: 18px; max-width: 500px; line-height: 1.5; }
  .overlay .big { font-size: 28px; font-weight: bold; }
  .overlay-btns { display: flex; gap: 14px; margin-top: 6px; }
  .ov-btn { border: none; padding: 12px 26px; font-size: 18px; font-weight: bold; border-radius: 10px; cursor: pointer; color: #fff; }
  .play { background: var(--btn-green); } .play:hover { background: var(--btn-green-h); }
  .menu { background: var(--btn-red); } .menu:hover { background: var(--btn-red-h); }
  .hidden { display: none; }

  /* ===================== CHAOS SIMON SCREEN ===================== */
  #simonScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--simon-bg); }
  #simonHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 20px; gap: 20px; color: var(--header-fg); flex: 0 0 auto;
  }
  #simonHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #simonHeader .hmenu:hover { background: var(--btn-red-h); }
  #simonHeader .htitle { color: var(--simon-title); font-size: 26px; font-weight: bold; letter-spacing: 0.5px; }
  #simonHeader .hstats { margin-left: auto; font-size: 20px; font-weight: bold; }
  #simonStage {
    position: relative; flex: 1 1 auto; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 20px; padding: 20px;
  }
  #simonStatus { color: var(--header-fg); font-size: 22px; font-weight: bold; min-height: 26px; text-align: center; }
  #simonBoard {
    display: flex; flex-wrap: wrap; justify-content: center; align-content: center;
    gap: 14px; width: min(86vw, 560px);
  }
  .sim-btn {
    flex: 0 0 auto; width: 80px; height: 80px;   /* size is set by simLayout() */
    border-radius: 16px; cursor: pointer;
    border: 3px solid rgba(0,0,0,0.28); filter: var(--sim-dim-filter);
    transition: filter 0.07s ease, transform 0.07s ease;
  }
  .sim-btn.lit { filter: var(--sim-lit-filter); transform: scale(1.04); box-shadow: 0 0 26px rgba(255,255,255,0.5); }
  #simonBoard.locked .sim-btn { cursor: default; }

  /* ===================== ONE WAY PONG SCREEN ===================== */
  #pongScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #pongHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 20px; gap: 20px; color: var(--header-fg); flex: 0 0 auto;
  }
  #pongHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #pongHeader .hmenu:hover { background: var(--btn-red-h); }
  #pongHeader .htitle { color: #e8924a; font-size: 26px; font-weight: bold; letter-spacing: 0.5px; }
  #pongHeader .hstats { margin-left: auto; font-size: 20px; font-weight: bold; }
  #pongStage { position: relative; flex: 1 1 auto; touch-action: none; }
  #pongCanvas { display: block; }

  /* ===================== Z-CASTLE DEFENSE SCREEN ===================== */
  #zcdScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #zcdHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 20px; gap: 20px; color: var(--header-fg); flex: 0 0 auto;
  }
  #zcdHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #zcdHeader .hmenu:hover { background: var(--btn-red-h); }
  #zcdHeader .htitle { color: #36c5d6; font-size: 26px; font-weight: bold; letter-spacing: 0.5px; }
  #zcdHeader .hstats { margin-left: auto; font-size: 20px; font-weight: bold; }
  #zcdStage { position: relative; flex: 1 1 auto; }
  #zcdCanvas { display: block; }
  #zcd2Screen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #zcd2Header {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 18px; gap: 14px; color: var(--header-fg); flex: 0 0 auto;
  }
  #zcd2Header .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #zcd2Header .hmenu:hover { background: var(--btn-red-h); }
  #zcd2Header .htitle { color: #36c5d6; font-size: 20px; font-weight: bold; letter-spacing: 0.4px; }
  #zcd2Header .hstats { margin-left: auto; font-size: 13px; font-weight: bold; text-align: right; line-height: 1.3; }
  #zcd2Stage { position: relative; flex: 1 1 auto; }
  #zcd2Canvas { display: block; }
  #zcd2Touch {
    position: absolute; left: 0; right: 0; bottom: 16px;
    display: none; justify-content: space-between; align-items: flex-end;
    padding: 0 20px; pointer-events: none;
  }
  #zcd2Touch.show { display: flex; }
  #mrScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: #000; }
  #mrHeader { height: 64px; background: var(--header-bg); display: flex; align-items: center; padding: 0 18px; gap: 14px; color: var(--header-fg); flex: 0 0 auto; }
  #mrHeader .hmenu { background: var(--btn-red); color: #fff; border: none; padding: 9px 18px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  #mrHeader .hmenu:hover { background: var(--btn-red-h); }
  #mrHeader .htitle { color: #36c5d6; font-size: 22px; font-weight: bold; letter-spacing: 0.4px; }
  #mrHeader .hstats { margin-left: auto; font-size: 14px; font-weight: bold; }
  #mrStage { position: relative; flex: 1 1 auto; background: #000; }
  #mrCanvas { display: block; }

  /* ===================== INFINITE SNAKE SCREEN ===================== */
  #isScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #isHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 20px; gap: 20px; color: var(--header-fg); flex: 0 0 auto;
  }
  #isHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #isHeader .hmenu:hover { background: var(--btn-red-h); }
  #isHeader .htitle { color: #3aa84f; font-size: 26px; font-weight: bold; letter-spacing: 0.5px; }
  #isHeader .hstats { margin-left: auto; font-size: 20px; font-weight: bold; }
  #isStage { position: relative; flex: 1 1 auto; touch-action: none; }
  #isCanvas { display: block; }
  #isTouch {
    position: absolute; left: 0; right: 0; bottom: 16px; display: none;
    flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  }
  #isTouch.show { display: flex; }
  .is-row { display: flex; gap: 8px; }
  .is-tbtn {
    pointer-events: auto; width: 62px; height: 62px; border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.5); background: rgba(35,35,35,0.45);
    color: #fff; font-size: 22px; font-weight: bold; cursor: pointer; touch-action: none;
    display: flex; align-items: center; justify-content: center;
  }
  .is-tbtn:active { background: rgba(35,35,35,0.72); }

  /* ===================== 2D BASEBALL SCREEN ===================== */
  #bbScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--ij-bg); }
  #bbHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 16px; gap: 14px; color: var(--header-fg); flex: 0 0 auto;
  }
  #bbHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 16px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #bbHeader .hmenu:hover { background: var(--btn-red-h); }
  #bbHeader .htitle { color: #e8c54a; font-size: 23px; font-weight: bold; white-space: nowrap; }
  #bbHeader .hstats { margin-left: auto; font-size: 14px; font-weight: bold; text-align: right; line-height: 1.3; }
  .bb-pause { background: rgba(255,255,255,0.22); color: var(--header-fg); border: none; width: 40px; height: 40px; border-radius: 8px; font-size: 18px; cursor: pointer; }
  .bb-pause:hover { background: rgba(255,255,255,0.34); }
  #bbStage { position: relative; flex: 1 1 auto; touch-action: none; }
  #bbCanvas { display: block; }
  .bb-modes { display: flex; flex-direction: column; gap: 8px; width: min(86vw, 320px); margin-top: 6px; }
  .bb-mode { background: var(--gbtn); color: #fff; border: none; padding: 12px; font-size: 16px; font-weight: bold; border-radius: 10px; cursor: pointer; }
  .bb-mode:hover { background: var(--gbtn-h); }

  /* ===================== GRAPPLE BLAST SCREEN ===================== */
  #gbScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: #0e1626; }
  #gbHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 16px; gap: 14px; color: var(--header-fg); flex: 0 0 auto;
  }
  #gbHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 16px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #gbHeader .hmenu:hover { background: var(--btn-red-h); }
  #gbHeader .htitle { color: #4ad6c0; font-size: 23px; font-weight: bold; white-space: nowrap; }
  #gbHeader .hstats { margin-left: auto; font-size: 13.5px; font-weight: bold; text-align: right; line-height: 1.3; }
  #gbStage { position: relative; flex: 1 1 auto; touch-action: none; }
  #gbCanvas { display: block; cursor: crosshair; }
  .gb-levels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: min(92vw, 440px); margin-top: 8px; }
  .gb-lv { background: var(--gbtn); color: #fff; border: none; padding: 11px 12px; font-size: 15px; font-weight: bold; border-radius: 10px; cursor: pointer; text-align: left; }
  .gb-lv:hover { background: var(--gbtn-h); }
  .gb-lv b { display: block; opacity: 0.65; font-size: 11px; font-weight: bold; }

  /* ===================== MAZE OF DARKNESS ===================== */
  #mazScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: #05060a; }
  #mazHeader {
    height: 64px; background: var(--header-bg); display: flex; align-items: center;
    padding: 0 16px; gap: 14px; color: var(--header-fg); flex: 0 0 auto;
  }
  #mazHeader .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 16px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #mazHeader .hmenu:hover { background: var(--btn-red-h); }
  #mazHeader .htitle { color: #8fb4ff; font-size: 23px; font-weight: bold; white-space: nowrap; }
  #mazHeader .hstats { margin-left: auto; font-size: 16px; font-weight: bold; text-align: right; }
  #mazStage { position: relative; flex: 1 1 auto; touch-action: none; background: #05060a; }
  #mazCanvas { display: block; }
  .maz-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(94vw, 520px); margin-top: 8px; max-height: 52vh; overflow-y: auto; padding: 2px; }
  .maz-lv { background: var(--gbtn); color: #fff; border: none; padding: 10px 11px; font-size: 14px; font-weight: bold; border-radius: 10px; cursor: pointer; text-align: left; }
  .maz-lv:hover { background: var(--gbtn-h); }
  .maz-lv b { display: block; opacity: 0.6; font-size: 10px; font-weight: bold; }
  #mazTouch {
    position: absolute; left: 0; right: 0; bottom: 16px; display: none;
    flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  }
  #mazTouch.show { display: flex; }

  /* ===================== DESTROY THE MOON CLICKER ===================== */
  #dmcScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: radial-gradient(circle at 50% 0%, #1a1d3a 0%, #0a0b1e 60%, #050510 100%); }
  #dmcHeader { height: 64px; background: var(--header-bg); display: flex; align-items: center; padding: 0 20px; gap: 16px; color: var(--header-fg); flex: 0 0 auto; }
  #dmcHeader .hmenu { background: var(--btn-red); color: #fff; border: none; padding: 9px 18px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  #dmcHeader .hmenu:hover { background: var(--btn-red-h); }
  #dmcHeader .htitle { color: #cfd2ff; font-size: 22px; font-weight: bold; letter-spacing: 0.5px; white-space: nowrap; }
  #dmcHeader .hstats { margin-left: auto; font-size: 18px; font-weight: bold; font-variant-numeric: tabular-nums; color: #ffd86b; white-space: nowrap; }
  #dmcBody { flex: 1 1 auto; display: flex; min-height: 0; }
  #dmcLeft { flex: 1 1 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; min-height: 0; }
  #dmcCoins { font-size: 40px; font-weight: 900; color: #fff; text-shadow: 0 0 18px rgba(120,140,255,0.6); font-variant-numeric: tabular-nums; text-align: center; }
  #dmcCoins span { font-size: 16px; color: #aab; font-weight: bold; }
  #dmcCps { font-size: 16px; color: #9aa0d8; font-weight: bold; }
  #dmcPick { font-size: 14px; color: #cfd2ff; }
  #dmcMoonWrap { position: relative; width: min(44vh, 64vw, 340px); aspect-ratio: 1 / 1; margin: 4px 0; }
  #dmcMoon { position: absolute; inset: 0; border-radius: 50%; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
    background: radial-gradient(circle at 36% 32%, #f4f4ee 0%, #c9c9c0 38%, #9a9a92 66%, #6f6f68 100%);
    box-shadow: inset -18px -16px 40px rgba(0,0,0,0.55), 0 0 50px rgba(180,190,255,0.35); }
  #dmcMoon:active { transform: scale(0.96); }
  .dmc-crater { position: absolute; border-radius: 50%; background: radial-gradient(circle at 40% 35%, rgba(120,120,112,0.75), rgba(90,90,84,0.55)); box-shadow: inset 2px 3px 6px rgba(0,0,0,0.5); }
  #dmcCracks { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
  #dmcCracks path { stroke: #14141c; stroke-width: 1.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  #dmcMoonWrap.shake { animation: dmcShake 0.12s; }
  @keyframes dmcShake { 0%{transform:translate(0,0)} 25%{transform:translate(-3px,2px)} 50%{transform:translate(2px,-2px)} 75%{transform:translate(-2px,-1px)} 100%{transform:translate(0,0)} }
  .dmc-float { position: absolute; pointer-events: none; color: #fff; font-weight: 900; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,0.7); animation: dmcFloat 0.9s ease-out forwards; transform: translate(-50%,-50%); }
  @keyframes dmcFloat { 0%{opacity:1} 100%{opacity:0; transform: translate(-50%,-50%) translateY(-70px) scale(1.3)} }
  #dmcProgWrap { width: min(86%, 320px); }
  #dmcProgBar { height: 14px; border-radius: 8px; background: rgba(255,255,255,0.12); overflow: hidden; }
  #dmcProgFill { height: 100%; width: 0%; background: linear-gradient(90deg, #6f7bff, #b66bff); transition: width 0.2s; }
  #dmcProgTxt { font-size: 12px; color: #9aa0d8; text-align: center; margin-top: 4px; font-weight: bold; font-variant-numeric: tabular-nums; }
  #dmcShop { flex: 1 1 50%; max-width: 460px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.25); border-left: 1px solid rgba(255,255,255,0.08); }
  .dmc-card { display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: inherit; width: 100%; }
  .dmc-card:hover { background: rgba(255,255,255,0.1); }
  .dmc-card.afford { border-color: rgba(140,200,120,0.65); box-shadow: 0 0 0 1px rgba(140,200,120,0.35); }
  .dmc-card.locked { opacity: 0.45; cursor: default; }
  .dmc-ic { font-size: 24px; width: 32px; text-align: center; flex: 0 0 auto; }
  .dmc-info { flex: 1 1 auto; min-width: 0; }
  .dmc-name { font-weight: bold; font-size: 15px; }
  .dmc-sub { font-size: 12px; color: #aab; }
  .dmc-right { text-align: right; flex: 0 0 auto; }
  .dmc-cost { font-weight: bold; font-size: 14px; color: #ffd86b; font-variant-numeric: tabular-nums; }
  .dmc-own { font-size: 12px; color: #9aa0d8; }
  .dmc-head { color: #cfd2ff; font-weight: bold; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; margin: 8px 2px 0; opacity: 0.7; }
  .dmc-reset { margin-top: 12px; background: none; border: 1px solid rgba(255,120,120,0.4); color: #ff9a9a; padding: 8px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
  .dmc-reset:hover { background: rgba(255,120,120,0.12); }
  #dmcWin .big2 { font-size: 20px; color: #ffd86b; font-weight: bold; font-variant-numeric: tabular-nums; }
  #dmcLock h2 { color: #ff6b6b; }
  #dmcLock .big2 { font-size: 40px; color: #fff; font-weight: 900; font-variant-numeric: tabular-nums; }
  @media (max-width: 760px) {
    #dmcBody { flex-direction: column; }
    #dmcShop { max-width: none; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); flex: 1 1 auto; }
    #dmcLeft { flex: 0 0 auto; padding: 10px; }
    #dmcCoins { font-size: 30px; }
    #dmcMoonWrap { width: min(40vh, 70vw, 260px); }
  }
  /* ----- Build a Potato Farm Empire ----- */
  #pfScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: linear-gradient(180deg, #9ad7f0 0%, #bde9c4 30%, #7a5331 31%, #553a22 100%); }
  #pfHeader { height: 64px; background: var(--header-bg); display: flex; align-items: center; padding: 0 20px; gap: 16px; color: var(--header-fg); flex: 0 0 auto; }
  #pfHeader .hmenu { background: var(--btn-red); color: #fff; border: none; padding: 9px 18px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  #pfHeader .hmenu:hover { background: var(--btn-red-h); }
  #pfHeader .htitle { color: #ffe08a; font-size: 20px; font-weight: bold; letter-spacing: 0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #pfHeader .hstats { margin-left: auto; font-size: 18px; font-weight: bold; font-variant-numeric: tabular-nums; color: #ffe08a; white-space: nowrap; }
  #pfBody { flex: 1 1 auto; display: flex; min-height: 0; }
  #pfLeft { flex: 1 1 55%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; min-height: 0; overflow-y: auto; }
  #pfStats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
  .pf-stat { background: rgba(0,0,0,0.30); border-radius: 12px; padding: 7px 14px; text-align: center; color: #fff; min-width: 96px; }
  .pf-stat b { display: block; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
  .pf-stat span { font-size: 11px; color: #ffd9a0; }
  #pfFarm { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; width: min(94%, 520px); background: #3e2a18; border: 4px solid #2c1d10; border-radius: 12px; padding: 6px; }
  .pf-tile { aspect-ratio: 1 / 1; border-radius: 6px; background: #6b4a2b; display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; user-select: none; box-shadow: inset 0 2px 4px rgba(0,0,0,0.35); transition: background 0.15s; }
  .pf-tile.sprout { background: #5d7a35; }
  .pf-tile.ripe { background: #87a83f; }
  #pfFarmBtns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
  .pf-act { border: none; border-radius: 12px; padding: 12px 20px; font-size: 16px; font-weight: 800; cursor: pointer; font-family: inherit; color: #2b1d0f; }
  .pf-harvest { background: linear-gradient(180deg, #ffd86b, #e0a93a); }
  .pf-harvest:active { transform: scale(0.96); }
  .pf-expand { background: linear-gradient(180deg, #9fd17a, #5e9c3e); color: #13280a; }
  .pf-expand:active { transform: scale(0.96); }
  #pfStand { width: min(94%, 520px); background: rgba(0,0,0,0.32); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 14px; color: #fff; }
  #pfStand .pf-standicon { font-size: 34px; flex: 0 0 auto; }
  #pfStand .pf-standinfo { flex: 1 1 auto; min-width: 0; }
  #pfStand .pf-standinfo .t { font-weight: 800; font-size: 15px; }
  #pfStand .pf-standinfo .s { font-size: 12px; color: #ffd9a0; font-variant-numeric: tabular-nums; }
  .pf-sell { background: linear-gradient(180deg, #ff9a5b, #e8632f); color: #fff; border: none; border-radius: 12px; padding: 15px 26px; font-size: 18px; font-weight: 900; cursor: pointer; font-family: inherit; flex: 0 0 auto; }
  .pf-sell:active { transform: scale(0.95); }
  .pf-float { position: fixed; pointer-events: none; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.75); animation: pfFloat 0.8s ease-out forwards; transform: translate(-50%,-50%); z-index: 60; }
  @keyframes pfFloat { 0% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-50%) translateY(-60px) scale(1.25); } }
  #pfShop { flex: 1 1 45%; max-width: 460px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.30); border-left: 1px solid rgba(255,255,255,0.1); }
  .pf-head { color: #ffe08a; font-weight: bold; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; margin: 4px 2px; opacity: 0.85; }
  .pf-card { display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: inherit; width: 100%; }
  .pf-card:hover { background: rgba(255,255,255,0.12); }
  .pf-card.afford { border-color: rgba(150,210,120,0.7); box-shadow: 0 0 0 1px rgba(150,210,120,0.4); }
  .pf-ic { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; }
  .pf-cinfo { flex: 1 1 auto; min-width: 0; }
  .pf-cname { font-weight: bold; font-size: 14px; }
  .pf-csub { font-size: 11px; color: #ffd9a0; }
  .pf-cright { text-align: right; flex: 0 0 auto; }
  .pf-ccost { font-weight: bold; font-size: 13px; color: #ffd86b; font-variant-numeric: tabular-nums; }
  .pf-cown { font-size: 11px; color: #cdd; }
  .pf-note { font-size: 12px; color: #ffe0a8; background: rgba(0,0,0,0.28); border: 1px dashed rgba(255,216,107,0.55); border-radius: 10px; padding: 9px 11px; text-align: center; line-height: 1.4; }
  .pf-reset { margin-top: 10px; background: none; border: 1px solid rgba(255,120,120,0.4); color: #ff9a9a; padding: 8px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
  .pf-reset:hover { background: rgba(255,120,120,0.12); }
  @media (max-width: 760px) {
    #pfBody { flex-direction: column; }
    #pfShop { max-width: none; border-left: none; border-top: 1px solid rgba(255,255,255,0.1); flex: 1 1 auto; }
    #pfLeft { flex: 0 0 auto; }
  }
  /* ----- Brain Timer ----- */
  #btScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; color: #fff; background: radial-gradient(circle at 50% 28%, #2c2456 0%, #15132c 70%); }
  #btHeader { height: 64px; background: var(--header-bg); display: flex; align-items: center; padding: 0 20px; gap: 16px; color: var(--header-fg); flex: 0 0 auto; }
  #btHeader .hmenu { background: var(--btn-red); color: #fff; border: none; padding: 9px 18px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  #btHeader .hmenu:hover { background: var(--btn-red-h); }
  #btHeader .htitle { color: #ffe08a; font-size: 21px; font-weight: bold; letter-spacing: 0.4px; }
  #btBody { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 0; }
  .bt-card { width: min(560px, 92vw); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
  .bt-card h2 { font-size: 26px; margin: 0; color: #ffe08a; }
  .bt-how { font-size: 17px; line-height: 1.6; color: #d8d6ee; max-width: 520px; margin: 0; }
  .bt-how b { color: #fff; }
  .bt-target { font-size: 15px; color: #9b9ac0; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
  .bt-btn { border: none; border-radius: 14px; padding: 16px 34px; font-size: 20px; font-weight: 800; cursor: pointer; font-family: inherit; }
  .bt-start { background: linear-gradient(180deg, #7be0a0, #3fa86a); color: #06240f; }
  .bt-start:active { transform: scale(0.97); }
  .bt-again { background: linear-gradient(180deg, #9ab0ff, #5a6fd8); color: #0a1030; }
  .bt-again:active { transform: scale(0.97); }
  .bt-stop { background: radial-gradient(circle at 50% 35%, #ff6f6f, #d11d1d); color: #fff; width: min(260px, 68vw); height: min(260px, 68vw); border-radius: 50%; font-size: 46px; font-weight: 900; letter-spacing: 2px; cursor: pointer; border: 6px solid #ff9a9a; box-shadow: 0 12px 34px rgba(209,29,29,0.5), inset 0 -6px 20px rgba(0,0,0,0.32); }
  .bt-stop:active { transform: scale(0.96); }
  .bt-hidden-note { font-size: 16px; color: #c9c8e6; max-width: 460px; line-height: 1.5; }
  .bt-reached { font-size: 16px; color: #bcbce0; }
  .bt-result-time { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; color: #ffe08a; line-height: 1.1; }
  .bt-result-time .u { font-size: 22px; color: #caa97a; }
  .bt-off { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .bt-off.good { color: #7be0a0; }
  .bt-off.mid { color: #ffd86b; }
  .bt-off.bad { color: #ff8a8a; }
  .bt-best { font-size: 14px; color: #9b9ac0; font-variant-numeric: tabular-nums; }
  /* ----- Personal high score badge (top bar of every game) ----- */
  .hs-badge { font-size: 12px; font-weight: bold; color: #ffe08a; background: rgba(0,0,0,0.28); padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: 0.3px; font-variant-numeric: tabular-nums; max-width: 48%; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
  @media (max-width: 560px) { .hs-badge { font-size: 10px; padding: 3px 7px; } }
  /* ----- Background music "now playing" toast ----- */
  #nowPlaying { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); background: #000; color: #fff; font-size: 13px; line-height: 1.3; padding: 6px 14px; border-radius: 6px; z-index: 99999; opacity: 0; pointer-events: none; transition: opacity 0.45s ease; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.3px; }
  #nowPlaying.show { opacity: 1; }
  .snd-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
  .snd-label { flex: 0 0 auto; min-width: 120px; font-size: 16px; }
  .snd-range { flex: 1 1 auto; height: 6px; cursor: pointer; accent-color: var(--btn-red); }
  .snd-pct { flex: 0 0 auto; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
  /* #brandLogo.egg-* (id) outranks the base 'h1.title .logo' rule so the transforms actually apply */
  #brandLogo.egg-big { transform: translateY(-50%) scale(5); transform-origin: left center; transition: transform .55s cubic-bezier(.2,.8,.2,1); }
  #brandLogo.egg-small { transform: translateY(-50%) scale(0.32); transition: transform .45s cubic-bezier(.2,.8,.2,1); }
  #brandLogo.egg-ghost { opacity: 0; transition: opacity 1.3s ease; }
  #brandLogo.egg-roll { animation: eggSpin 1.05s linear infinite; }
  @keyframes eggSpin { from { transform: translateY(-50%) rotate(0deg); } to { transform: translateY(-50%) rotate(360deg); } }
  #eggPage { position: fixed; inset: 0; z-index: 12000; display: none; overflow-y: auto; background: var(--ij-bg, #EFE4B0); padding: 30px 20px 50px; }
  #eggPage.show { display: block; }
  #eggPage .egg-wrap { max-width: 720px; margin: 0 auto; }
  #eggPage .egg-back { background: var(--btn-red); color: #fff; border: none; padding: 10px 20px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  #eggPage .egg-back:hover { background: var(--btn-red-h); }
  #eggPage h1 { color: #36c5d6; font-size: 34px; margin: 18px 0 6px; }
  #eggPage .egg-intro { font-size: 15px; line-height: 1.5; margin: 0 0 20px; color: var(--muted, #444); }
  #eggPage .egg-item { background: rgba(0,0,0,0.05); border-radius: 12px; padding: 14px 16px; margin: 0 0 12px; }
  #eggPage .egg-word { display: inline-block; font-family: monospace; font-weight: bold; font-size: 16px; background: #36c5d6; color: #08343a; padding: 3px 10px; border-radius: 6px; margin-bottom: 6px; }
  #eggPage .egg-desc { font-size: 15px; line-height: 1.45; }
  .order-wrap { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
  .order-wrap label { font-size: 15px; font-weight: bold; }
  #orderSelect { font-family: inherit; font-size: 15px; font-weight: bold; padding: 7px 12px; border-radius: 8px; border: 2px solid rgba(0,0,0,0.25); background: #fff; cursor: pointer; }
  #zcdTouch {
    position: absolute; left: 0; right: 0; bottom: 16px;
    display: none; justify-content: space-between; align-items: flex-end;
    padding: 0 20px; pointer-events: none;
  }
  #zcdTouch.show { display: flex; }
  .zcd-group { display: flex; pointer-events: auto; }
  .zcd-left { flex-direction: column; gap: 14px; }      /* up sits above down */
  .zcd-tbtn {
    width: 76px; height: 76px; border-radius: 50%;
    background: rgba(35,35,35,0.45); color: #fff; border: 2px solid rgba(255,255,255,0.55);
    font-size: 36px; font-weight: bold; cursor: pointer; touch-action: none; user-select: none;
    display: flex; align-items: center; justify-content: center;
  }
  .zcd-tbtn:active { background: rgba(35,35,35,0.72); transform: scale(0.95); }
  .zcd-fire {
    width: 96px; height: 96px; font-size: 20px;
    background: rgba(214,58,58,0.5); border-color: rgba(255,170,170,0.75);
  }
  .zcd-fire:active { background: rgba(214,58,58,0.78); }

  /* ===================== ROTATE / LANDSCAPE PROMPTS ===================== */
  #rotateOverlay {
    position: fixed; inset: 0; z-index: 50; display: none;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 24px; text-align: center; padding: 30px;
    background: rgba(10,12,18,0.97); color: #fff;
  }
  #rotateOverlay.show { display: flex; }
  #rotateOverlay .ro-icon { font-size: 70px; line-height: 1; animation: roSpin 2.6s ease-in-out infinite; }
  #rotateOverlay p { font-size: 22px; font-weight: bold; max-width: 440px; line-height: 1.45; margin: 0; }
  @keyframes roSpin { 0%, 38% { transform: rotate(0deg); } 58%, 100% { transform: rotate(-90deg); } }

  #landscapeToast {
    position: fixed; inset: 0; z-index: 60; display: none;
    align-items: center; justify-content: center; background: rgba(0,0,0,0.5); padding: 24px;
  }
  #landscapeToast.show { display: flex; }
  #landscapeToast .lt-card {
    background: var(--panel-bg); color: var(--panel-fg); border-radius: 16px;
    padding: 26px 28px; max-width: 380px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  }
  #landscapeToast .lt-card p { font-size: 18px; font-weight: 600; margin: 0 0 18px; line-height: 1.45; }
  #landscapeToast .lt-ok {
    background: var(--btn-green); color: #fff; border: none; border-radius: 10px;
    padding: 10px 28px; font-size: 16px; font-weight: bold; cursor: pointer;
  }
  #landscapeToast .lt-ok:hover { background: var(--btn-green-h); }

  /* ===================== ADMIN (hidden) ===================== */
  #adminDot {
    position: fixed; top: 0; left: 0; width: 46px; height: 46px; z-index: 45;
    background: transparent; border: none; padding: 0; margin: 0; cursor: pointer;
  }
  #adminPinScreen {
    display: none; position: fixed; inset: 0; z-index: 70;
    background: rgba(0,0,0,0.6); align-items: center; justify-content: center; padding: 20px;
  }
  #adminPinScreen.open { display: flex; }
  .admin-card {
    background: var(--panel-bg); color: var(--panel-fg);
    width: min(94vw, 420px); border-radius: 16px; padding: 26px; text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  }
  .admin-card h2 { font-size: 23px; margin: 0 0 18px; }
  #adminPinInput {
    width: 100%; box-sizing: border-box; padding: 12px; font-size: 18px; text-align: center;
    letter-spacing: 6px; border-radius: 10px; border: 2px solid var(--search-border);
    background: var(--panel-bg); color: var(--panel-fg);
  }
  .admin-back {
    margin-top: 16px; background: var(--btn-red); color: #fff; border: none;
    border-radius: 10px; padding: 10px 26px; font-size: 16px; font-weight: bold; cursor: pointer;
  }
  .admin-back:hover { background: var(--btn-red-h); }
  #adminScreen { display: none; flex-direction: column; height: 100vh; overflow: hidden; background: var(--page-bg); color: var(--page-fg); }
  #adminScreen .ad-header {
    height: 64px; background: var(--header-bg); color: var(--header-fg); display: flex;
    align-items: center; padding: 0 20px; gap: 20px; flex: 0 0 auto;
  }
  #adminScreen .ad-header .hmenu {
    background: var(--btn-red); color: #fff; border: none; padding: 9px 18px;
    font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer;
  }
  #adminScreen .ad-header .hmenu:hover { background: var(--btn-red-h); }
  #adminScreen .ad-header .htitle { font-size: 24px; font-weight: bold; }
  .admin-tabs { display: flex; gap: 4px; padding: 8px 14px 0; background: var(--header-bg); flex: 0 0 auto; overflow-x: auto; }
  .admin-tab {
    background: transparent; color: var(--header-fg); border: none; border-bottom: 3px solid transparent;
    padding: 10px 14px; font-size: 15px; font-weight: bold; cursor: pointer; white-space: nowrap; opacity: 0.65;
  }
  .admin-tab:hover { opacity: 1; }
  .admin-tab.active { opacity: 1; border-bottom-color: #36c5d6; }
  #adminBody { flex: 1 1 auto; overflow-y: auto; padding: 26px; }
  #adminBody h3 { font-size: 18px; margin: 26px 0 12px; }
  #adminBody h3:first-child { margin-top: 0; }
  .stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
  .stat { background: var(--panel-sub); border-radius: 12px; padding: 16px 12px; text-align: center; }
  .stat-num { font-size: 30px; font-weight: bold; line-height: 1.1; }
  .stat-lbl { font-size: 13px; opacity: 0.78; margin-top: 5px; }
  .lookup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; }
  .lookup input, .lookup select {
    padding: 8px 10px; font-size: 16px; border-radius: 8px;
    border: 2px solid var(--search-border); background: var(--panel-bg); color: var(--page-fg);
  }
  .lookup input { width: 84px; }
  .lookup-result { margin-top: 14px; font-size: 21px; font-weight: bold; }
  .stat-note { margin-top: 24px; font-size: 13px; opacity: 0.7; max-width: 640px; line-height: 1.55; }
  .ticker { font-size: 68px; font-weight: 800; letter-spacing: 1px; line-height: 1.05; font-variant-numeric: tabular-nums; }
  .ticker-sub { font-size: 15px; opacity: 0.82; margin-top: 8px; }

  /* ===================== SETTINGS ===================== */
  #settingsScreen, #languageScreen {
    display: none; position: fixed; inset: 0; z-index: 50;
    background: rgba(0,0,0,0.55); align-items: center; justify-content: center; padding: 20px;
  }
  #settingsScreen.open, #languageScreen.open { display: flex; }
  #settingsPanel {
    background: var(--panel-bg); color: var(--panel-fg);
    width: min(94vw, 460px); max-height: 90vh; overflow-y: auto;
    border-radius: 16px; padding: 26px; box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  }
  #settingsPanel h2 { font-size: 30px; margin-bottom: 6px; }
  #settingsPanel h3 { font-size: 18px; margin: 22px 0 10px; }
  .set-row { display: flex; flex-wrap: wrap; gap: 10px; }
  .set-opt {
    flex: 1 1 0; min-width: 90px; padding: 12px 8px; border-radius: 10px; cursor: pointer;
    border: 2px solid transparent; background: var(--panel-sub); color: var(--panel-fg);
    font-size: 15px; font-weight: bold; text-align: center;
  }
  .set-opt:hover { border-color: #888; }
  .set-opt.active { border-color: #2f9fd0; background: #2f9fd0; color: #fff; }
  .set-custom { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  .set-custom input {
    width: 92px; padding: 9px; font-size: 15px; border-radius: 8px;
    border: 2px solid var(--search-border); background: var(--panel-bg); color: var(--panel-fg);
  }
  .set-custom button {
    border: none; padding: 10px 16px; font-size: 15px; font-weight: bold;
    border-radius: 8px; cursor: pointer; color: #fff; background: #5e9c3a;
  }
  .set-custom button:hover { background: #4d8330; }
  .set-note { font-size: 13px; opacity: 0.8; margin-top: 8px; line-height: 1.4; }
  .pt-note { font-size: 13px; line-height: 1.45; color: var(--muted, #555); margin: 4px 0 10px; }
  .pt-row { display: flex; gap: 10px; flex-wrap: wrap; }
  .pt-btn { flex: 1 1 140px; background: #36c5d6; color: #08343a; border: none; padding: 11px 14px; font-size: 15px; font-weight: bold; border-radius: 8px; cursor: pointer; }
  .pt-btn:hover { filter: brightness(1.07); }
  .pt-status { min-height: 18px; font-size: 13px; font-weight: bold; margin-top: 8px; }
  .pt-status.ok { color: #2e9e4f; }
  .pt-status.err { color: #d23b3b; }
  .set-actions { display: flex; gap: 12px; margin-top: 24px; }
  .set-actions button {
    flex: 1; border: none; padding: 13px; font-size: 17px; font-weight: bold;
    border-radius: 8px; cursor: pointer; color: #fff;
  }
  .set-confirm { background: #3aa33a; }
  .set-confirm:hover { background: #2f8a2f; }
  .set-cancel { background: #d62b2b; }
  .set-cancel:hover { background: #b81f1f; }
  .gib-check { display: flex; align-items: center; gap: 9px; margin-top: 16px; font-weight: bold; cursor: pointer; }
  .gib-check input { width: 18px; height: 18px; cursor: pointer; }
