* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: #1a2a3a;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}

#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- Rotate prompt ---------- */
#rotate-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #1a2a3a; color: #fff;
  display: none; align-items: center; justify-content: center; text-align: center;
}
@media (orientation: portrait) { #rotate-overlay { display: flex; } }
.rotate-icon { font-size: 64px; margin-bottom: 16px; }
.rotate-inner p { opacity: .7; margin-top: 8px; }

/* ---------- Pet selection ---------- */
#select-screen {
  position: fixed; inset: 0; z-index: 50;
  background: linear-gradient(160deg, #7ec8e3 0%, #b8e0c9 60%, #f5e6b8 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 12px;
}
.game-title { font-size: clamp(26px, 5vw, 44px); color: #2c3e50; text-shadow: 0 2px 0 rgba(255,255,255,.6); }
.subtitle { color: #44607a; font-size: clamp(13px, 2vw, 17px); }

#pet-cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pet-card {
  width: clamp(90px, 14vw, 130px); padding: 12px 6px;
  background: rgba(255,255,255,.85); border: 3px solid transparent; border-radius: 16px;
  text-align: center; cursor: pointer; transition: transform .12s, border-color .12s;
}
.pet-card:active { transform: scale(.95); }
.pet-card.selected { border-color: #ff9f43; background: #fff; transform: translateY(-4px); }
.pet-card .pet-emoji { font-size: clamp(34px, 6vw, 52px); }
.pet-card .pet-label { font-weight: bold; color: #2c3e50; margin-top: 4px; }
.pet-card .pet-desc { font-size: 11px; color: #7a8aa0; margin-top: 2px; }

.name-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
#pet-name-input {
  padding: 10px 14px; border-radius: 12px; border: 2px solid #b0c4d4;
  font-size: 16px; width: 200px; outline: none; user-select: text; -webkit-user-select: text;
}

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 12px; padding: 10px 18px; font-size: 16px; font-weight: bold;
  cursor: pointer; color: #fff; background: #6c7a89;
  box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-primary { background: #ff9f43; }
.btn-primary:disabled { background: #c8c8c8; cursor: default; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud-top {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; gap: 8px; justify-content: space-between;
}
.hud-pill {
  background: rgba(20, 32, 44, .65); color: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: bold; backdrop-filter: blur(4px);
}

#joystick-zone {
  position: absolute; left: 0; bottom: 0; width: 45%; height: 65%;
  pointer-events: auto;
}
/* drag on the right side to rotate the camera */
#camera-zone {
  position: absolute; right: 0; top: 58px; width: 55%; height: 82%;
  pointer-events: auto; touch-action: none;
}
#joystick-base {
  position: absolute; left: 36px; bottom: 36px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3);
  display: none;
}
#joystick-base.active { display: block; }
#joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; background: rgba(255,255,255,.55);
}

