/* My Dream School: screens, menus and buttons. The game world itself is drawn on the canvas. */
:root {
  --ink: #3d2756;
  --ink-soft: #6b5480;
  --purple: #7b5cff;
  --purple-dark: #5636d6;
  --pink: #ff3d8b;
  --pink-dark: #b8226a;
  --yellow: #ffd23f;
  --line: #eadcf5;
  --panel: #ffffff;
  --font: Fredoka, "Trebuchet MS", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8ed66b; font-family: var(--font); color: var(--ink); }
#game { position: fixed; inset: 0; display: block; touch-action: none; }
button { font-family: var(--font); cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.big, .mid, .small {
  border: 0; border-radius: 18px; font-weight: 600; color: #fff; background: var(--purple);
  box-shadow: 0 5px 0 var(--purple-dark); transition: transform .08s, box-shadow .08s; min-height: 48px;
}
.big { font-size: 24px; padding: 14px 30px; }
.mid { font-size: 18px; padding: 10px 20px; background: #fff; color: var(--ink); box-shadow: 0 4px 0 #d9c9ef; border: 3px solid var(--line); }
.mid.on { border-color: var(--purple); background: #f3eeff; }
.mid.yellow { background: var(--yellow); color: #5a3d00; border-color: var(--yellow); box-shadow: 0 4px 0 #d9a800; }
.small { font-size: 15px; padding: 8px 16px; background: rgba(255,255,255,.9); color: var(--ink); box-shadow: 0 3px 0 rgba(74,47,102,.3); min-height: 40px; }
.big:active, .mid:active, .small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--purple-dark); }
.big:focus-visible, .mid:focus-visible, .small:focus-visible, .card:focus-visible, .tile:focus-visible, .sw:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(61, 39, 86, .45);
}
.screen.title { background: linear-gradient(rgba(61,39,86,.15), rgba(61,39,86,.45)); align-items: center; }
.panel {
  width: min(1120px, 100%); margin: auto; background: var(--panel); border-radius: 30px; padding: clamp(18px, 3vw, 32px);
  box-shadow: 0 8px 0 rgba(61,39,86,.25);
}
.small-panel { width: min(760px, 100%); }
.panel h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.05; color: #4a2f66; letter-spacing: -.01em; }
.sub { margin: 8px 0 18px; font-size: 18px; color: var(--ink-soft); line-height: 1.4; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { background: #fff0f6; color: var(--pink-dark); font-weight: 600; padding: 8px 16px; border-radius: 999px; font-size: 16px; }
.row-end { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.row-wrap { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; font-size: 18px; font-weight: 600; color: #4a2f66; }
.field input { font: 600 22px var(--font); color: var(--ink); padding: 10px 14px; border: 3px solid var(--line); border-radius: 14px; width: 100%; max-width: 460px; }
.field input:focus { outline: none; border-color: var(--purple); }
.name-err { color: #e0245e; font-weight: 700; font-size: 16px; margin-top: 6px; min-height: 0; }

/* ---------- Title ---------- */
.title-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px; }
.logo { margin: 0; display: flex; flex-direction: column; line-height: .95; font-weight: 700; color: #fff; letter-spacing: -.02em; text-shadow: 0 6px 0 #ff3d8b, 0 10px 24px rgba(61,39,86,.45); }
.logo span:first-child { font-size: clamp(44px, 8vw, 90px); }
.logo span:last-child { font-size: clamp(64px, 12vw, 140px); color: #ffd23f; text-shadow: 0 6px 0 #7b5cff, 0 10px 24px rgba(61,39,86,.45); }
.tag { margin: 0; max-width: 560px; font-size: clamp(18px, 2.4vw, 22px); color: #fff; font-weight: 600; text-shadow: 0 2px 6px rgba(61,39,86,.7); }
.btns { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.btns .big { font-size: 30px; padding: 16px 48px; background: var(--pink); box-shadow: 0 6px 0 var(--pink-dark); }

.avatar-screen .row-end, .draw-screen .row-end { position: sticky; bottom: -16px; background: #fff; margin: 12px -8px -8px; padding: 12px 8px 8px; border-radius: 0 0 22px 22px; }
.draw-screen .canvas-wrap { max-width: calc((100vh - 330px) * 800 / 560); min-width: 280px; }

/* ---------- Choice cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: #fff7fb; border: 4px solid #f3dff0; border-radius: 22px; padding: 14px; display: flex; flex-direction: column; gap: 8px;
  align-items: center; text-align: center; color: var(--ink); min-width: 0;
}
.card canvas { width: 100%; max-width: 240px; height: auto; border-radius: 14px; }
.card b { font-size: 24px; }
.card span { font-size: 16px; color: var(--ink-soft); line-height: 1.35; }
.card.on { border-color: var(--purple); background: #f3eeff; box-shadow: 0 0 0 4px rgba(123,92,255,.2); }

/* ---------- Avatar maker ---------- */
.av-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; }
.av-left { display: flex; flex-direction: column; gap: 12px; }
.av-left .field { margin-top: 0; }
.stage { position: relative; border-radius: 22px; background: linear-gradient(#e8f6ff, #fdf0ff); }
.stage canvas { display: block; width: 100%; height: auto; }
.turn { position: absolute; top: 45%; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: var(--purple); font-size: 18px; box-shadow: 0 3px 0 #d9c9ef; }
.turn.l { left: 8px; } .turn.r { right: 8px; }
.av-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.opt-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 10px; }
.opt-label { font-size: 18px; font-weight: 600; color: #4a2f66; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px #e3d2f0; position: relative; padding: 0; }
.sw.on { box-shadow: 0 0 0 3.5px var(--purple); }
.tile { width: 64px; height: 64px; border-radius: 16px; border: 3px solid #f0dfee; background: #fff7fb; padding: 0; position: relative; overflow: hidden; }
.tile canvas { width: 100%; height: 100%; display: block; }
.tile.on { border-color: var(--purple); background: #f3eeff; }
.locked { opacity: .55; cursor: not-allowed; }
.locked i, .sw.locked i { position: absolute; inset: auto 0 0 0; font-style: normal; font-size: 11px; font-weight: 700; background: rgba(61,39,86,.8); color: #ffd23f; text-align: center; line-height: 16px; }
.sw.locked i { inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; line-height: 1; }

/* ---------- Art studio ---------- */
.papers { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.paper-btn { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 3px solid #f0dfee; background: #fff; border-radius: 14px; padding: 6px; color: var(--ink); font-size: 13px; font-weight: 600; width: 104px; }
.paper-btn canvas { width: 88px; height: 58px; border-radius: 6px; box-shadow: 0 0 0 1px #eee; }
.paper-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px; }
.paper-btn.on { border-color: var(--purple); background: #f3eeff; }
.draw-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.tools { display: flex; flex-direction: column; gap: 12px; }
.colors { display: grid; grid-template-columns: repeat(4, 42px); gap: 8px; }
.tool-grid, .sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sizes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool { border: 3px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 4px; font-size: 15px; font-weight: 600; color: var(--ink); min-height: 44px; }
.tool.on { border-color: var(--purple); background: #f3eeff; }
.canvas-wrap { position: relative; width: 100%; aspect-ratio: 800 / 560; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 4px #f0dfee; background: #fff; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.paper-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.paper-sample { display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 600; }
.paper-sample canvas { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 0 0 1px #eee; }
.paper-sample em { font-style: normal; color: var(--pink); }

/* ---------- Cinema ---------- */
.screen-wrap { background: #0f0a1c; border-radius: 18px; padding: 10px; }
.screen-wrap canvas, .screen-wrap video { display: block; width: 100%; height: auto; border-radius: 10px; }
.file { display: inline-flex; align-items: center; }

/* ---------- Menu and help ---------- */
.menu-btns { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.help { display: grid; gap: 10px; margin-top: 16px; }
.help div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 10px 14px; background: #faf6ff; border-radius: 14px; font-size: 17px; }
.help b { color: #4a2f66; }
.help span { color: var(--ink-soft); line-height: 1.35; }

/* ---------- HUD ---------- */
#hud { position: fixed; z-index: 10; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 10px; }
.hud-btn { height: 52px; min-width: 52px; border-radius: 26px; border: 0; background: #fff; color: #4a2f66; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; box-shadow: 0 3px 0 rgba(74,47,102,.3); font-size: 18px; font-weight: 600; }
.hud-btn svg { width: 26px; height: 26px; }
#hParty { color: #e0193a; }
#hParty.on { background: #ff3d8b; color: #fff; }
#hSound .cross { display: none; }
#hSound.off .cross { display: inline; } #hSound.off .wave { display: none; }

/* ---------- Touch controls ---------- */
#touch { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
#stick { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: max(24px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.3); border: 3px solid rgba(255,255,255,.85); pointer-events: auto; touch-action: none; display: flex; align-items: center; justify-content: center; }
#knob { width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: 0 4px 0 rgba(74,47,102,.3); pointer-events: none; }
#tBtns { position: absolute; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 12px; pointer-events: auto; }
#tAct { width: 128px; height: 128px; border-radius: 50%; border: 5px solid #fff; background: radial-gradient(circle at 35% 30%, #ff8ac0, #ff3d8b 70%); color: #fff; font-size: 26px; font-weight: 700; box-shadow: 0 5px 0 var(--pink-dark); touch-action: none; padding: 8px; line-height: 1.1; }
#tAct.long { font-size: 17px; }
.t-small { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: var(--purple); color: #fff; font-size: 16px; font-weight: 600; box-shadow: 0 4px 0 var(--purple-dark); touch-action: none; }

/* ---------- Toast, rotate notice, errors ---------- */
#toast { position: fixed; z-index: 30; left: 50%; top: max(80px, env(safe-area-inset-top)); transform: translate(-50%, -10px); opacity: 0; transition: opacity .25s, transform .25s; background: #fff; color: #4a2f66; font-size: 19px; font-weight: 600; padding: 12px 22px; border-radius: 18px; box-shadow: 0 5px 0 rgba(74,47,102,.3); max-width: min(92vw, 640px); text-align: center; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#refocus { position: fixed; z-index: 40; inset: 0; width: 100%; border: 0; background: rgba(74,47,102,.35); color: #fff; font: inherit; font-size: 30px; font-weight: 700; text-shadow: 0 3px 0 rgba(74,47,102,.6); cursor: pointer; }
#refocus[hidden] { display: none; }
#rotate { display: none; }
@media (orientation: portrait) and (max-width: 900px) and (pointer: coarse) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 50; background: #6d4c86; color: #fff; align-items: center; justify-content: center; text-align: center; padding: 24px; }
  #rotate div { display: flex; flex-direction: column; gap: 8px; }
  #rotate b { font-size: 30px; } #rotate span { font-size: 18px; }
}
#err { position: fixed; left: 8px; bottom: 8px; z-index: 99; max-width: 70vw; max-height: 40vh; overflow: auto; background: #fff0f0; color: #a00; font: 12px/1.4 monospace; padding: 8px; border: 2px solid #a00; border-radius: 8px; white-space: pre-wrap; }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .av-grid { grid-template-columns: minmax(0, 1fr); }
  .av-left { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .stage { width: 220px; }
  .draw-body { grid-template-columns: minmax(0, 1fr); }
  .tools { flex-direction: row; flex-wrap: wrap; }
  .colors { grid-template-columns: repeat(6, 38px); }
  .colors .sw { width: 38px; height: 38px; }
}
@media (max-width: 640px) {
  .cards, .cards.two { grid-template-columns: minmax(0, 1fr); }
  .card canvas { max-width: 160px; }
  .opt-row { grid-template-columns: minmax(0, 1fr); }
  .paper-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help div { grid-template-columns: minmax(0, 1fr); }
  .hud-btn span:not(.hud-emo) { display: none; }
}

/* ---------- Talking to a classmate ---------- */
.chat-screen .chat { width: min(720px, 100%); }
.chat-top { display: flex; gap: 18px; align-items: center; }
.chat canvas.face { width: 112px; height: 112px; border-radius: 50%; background: #ffe3ef; border: 4px solid #ffd0e3; flex: none; }
.chat-name { font-weight: 700; font-size: 20px; color: var(--purple); margin-bottom: 6px; }
.chat-name .heart { color: var(--pink); font-size: 16px; margin-left: 6px; }
.chat .speech { background: #fff8fb; border: 3px solid #ffd0e3; border-radius: 20px; padding: 12px 18px; font-size: 22px; line-height: 1.35; color: #4a2f66; }
.chat .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.chat .opts.places { grid-template-columns: repeat(3, 1fr); }
.chat .opts button { display: flex; align-items: center; gap: 10px; text-align: left; }
.chat .opts kbd { font-family: var(--font); font-size: 13px; background: #f0e8fb; color: #7b5cff; border-radius: 6px; padding: 1px 7px; flex: none; }
.chat .opts .emo { font-size: 24px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
@media (max-width: 600px) { .chat .opts, .chat .opts.places { grid-template-columns: 1fr 1fr; } .chat .speech { font-size: 18px; } }

/* Keyboard highlight in menus */
.screen .sel { outline: 5px solid var(--pink); outline-offset: 3px; position: relative; z-index: 1; transform: scale(1.04); }
.chat .keys-hint { margin: 14px 0 0; text-align: center; font-size: 14px; color: #9a86b8; }

/* ---------- Ice cream parlour ---------- */
.ice-screen .icecream { width: min(980px, 100%); }
.ice-body { display: flex; gap: 22px; align-items: flex-start; margin-top: 14px; }
#iceCv { width: 260px; height: auto; background: #fff4f8; border-radius: 22px; border: 4px solid #ffd0e3; flex: none; }
.ice-opts h3 { margin: 6px 0 8px; color: #4a2f66; font-size: 18px; }
.ice-opts .row-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ice-opts .mid { font-size: 16px; padding: 8px 14px; }
.ice-opts .flavour i { display: inline-block; width: 16px; height: 16px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; border: 2px solid rgba(0,0,0,0.1); }
@media (max-width: 700px) { .ice-body { flex-direction: column; align-items: center; } }
/* more places to choose in the chat */
/* places to go together: small picture tiles */
.chat .opts.places { grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chat .opts.places button { flex-direction: column; justify-content: center; text-align: center; gap: 4px; padding: 10px 4px 8px; font-size: 13px; line-height: 1.15; min-height: 84px; }
.chat .opts.places kbd { display: none; }
.chat .opts.places .emo { font-size: 28px; }
.chat .opts.places button:last-child { font-size: 15px; }
@media (max-width: 700px) { .chat .opts.places { grid-template-columns: repeat(3, 1fr); } }

/* ---------- School map ---------- */
.map-screen .map-panel { width: min(1180px, 100%); }
.map-wrap { position: relative; margin: 10px auto 0; width: max-content; max-width: 100%; border-radius: 18px; overflow: hidden; border: 4px solid #e8dcff; line-height: 0; }
.map-wrap canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 220px); }
.map-screen .map-panel { padding-top: 16px; padding-bottom: 16px; }
.map-screen .map-panel h1 { font-size: 30px; }
.map-pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 2px; line-height: 1; }
.map-pin .emo { width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 3px solid #ffd23f; display: flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: 0 3px 0 rgba(74,47,102,.3); font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.map-pin b { font-size: 12px; background: rgba(255,255,255,.95); color: #4a2f66; border-radius: 8px; padding: 2px 6px; white-space: nowrap; }
.map-pin.on .emo, .map-pin.sel .emo { border-color: var(--pink); transform: scale(1.18); }
.map-pin.on b { background: var(--pink); color: #fff; }
.screen .map-pin.sel { outline: none; position: absolute; z-index: 2; transform: translate(-50%, -50%) scale(1.08); }
.map-pin.sel b { outline: 3px solid var(--pink); }
.map-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.map-bar #mapName { flex: 1; font-size: 20px; font-weight: 600; color: #4a2f66; min-width: 180px; }
.map-bar button:disabled { opacity: .45; cursor: default; }
@media (max-width: 700px) { .map-pin b { display: none; } .map-pin .emo { width: 30px; height: 30px; font-size: 16px; } }

.gender-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 600; color: #4a2f66; }
.gender-row .mid { padding: 6px 16px; font-size: 16px; }

/* ---------- Learning screens ---------- */
.learn .learn-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; }
.learn .learn-opts.books { grid-template-columns: 1fr 1fr; }
.learn .big-emo { flex-direction: column; gap: 6px; min-height: 96px; justify-content: center; text-align: center; }
.learn .big-emo .emo { font-size: 34px; line-height: 1; }
.learn .done-tick { color: #2fae6a; }
.learn .small-note { font-size: 15px; color: #8a6aa8; margin: 8px 0 0; }
.learn h3 { margin: 16px 0 6px; color: #4a2f66; }
.learn .row-wrap .mid.on { outline: 3px solid var(--purple); background: #f3eefe; }
.hud-emo { font-size: 22px; line-height: 1; }
/* shop */
.shop-body { display: grid; grid-template-columns: 1fr 200px 1.3fr; gap: 16px; align-items: center; margin-top: 10px; }
.shop-cust { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.shop-cust .face { width: 96px; height: 96px; border-radius: 50%; background: #ffe3ef; }
.shop-cust .speech { background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 10px 14px; font-size: 18px; }
.shop-opts .row-wrap { margin-bottom: 10px; }
.coin-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0; font-size: 22px; }
.coin-row .small-note { flex-basis: 100%; text-align: center; font-size: 18px; }
.scoop-coins { background: #fff8d6; border-radius: 12px; padding: 4px 10px; }
@media (max-width: 760px) { .shop-body { grid-template-columns: 1fr; } }
/* art lab */
.mix-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.pot { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; font: 600 16px var(--font); color: #4a2f66; text-transform: capitalize; cursor: pointer; }
.pot i { width: 48px; height: 40px; border-radius: 6px 6px 18px 18px; border: 2px solid #d9cce9; }
.pot.on { border-color: var(--purple); transform: translateY(-4px); }
.mix-bowl { display: flex; justify-content: center; margin: 8px 0 4px; }
.mix-bowl i { width: 150px; height: 70px; border-radius: 0 0 75px 75px; border: 5px solid #c9b6e0; border-top-width: 2px; transition: background .4s; }
.mirror-grid { display: grid; gap: 4px; max-width: 420px; margin: 12px auto; }
.mirror-grid .cell { aspect-ratio: 1; border: 2px solid #e3d6f2; border-radius: 6px; background: #fff; cursor: pointer; padding: 0; min-width: 0; }
.mirror-grid .cell.fixed { cursor: default; background: #faf7fe; }
.mirror-grid .cell.mid-line { box-shadow: -4px 0 0 #ff9ec4; }
.mirror-grid .cell.oops { animation: oops 0.8s ease-in-out infinite alternate; }
@keyframes oops { from { border-color: #ffd23f; } to { border-color: #ff9f43; box-shadow: 0 0 0 3px #ffe9a8; } }
/* compass, clock */
.compass-big { display: flex; justify-content: center; margin: 6px 0; }
.chat .speech canvas.clock-cv { display: block; width: 150px; height: 150px; margin: 8px auto 0; }
/* copy my moves */
.pads { display: grid; grid-template-columns: repeat(3, 90px); grid-template-rows: repeat(3, 90px); gap: 8px; justify-content: center; margin: 14px 0; }
.pad { border: 0; border-radius: 22px; background: var(--c); opacity: .55; font-size: 36px; cursor: pointer; transition: transform .1s, opacity .1s; }
.pad.lit { opacity: 1; transform: scale(1.1); box-shadow: 0 0 0 6px #fff, 0 0 24px var(--c); }
.pad-up { grid-column: 2; grid-row: 1; } .pad-left { grid-column: 1; grid-row: 2; } .pad-right { grid-column: 3; grid-row: 2; } .pad-down { grid-column: 2; grid-row: 3; }
/* stories and spelling */
.story-pic { font-size: 72px; text-align: center; margin: 10px 0; letter-spacing: 8px; }
.story-text { font-size: 24px; line-height: 1.5; color: #3d2756; text-align: center; margin: 0 0 12px; }
.spell canvas { display: block; width: 100%; max-width: 640px; margin: 10px auto; border-radius: 16px; touch-action: none; }
/* sticker book */
.book .stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.sticker { background: #f6f2fb; border: 2px dashed #d9cce9; border-radius: 14px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.sticker span { font-size: 30px; color: #c9b6e0; font-weight: 700; }
.sticker b { font-size: 12px; font-weight: 600; color: #8a6aa8; }
.sticker.got { background: #fff8d6; border: 2px solid #ffd23f; }
.sticker.got b { color: #4a2f66; }
.learn-week { padding-left: 18px; line-height: 1.6; font-size: 16px; }
.learn-week span { color: #8a6aa8; }

/* two players: icon-only buttons so they don't cover player 2's name */
#hud.compact .hud-btn span:not(.hud-emo) { display: none; }
#hud.compact .hud-btn { min-width: 46px; height: 46px; padding: 0 10px; }
/* treasure hunt clue card */
.hunt-steps { display: flex; align-items: center; justify-content: center; gap: 0; margin: 6px 0 2px; }
.hunt-steps span { font-size: 26px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #f3eefa; filter: grayscale(1); opacity: .5; }
.hunt-steps span.got { background: #fff3c4; filter: none; opacity: 1; }
.hunt-steps span.now { background: #fff; filter: none; opacity: 1; box-shadow: 0 0 0 3px #ffc21a; animation: nowpulse 1s ease-in-out infinite alternate; }
.hunt-steps i { width: 34px; height: 4px; background: #e8dcf5; border-radius: 2px; }
@keyframes nowpulse { to { box-shadow: 0 0 0 6px #ffe08a; } }
.clue-box { display: flex; align-items: center; gap: 18px; background: #fff8e6; border: 3px solid #ffc21a; border-radius: 20px; padding: 12px 18px; margin: 10px 0; }
.clue-box canvas { width: 120px; height: 120px; flex: none; }
.clue-box div { display: flex; flex-direction: column; gap: 2px; }
.clue-box b { font-size: 30px; color: #4a2f66; letter-spacing: .5px; }
.clue-box span { font-size: 18px; color: #c98a00; font-weight: 700; }
.clue-box em { font-style: normal; font-size: 22px; color: #4a2f66; }
.wonder-big { font-size: 72px; text-align: center; margin: 4px 0; }
.wonder-text { font-size: 24px; font-weight: 600; line-height: 1.4; color: #4a2f66; text-align: center; margin: 6px 8px 14px; }
.tabs { margin: 4px 0 10px; }
.wlist { display: flex; flex-direction: column; gap: 6px; }
.wrow { display: flex; align-items: center; gap: 10px; background: #f6f2fb; border: 2px dashed #d9cce9; border-radius: 14px; padding: 6px 10px; }
.wrow.got { background: #fff8d6; border: 2px solid #ffd23f; }
.wrow p { flex: 1; margin: 0; font-size: 16px; color: #4a2f66; }
.wrow:not(.got) p { color: #8a6aa8; }
.wemo { font-size: 28px; width: 40px; text-align: center; }
.wemo.q { color: #c9b6e0; font-weight: 700; }
.wtodo { margin-top: 6px; }
.jukebox .songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.jukebox .song { justify-content: flex-start; text-align: left; }
.jukebox .song .emo { font-size: 26px; margin-right: 8px; }
.jukebox .on { background: #fff1a8; box-shadow: 0 0 0 3px #ffc21a inset, 0 4px 0 rgba(74,47,102,.25); }
.game-opts button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.game-opts button b { display: block; font-size: 18px; }
.game-opts small { display: block; }
.game-opts small { font-size: 13px; font-weight: 500; color: #7a5a98; }
.pd-card { display: flex; flex-direction: column; gap: 8px; background: #fff8d6; border: 2px solid #ffd23f; border-radius: 16px; padding: 12px 16px; margin: 6px 0 10px; }
.pd-card div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.pd-card span { color: #8a6aa8; font-size: 15px; }
.pd-card b { font-size: 24px; color: #4a2f66; }
.online select { font: inherit; font-size: 18px; padding: 6px 10px; border-radius: 12px; border: 2px solid #d9cce9; }
.pd-row p small { color: #8a6aa8; }
.jb-fact { min-height: 1.4em; margin-top: 10px; }
.wtodo .sticker span { font-size: 22px; }
.wrow .read { padding: 4px 10px; min-width: 0; }
.treasure-big { font-size: 64px; text-align: center; letter-spacing: 6px; animation: nowpulse 1s infinite alternate; }

/* ---------- The time machine ---------- */
.tm-panel .timeline { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 6px 0 14px; position: relative; padding-bottom: 6px; }
.tm-card { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 8px; border-radius: 18px; border: 3px solid var(--line); background: #fff; color: var(--ink); font-family: var(--font); min-height: 150px; box-shadow: 0 4px 0 #d9c9ef; }
.tm-card .emo { font-size: 40px; line-height: 1.1; background: #fff; border-radius: 50%; }
.tm-card b { font-size: 15px; line-height: 1.15; }
.tm-card i { font-style: normal; font-size: 12.5px; color: var(--ink-soft); line-height: 1.2; }
.tm-card em { font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #fff0f6; color: var(--pink-dark); margin-top: auto; }
.tm-card.soon { opacity: .62; }
.tm-card.here { background: #f0fff4; border-color: #52d273; }
.tm-card.here em { background: #d9f7e2; color: #237a44; }
.tm-card.locked { background: #2a1f45; color: #fff; border-color: #4a3a75; }
.tm-card.locked i { color: #c9b8ef; }
.tm-card.on { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(123,92,255,.25), 0 4px 0 #d9c9ef; opacity: 1; }
.tm-card:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }
.tm-detail { min-height: 64px; font-size: 18px; line-height: 1.45; background: #f8f4ff; border-radius: 18px; padding: 12px 16px; margin-bottom: 14px; }
.tm-detail .soon-tag { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--pink-dark); }
@media (max-width: 760px) { .tm-panel .timeline { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.passport .stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.passport { background: linear-gradient(#fff, #fff7f0); }
.stamp i { font-style: normal; font-size: 12px; color: #8a6aa8; line-height: 1.2; }
.stamp.got { transform: rotate(-2deg); background: #fff1e6; border: 3px solid #e85d3a; }
.stamp.got span { color: inherit; }
.tm-paint .paint-wrap { display: flex; justify-content: center; margin: 4px 0 10px; }
.tm-paint canvas { max-width: 100%; height: auto; border-radius: 16px; touch-action: none; cursor: crosshair; background: #fff; box-shadow: 0 4px 14px rgba(74,47,102,.15); }
.tm-paint canvas.paint-palm { background: transparent; box-shadow: none; }
.tm-paint .ink i { display: inline-block; width: 18px; height: 18px; border-radius: 50%; margin-right: 6px; vertical-align: -3px; border: 2px solid rgba(0,0,0,.15); }
.tm-paint .row-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; justify-content: center; }
.tm-stars canvas, .tm-dino canvas { display: block; width: 100%; height: auto; border-radius: 18px; margin: 4px 0 8px; }
.tm-dino .wonder-text { font-size: 21px; margin: 4px 8px 10px; }
.pachisi .pc-body { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pachisi #pcCv { width: min(460px, 100%); height: auto; border-radius: 16px; }
.pachisi .pc-side { flex: 1; min-width: 240px; max-width: 340px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.pachisi .pc-msg { font-size: 20px; min-height: 56px; margin: 0; line-height: 1.35; }
.pachisi #pcShells { width: 300px; max-width: 100%; height: auto; background: #f6e7c8; border-radius: 14px; }
.tm-stars canvas, .tm-dino canvas { width: auto; max-width: 100%; max-height: 54vh; margin-left: auto; margin-right: auto; }

.gallery-view .gv-pic { display: flex; justify-content: center; align-items: center; background: #f6f0ff; border-radius: 16px; padding: 14px; min-height: 240px; }
.gallery-view .gv-pic img { max-width: 100%; max-height: 56vh; border: 10px solid #ffffff; border-radius: 10px; box-shadow: 0 6px 18px rgba(74, 47, 102, 0.25); }
