/* Circleback – a retro "office desktop" look: pinstriped windows, glossy gel buttons, a menu bar and a dock. */
:root {
  --font: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
  --g1: #d3e8ff; --g2: #7fbaf8; --g3: #3d8ff0; --g4: #9fd6ff; --gb: #2a5ea8; /* gel accent */
  --hl: #3875d7; --hl-soft: #cfe0fa; --hl-text: #fff;
  --ink: #111; --sub: #555; --muted: #8a8a8a; --line: #b9b9b9; --line-soft: #d8d8d8;
  --ok: #2f9e1f; --ok-soft: #dff5d6; --bad: #d4301f; --bad-soft: #fde1dd;
  --stripe: repeating-linear-gradient(#ffffff 0 2px, #f0f0f0 2px 4px);
  --metal: linear-gradient(#e9e9e9, #c3c3c3 60%, #b5b5b5);
}
:root[data-theme="graphite"] {
  --g1: #eef1f4; --g2: #b9c2cc; --g3: #7d8894; --g4: #cdd5dd; --gb: #5d6670;
  --hl: #6d7a88; --hl-soft: #dfe4ea;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.45 var(--font); color: var(--ink); overflow-x: hidden;
  background:
    radial-gradient(ellipse 70% 45% at 15% 105%, rgba(170, 220, 255, .75), transparent 70%),
    radial-gradient(ellipse 60% 40% at 95% -5%, rgba(120, 190, 255, .7), transparent 70%),
    radial-gradient(ellipse 120% 30% at 50% 62%, rgba(255, 255, 255, .18), transparent 70%),
    linear-gradient(165deg, #0f3f8c 0%, #2f78d6 42%, #1b56b0 70%, #0d3577 100%);
  background-attachment: fixed; }
:root[data-theme="graphite"] body { background:
    radial-gradient(ellipse 70% 45% at 15% 105%, rgba(220, 225, 232, .6), transparent 70%),
    radial-gradient(ellipse 120% 30% at 50% 62%, rgba(255, 255, 255, .15), transparent 70%),
    linear-gradient(165deg, #3b434c 0%, #6f7a86 45%, #4a535d 75%, #2c3238 100%); background-attachment: fixed; }
button { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 12px; letter-spacing: -.3px; }
h2 { font-size: 17px; margin: 0 0 8px; }
h3 { font-size: 13px; margin: 22px 0 8px; text-transform: none; color: #333; }
.sub { color: var(--sub); }
.center { text-align: center; }
.ex { font-style: italic; color: var(--sub); }
.ex b { color: var(--ink); font-style: normal; }

/* ---------- gel buttons ---------- */
.btn { position: relative; min-height: 22px; padding: 3px 16px; border-radius: 999px; border: 1px solid #8e8e8e; cursor: pointer;
  background: linear-gradient(#ffffff 0%, #f3f3f3 45%, #dedede 52%, #ececec 80%, #fbfbfb 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 #fff; color: #000; white-space: nowrap; }
.btn:active { background: linear-gradient(#c9c9c9, #e2e2e2); }
.btn:disabled { color: #a0a0a0; cursor: default; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); border-color: #bdbdbd; }
.btn.default { border-color: var(--gb); background: linear-gradient(var(--g1) 0%, var(--g2) 46%, var(--g3) 52%, var(--g3) 70%, var(--g4) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .8); }
/* The default button gently pulses. Animating the opacity of an overlay is cheap (GPU-composited), unlike animating filters. */
.btn.default::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(255, 255, 255, .45); opacity: 0;
  pointer-events: none; animation: throb 1.8s ease-in-out infinite; will-change: opacity; }
.btn.default:disabled { border-color: #bdbdbd; background: linear-gradient(#fff, #e9e9e9); }
.btn.default:disabled::after, .btn.pending::after { animation: none; opacity: 0; }
@keyframes throb { 50% { opacity: 1; } }
.btn.pending { cursor: progress; color: transparent !important; }
.btn.pending::before { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .25); border-top-color: #222; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Visible keyboard focus, styled like the classic blue focus ring. */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(61, 143, 240, .6) !important; }
.titlebar, .ptitle, .menubar, .dock, .lights, .ficon, .col-row, .tile, .choice { -webkit-user-select: none; user-select: none; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btns.end { justify-content: flex-end; margin-top: 14px; }

/* ---------- menu bar ---------- */
.menubar { position: fixed; top: 0; left: 0; right: 0; height: 24px; z-index: 50; display: flex; align-items: center; padding: 0 8px;
  background: linear-gradient(rgba(255, 255, 255, .97), rgba(232, 232, 232, .97)); border-bottom: 1px solid #8f8f8f; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.mb-wrap { position: relative; }
.mb-item { height: 24px; padding: 0 10px; border: 0; background: none; cursor: default; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.mb-item:hover, .mb-wrap:has(> .pop) > .mb-item { background: var(--hl); color: #fff; }
.mb-item.bold { font-weight: bold; }
.mb-item.dim { opacity: .55; }
.mb-logo .biz { margin-top: -2px; }
.mb-right { margin-left: auto; display: flex; align-items: center; }
/* Shown in the menu bar while the server is taking a while to answer. */
.mb-spin { width: 14px; height: 14px; margin: 0 8px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .15); border-top-color: #333;
  animation: spin .7s linear infinite; visibility: hidden; }
body.slow .mb-spin { visibility: visible; }
.clock { padding-right: 4px; }
.clock:hover { background: none; color: inherit; }

/* ---------- popovers & menus ---------- */
.pop { position: absolute; z-index: 60; top: 100%; left: 0; min-width: 220px; padding: 10px 12px; background: rgba(250, 250, 250, .97);
  border: 1px solid #a5a5a5; border-radius: 0 0 6px 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); font-size: 13px; }
.pop h4 { margin: 0 0 6px; font-size: 14px; }
.pop p { margin: 0 0 8px; color: var(--sub); }
.pop.menu { padding: 4px 0; min-width: 230px; }
.stat-pop { left: auto; right: 0; width: 270px; }
.menu-item { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; padding: 3px 18px; text-align: left; cursor: default; font-size: 14px; }
.menu-item:hover { background: var(--hl); color: #fff; }
.menu-item kbd { font: inherit; color: var(--muted); }
.menu-item:hover kbd { color: #fff; }
.pop hr { border: 0; border-top: 1px solid #d6d6d6; margin: 4px 0; }
.cups { display: flex; gap: 4px; font-size: 22px; margin-bottom: 6px; }
.cups .empty { filter: grayscale(1); opacity: .3; }
.cups.big { font-size: 36px; justify-content: center; margin-top: 14px; }
.week { display: flex; justify-content: space-between; gap: 4px; margin: 6px 0 10px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.wd span { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(#f4f4f4, #d6d6d6); border: 1px solid #aaa; display: grid; place-items: center; color: #fff; font-size: 12px; }
.wd.on span { background: linear-gradient(#ffd27a, #ff9600 55%, #ffb347); border-color: #c86f00; }
.wd.today small { color: #c86f00; font-weight: bold; }

/* ---------- notifications ---------- */
#toasts { position: fixed; top: 34px; right: 14px; z-index: 100; display: grid; gap: 8px; width: min(320px, calc(100% - 28px)); }
.toast { background: rgba(20, 20, 20, .82); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  animation: fadein .3s ease-out; transition: opacity .4s; }
.toast.out { opacity: 0; }
@keyframes fadein { from { opacity: 0; transform: translateX(16px); } }

/* ---------- desktop & windows ---------- */
/* The desk sits under the menu bar; page windows and palettes float on it. Lessons use the activity layer above a shade. */
.desk, .act-layer { position: fixed; top: 24px; left: 0; right: 0; bottom: 0; overflow: hidden; }
.act-layer { z-index: 46; pointer-events: none; }
.act-layer > * { pointer-events: auto; }
.shade { position: fixed; inset: 24px 0 0 0; z-index: 45; background: rgba(10, 30, 70, .35); animation: fadein .2s; }
.window { position: absolute; width: min(860px, calc(100vw - 24px)); height: min(680px, calc(100vh - 140px)); display: flex; flex-direction: column;
  background: var(--stripe); border-radius: 8px 8px 5px 5px; box-shadow: 0 16px 48px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .35); overflow: hidden; contain: layout paint;
  animation: open .25s ease-out; }
.desk .window:not(.front) { box-shadow: 0 8px 24px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .3); }
.desk .window:not(.front) .titlebar { opacity: .75; }
.desk .window:not(.front) .lights .light:not(.off) { filter: grayscale(1) brightness(1.15); }
.window.activity { width: min(720px, calc(100vw - 16px)); height: min(780px, calc(100vh - 44px)); }
.window.minimised { display: none; }
.window.zoomed { left: 8px !important; top: 8px !important; width: calc(100vw - 16px); height: calc(100vh - 120px); }
/* Dragging must not touch `animation`: switching it off and back on would replay the window-open animation on drop. */
.window.dragging, .palette.dragging { opacity: .92; user-select: none; }
@keyframes open { from { transform: scale(.96); opacity: 0; } }
.window.steady { animation: none; }
.titlebar { position: relative; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: default; touch-action: none;
  background: repeating-linear-gradient(#fbfbfb 0 1px, #e6e6e6 1px 2px); border-bottom: 1px solid #9c9c9c; }
.light.min, .light.max { cursor: pointer; }
.window.metal { background: var(--metal); }
.window.metal .titlebar { background: transparent; border-bottom-color: transparent; }
.window.metal::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, .025) 1px 3px); }
.lights { position: absolute; left: 9px; top: 5px; display: flex; gap: 7px; z-index: 2; }
.light { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .4); padding: 0; cursor: default; display: inline-block;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .9), inset 0 -2px 3px rgba(0, 0, 0, .15); }
.light.close { background: radial-gradient(circle at 50% 30%, #ffc3b8, #f2533f 55%, #b8261a); cursor: pointer; }
.light.min { background: radial-gradient(circle at 50% 30%, #ffefb0, #f6b929 55%, #b77d06); }
.light.max { background: radial-gradient(circle at 50% 30%, #d7f7b2, #64c53b 55%, #2d7d17); }
.light.off { background: radial-gradient(circle at 50% 30%, #fafafa, #cfcfcf 60%, #a9a9a9) !important; cursor: default; }
.light.close:hover::after { content: "×"; display: block; font-size: 12px; line-height: 10px; text-align: center; color: #5a0d06; }
:root[data-theme="graphite"] .light { background: radial-gradient(circle at 50% 30%, #f0f3f6, #9aa4ae 55%, #5d6670) !important; }
.wtitle { font-size: 13px; color: #222; text-shadow: 0 1px 0 rgba(255, 255, 255, .8); display: flex; gap: 5px; align-items: center; max-width: 70%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticon { font-size: 13px; }
.win-body { flex: 1; position: relative; overflow: auto; overscroll-behavior: contain; }
.statusbar { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; font-size: 12px; color: #333;
  background: linear-gradient(#e7e7e7, #cfcfcf); border-top: 1px solid #a2a2a2; }
.window.metal .statusbar { background: transparent; border-top-color: rgba(0, 0, 0, .2); }
.activity .statusbar { padding: 12px 16px; }
.activity .statusbar .btn { min-width: 100px; padding: 4px 18px; font-size: 13px; }
.pad { padding: 18px 22px 28px; }
.group { border: 1px solid #c3c3c3; border-radius: 6px; background: rgba(0, 0, 0, .035); padding: 12px 14px; }

/* ---------- palettes ---------- */
.palette { position: absolute; width: 250px; contain: layout paint; background: rgba(250, 250, 250, .96); border-radius: 6px 6px 4px 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 0 1px rgba(0, 0, 0, .3); overflow: hidden; }
.ptitle { position: relative; height: 17px; cursor: default; touch-action: none; font-size: 11px; text-align: center; line-height: 16px; color: #333;
  background: repeating-linear-gradient(#fafafa 0 1px, #e2e2e2 1px 2px); border-bottom: 1px solid #9c9c9c; }
.light.tiny { position: absolute; left: 6px; top: 3px; width: 10px; height: 10px; cursor: pointer; background: radial-gradient(circle at 50% 30%, #ffc3b8, #f2533f 55%, #b8261a); }
.pbody { padding: 10px 12px; font-size: 12px; }
.pbody p { margin: 4px 0 0; color: var(--sub); }
.league-mini { display: flex; gap: 10px; align-items: center; }
.league-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; font-size: 20px; flex-shrink: 0;
  background: linear-gradient(#fff, var(--lc-35, #eef2f6)); border: 2px solid var(--lc); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .25); }
.q-mini { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.q-mini > span { font-size: 18px; } .q-mini > div { flex: 1; }
.wotd { font-size: 15px; }
.biz-tip { display: flex; gap: 10px; align-items: center; }
.biz-tip p { margin: 0; }

/* ---------- aqua progress bar ---------- */
.aqua-bar { position: relative; height: 14px; border-radius: 7px; border: 1px solid #7b8796; overflow: hidden; margin-top: 3px;
  background: linear-gradient(#cfcfcf, #f6f6f6 60%, #e8e8e8); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.aqua-bar > i { display: block; height: 100%; border-radius: 7px; transition: width .4s; min-width: 0;
  background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .1) 50%, rgba(0, 0, 0, .06) 51%, rgba(255, 255, 255, .35)),
    repeating-linear-gradient(-45deg, var(--g3) 0 7px, var(--g2) 7px 14px); }
/* Only the lesson progress bar animates; the stripes slide with a GPU transform instead of repainting the background. */
.lesson-top .aqua-bar > i { position: relative; overflow: hidden; }
.lesson-top .aqua-bar > i::before { content: ""; position: absolute; top: 0; bottom: 0; left: -20px; right: 0; will-change: transform;
  background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .1) 50%, rgba(0, 0, 0, .06) 51%, rgba(255, 255, 255, .35)),
    repeating-linear-gradient(-45deg, var(--g3) 0 7px, var(--g2) 7px 14px);
  background-size: 100% 100%, auto; animation: barber .9s linear infinite; }
@keyframes barber { to { transform: translateX(19.8px); } }
.aqua-bar > em { position: absolute; inset: 0; text-align: center; font-style: normal; font-size: 10px; line-height: 12px; color: #222; text-shadow: 0 0 3px #fff; }

/* ---------- dock ---------- */
.dock { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; z-index: 40; pointer-events: none; }
.dock-shelf { pointer-events: auto; display: flex; align-items: flex-end; gap: 4px; padding: 6px 12px 10px; border-radius: 10px 10px 0 0;
  background: linear-gradient(rgba(235, 242, 252, .82), rgba(205, 220, 240, .72)); border: 1px solid rgba(255, 255, 255, .7); border-bottom: 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .2); }
.dock-item { position: relative; border: 0; background: none; padding: 0 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.dock-icon { display: block; font-size: 40px; line-height: 1.1; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); transition: transform .15s ease-out; transform-origin: bottom center; }
/* Magnify only with a real mouse, so taps on touch screens don't leave icons stuck enlarged. */
@media (hover: hover) {
  .dock-item:hover .dock-icon { transform: scale(1.4) translateY(-4px); }
  .dock-item:hover + .dock-item .dock-icon, .dock-item:has(+ .dock-item:hover) .dock-icon { transform: scale(1.15); }
}
.dock-label { position: absolute; bottom: calc(100% + 16px); padding: 2px 10px; border-radius: 10px; background: rgba(30, 30, 30, .75); color: #fff; font-size: 12px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .1s; }
.dock-item:hover .dock-label { opacity: 1; }
/* A glowing dot under every page that has a window open (including minimised ones). */
.dock-item.open::after { content: ""; position: absolute; bottom: -7px; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, #9fd0ff 45%, #2a6fd0); box-shadow: 0 0 4px rgba(120, 190, 255, .9); }
.dock-sep { width: 1px; align-self: stretch; margin: 4px 8px 0; background: rgba(0, 0, 0, .35); box-shadow: 1px 0 0 rgba(255, 255, 255, .5); }

/* ---------- sheets / alerts ---------- */
.sheet-back { position: absolute; inset: 24px 0 0 0; z-index: 30; background: rgba(0, 0, 0, .08); display: flex; justify-content: center; align-items: flex-start; }
.sheet-back.clear { background: transparent; }
.sheet { width: min(500px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; padding: 18px 20px 16px; background: rgba(246, 246, 246, .98);
  border: 1px solid #8f8f8f; border-top: 0; border-radius: 0 0 8px 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .45); animation: sheet .25s ease-out; }
/* Wide sheets (the guidebook) scroll only their inner list, so there's one scrollbar, not two. */
.sheet.wide { width: min(640px, calc(100% - 24px)); display: flex; flex-direction: column; overflow: hidden; }
@keyframes sheet { from { transform: translateY(-100%); } }
.alert { display: flex; gap: 16px; align-items: flex-start; }
.alert-icon { position: relative; flex-shrink: 0; }
.alert-badge { position: absolute; right: -6px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: bold; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.alert.ok .alert-badge { background: radial-gradient(circle at 50% 30%, #a9ec7f, #2f9e1f 70%); }
.alert.bad .alert-badge { background: radial-gradient(circle at 50% 30%, #ff9f92, #d4301f 70%); }
.alert-text { min-width: 0; }
.alert-text h2 { margin: 2px 0 6px; }
.alert.ok h2 { color: var(--ok); } .alert.bad h2 { color: var(--bad); }
.alert-text p { margin: 0 0 6px; }
.quote { font-style: italic; color: #333; }
.about { text-align: center; }
.about .biz { margin: 0 auto 6px; }
.cert { text-align: center; padding: 18px; border: 6px double #c9a227; border-radius: 4px; background: #fffdf3; }
.cert small { text-transform: uppercase; letter-spacing: 2px; color: #a8871c; }
.cert h2 { font-size: 22px; margin: 6px 0 10px; font-family: Georgia, serif; }
.sig { display: inline-flex; gap: 10px; align-items: center; margin-top: 8px; text-align: left; }
.sig i { font-family: "Brush Script MT", cursive; font-size: 22px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* ---------- characters ---------- */
.biz { display: block; overflow: visible; flex-shrink: 0; }
.biz .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.jump { animation: jump .9s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes jump { from { transform: scale(.4) translateY(40px); opacity: 0; } }
.avatar { display: inline-block; border-radius: 22%; overflow: hidden; flex-shrink: 0; vertical-align: middle; position: relative;
  background: linear-gradient(#fff, var(--ac-40, #e6edf5)); border: 1px solid rgba(0, 0, 0, .35); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.avatar::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%; background: linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, 0)); pointer-events: none; }
.avatar svg { display: block; }
.biz-av { display: inline-grid; place-items: center; }
.you-av { display: grid; place-items: center; width: 44px; height: 44px; font-size: 24px; --ac: #3d8ff0; }

/* glossy chat bubble */
.ichat { position: relative; padding: 8px 14px; border-radius: 16px; font-size: 15px; line-height: 1.4; border: 1px solid rgba(0, 0, 0, .25);
  background: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, 0) 51%), var(--ac-30, #e9f0f8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2); }
.ichat.big { font-size: 15px; max-width: 460px; margin-top: 8px; }

/* ---------- Learn: column + icon view ---------- */
.page-learn .win-body { overflow: hidden; }
.columns { display: flex; height: 100%; }
.col-main .icon-grid { overflow: auto; }
.col-list { width: 210px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 4px 0; overflow: auto; }
.col-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 5px 10px; text-align: left; cursor: pointer; font-size: 13px; }
.col-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-row small { color: var(--muted); }
.col-row.on { background: var(--hl); color: #fff; }
.col-row.on small { color: #e6eefc; }
.col-row.locked { color: #999; }
.col-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.unit-head { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(var(--u-18, #f1f5fa), rgba(255, 255, 255, .6)); }
.unit-head > div { flex: 1; min-width: 0; }
.unit-head small { text-transform: uppercase; letter-spacing: 1px; color: #555; font-size: 10px; font-weight: bold; }
.unit-head h2 { margin: 0 0 2px; font-size: 19px; }
.unit-head p { margin: 0; color: var(--sub); font-size: 12px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px 6px; padding: 18px; align-content: start; flex: 1; }
.ficon { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: default; padding: 4px; }
.fimg { position: relative; padding: 4px; border-radius: 6px; }
.fimg svg { display: block; }
.flabel { font-size: 12px; padding: 1px 6px; border-radius: 8px; max-width: 100px; text-align: center; overflow-wrap: anywhere; }
.ficon.sel .fimg { background: rgba(0, 0, 0, .14); }
.ficon.sel .flabel { background: var(--hl); color: #fff; }
.ficon.locked svg { opacity: .45; }
.ibadge { position: absolute; right: -4px; bottom: -2px; font-size: 14px; }
.ibadge.ok { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: bold;
  background: radial-gradient(circle at 50% 30%, #a9ec7f, #2f9e1f 70%); border: 1px solid #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.info { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .75); }
.info-text { flex: 1; min-width: 0; }
.info-text p { margin: 4px 0 0; color: var(--sub); font-size: 12px; }
.pill { display: inline-block; font-size: 10px; padding: 0 7px; border-radius: 8px; margin-left: 6px; color: #fff; background: var(--g3); vertical-align: 1px; }
.pill.ok { background: var(--ok); } .pill.off { background: #9a9a9a; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.table th { text-align: left; font-weight: normal; padding: 3px 8px; background: linear-gradient(#fafafa, #dcdcdc); border-bottom: 1px solid #9c9c9c; border-right: 1px solid #c4c4c4; }
.table td { padding: 6px 8px; vertical-align: top; }
.table.striped tbody tr:nth-child(even) { background: #edf3fe; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.me { background: var(--hl) !important; color: #fff; }
.table tr.zone td { text-align: center; color: var(--ok); font-weight: bold; font-size: 11px; letter-spacing: 1px; background: var(--ok-soft); }
.table .si { font-size: 26px; width: 40px; vertical-align: middle; }
.table td.num { vertical-align: middle; }
.miss { color: var(--bad); font-weight: bold; }
.rank { font-weight: bold; }
.rank.r1 { color: #c79400; } .rank.r2 { color: #8a96a0; } .rank.r3 { color: #b0682a; }
.table tr.me .rank { color: #fff; }
.av { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 15px; vertical-align: middle; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .3); vertical-align: middle; }
.gloss-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.gloss-top h1 { margin: 0; }
.search { display: flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; border: 1px solid #8e8e8e; background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); width: 240px; max-width: 100%; }
.search input { border: 0; outline: 0; font: inherit; flex: 1; min-width: 0; background: transparent; padding: 2px 0; }
.gloss .folder { vertical-align: -3px; }

/* ---------- pages ---------- */
.hero { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; }
.hero h1 { margin-bottom: 4px; }
.hero p { margin: 0 0 8px; }
.league-row { display: flex; justify-content: center; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
.league-row .league-ico.locked { filter: grayscale(1); opacity: .45; }
.league-row .league-ico.cur { transform: scale(1.25); margin: 0 8px; }
.quest { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; background: #fff; }
.quest.done { border-color: var(--ok); background: var(--ok-soft); }
.qi { font-size: 28px; } .qb { flex: 1; }
.qr { display: flex; flex-direction: column; align-items: center; font-size: 22px; }
.qr small { font-size: 11px; color: #9a7400; }
.wardrobe { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: start; }
.wardrobe-biz { display: grid; place-items: center; background: #fff; }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pref { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border-radius: 6px; }
.pref:hover { background: rgba(0, 0, 0, .05); }
.pref span { font-size: 32px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); }
.pref small { color: var(--sub); font-size: 11px; }
.pref.locked span { filter: grayscale(1); opacity: .35; }
.pref.locked b { color: #999; }
.settings { display: grid; gap: 10px; margin-bottom: 14px; max-width: 420px; }
.settings label { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.settings label span { flex: 1; text-align: right; }
.settings select { flex: 0 0 200px; font: inherit; padding: 2px 26px 2px 10px; border-radius: 6px; border: 1px solid #8e8e8e; appearance: none; cursor: pointer;
  background: linear-gradient(var(--g1), var(--g2) 46%, var(--g3) 52%, var(--g4)) right / 20px 100% no-repeat, linear-gradient(#fff, #e6e6e6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.settings input[type=checkbox] { flex: 0 0 200px; width: 16px; height: 16px; margin: 0; accent-color: var(--g3); }

/* ---------- setup assistant ---------- */
.window.setup .win-body { display: flex; }
.setup-wrap { display: flex; flex: 1; min-width: 0; }
.steps { width: 190px; flex-shrink: 0; margin: 0; padding: 22px 16px 22px 34px; background: linear-gradient(90deg, rgba(0, 0, 0, .06), rgba(0, 0, 0, .02));
  border-right: 1px solid var(--line-soft); color: #888; }
.steps li { margin-bottom: 10px; }
.steps li.cur { color: #000; font-weight: bold; list-style-type: "▶ "; }
.steps li.past { color: #555; list-style-type: "✓ "; }
.setup-main { flex: 1; padding: 26px 28px; }
.ob-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ob-hero h1 { margin-top: 14px; }
.ob-hero p { max-width: 420px; }
.cast-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.radio-list { display: grid; gap: 4px; margin-top: 14px; }
.radio-row { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 8px; border-radius: 6px; text-align: left; cursor: pointer; font-size: 14px; }
.radio-row:hover { background: rgba(0, 0, 0, .05); }
.radio { width: 15px; height: 15px; border-radius: 50%; border: 1px solid #7a7a7a; background: linear-gradient(#fff, #dcdcdc); box-shadow: inset 0 1px 1px #fff, 0 1px 1px rgba(0, 0, 0, .2); flex-shrink: 0; }
.radio-row.on .radio { border-color: var(--gb); background: radial-gradient(circle, #111 0 2.5px, transparent 3px), linear-gradient(var(--g1), var(--g2) 46%, var(--g3) 52%, var(--g4)); }
.rico { font-size: 20px; }
.field { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.field input { flex: 1; max-width: 260px; font: inherit; font-size: 14px; padding: 4px 8px; border: 1px solid #8e8e8e; border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); outline: none; }
.field input:focus { box-shadow: 0 0 0 3px rgba(61, 143, 240, .55), inset 0 1px 2px rgba(0, 0, 0, .3); }
.field-msg { min-height: 20px; margin: 6px 0 0 82px; font-size: 12px; }
.field-msg.ok { color: var(--ok); } .field-msg.bad { color: var(--bad); }
.small { font-size: 11px; }
.npc { font-size: 9px; padding: 0 5px; border-radius: 6px; background: #c8c8c8; color: #444; vertical-align: 1px; }
.table tr.me .npc { background: rgba(255, 255, 255, .4); color: #fff; }
body.busy, body.busy * { cursor: progress !important; }
code { font-family: Monaco, Consolas, monospace; font-size: 12px; background: rgba(0, 0, 0, .06); padding: 1px 4px; border-radius: 3px; }

/* ---------- lesson ---------- */
.lesson-top { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 24px 0; }
.lesson-top .aqua-bar { flex: 1; height: 16px; border-radius: 8px; }
.combo { position: absolute; left: 24px; top: -1px; font-size: 11px; font-weight: bold; color: #b85f00; opacity: 0; transition: opacity .2s; }
.combo.show { opacity: 1; }
.coffee-count { font-weight: bold; white-space: nowrap; }
.q-area { max-width: 580px; margin: 0 auto; padding: 22px 20px 30px; }
.q-area h1 { font-size: 21px; }
.tag { display: inline-block; font-size: 11px; font-weight: bold; padding: 1px 9px; border-radius: 9px; color: #fff; margin-bottom: 8px;
  background: linear-gradient(#ffc27a, #ff8c00 55%, #ffb04d); border: 1px solid #b86400; }
.tag.new { background: linear-gradient(#e5c3ff, #a55fd6 55%, #c690f0); border-color: #7a3aa8; }
.speech { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 22px; }
.speech .ichat { font-size: 18px; font-weight: bold; }
.speech .ichat::before { content: ""; position: absolute; left: -7px; bottom: 12px; width: 12px; height: 12px; background: var(--ac-30, #e9f0f8);
  border-left: 1px solid rgba(0, 0, 0, .25); border-bottom: 1px solid rgba(0, 0, 0, .25); transform: rotate(45deg); }
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 14px; font-size: 14px; cursor: pointer; border-radius: 10px;
  border: 1px solid #9a9a9a; background: linear-gradient(#ffffff 0%, #f6f6f6 48%, #e9e9e9 52%, #f7f7f7 100%); box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 1px 0 #fff; }
.choice:hover { border-color: #6f6f6f; }
.choice .k { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; color: #666; background: rgba(0, 0, 0, .06); border: 1px solid rgba(0, 0, 0, .15); flex-shrink: 0; }
.choice.sel { border-color: var(--gb); background: linear-gradient(var(--g1) 0%, var(--g2) 46%, var(--g3) 52%, var(--g4) 100%); color: #000; }
.choice.right { border-color: #2c7a16; background: linear-gradient(#e2fbd0 0%, #9fe07a 46%, #5fbf3a 52%, #b5ef92 100%); color: #0d3a02; }
.choice.wrong { border-color: #9e1c10; background: linear-gradient(#ffe0db 0%, #ff9d90 46%, #ea5442 52%, #ffb2a6 100%); color: #3d0600; }
.choice.sel .k, .choice.right .k, .choice.wrong .k { background: rgba(255, 255, 255, .5); color: #000; }
.choice.gone { opacity: .3; pointer-events: none; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.match .choice { justify-content: center; text-align: center; min-height: 52px; font-size: 13px; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.mail { background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); margin-bottom: 18px; }
.mail-head { padding: 8px 12px; font-size: 12px; background: linear-gradient(#f7f7f7, #e7e7e7); border-bottom: 1px solid var(--line); }
.mail-head span { display: inline-block; width: 58px; text-align: right; color: #777; margin-right: 4px; }
.mail-body { display: flex; gap: 12px; align-items: flex-start; padding: 14px; }
.mail-body p { margin: 0; font-size: 16px; line-height: 1.7; }
.blank { display: inline-block; min-width: 90px; border-bottom: 2px solid #9a9a9a; margin: 0 4px; text-align: center; color: var(--hl); font-weight: bold; }
.blank.filled { border-color: var(--hl); background: var(--hl-soft); }
.answer-line { min-height: 54px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0; margin-bottom: 20px; align-items: center; }
.bank { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tile { padding: 4px 14px; border-radius: 999px; border: 1px solid #8e8e8e; font-size: 14px; cursor: pointer;
  background: linear-gradient(#ffffff 0%, #f3f3f3 45%, #dedede 52%, #fbfbfb 100%); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.answer-line .tile { border-color: var(--gb); background: linear-gradient(var(--g1), var(--g2) 46%, var(--g3) 52%, var(--g4)); }
.tile.used { visibility: hidden; }

/* ---------- meetings (chat) ---------- */
.window.chat-win .win-body { background: #fff; }
.chat { display: flex; flex-direction: column; gap: 12px; padding: 14px 22px 30px; max-width: 640px; margin: 0 auto; }
.chat-head { text-align: center; color: #777; font-size: 12px; padding: 4px 0 8px; border-bottom: 1px solid var(--line-soft); }
.s-line { display: flex; gap: 10px; align-items: flex-end; max-width: 88%; }
.s-line > div { min-width: 0; }
.s-line small { display: block; font-size: 11px; color: #777; margin: 0 0 2px 10px; }
.s-line .ichat::before { content: ""; position: absolute; left: -6px; bottom: 9px; width: 11px; height: 11px; background: var(--ac-30, #e9f0f8);
  border-left: 1px solid rgba(0, 0, 0, .25); border-bottom: 1px solid rgba(0, 0, 0, .25); transform: rotate(45deg); }
.s-line.new, .s-q.new { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.s-line.you { align-self: flex-end; }
.s-line.you .ichat::before { left: auto; right: -6px; transform: rotate(-135deg); }
.s-q { background: #f4f7fc; }
.s-q > p { margin: 0 0 10px; font-weight: bold; }
.s-q.done { border: 0; background: none; padding: 0 0 0 54px; color: #777; font-size: 11px; }
.s-q.done b { color: var(--ok); }

/* ---------- end screens ---------- */
.center-stage { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 34px 20px; }
.center-stage h1 { margin: 14px 0 4px; font-size: 26px; }
.center-stage .sub { margin: 0 0 20px; }
.kicker { text-transform: uppercase; font-weight: bold; letter-spacing: 1px; margin-top: 12px; font-size: 11px; }
.duo { display: flex; align-items: flex-end; gap: 8px; }
.boxes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.box { width: 140px; background: rgba(255, 255, 255, .6); display: flex; flex-direction: column; gap: 4px; }
.box small { color: #555; text-transform: uppercase; font-size: 10px; letter-spacing: 1px; }
.box b { font-size: 22px; }
.flame { font-size: 90px; animation: jump .8s cubic-bezier(.3, 1.6, .5, 1); line-height: 1; }
.streak-num { font-size: 80px; font-weight: bold; color: #e07a00; line-height: 1; text-shadow: 0 2px 0 #fff; }
.week-card { width: 100%; max-width: 340px; margin-top: 14px; background: rgba(255, 255, 255, .6); }
.week-card p { margin: 0; }
.reward-list { display: grid; gap: 8px; width: 100%; max-width: 420px; margin-top: 10px; text-align: left; }
.gb-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.gb-head h2 { margin: 2px 0; }
.gb-head p { margin: 0; color: var(--sub); }
.gb-head small { text-transform: uppercase; letter-spacing: 1px; font-size: 10px; color: #777; }
.gb-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.gb-scroll h3 { margin: 12px 0 6px; }
.gb-scroll .table td:first-child { width: 35%; }

/* ---------- responsive ---------- */
/* Phones (portrait, or landscape on a touch screen): one full-screen window at a time, no dragging, bigger tap targets.
   Keep this query in sync with isPhone() in app.js. */
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  body { font-size: 14px; }
  .clock { display: none; }
  .mb-item { padding: 0 7px; font-size: 13px; }
  .palette { display: none; }
  .desk .window { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 64px - env(safe-area-inset-bottom)) !important;
    border-radius: 0; box-shadow: none; animation-duration: .15s; }
  .desk .window:not(.front) { display: none; }
  .desk .window .light.max { display: none; }
  .window.activity { left: 0 !important; top: 0 !important; width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
  .activity .statusbar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .titlebar { height: 30px; }
  .sheet-back { inset: 30px 0 0 0; }
  .lights { top: 8px; }
  .wtitle { max-width: 60%; }
  /* With every window closed, the panels become a scrollable "today" view instead of an empty desktop. */
  .desk.empty { overflow-y: auto; padding: 12px 12px 90px; -webkit-overflow-scrolling: touch; }
  .desk.empty .palette:not(.hidden) { display: block; position: relative; left: auto !important; top: auto !important; width: auto; margin: 0 auto 12px; max-width: 480px; }
  /* Learn: the whole window scrolls; the unit list becomes a swipeable row and the info pane sticks to the bottom. */
  .page-learn .win-body { overflow: auto; }
  .columns { flex-direction: column; height: auto; min-height: 100%; }
  .col-list { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; flex-shrink: 0; scroll-snap-type: x proximity; }
  .col-row { flex-shrink: 0; width: auto; border-radius: 6px; min-height: 40px; scroll-snap-align: start; }
  .col-row span { max-width: 150px; }
  .col-sep { display: none; }
  .col-main { flex: 1; }
  .col-main .icon-grid { overflow: visible; flex: 1 0 auto; }
  .unit-head { flex-wrap: wrap; padding: 12px 14px; }
  .unit-head p i { display: none; }
  .info { flex-wrap: wrap; position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -4px 12px rgba(0, 0, 0, .08); }
  .info-icon { display: none; }
  .info-btn { width: 100%; } .info-btn .btn { width: 100%; min-height: 40px; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); padding: 12px; }
  /* Dock: 44px tap targets and clear of the iPhone home indicator. */
  .dock-shelf { gap: 0; padding: 2px 4px calc(6px + env(safe-area-inset-bottom)); max-width: 100vw; }
  .dock-item { padding: 6px 4px 4px; min-width: 40px; }
  .dock-icon { font-size: 28px; }
  .dock-sep { margin: 6px 3px 2px; }
  .dock-label { display: none; }
  .setup-wrap { flex-direction: column; }
  .steps { width: auto; display: flex; gap: 14px; padding: 10px 16px; overflow-x: auto; white-space: nowrap; border-right: 0; border-bottom: 1px solid var(--line-soft); list-style-position: inside; flex-shrink: 0; }
  .steps li { margin: 0; }
  .setup-main { padding: 18px 16px; }
  .radio-row { min-height: 44px; }
  .q-area { padding: 14px 14px 24px; }
  .q-area h1 { font-size: 19px; }
  .lesson-top { padding: 10px 14px 0; }
  .speech { margin-bottom: 16px; }
  .speech .avatar { width: 64px !important; height: 64px !important; }
  .speech .avatar svg { width: 64px; height: 64px; }
  .speech .ichat { font-size: 16px; }
  .choice { min-height: 46px; font-size: 15px; }
  .match .choice { font-size: 13px; padding: 6px; min-height: 54px; }
  .tile { padding: 8px 14px; font-size: 15px; }
  .mail-head span { width: 50px; }
  .mail-body p { font-size: 15px; }
  .btn { min-height: 34px; padding: 6px 16px; }
  .activity .statusbar .btn { min-width: 0; flex: 1; min-height: 40px; }
  .sheet { width: calc(100% - 16px); }
  .alert { gap: 12px; }
  .alert-icon .avatar { width: 52px !important; height: 52px !important; }
  .alert-icon .avatar svg { width: 52px; height: 52px; }
  .btns.end .btn { flex: 1; min-height: 40px; }
  /* 16px text in inputs stops iOS zooming in when you tap them. */
  input, select, textarea { font-size: 16px !important; }
  .field { flex-wrap: wrap; }
  .field input { max-width: none; width: 100%; min-height: 42px; }
  .field-msg { margin-left: 0; }
  .settings label { flex-wrap: wrap; justify-content: space-between; }
  .settings label span { text-align: left; }
  .settings select, .co-name { flex: 1 1 160px; }
  .wardrobe { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align: center; }
  .stat-pop { position: fixed; top: 24px; right: 4px; left: 4px; width: auto; }
  .gloss td:nth-child(3), .gloss th:nth-child(3) { display: none; }
  .search { width: 100%; }
  .chat { padding: 12px 12px 24px; }
  .s-line { max-width: 94%; }
  .pref-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
/* Phone extras: setup content may not be wider than the screen, sheets slide up from the bottom (thumb-reachable,
   and the answers stay visible above the feedback), and every control is at least 40px tall. */
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .setup-wrap > *, .columns > *, .col-main { min-width: 0; }
  .steps { max-width: 100%; }
  .unit-head .quip { display: none; }
  .sheet-back { align-items: flex-end; }
  .sheet { width: 100%; max-height: 85%; border-radius: 14px 14px 0 0; border: 1px solid #8f8f8f; border-bottom: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 28px rgba(0, 0, 0, .35); animation: sheetup .22s ease-out; }
  @keyframes sheetup { from { transform: translateY(100%); } }
  .btn, select, .search { min-height: 40px; }
  .search input { min-height: 36px; }
  .settings input[type=checkbox] { width: 24px; height: 24px; }
}
/* Landscape phones are short: let the info pane scroll with the page instead of covering the lesson icons. */
@media (max-height: 520px) and (pointer: coarse) {
  .info { position: static; box-shadow: none; }
  .unit-head { padding: 8px 14px; }
  .unit-head .avatar { width: 44px !important; height: 44px !important; }
  .unit-head .avatar svg { width: 44px; height: 44px; }
  .lesson-top { padding-top: 6px; }
  .q-area { padding-top: 8px; }
}/* Very narrow phones: drop the Help menu (its items are also reachable elsewhere) so the stats always fit. */
@media (max-width: 400px) {
  .menubar .mb-wrap:nth-child(4) { display: none; }
  .mb-item { padding: 0 5px; }
}
/* Remove the tap delay and double-tap zoom on controls. */
button, .choice, .tile, .ficon, .col-row, a { touch-action: manipulation; }@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.palette.hidden { display: none; }

/* ---------- startup screen (in index.html, before the app loads) ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 40px; border-radius: 12px; text-align: center; max-width: 340px;
  background: rgba(250, 250, 250, .95); box-shadow: 0 16px 48px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .3); animation: fadein .3s; }
.boot-box b { font-size: 18px; }
.boot-box small { color: var(--sub); }
.boot-icon { font-size: 44px; }
.boot-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .15); border-top-color: #333; animation: spin .7s linear infinite; }
/* ---------- company packs ---------- */
.col-sep { margin: 10px 10px 4px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.col-row.add { color: var(--hl); }
.col-row.add:hover { background: var(--hl-soft); }
.co-name { flex: 0 0 200px; }
/* ---------- privacy & terms pages ---------- */
.doc-body { min-height: 100vh; padding: 24px 12px 40px; }
.doc.window { position: relative; margin: 0 auto; width: min(860px, 100%); height: auto; animation: none; contain: none; }
.doc .titlebar { justify-content: center; }
.doc-text { padding: 20px 28px 30px; font-size: 14px; line-height: 1.6; overflow: visible; }
.doc-text h1 { font-size: 24px; margin: 8px 0 2px; }
.doc-text h2 { font-size: 16px; margin: 24px 0 6px; }
.doc-text .table { font-size: 13px; margin: 8px 0; }
.doc-text a { color: var(--hl); }
.doc-back { margin: 0 0 8px; font-size: 13px; }
.doc-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--sub); }
.legal { font-size: 12px; color: var(--sub); }
.legal a, .data-links a { color: var(--hl); }
@media (max-width: 760px) { .doc-body { padding: 0; } .doc.window { border-radius: 0; } .doc-text { padding: 16px; } }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: #000; }

/* sign-in key */
.signin-key { font: bold 22px/1.3 Monaco, Consolas, monospace; letter-spacing: 2px; text-align: center; padding: 12px; margin: 10px 0; border-radius: 8px; background: #fff; border: 1px dashed #8e8e8e; user-select: all; }

/* ================= v4: levels, friends, notifications, shop extras, mobile tab bar ================= */
.badge-count { position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; line-height: 16px;
  font-weight: bold; color: #fff; text-align: center; background: radial-gradient(circle at 50% 30%, #ff8f80, #e0412f 70%); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.mb-item.bell, .dock-item, .tab-icon { position: relative; }
.mb-item.bell .badge-count { top: 1px; right: 0; }
.col-sep.first { margin-top: 2px; border-top: 0; padding-top: 4px; }
.seg { display: inline-flex; margin: 0 auto 6px; border: 1px solid #8e8e8e; border-radius: 999px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.pad > .seg { display: flex; width: fit-content; }
.seg button { border: 0; padding: 4px 14px; font: inherit; cursor: pointer; background: linear-gradient(#fff, #e6e6e6); }
.seg button + button { border-left: 1px solid #b0b0b0; }
.seg button.on { background: linear-gradient(var(--g1), var(--g2) 46%, var(--g3) 52%, var(--g4)); color: #000; }
.box.wide { width: 230px; }
.small-btn { min-height: 20px !important; padding: 1px 10px !important; font-size: 11px; }

/* Q2 multi-fill and quick-fire feedback */
.mf-sentence { line-height: 2.1; }
.mf-blank { min-width: 84px; font: inherit; font-weight: bold; color: var(--hl); background: rgba(255, 255, 255, .6); border: 0; border-bottom: 2px solid #9a9a9a; border-radius: 4px 4px 0 0;
  margin: 0 3px; padding: 0 6px; cursor: pointer; }
.mf-blank.filled { border-color: var(--hl); background: var(--hl-soft); }
.tile.used { visibility: hidden; }
.timer { font-weight: bold; font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 10px; background: #fff; border: 1px solid #999; }
.timer.low { color: #fff; background: radial-gradient(circle at 50% 30%, #ff8f80, #d4301f 70%); border-color: #9e1c10; animation: pulse-low .6s ease-in-out infinite alternate; }
@keyframes pulse-low { to { transform: scale(1.08); } }
.q-area.flash-ok { box-shadow: inset 0 0 0 4px rgba(47, 158, 31, .55); }
.q-area.flash-bad { box-shadow: inset 0 0 0 4px rgba(212, 48, 31, .55); }

/* Friends window */
.add-friend { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.add-friend .field { margin: 0; flex: 1; }
.req-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; background: #fffbe6; border-color: #e0c060; }
.req-row > div { flex: 1; }
.av.big { width: 40px; height: 40px; font-size: 26px; background: #fff; border: 1px solid #ccc; }

/* MySpace-style friend request pop-up */
.myspace { position: fixed; z-index: 70; top: calc(70px + var(--i) * 26px); left: calc(50% - 170px + var(--i) * 26px); width: 340px; background: #fff;
  border: 1px solid #36c; box-shadow: 4px 4px 0 rgba(0, 0, 0, .25), 0 12px 30px rgba(0, 0, 0, .35); font-family: Verdana, Arial, sans-serif; font-size: 12px;
  animation: ms-pop .3s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes ms-pop { from { transform: scale(.7); opacity: 0; } }
.ms-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; color: #fff; font-weight: bold; background: linear-gradient(#5d8edb, #003399); }
.ms-bar button { border: 0; background: none; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.ms-body { display: flex; gap: 12px; padding: 12px; background: #e5edfa; }
.ms-pic { width: 70px; height: 70px; flex-shrink: 0; display: grid; place-items: center; font-size: 44px; background: #fff; border: 1px solid #99b; }
.ms-name { color: #036; font-size: 14px; }
.ms-body p { margin: 4px 0; }
.ms-small { color: #666; font-size: 11px; }
.ms-btns { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 12px; background: #fff; border-top: 1px solid #ccd; }
.ms-btn { font: bold 12px Verdana, Arial, sans-serif; padding: 4px 14px; cursor: pointer; border: 1px solid #036; }
.ms-btn.ok { color: #fff; background: linear-gradient(#ff9a3c, #e86b00); border-color: #b25200; }
.ms-btn.deny { color: #036; background: linear-gradient(#fff, #dde6f5); }

/* Notifications list */
.notes-pop { width: 320px; }
.notes { max-height: 300px; overflow: auto; margin: 6px 0 10px; }
.note { padding: 7px 8px; border-bottom: 1px solid #e3e3e3; }
.note p { margin: 0; color: var(--ink); }
.note small { color: var(--muted); }
.note.unread { background: var(--hl-soft); }

/* Phone "More" sheet */
.more-title { margin: 0 0 8px; }
.more-list { display: grid; gap: 2px; margin: 0 -6px; }
.more-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 0 12px; border: 0; border-radius: 10px; background: none;
  font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.more-row:hover, .more-row:active { background: var(--hl-soft); }
.more-row span { font-size: 22px; width: 30px; text-align: center; }
.more-row em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 22px; }

/* Shop: wallpapers */
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.wp-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid #c3c3c3; border-radius: 8px; background: #fff; }
.wp-card.on { border-color: var(--hl); box-shadow: 0 0 0 2px var(--hl-soft); }
.wp-card small { color: var(--sub); font-size: 11px; flex: 1; }
.wp-swatch { height: 70px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .25); }

/* Wallpapers (the same gradients are used for the shop previews) */
[data-wp-preview="aqua"] { background: radial-gradient(ellipse 70% 45% at 15% 105%, rgba(170, 220, 255, .75), transparent 70%), linear-gradient(165deg, #0f3f8c, #2f78d6 42%, #1b56b0 70%, #0d3577); }
:root[data-wp="sunset"] body, [data-wp-preview="sunset"] { background: radial-gradient(ellipse 80% 40% at 50% 100%, rgba(255, 210, 120, .9), transparent 70%),
  linear-gradient(180deg, #2b1a5a 0%, #7a2f6e 40%, #e0624a 75%, #f6b05a 100%); background-attachment: fixed; }
:root[data-wp="evergreen"] body, [data-wp-preview="evergreen"] { background: radial-gradient(ellipse 70% 50% at 20% 110%, rgba(170, 240, 190, .55), transparent 70%),
  linear-gradient(165deg, #0d3b2a, #1f7a52 45%, #145c3c 75%, #0a2e20); background-attachment: fixed; }
:root[data-wp="night"] body, [data-wp-preview="night"] { background: radial-gradient(circle at 80% 20%, rgba(255, 255, 220, .35) 0 3%, transparent 4%),
  radial-gradient(ellipse 90% 40% at 50% 110%, rgba(80, 120, 255, .35), transparent 70%), linear-gradient(180deg, #050816, #121a3a 60%, #1d2a5a); background-attachment: fixed; }
:root[data-wp="carpet"] body, [data-wp-preview="carpet"] { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 6px),
  repeating-linear-gradient(-45deg, rgba(0, 0, 0, .07) 0 2px, transparent 2px 7px), linear-gradient(#5b6b80, #4a586b); background-attachment: fixed; }
:root[data-wp="pinstripe"] body, [data-wp-preview="pinstripe"] { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .13) 0 1px, transparent 1px 22px),
  linear-gradient(160deg, #1d2633, #2c3a4f 50%, #1a222e); background-attachment: fixed; }
:root[data-wp="spreadsheet"] body, [data-wp-preview="spreadsheet"] { background: linear-gradient(rgba(33, 115, 70, .18) 1px, transparent 1px) 0 0 / 80px 22px,
  linear-gradient(90deg, rgba(33, 115, 70, .18) 1px, transparent 1px) 0 0 / 80px 22px, linear-gradient(#f4fbf6, #e3f2e8); background-attachment: fixed; }
:root[data-wp="gold"] body, [data-wp-preview="gold"] { background: radial-gradient(ellipse 60% 40% at 30% 20%, rgba(255, 250, 220, .7), transparent 70%),
  linear-gradient(150deg, #7a5410, #d4a32a 40%, #f5d77a 55%, #b8861b 75%, #5c3d08); background-attachment: fixed; }
[data-wp-preview] { background-attachment: scroll !important; }

/* Desk decorations */
.decor { position: absolute; z-index: 2; cursor: grab; touch-action: none; user-select: none; text-align: center; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .35)); }
.decor.dragging { cursor: grabbing; }
.decor-icon { display: block; font-size: 72px; line-height: 1; }
.mug-text { display: block; margin-top: -6px; font: bold 8px Verdana, sans-serif; color: #fff; text-shadow: 0 1px 2px #000; }
.poster { width: 130px; padding: 10px 8px 12px; background: #111; border: 6px solid #2b2b2b; outline: 2px solid #8a7a4a; color: #fff; font-family: Georgia, serif; }
.poster span { display: block; font-size: 52px; line-height: 1.1; }
.poster b { display: block; letter-spacing: 4px; font-size: 16px; margin-top: 4px; }
.poster small { display: block; font-size: 9px; font-style: italic; color: #ccc; margin-top: 2px; }
.plaque { width: 120px; padding: 8px; background: linear-gradient(#6b4423, #4a2d14); border: 3px solid #c9a227; color: #f6e7b0; font-family: Georgia, serif; }
.plaque span { display: block; font-size: 44px; }
.plaque small { display: block; font-size: 8px; letter-spacing: 1px; }
.plaque b { display: block; font-size: 12px; margin-top: 2px; }

/* Phone tab bar: hidden on desktop, replaces the dock on phones */
.tabbar { display: none; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .menubar { height: 32px; }
  .mb-item { height: 32px; font-size: 14px; }
  .menubar .mb-wrap:nth-child(3), .menubar .mb-wrap:nth-child(4) { display: none; } /* Go & Help live in "More" */
  .desk, .act-layer { top: 32px; }
  .shade { inset: 32px 0 0 0; }
  #toasts { top: 40px; }
  .stat-pop { top: 32px; }
  .decor { display: none; }
  .dock { pointer-events: auto; }
  .dock-shelf { display: none; }
  .tabbar { display: flex; width: 100%; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 2px;
    background: linear-gradient(rgba(250, 250, 252, .97), rgba(226, 230, 238, .97)); border-top: 1px solid #9aa3b0; box-shadow: 0 -2px 10px rgba(0, 0, 0, .18); }
  .tab { flex: 1; min-height: 56px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-radius: 12px; cursor: pointer; color: #333; font: inherit; }
  .tab-icon { font-size: 25px; line-height: 1; padding: 3px 12px; border-radius: 14px; }
  .tab-label { font-size: 11px; }
  .tab.on .tab-icon { background: linear-gradient(var(--g1), var(--g2) 46%, var(--g3) 52%, var(--g4)); box-shadow: 0 1px 3px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .7); }
  .tab.on .tab-label { color: var(--hl); font-weight: bold; }
  .tab .badge-count { top: -2px; right: 2px; }
  .desk .window { height: calc(100% - 66px - env(safe-area-inset-bottom)) !important; }
  /* Big, obvious window controls: a large red close button with a visible ×, and no tiny yellow/green buttons. */
  .titlebar { height: 46px; }
  .wtitle { font-size: 16px; max-width: 64%; }
  .lights { top: 7px; left: 10px; gap: 10px; }
  .light.min, .light.max, .light.off:not(:first-child) { display: none !important; }
  .light.close, .lights .light.off:first-child { width: 32px; height: 32px; }
  .light.close::after { content: "×"; display: block; font-size: 24px; line-height: 28px; text-align: center; color: #5a0d06; font-weight: bold; }
  .sheet-back { inset: 46px 0 0 0; }
  .myspace { left: 12px; right: 12px; width: auto; top: calc(60px + var(--i) * 20px); }
  .wp-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ---------- certificates: celebration + framed on the desktop ---------- */
.celebrate-burst { font-size: 70px; line-height: 1; animation: jump .8s cubic-bezier(.3, 1.6, .5, 1); }
.cert-reveal { width: min(480px, 100%); margin-top: 6px; animation: cert-in .7s .2s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes cert-in { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.desk-cert { cursor: pointer; }
.mini-cert { width: 132px; padding: 8px 8px 10px; text-align: center; font-family: Georgia, serif; background: #fffdf3;
  border: 5px double #c9a227; outline: 4px solid #5a3c1a; box-shadow: 0 0 0 1px #3d2810; }
.mini-cert small { display: block; font-size: 7px; letter-spacing: 2px; color: #a8871c; }
.mini-cert b { display: block; font-size: 12px; line-height: 1.2; margin: 3px 0; color: #222; }
.mini-cert span { display: block; font-size: 9px; font-style: italic; color: #555; }
.mini-cert i { display: block; font-style: normal; font-size: 18px; margin-top: 2px; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) { .seg button { min-height: 40px; padding: 6px 16px; } }