#interact-btn {
  position: absolute; right: 26px; bottom: 44px; pointer-events: auto;
  border: none; border-radius: 999px; padding: 16px 22px;
  font-size: 16px; font-weight: bold; color: #4a2c00; background: #ffd166;
  box-shadow: 0 4px 0 #d4a437; max-width: 42vw;
}
#interact-btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Modal / panels ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(10, 18, 28, .55);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.panel {
  background: #fdf6ec; border-radius: 18px; padding: 18px;
  width: min(560px, 94vw); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.panel h2 { color: #2c3e50; margin-bottom: 10px; font-size: 20px; }
#modal-body { color: #44505e; font-size: 15px; line-height: 1.45; }
#modal-buttons { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: flex-end; }

/* shop / decor grids inside modal */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; margin-top: 8px; }
.item-card {
  background: #fff; border: 2px solid #e3d9c8; border-radius: 12px; padding: 8px;
  text-align: center; cursor: pointer; font-size: 13px;
}
.item-card .item-icon { font-size: 28px; }
.item-card .item-img { width: 100%; height: 72px; object-fit: contain; display: block;
  background: linear-gradient(160deg, #fbf6ec, #efe4d0); border-radius: 9px; }
.item-card .item-name { font-weight: bold; color: #2c3e50; margin: 2px 0; }
.item-card .item-price { color: #b07a18; font-weight: bold; }
.item-card.owned { border-color: #7dba6f; }
.item-card.equipped { border-color: #ff9f43; background: #fff4e3; }
.item-card .item-status { font-size: 11px; color: #7dba6f; }
.shop-tabs { display: flex; gap: 6px; margin-bottom: 4px; }
.shop-tab { flex: 1; padding: 7px; border-radius: 10px; border: none; font-weight: bold; background: #e8dcc8; color: #6b5b3e; cursor: pointer; }
.shop-tab.active { background: #ff9f43; color: #fff; }

/* ---------- Chat ---------- */
.panel.chat { display: flex; flex-direction: column; height: min(420px, 84vh); }
.chat-header { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid #eadfce; padding-bottom: 8px; }
#chat-avatar { font-size: 34px; }
#chat-name { font-weight: bold; color: #2c3e50; }
#chat-sub { font-size: 12px; color: #8a96a3; }
.close-x { margin-left: auto; border: none; background: #e8dcc8; border-radius: 50%; width: 32px; height: 32px; font-size: 15px; cursor: pointer; }
#chat-messages { flex: 1; overflow-y: auto; padding: 10px 2px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.35; }
.msg.them { background: #e9eef4; color: #2c3e50; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: #ff9f43; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input-row { display: flex; gap: 8px; padding-top: 8px; }
#chat-input {
  flex: 1; padding: 10px 12px; border-radius: 12px; border: 2px solid #d8ccb8;
  font-size: 15px; outline: none; user-select: text; -webkit-user-select: text;
}

/* ---------- Focus / pomodoro lock ---------- */
#focus-overlay {
  position: fixed; inset: 0; z-index: 60;
  /* low-opacity scrim so the player can still see their character studying */
  background: rgba(16, 24, 40, 0.16);
  display: flex; align-items: center; justify-content: center; text-align: center; color: #fff;
}
#focus-overlay.is-break { background: rgba(20, 38, 30, 0.16); }
.focus-inner {
  background: rgba(18, 28, 46, 0.42);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 26px; padding: 20px 32px;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  box-shadow: 0 12px 44px rgba(0,0,0,0.28);
}
#focus-overlay.is-break .focus-inner { background: rgba(20, 40, 32, 0.42); }
#focus-emoji { font-size: 56px; }
#focus-timer { font-size: clamp(56px, 14vw, 110px); font-weight: bold; letter-spacing: 4px; font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
#focus-label { opacity: .75; margin-top: 4px; }
#focus-quote { opacity: .55; font-style: italic; margin-top: 14px; font-size: 14px; max-width: 70vw; margin-left: auto; margin-right: auto; }
#focus-giveup {
  margin-top: 26px; padding: 12px 22px; border-radius: 999px; border: 2px solid rgba(255,255,255,.35);
  background: transparent; color: rgba(255,255,255,.7); font-size: 14px; cursor: pointer;
  position: relative; overflow: hidden;
}
#focus-giveup .fill {
  position: absolute; inset: 0; width: 0%; background: rgba(231, 76, 60, .55); transition: none;
}
#focus-giveup span { position: relative; }

/* ---------- Pomodoro setup ---------- */
.pomo { display: flex; flex-direction: column; gap: 10px; }
.pomo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pomo-cap { font-weight: 600; font-size: 15px; }
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; background: #e9dfca; color: #5a4a2e;
}
.stepper button:active { background: #ddcfb0; }
.stepper b { min-width: 2.4ch; text-align: center; font-size: 24px; }
.stepper i { opacity: .55; font-style: normal; font-size: 13px; }
.pomo-presets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pomo-presets button {
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(0,0,0,.16);
  background: #fff; cursor: pointer; font-size: 14px;
}
.pomo-presets button:active { background: #f0e9d8; }
.pomo-hint { opacity: .6; font-size: 12px; text-align: center; margin: 2px 0 0; }

/* ---------- Room editor ---------- */
#room-editor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 14px;
  pointer-events: none; background: linear-gradient(to top, rgba(10,14,24,.55), transparent);
}
#room-editor > * { pointer-events: auto; }
#re-top { display: flex; align-items: center; gap: 12px; }
#re-title { font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
#re-hint { flex: 1; color: rgba(255,255,255,.85); font-size: 13px; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
#re-sel { display: flex; gap: 8px; }
.re-btn {
  border: none; border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; background: rgba(255,255,255,.92); color: #2c2233;
}
.re-btn.re-primary { background: #ffd166; }
.re-btn.re-danger { background: #ef6f6f; color: #fff; }
.re-btn:active { transform: translateY(1px); }
#re-palette { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; -webkit-overflow-scrolling: touch; }
.re-item {
  flex: 0 0 auto; width: 78px; padding: 8px 6px; border-radius: 14px; border: none; cursor: pointer;
  background: rgba(28,34,52,.78); color: #fff; text-align: center; backdrop-filter: blur(2px);
}
.re-item .ic { font-size: 26px; display: block; line-height: 1.1; }
.re-item .nm { font-size: 11px; opacity: .85; }
.re-item:active { background: rgba(60,70,100,.9); }
.re-item .ct { font-size: 11px; font-weight: 700; color: #ffd166; }
.re-item:disabled, .re-item.disabled { opacity: .4; }
.item-buy { margin-top: 4px; font-size: 12px; font-weight: 700; color: #2c8a4a; }
/* bottom-left "edit room" button, only while in the bedroom */
#edit-room-btn {
  position: absolute; left: 16px; bottom: 18px; z-index: 6; pointer-events: auto;
  border: none; border-radius: 999px; padding: 12px 18px; font-size: 15px; font-weight: 700;
  background: #ffd166; color: #5a4a1e; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer;
}
#edit-room-btn:active { transform: translateY(1px); }
/* hide the normal controls while editing */
#hud.editing #joystick-zone, #hud.editing #interact-btn, #hud.editing #camera-zone, #hud.editing #edit-room-btn { display: none; }

/* ---------- 3D basketball ---------- */
#bball-hud { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
#bball-hud > * { pointer-events: auto; }
#bball-top {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 8px 14px;
  background: rgba(12,20,30,.6); border-radius: 999px; color: #fff; font-weight: 700;
}
#bball-time { opacity: .9; }
#bball-msg {
  position: absolute; top: 24%; left: 0; right: 0; text-align: center;
  font-size: clamp(28px, 7vw, 54px); font-weight: 800; color: #ffd166;
  text-shadow: 0 3px 16px rgba(0,0,0,.6); pointer-events: none;
}
#bball-meter {
  position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%);
  width: min(60vw, 320px); height: 18px; border-radius: 999px; pointer-events: none;
  background: rgba(0,0,0,.45); overflow: hidden; border: 2px solid rgba(255,255,255,.3);
}
#bball-sweet { position: absolute; left: 74%; width: 14%; top: 0; bottom: 0; background: rgba(107,224,160,.55); }
#bball-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: #ffd166; }
#bball-actions { position: absolute; right: 22px; bottom: 28px; display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
.bb-btn {
  border: 1.5px solid rgba(255,255,255,.5); border-radius: 18px; padding: 16px 22px; min-width: 100px;
  font-size: 16px; font-weight: 700; text-align: center; color: #fff; cursor: pointer;
  background: rgba(255,255,255,.28); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  box-shadow: 0 4px 14px rgba(0,0,0,.25); text-shadow: 0 1px 3px rgba(0,0,0,.45);
  touch-action: none; user-select: none;
}
.bb-btn:active { transform: translateY(1px); background: rgba(255,255,255,.42); }
.bb-shoot { background: rgba(224,122,51,.6); border-color: rgba(255,235,210,.6); font-size: 20px; padding: 22px 30px; min-width: 124px; }
.bb-shoot:active { background: rgba(224,122,51,.78); }
#bball-top .bb-btn { padding: 6px 14px; min-width: 0; font-size: 13px; color: #20303f; background: rgba(255,255,255,.85); border-color: transparent; }
#hud.playing-bball #interact-btn, #hud.playing-bball #edit-room-btn { display: none; }

/* ---------- First-person table dining ---------- */
#table-hud { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
#table-hud > * { pointer-events: auto; }
#table-msg {
  position: absolute; top: 16%; left: 0; right: 0; text-align: center;
  font-size: clamp(16px, 3.4vw, 24px); font-weight: 700; color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.6); pointer-events: none; padding: 0 16px;
}
#table-actions {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center;
}
#table-bite { background: rgba(224,122,51,.6); border-color: rgba(255,235,210,.6); }
#table-bite:active { background: rgba(224,122,51,.78); }
/* while seated, hide the roaming controls but keep the 🎒 inventory reachable */
#hud.dining #joystick-zone, #hud.dining #interact-btn, #hud.dining #camera-zone,
#hud.dining #edit-room-btn, #hud.dining #needs-hud { display: none; }

/* ---------- Mini-game ---------- */
#minigame-overlay { position: fixed; inset: 0; z-index: 40; background: #102030; }
#minigame-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#minigame-hud {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 12px; color: #fff; font-weight: bold;
  pointer-events: none;
}
#minigame-hud .btn { pointer-events: auto; margin-left: auto; }
#minigame-title { font-size: 16px; }
#minigame-score { font-size: 16px; color: #ffd166; }

/* NPC speech bubbles rendered as DOM */
.speech-bubble {
  position: fixed; z-index: 5; transform: translate(-50%, -100%);
  background: #fff; color: #2c3e50; border-radius: 12px; padding: 5px 10px;
  font-size: 13px; font-weight: bold; pointer-events: none; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.speech-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px;
  border: 6px solid transparent; border-top-color: #fff; border-bottom: none;
}

/* ---------- Fitting-room try-on ---------- */
#tryon-overlay { position: fixed; inset: 0; z-index: 60;
  background: radial-gradient(120% 90% at 50% 18%, #4a3b53 0%, #2a2230 70%, #1d1822 100%); }
/* split layout: item list on the left, live character preview on the right */
#tryon-canvas { position: absolute; top: 0; bottom: 0; left: 42%; width: 58%; height: 100%; touch-action: none; }
#tryon-top { position: absolute; top: 12px; left: calc(42% + 29%); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 8px 16px; z-index: 2;
  background: rgba(20,16,26,.55); border-radius: 999px; color: #fff; font-weight: 700; backdrop-filter: blur(6px); }
#tryon-coins.flash { color: #ff6b6b; animation: tryonflash .5s; }
@keyframes tryonflash { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
#tryon-rotate { position: absolute; top: 50%; left: 42%; right: 0; display: flex; justify-content: space-between;
  padding: 0 10px; pointer-events: none; }
.tryon-arrow { pointer-events: auto; width: 46px; height: 46px; border-radius: 50%; border: none;
  font-size: 26px; line-height: 1; color: #fff; background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px); cursor: pointer; }
.tryon-arrow:active { background: rgba(255,255,255,.32); }
#tryon-items { position: absolute; left: 0; top: 0; bottom: 0; width: 42%;
  display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(90deg, rgba(20,16,26,.82), rgba(20,16,26,.5)); }
.tryon-item { flex: 0 0 auto; width: 100%; border: 2px solid rgba(255,255,255,.22); border-radius: 14px;
  background: rgba(255,255,255,.94); padding: 8px 10px; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 10px; }
.tryon-item img { width: 52px; height: 52px; object-fit: contain;
  background: linear-gradient(160deg, #fbf6ec, #efe4d0); border-radius: 9px; }
.tryon-item .ti-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tryon-item .ti-name { font-size: 14px; font-weight: 700; color: #2c3e50; }
.tryon-item .ti-tag { font-size: 12px; color: #7a6a55; }
.tryon-item.on { border-color: #ff9f43; background: #fff4e3; }
.tryon-item.on .ti-tag { color: #d2791f; font-weight: 700; }
.tryon-item.locked .ti-tag { color: #b07a18; font-weight: 700; }

/* ---------- Campus-life HUD: level pill, needs, menu ---------- */
#hud-level { display: flex; align-items: center; gap: 6px; }
.xp-mini { display: inline-block; width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.xp-mini > span { display: block; height: 100%; width: 0%; background: #7ec8e3; transition: width .3s; }
#menu-btn { pointer-events: auto; border: none; cursor: pointer; font-size: 15px; }
#needs-hud { position: absolute; top: max(46px, calc(env(safe-area-inset-top) + 38px)); left: 12px;
  display: flex; flex-direction: column; gap: 4px; background: rgba(20,32,44,.5);
  padding: 7px 9px; border-radius: 12px; backdrop-filter: blur(4px); }
.need { display: flex; align-items: center; gap: 6px; }
.need-ic { font-size: 12px; width: 16px; text-align: center; }
.need-bar { display: inline-block; width: 76px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.need-bar > span { display: block; height: 100%; width: 100%; border-radius: 4px; transition: width .4s, background .4s; }

/* ---------- Campus panel ---------- */
.cp-head { display: flex; align-items: center; margin-bottom: 8px; }
.cp-head h2 { flex: 1; margin: 0; }
.cp-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.cp-tab { flex: 1; padding: 8px; border: none; border-radius: 10px; font-weight: bold; cursor: pointer;
  background: #e8dcc8; color: #6b5b3e; }
.cp-tab.active { background: #ff9f43; color: #fff; }
.cp-day { font-weight: bold; color: #2c3e50; margin: 4px 0 8px; }
.cp-empty { color: #8a7a64; font-size: 14px; padding: 8px 0; }
.cp-bar { height: 8px; border-radius: 5px; background: #e7ddcb; overflow: hidden; margin: 3px 0; }
.cp-bar-fill { height: 100%; border-radius: 5px; transition: width .3s; }
.cp-quest { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #ece2d2;
  border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.cp-quest.done { border-color: #6be0a0; }
.cp-quest.claimed { opacity: .55; }
.cp-q-icon { font-size: 24px; }
.cp-q-main { flex: 1; min-width: 0; }
.cp-q-text { font-weight: bold; color: #2c3e50; font-size: 14px; }
.cp-q-sub { font-size: 12px; color: #8a7a64; }
.cp-q-btn { border: none; border-radius: 10px; padding: 8px 12px; font-weight: bold; cursor: pointer;
  background: #ff9f43; color: #fff; }
.cp-q-btn:disabled { background: #d8cdbb; color: #fff; cursor: default; }
.cp-friend { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #ece2d2;
  border-radius: 12px; padding: 8px 10px; margin-bottom: 6px; }
.cp-f-icon { font-size: 22px; }
.cp-f-name { font-weight: bold; color: #2c3e50; }
.cp-f-tier { font-size: 12px; color: #8a7a64; }
.cp-xp { font-size: 13px; color: #5a6b7a; margin-bottom: 10px; }
.cp-needs .cp-need { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #44505e; margin-bottom: 4px; }
.cp-needs .cp-need > span:first-child { width: 92px; }
.cp-needs .cp-need .cp-bar { flex: 1; }
.cp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px;
  font-size: 13px; color: #44505e; }
.cp-stats > div { background: #f3ece0; border-radius: 8px; padding: 7px 9px; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); z-index: 80; pointer-events: none;
  background: rgba(24,18,30,.9); color: #fff; font-weight: 700; padding: 11px 18px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px; opacity: 0; transition: opacity .25s, transform .25s; max-width: 80vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Dining hall ---------- */
.dh-bal { font-weight: 700; color: #6b5b3e; margin-bottom: 6px; }
.food-card .food-fx { font-size: 11px; color: #5a8a5a; margin: 2px 0; }

/* cooking shift mini-game */
#cook-overlay { position: fixed; inset: 0; z-index: 62;
  background: radial-gradient(120% 90% at 50% 30%, #3a2f28 0%, #241c17 75%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
#cook-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; padding: 8px 16px; color: #fff; font-weight: 800;
  background: rgba(0,0,0,.4); border-radius: 999px; }
#cook-combo { color: #ffb04a; }
#cook-stage { text-align: center; }
#cook-label { color: #f0e6d6; font-weight: 700; margin-bottom: 6px; }
#cook-order { font-size: clamp(70px, 18vw, 140px); line-height: 1; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
#cook-order.good { animation: cookgood .3s; }
#cook-order.bad { animation: cookbad .3s; }
@keyframes cookgood { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes cookbad { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-12px); } 75% { transform: translateX(12px); } }
#cook-timer { width: min(70vw, 360px); height: 12px; border-radius: 8px; background: rgba(255,255,255,.18);
  overflow: hidden; margin: 12px auto 0; }
#cook-timer-fill { height: 100%; width: 100%; background: #6be0a0; border-radius: 8px; transition: width .08s linear; }
#cook-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.cook-btn { width: 76px; height: 76px; border-radius: 18px; border: none; font-size: 38px;
  background: rgba(255,255,255,.92); cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.28); }
.cook-btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Arcade mini-games ---------- */
.arc-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; padding: 8px 16px; color: #fff; font-weight: 800;
  background: rgba(0,0,0,.45); border-radius: 999px; }
#trivia-overlay, #memory-overlay { position: fixed; inset: 0; z-index: 62;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
#trivia-overlay { background: radial-gradient(120% 90% at 50% 25%, #243a52 0%, #15202e 75%); }
#memory-overlay { background: radial-gradient(120% 90% at 50% 25%, #3a2444 0%, #1d1526 75%); }
#trivia-card { width: min(560px, 92vw); background: rgba(255,255,255,.96); border-radius: 18px; padding: 20px; }
#trivia-q { font-size: 19px; font-weight: 800; color: #233; margin-bottom: 14px; }
#trivia-options { display: flex; flex-direction: column; gap: 10px; }
.trivia-opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 2px solid #d8ccb8;
  background: #fbf6ec; font-size: 15px; font-weight: 600; color: #2c3e50; cursor: pointer; }
.trivia-opt:active { transform: translateY(1px); }
.trivia-opt.correct { background: #c7f0d4; border-color: #6be0a0; }
.trivia-opt.wrong { background: #f6cccc; border-color: #e15b5b; }
#memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: min(420px, 90vw); }
.mem-card { aspect-ratio: 1; border-radius: 14px; border: none; font-size: clamp(26px, 8vw, 40px);
  background: linear-gradient(160deg, #6a5acd, #4a3aad); color: #fff; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
.mem-card.up { background: #fff; }
.mem-card.done { opacity: .45; }
.mem-card:active { transform: translateY(2px); box-shadow: none; }

/* ---------- Sleep fade + gifting ---------- */
#sleep-fade { position: fixed; inset: 0; z-index: 90; background: #0a0a14; opacity: 0;
  pointer-events: none; transition: opacity .7s ease; }
#sleep-fade.show { opacity: 1; }
#chat-gift { background: #8e6bbf; padding: 10px 12px; }
.food-card { position: relative; }
.food-gift { position: absolute; top: 4px; right: 4px; border: none; border-radius: 8px;
  background: #f1e7d4; font-size: 13px; padding: 2px 5px; cursor: pointer; line-height: 1.2; }
.food-gift:active { transform: translateY(1px); }
.dh-hint { font-size: 12px; color: #8a7a64; margin-bottom: 6px; }

/* ---------- Fishing ---------- */
#fish-overlay { position: fixed; inset: 0; z-index: 62;
  background: radial-gradient(120% 90% at 50% 30%, #2a6b86 0%, #163b4c 75%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
#fish-pic { font-size: clamp(80px, 22vw, 150px); line-height: 1; filter: drop-shadow(0 8px 16px rgba(0,0,0,.45)); }
#fish-msg { color: #eaf4f8; font-size: 18px; font-weight: 700; text-align: center; max-width: 80vw; }
.fish-rare { color: #ffd166; }
.fish-btn { border: none; border-radius: 16px; padding: 16px 34px; font-size: 19px; font-weight: 800;
  color: #14323f; background: #ffd166; cursor: pointer; box-shadow: 0 5px 0 #d4a437; }
.fish-btn:disabled { opacity: .6; box-shadow: none; }
.fish-btn:active { transform: translateY(3px); box-shadow: none; }
.fish-btn.reel { background: #6be0a0; color: #0d3a26; box-shadow: 0 5px 0 #3aa873; animation: reelpulse .5s infinite; }
@keyframes reelpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* ---------- Cup Pong (3D in-scene; overlay is just swipe + HUD) ---------- */
#cuppong-overlay { position: fixed; inset: 0; z-index: 62; touch-action: none; background: transparent; pointer-events: auto; }
#cuppong-top { position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
#cuppong-top .cp-side { background: rgba(12,20,30,.6); color: #fff; font-weight: 800;
  padding: 8px 16px; border-radius: 999px; backdrop-filter: blur(4px); }
#cuppong-quit { pointer-events: auto; }
#cuppong-msg { position: absolute; top: 46%; left: 0; right: 0; text-align: center;
  font-size: clamp(22px, 6vw, 42px); font-weight: 800; color: #fff; pointer-events: none;
  text-shadow: 0 3px 14px rgba(0,0,0,.6); }

/* ---------- Inventory ---------- */
#inv-btn { pointer-events: auto; border: none; cursor: pointer; font-size: 15px; }
.food-card { position: relative; }
.inv-eat { margin-top: 4px; width: 100%; border: none; border-radius: 9px; padding: 6px;
  font-weight: 700; font-size: 12px; background: #ff9f43; color: #fff; cursor: pointer; }
.inv-eat:active { transform: translateY(1px); }
