/* ---------------------------------------------------------------
   Café & Good Vibes — warm pixel cafe for two
   --------------------------------------------------------------- */
:root {
  --ink: #3b2418;
  --ink-soft: #6a4a33;
  --cream: #fdf1da;
  --cream-2: #f4dfbc;
  --cream-3: #e6c8a0;
  --wood: #8a5a36;
  --wood-dark: #5a3a24;
  --wood-deep: #3f2718;
  --pink: #e791a2;
  --pink-dark: #c76f84;
  --green: #7f9a68;
  --gold: #e7b563;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #241610 radial-gradient(circle at 50% 15%, #5a3a2c 0%, #2a1a13 55%, #160e0a 100%);
  color: var(--ink);
  font-family: "Pixelify Sans", ui-monospace, "Courier New", monospace;
  -webkit-font-smoothing: none;
}

img {
  display: block;
  image-rendering: pixelated;
  -webkit-user-drag: none;
  user-select: none;
}

#stage {
  position: relative;
  flex: none;
  width: 960px;
  height: 600px;
  overflow: hidden;
  border-radius: 10px;
  background: #2b1a12;
  transform-origin: center center;
  box-shadow:
    0 0 0 5px #3d2617,
    0 0 0 9px #1d110b,
    0 26px 70px rgba(0, 0, 0, 0.7);
}

.hidden { display: none !important; }

/* ------------------------------ room ------------------------------ */
.room {
  position: absolute;
  inset: 0;
}

.wall {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 302px;
  background:
    repeating-linear-gradient(90deg, #ecd8b6 0 38px, #e5cea6 38px 40px, #ecd8b6 40px 80px);
}

.wall-light {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 302px;
  pointer-events: none;
  background:
    radial-gradient(42% 62% at 22% 26%, rgba(255, 226, 164, 0.55), transparent 72%),
    radial-gradient(38% 55% at 52% 18%, rgba(255, 214, 150, 0.38), transparent 74%),
    radial-gradient(50% 60% at 84% 40%, rgba(255, 198, 138, 0.3), transparent 76%),
    linear-gradient(180deg, rgba(120, 74, 40, 0.12), transparent 45%);
}

.wainscot {
  position: absolute;
  left: 0;
  top: 246px;
  width: 100%;
  height: 58px;
  border-top: 4px solid #5f3d25;
  background:
    repeating-linear-gradient(90deg, rgba(48, 27, 15, 0.35) 0 2px, transparent 2px 79px),
    repeating-linear-gradient(0deg, #8d5c39 0 25px, #7d5132 25px 28px);
  box-shadow: inset 0 -12px 20px rgba(48, 27, 15, 0.3);
}

.floor {
  position: absolute;
  left: 0;
  top: 300px;
  width: 100%;
  height: 300px;
  background:
    repeating-linear-gradient(0deg, rgba(72, 42, 22, 0.22) 0 2px, transparent 2px 54px),
    repeating-linear-gradient(90deg, #b98252 0 62px, #ac7747 62px 65px, #bd8857 65px 128px),
    linear-gradient(#c48f5d 0%, #a97445 55%, #986739 100%);
}

.floor::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 50% 40%, rgba(255, 216, 158, 0.18), transparent 70%),
    radial-gradient(120% 70% at 50% 100%, rgba(60, 33, 17, 0.22), transparent 70%);
}

/* window */
.window {
  position: absolute;
  left: 18px;
  top: 84px;
  width: 122px;
  height: 158px;
  border: 5px solid #7a5236;
  border-radius: 8px 8px 3px 3px;
  overflow: hidden;
  box-shadow: 0 5px 0 rgba(58, 34, 20, 0.35), inset 0 0 0 3px #d9b184;
  background: #f6c98a;
}

.window .glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(#ffeec2 0%, #ffd79c 38%, #f0a86c 72%, #d98b58 100%);
}

.window .sky-blob {
  position: absolute;
  left: -18px;
  top: 22px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 205, 0.95), rgba(255, 224, 160, 0) 65%);
}

.window .mullion {
  position: absolute;
  background: #7a5236;
  box-shadow: 0 0 0 1px rgba(50, 30, 16, 0.3);
}

.window .mullion.v { left: 50%; top: 0; width: 5px; height: 100%; margin-left: -2px; }
.window .mullion.h { left: 0; top: 52%; width: 100%; height: 5px; }

.window .curtain {
  position: absolute;
  top: -4px;
  width: 26px;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, #e0a29c 0 6px, #d28f8b 6px 9px);
  border-bottom: 4px solid #b97674;
  opacity: 0.95;
}

.window .curtain.left { left: -4px; border-radius: 0 0 12px 0; }
.window .curtain.right { right: -4px; border-radius: 0 0 0 12px; }

.window-sill {
  position: absolute;
  left: 8px;
  top: 238px;
  width: 142px;
  height: 13px;
  border: 3px solid #5f3d25;
  border-radius: 4px;
  background: linear-gradient(#c99a68, #a97a4b);
  box-shadow: 0 5px 8px rgba(58, 34, 20, 0.28);
}

/* lamps */
.lamp {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.lamp img { width: 100%; }

.lamp-glow {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 210px;
  height: 190px;
  margin-left: -105px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 18%, rgba(255, 224, 150, 0.55), rgba(255, 208, 128, 0.18) 45%, transparent 72%);
  animation: lampPulse 5.5s ease-in-out infinite;
  pointer-events: none;
}

.lamp:nth-of-type(2) .lamp-glow { animation-delay: -2.2s; }

@keyframes lampPulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* counter */
.counter {
  position: absolute;
  left: 150px;
  top: 210px;
  width: 300px;
  height: 96px;
  z-index: 7;
}

.counter-top {
  position: absolute;
  left: -8px;
  top: 0;
  width: 316px;
  height: 16px;
  border: 3px solid #5d3b24;
  border-radius: 6px;
  background: linear-gradient(#d8a771, #b57f4e 65%, #9b6a3e);
  box-shadow: inset 0 2px 0 rgba(255, 226, 180, 0.5), 0 4px 0 rgba(58, 34, 20, 0.25);
  z-index: 4;
}

.counter-front {
  position: absolute;
  left: 0;
  top: 14px;
  width: 300px;
  height: 84px;
  border: 3px solid #4f3220;
  border-radius: 0 0 6px 6px;
  background:
    repeating-linear-gradient(90deg, #8d5c38 0 96px, #7d4e2e 96px 100px),
    #8d5c38;
  box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.22), 0 6px 0 rgba(40, 23, 13, 0.35);
  z-index: 2;
}

.counter-front span {
  position: absolute;
  top: 16px;
  width: 82px;
  height: 50px;
  border: 3px solid rgba(60, 34, 20, 0.55);
  border-radius: 4px;
  background: linear-gradient(rgba(255, 226, 184, 0.14), rgba(40, 22, 12, 0.16));
}

.counter-front span:nth-child(1) { left: 14px; }
.counter-front span:nth-child(2) { left: 106px; }
.counter-front span:nth-child(3) { left: 198px; }

/* espresso machine */
.machine {
  position: absolute;
  left: 20px;
  top: -56px;
  width: 86px;
  height: 68px;
  z-index: 6;
}

.m-body {
  position: absolute;
  left: 6px;
  top: 10px;
  width: 74px;
  height: 52px;
  border: 3px solid #3a2114;
  border-radius: 4px;
  background: linear-gradient(105deg, #b9724d, #8d4f31 45%, #6d3a22);
  box-shadow: inset 0 0 0 3px rgba(255, 200, 150, 0.14);
}

.m-top {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 82px;
  height: 13px;
  border: 3px solid #2f1a10;
  border-radius: 5px;
  background: linear-gradient(#d9d6cf, #a8a49c 60%, #7d7a72);
}

.m-gauge {
  position: absolute;
  right: 12px;
  top: 20px;
  width: 16px;
  height: 16px;
  border: 2px solid #2f1a10;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff4d2, #e9c477 60%, #b98d4a);
}

.m-head {
  position: absolute;
  top: 38px;
  width: 22px;
  height: 20px;
  border: 2px solid #2f1a10;
  border-radius: 3px 3px 6px 6px;
  background: linear-gradient(#6c675f, #3e3a34);
}

.m-head::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 6px;
  height: 8px;
  margin-left: -3px;
  background: #3e3a34;
  border: 2px solid #2f1a10;
}

.m-head.a { left: 18px; }
.m-head.b { left: 48px; }

.m-tray {
  position: absolute;
  left: 10px;
  bottom: 0;
  width: 66px;
  height: 7px;
  border: 2px solid #2f1a10;
  border-radius: 3px;
  background: #8f8a80;
}

.steam {
  position: absolute;
  bottom: 18px;
  width: 14px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 240, 0.7), rgba(255, 250, 235, 0) 70%);
  opacity: 0;
  animation: steamRise 3.4s ease-in infinite;
  pointer-events: none;
}

.steam.s1 { left: 16px; animation-delay: 0s; }
.steam.s2 { left: 52px; animation-delay: 1.7s; }

@keyframes steamRise {
  0% { opacity: 0; transform: translateY(6px) scale(0.6); }
  25% { opacity: 0.75; }
  100% { opacity: 0; transform: translateY(-30px) scale(1.35); }
}

/* cups + shelf */
.cup-shelf {
  position: absolute;
  left: 108px;
  top: -62px;
  width: 78px;
  height: 60px;
  z-index: 5;
}

.cup-shelf em {
  position: absolute;
  left: 0;
  bottom: 6px;
  width: 100%;
  height: 6px;
  border: 2px solid #4a2e1c;
  background: #a2703f;
  border-radius: 2px;
}

.mini-cup {
  position: absolute;
  bottom: 12px;
  width: 18px;
  height: 13px;
  border: 2px solid #4a2e1c;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(#fff4e2, #dcc0a0);
}

.mini-cup::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 2px;
  width: 6px;
  height: 7px;
  border: 2px solid #4a2e1c;
  border-left: 0;
  border-radius: 0 4px 4px 0;
}

.mini-cup.a { left: 2px; }
.mini-cup.b { left: 27px; }
.mini-cup.c { left: 52px; }

/* cake case */
.cake-case {
  position: absolute;
  right: 14px;
  top: -54px;
  width: 86px;
  height: 58px;
  z-index: 5;
}

.cake-case img {
  position: absolute;
  left: 13px;
  bottom: 4px;
  width: 60px;
  height: auto;
}

.case-glass {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(120, 84, 56, 0.7);
  border-radius: 30px 30px 4px 4px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.06) 55%, rgba(160, 200, 210, 0.14));
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.4);
}

/* menu board */
.menu-board {
  position: absolute;
  left: 440px;
  top: 66px;
  width: 162px;
  height: 112px;
  padding: 7px 10px 6px;
  border: 5px solid #8a5a36;
  border-radius: 5px;
  background: linear-gradient(#332c25, #262019);
  box-shadow: 0 6px 0 rgba(50, 30, 18, 0.35), inset 0 0 0 2px rgba(255, 240, 205, 0.12);
  color: #f2e3c4;
  z-index: 6;
  transform: rotate(-0.6deg);
}

.menu-board h3 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-align: center;
  color: #ffe9b8;
}

.menu-board ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-board li {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  line-height: 1.42;
  color: #ede0c4;
  opacity: 0;
  transform: translateY(2px);
  animation: chalkIn 0.35s ease forwards;
}

.menu-board li i {
  font-style: normal;
  color: #e5b978;
}

@keyframes chalkIn {
  to { opacity: 1; transform: none; }
}

/* wall props */
.prop {
  position: absolute;
  pointer-events: none;
}

.prop img { width: 100%; }

.fireplace { z-index: 6; }
.board { z-index: 6; transform: rotate(0.4deg); }
.bookshelf { z-index: 6; }
.wall-plant { z-index: 6; }
.armchair { z-index: 520; }
.floor-plant { z-index: 515; }

.fire-glow {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 120px;
  height: 96px;
  margin-left: -60px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 75%, rgba(255, 190, 90, 0.7), rgba(255, 150, 60, 0.2) 45%, transparent 72%);
  animation: fireFlicker 2.6s ease-in-out infinite;
  mix-blend-mode: screen;
  z-index: 2;
}

@keyframes fireFlicker {
  0%, 100% { opacity: 0.75; transform: scale(1, 1); }
  30% { opacity: 1; transform: scale(1.06, 0.96); }
  55% { opacity: 0.82; transform: scale(0.97, 1.05); }
  78% { opacity: 0.95; transform: scale(1.03, 1.02); }
}

/* door */
.door {
  position: absolute;
  left: 862px;
  top: 118px;
  width: 86px;
  height: 184px;
  z-index: 6;
}

.door-frame {
  position: absolute;
  inset: 0;
  border: 5px solid #5a3a24;
  border-radius: 42px 42px 2px 2px;
  background: linear-gradient(160deg, #ffe2ae, #f2b57a 55%, #d18b58);
  box-shadow: 0 6px 0 rgba(50, 30, 18, 0.3);
}

.door-glass {
  position: absolute;
  left: 11px;
  top: 12px;
  right: 11px;
  bottom: 26px;
  border: 3px solid #6f4a30;
  border-radius: 32px 32px 2px 2px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.5) 0 18%, transparent 18% 42%, rgba(255, 245, 210, 0.35) 42% 55%, transparent 55%),
    linear-gradient(180deg, rgba(255, 232, 176, 0.9), rgba(240, 170, 110, 0.85));
}

.door-knob {
  position: absolute;
  right: 12px;
  top: 52%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd88f;
  border: 2px solid #6b4526;
  box-shadow: 0 0 8px rgba(255, 214, 138, 0.9);
}

.door-sign {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translateX(-50%) rotate(-3deg);
  padding: 2px 7px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #4a2a18;
  background: linear-gradient(#fdf0d4, #e8cfa6);
  border: 2px solid #6b4526;
  border-radius: 3px;
}

.bell {
  position: absolute;
  left: 50%;
  top: -6px;
  width: 12px;
  height: 10px;
  margin-left: -6px;
  border-radius: 50% 50% 0 0;
  border: 2px solid #7a5327;
  background: linear-gradient(#ffe6a0, #c99a41);
  transform-origin: top center;
  animation: bellSway 6s ease-in-out infinite;
}

@keyframes bellSway {
  0%, 86%, 100% { transform: rotate(0deg); }
  90% { transform: rotate(9deg); }
  94% { transform: rotate(-7deg); }
  97% { transform: rotate(4deg); }
}

.rug {
  position: absolute;
  left: 340px;
  top: 400px;
  width: 196px;
  z-index: 3;
  opacity: 0.96;
  filter: drop-shadow(0 4px 6px rgba(60, 34, 20, 0.28));
}

.rug img { width: 100%; }

/* warm overlay + vignette */
.warmth {
  position: absolute;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 30% 18%, rgba(255, 205, 130, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(255, 190, 120, 0.06), rgba(90, 50, 25, 0.1));
  mix-blend-mode: soft-light;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 801;
  pointer-events: none;
  box-shadow: inset 0 0 120px rgba(46, 24, 12, 0.4), inset 0 0 40px rgba(46, 24, 12, 0.26);
}

/* --------------------------- entities --------------------------- */
#entities, #bubbles, #fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#entities { z-index: 500; }
#bubbles { z-index: 600; }
#fx { z-index: 700; }

.table {
  position: absolute;
}

.table img { width: 100%; display: block; }

.table .table-cup {
  position: absolute;
  width: 30px;
  height: auto;
  bottom: 62px;
  filter: drop-shadow(0 2px 0 rgba(60, 34, 20, 0.25));
}

.actor {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  will-change: transform;
}

.actor .shadow {
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 52px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(46, 26, 14, 0.42), rgba(46, 26, 14, 0) 72%);
}

.actor .bob {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(-50%);
  transform-origin: bottom center;
}

.actor .sprite {
  width: auto;
  height: 124px;
  filter: drop-shadow(0 2px 0 rgba(60, 35, 20, 0.16));
  transition: opacity 0.4s ease;
}

.actor.entering .sprite,
.actor.entering .shadow { opacity: 0; }
.actor.entering .bob { transform: translateX(-50%) translateY(6px); }

.actor .bob.face-left .sprite { transform: scaleX(-1); }

.actor .tray {
  position: absolute;
  right: -22px;
  bottom: 54px;
  width: 30px;
  transition: opacity 0.2s;
}

.actor .tray img { width: 100%; }

.actor .tray.hidden { display: none; }

/* order bubbles */
.order {
  position: absolute;
  width: 58px;
  padding: 5px 4px 4px;
  border: 3px solid #5a3a24;
  border-radius: 9px;
  background: linear-gradient(#fdf3e0, #f3e0c0);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.28);
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: bubbleIn 0.28s cubic-bezier(0.24, 1.4, 0.5, 1) both;
}

.order::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: #f3e0c0;
  border-right: 3px solid #5a3a24;
  border-bottom: 3px solid #5a3a24;
  transform: rotate(45deg);
}

.order img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.order .bar {
  width: 40px;
  height: 6px;
  border: 2px solid #5a3a24;
  border-radius: 4px;
  background: #e0c8a2;
  overflow: hidden;
}

.order .bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(#a8c187, #7f9a68);
  transition: width 0.18s linear, background 0.3s;
}

.order.low .bar i { background: linear-gradient(#e7a977, #cf7f52); }
.order.critical .bar i { background: linear-gradient(#ec9a9a, #cc6464); }
.order.happy { border-color: #8a5f7a; }

@keyframes bubbleIn {
  from { transform: translate(-50%, -85%) scale(0.8); opacity: 0; }
  to { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

/* floating text + particles */
.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 700;
  color: #fff6dd;
  text-shadow: 0 2px 0 #6a4126, 0 0 8px rgba(255, 200, 120, 0.7);
  animation: floatUp 1.35s ease-out forwards;
  white-space: nowrap;
}

.float-text.bad { color: #ffd7d7; text-shadow: 0 2px 0 #7d3030; }
.float-text.sweet { color: #ffd3e4; }

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.85); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

.heart-pop {
  position: absolute;
  width: 22px;
  animation: heartPop 1.1s ease-out forwards;
}

@keyframes heartPop {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.5); }
  25% { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54px) scale(0.85); }
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #ffe9b0;
  box-shadow: 0 0 8px rgba(255, 220, 150, 0.9);
  animation: sparkleOut 0.8s ease-out forwards;
}

@keyframes sparkleOut {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.2) rotate(90deg); }
}

/* ------------------------------ HUD ------------------------------ */
.hud {
  position: absolute;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hud-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 3px solid var(--wood-dark);
  border-radius: 9px;
  background: linear-gradient(#fdf3e2, #f1dcbb);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.45);
  pointer-events: auto;
}

.hud-card img { width: 22px; height: 22px; }

.hud-card.hearts .meter {
  width: 92px;
  height: 11px;
  border: 2px solid #6a4126;
  border-radius: 6px;
  background: #e2c8a4;
  overflow: hidden;
}

.hud-card.hearts .meter i {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 4px;
  background: linear-gradient(#f3a3b4, #dd7389);
  transition: width 0.4s ease;
}

.hud-card.clock {
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 3px 16px;
  line-height: 1.15;
}

.hud-card.clock span:first-child {
  font-size: 9px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #8a6a4d;
}

.hud-card.clock span:last-child {
  font-size: 13px;
  font-weight: 700;
  color: #4f3320;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-card.coins {
  font-size: 14px;
  font-weight: 700;
  color: #5a3a1e;
  padding: 3px 12px;
}

.hud-card.coins img { width: 24px; height: 24px; }

.hud-right .btn { pointer-events: auto; }

/* buttons */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #4a2a18;
  padding: 6px 12px;
  border: 3px solid #5b3a24;
  border-radius: 7px;
  background: linear-gradient(#fbeacb, #eccd9f);
  box-shadow: 0 3px 0 #a37c56, 0 5px 0 rgba(59, 36, 24, 0.16);
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
  pointer-events: auto;
}

.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: none; }

.btn.primary {
  background: linear-gradient(#f8b6c6, #e2849a);
  border-color: #7d3f52;
  box-shadow: 0 3px 0 #b96a80, 0 5px 0 rgba(59, 36, 24, 0.16);
  color: #4a2029;
}

.btn.tiny {
  font-size: 12px;
  padding: 5px 10px;
}

.btn.icon {
  width: 34px;
  padding: 5px 0;
  font-size: 15px;
}

.btn.icon.off { opacity: 0.5; }
.btn:disabled { filter: grayscale(0.55); opacity: 0.65; cursor: not-allowed; }

/* quest card */
.quest-card {
  position: absolute;
  left: 14px;
  bottom: 16px;
  width: 214px;
  padding: 8px 11px 9px;
  border: 3px solid var(--wood-dark);
  border-radius: 9px;
  background: linear-gradient(#fdf3e2, #f2dcba);
  box-shadow: 0 4px 0 rgba(60, 35, 20, 0.32), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
  pointer-events: auto;
}

.q-head {
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #a2734c;
}

.q-text {
  margin: 2px 0 6px;
  font-size: 12px;
  line-height: 1.25;
  color: #4a3120;
}

.q-bar {
  height: 8px;
  border: 2px solid #6a4126;
  border-radius: 5px;
  background: #e3c9a5;
  overflow: hidden;
}

.q-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(#a9c48a, #7f9a68);
  transition: width 0.45s ease;
}

.q-count {
  margin-top: 3px;
  font-size: 10px;
  text-align: right;
  color: #8a6a4d;
}

.quest-card.done .q-bar i { background: linear-gradient(#f6bccb, #e0849a); }

/* carry slot */
.carry {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 62px;
  height: 62px;
  border: 3px dashed rgba(90, 58, 36, 0.55);
  border-radius: 10px;
  background: rgba(253, 241, 218, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: all 0.2s ease;
}

.carry.has {
  border-style: solid;
  border-color: #5a3a24;
  background: linear-gradient(#fdf3e2, #f2dcba);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.3);
  opacity: 1;
}

.carry img { width: 46px; height: 46px; object-fit: contain; }

.carry::after {
  content: "tray";
  position: absolute;
  bottom: -16px;
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(90, 58, 36, 0.8);
}

.carry.has::after { color: #6a4126; }

/* hint bar + key hint */
.hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border: 3px solid rgba(90, 58, 36, 0.85);
  border-radius: 9px;
  background: rgba(253, 241, 218, 0.9);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.25);
  font-size: 11.5px;
  color: #4a3120;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
}

.hint.show { opacity: 1; }

.key-hint {
  position: absolute;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid #4a2a18;
  border-radius: 6px;
  background: linear-gradient(#fff6e2, #f0d9b4);
  box-shadow: 0 2px 0 rgba(60, 35, 20, 0.4);
  font-size: 12px;
  font-weight: 700;
  color: #4a2a18;
  opacity: 0;
  transition: opacity 0.18s;
  animation: keyBob 1.2s ease-in-out infinite;
}

.key-hint.show { opacity: 1; }

@keyframes keyBob {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -3px; }
}

/* ---------------------------- title ---------------------------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 60% at 50% 40%, rgba(255, 208, 150, 0.22), transparent 70%),
    linear-gradient(160deg, #4a2c1d, #241410 70%);
  transition: opacity 0.6s ease, visibility 0.6s;
}

.screen.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 34px;
  width: 830px;
  padding: 26px 30px;
  border: 4px solid #6b4526;
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 30px, transparent 30px 60px),
    linear-gradient(#3a2417, #2a1810);
  box-shadow: 0 0 0 4px rgba(255, 214, 160, 0.14), 0 20px 50px rgba(0, 0, 0, 0.55);
}

.title-art {
  flex: none;
  width: 320px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
  animation: artFloat 6s ease-in-out infinite;
}

.title-art img { width: 100%; }

@keyframes artFloat {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-7px) rotate(0.4deg); }
}

.title-copy { color: #f8e9cd; min-width: 0; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #d7a97a;
}

.title-copy h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.02;
  color: #ffe9c2;
  text-shadow: 0 3px 0 #7a3f2c, 0 0 22px rgba(255, 190, 130, 0.35);
}

.title-copy h1 span { color: #f0a1af; }

.title-copy .sub {
  margin: 8px 0 16px;
  font-size: 13px;
  line-height: 1.4;
  color: #e7cfae;
}

.name-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.name-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #c99f74;
}

.name-row input {
  width: 150px;
  padding: 6px 9px;
  font-family: inherit;
  font-size: 14px;
  color: #4a2a18;
  border: 3px solid #6b4526;
  border-radius: 6px;
  background: linear-gradient(#fff6e4, #f2ddbc);
  outline: none;
}

.name-row input:focus { border-color: #e791a2; box-shadow: 0 0 0 3px rgba(231, 145, 162, 0.28); }

.btn.big {
  font-size: 16px;
  padding: 10px 22px;
}

.title-copy .keys {
  margin: 12px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  color: #b9936b;
}

.title-copy .keys b { color: #f0d7aa; }

/* -------------------------- story sheet -------------------------- */
.sheet {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 1400;
  width: 740px;
  height: 214px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 4px solid #5b3a24;
  border-radius: 12px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 30%),
    linear-gradient(#fdf3e2, #f0d9b6);
  box-shadow: 0 0 0 3px rgba(255, 232, 196, 0.5), 0 14px 30px rgba(50, 28, 14, 0.45);
  animation: sheetIn 0.3s cubic-bezier(0.22, 1.2, 0.45, 1) both;
}

@keyframes sheetIn {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet-portrait {
  flex: none;
  width: 118px;
  height: 100%;
  border: 3px solid #7a5236;
  border-radius: 9px;
  background:
    radial-gradient(70% 70% at 50% 30%, #ffe3b6, #eabf8a 60%, #d9a878);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(150, 96, 50, 0.35);
}

.sheet-portrait img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 3px 0 rgba(90, 55, 30, 0.25));
}

.sheet-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px dashed rgba(140, 96, 60, 0.4);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.sheet-head span {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #a2734c;
}

.x {
  pointer-events: auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid #6b4526;
  border-radius: 6px;
  background: linear-gradient(#fbeacb, #eccd9f);
  color: #5a3a24;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.x:hover { filter: brightness(1.06); }

.story-text {
  flex: 1;
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #4a3120;
  overflow-y: auto;
}

.story-text .name { color: #b06a7c; font-weight: 700; }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.choice {
  pointer-events: auto;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border: 3px solid #7a5236;
  border-radius: 7px;
  background: linear-gradient(#fff8ea, #f2e1c6);
  color: #4a3120;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(90, 58, 36, 0.28);
  transition: transform 0.06s, border-color 0.2s;
}

.choice:hover { border-color: #c0768a; transform: translateY(-1px); }
.choice:active { transform: translateY(2px); box-shadow: none; }
.choice.told { opacity: 0.72; }
.choice.told::after { content: " ♡"; color: #cf8798; }

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 10.5px;
  color: #9a7550;
}

/* --------------------------- modals --------------------------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  background: rgba(48, 28, 16, 0.55);
  backdrop-filter: blur(2px);
}

/* the join panel is opened from the title screen, so it has to sit above it */
#together { z-index: 2100; }

.modal-card {
  width: 560px;
  max-height: 520px;
  padding: 16px 18px 14px;
  border: 4px solid #5b3a24;
  border-radius: 12px;
  background: linear-gradient(#fdf3e2, #f0d9b6);
  box-shadow: 0 0 0 3px rgba(255, 232, 196, 0.5), 0 18px 40px rgba(40, 22, 10, 0.5);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.24s cubic-bezier(0.22, 1.2, 0.45, 1) both;
}

@keyframes modalIn {
  from { transform: translateY(12px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px dashed rgba(140, 96, 60, 0.4);
  padding-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
  color: #5a3a24;
  flex: 1;
}

.modal-coins {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #7a5320;
  padding: 2px 9px;
  border: 2px solid #7a5236;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.45);
}

.modal-coins img { width: 20px; height: 20px; }

.modal-sub {
  margin: 8px 0 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #7a5a3c;
}

.modal-foot {
  margin: 10px 0 0;
  font-size: 10.5px;
  color: #9a7550;
  text-align: center;
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  overflow-y: auto;
  padding-right: 4px;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 3px solid #a37c56;
  border-radius: 9px;
  background: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.15));
}

.shop-item img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: none;
}

.shop-item .info { flex: 1; min-width: 0; }

.shop-item .name {
  font-size: 12.5px;
  font-weight: 600;
  color: #4a3120;
  line-height: 1.2;
}

.shop-item .price {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  color: #8a6a4d;
}

.shop-item .price img { width: 13px; height: 13px; }

.shop-item.owned { border-color: #7f9a68; background: rgba(127, 154, 104, 0.16); }

.shop-item .buy {
  pointer-events: auto;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border: 2px solid #5b3a24;
  border-radius: 6px;
  background: linear-gradient(#a9c48a, #7f9a68);
  color: #2f3d24;
  cursor: pointer;
  white-space: nowrap;
}

.shop-item .buy:disabled {
  background: linear-gradient(#e7d6b8, #d5bf9c);
  color: #8a6a4d;
  opacity: 0.8;
  cursor: not-allowed;
}

.shop-item .tag {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6c8455;
}

/* journal */
.journal-stats {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.stat {
  flex: 1;
  padding: 7px;
  border: 2px solid #a37c56;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 19px;
  color: #5a3a24;
  line-height: 1.1;
}

.stat span {
  font-size: 9.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #8a6a4d;
}

.memories {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  padding-right: 4px;
}

.memory {
  padding: 8px 10px;
  border: 2px solid #a37c56;
  border-left: 5px solid #d99aab;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

.memory b {
  display: block;
  font-size: 12.5px;
  color: #5a3a24;
}

.memory span {
  font-size: 11px;
  color: #7a5a3c;
  line-height: 1.35;
}

.memory.locked {
  border-left-color: #cfc0a6;
  opacity: 0.7;
  font-size: 11.5px;
  color: #8a6a4d;
  font-style: italic;
}

/* toast */
.toast {
  position: absolute;
  left: 50%;
  top: 66px;
  transform: translate(-50%, -10px);
  z-index: 1900;
  max-width: 560px;
  padding: 7px 16px;
  border: 3px solid #5b3a24;
  border-radius: 9px;
  background: linear-gradient(#fff6e6, #f3ddba);
  box-shadow: 0 4px 0 rgba(60, 35, 20, 0.3);
  font-size: 12px;
  color: #4a3120;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* brewing progress + steam puffs */
.make-progress {
  position: absolute;
  width: 84px;
  height: 11px;
  transform: translate(-50%, -50%);
  border: 2px solid #4a2a18;
  border-radius: 5px;
  background: #f0dcbb;
  box-shadow: 0 2px 0 rgba(60, 35, 20, 0.3);
  overflow: hidden;
}

.make-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(#f6bfcd, #e0849a);
}

.steam-puff {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 250, 235, 0.9), rgba(255, 250, 235, 0) 70%);
  animation: puffUp 1.3s ease-out forwards;
}

@keyframes puffUp {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1.6); }
}

/* while a panel is open, clear the lower HUD out of the way */
.hud.busy .quest-card,
.hud.busy .carry,
.hud.busy .hint {
  opacity: 0;
  pointer-events: none;
}

/* ------------------------- together / online ------------------------- */
.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.modal-card.narrow { width: 430px; }

.join-fields {
  display: flex;
  gap: 10px;
  margin: 4px 0 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #a2734c;
}

.field input {
  width: 100%;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 15px;
  color: #4a2a18;
  border: 3px solid #7a5236;
  border-radius: 6px;
  background: linear-gradient(#fff6e4, #f2ddbc);
  outline: none;
}

.field input:focus { border-color: #e791a2; box-shadow: 0 0 0 3px rgba(231, 145, 162, 0.25); }

.role-row {
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
}

.role {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12.5px;
  color: #5a3a24;
  border: 3px solid #a37c56;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.role img { width: 34px; height: 48px; object-fit: contain; object-position: bottom; }

.role.active {
  border-color: #c76f84;
  background: linear-gradient(#fff1f4, #f7d7de);
  box-shadow: inset 0 0 0 2px rgba(231, 145, 162, 0.35);
}

#btn-join { width: 100%; }

.coop-pill {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  padding: 3px 12px;
  border: 2px solid rgba(90, 58, 36, 0.8);
  border-radius: 20px;
  background: rgba(253, 241, 218, 0.9);
  font-size: 10.5px;
  letter-spacing: 0.4px;
  color: #6a4126;
  box-shadow: 0 2px 0 rgba(60, 35, 20, 0.2);
  pointer-events: none;
  white-space: nowrap;
}

.coop-pill.offline { color: #9a5a42; border-color: rgba(140, 80, 54, 0.8); }

/* speech bubbles during a shared story */
.say {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 240px;
  padding: 6px 10px 7px;
  border: 3px solid #5a3a24;
  border-radius: 10px;
  background: linear-gradient(#fff8ea, #f4e2c6);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.28);
  font-size: 11.5px;
  line-height: 1.35;
  color: #4a3120;
  animation: bubbleIn 0.25s cubic-bezier(0.24, 1.4, 0.5, 1) both;
  z-index: 710;
}

.say b {
  display: block;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #c0768a;
  margin-bottom: 2px;
}

.say.narr {
  border-color: #8a5f7a;
  background: linear-gradient(#fdf0f4, #f3d9e2);
  font-style: italic;
}

/* scrollbars */
.modal-card ::-webkit-scrollbar,
.story-text::-webkit-scrollbar { width: 8px; }

.modal-card ::-webkit-scrollbar-thumb,
.story-text::-webkit-scrollbar-thumb {
  background: #c8a67e;
  border-radius: 4px;
}

/* --- monthly anniversary, scores and customer thoughts --- */
.hud-card.clock #clock-anniv {
  font-size: 9px;
  color: #ffb3c7;
  letter-spacing: 0.02em;
}
.hud-card.score span {
  color: #f6c56b;
  font-size: 12px;
  line-height: 1;
}
.thought {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 158px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(38, 26, 22, 0.86);
  border: 1px solid rgba(255, 205, 170, 0.35);
  color: #ffe6d2;
  font-size: 9px;
  line-height: 1.35;
  font-style: italic;
  text-align: center;
  z-index: 3000;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  animation: thought-in 0.25s ease both;
}
.thought::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: inherit;
  border-right: 1px solid rgba(255, 205, 170, 0.35);
  border-bottom: 1px solid rgba(255, 205, 170, 0.35);
  transform: rotate(45deg);
}
.thought.soft {
  background: rgba(38, 26, 22, 0.72);
  color: #ffe6d2;
}
@keyframes thought-in {
  from { opacity: 0; transform: translate(-50%, -92%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
.float-text.score {
  color: #f6c56b;
  font-weight: 700;
}
.float-text.sweet {
  color: #ffb3c7;
  font-style: italic;
}
.hint {
  top: 58px;
  bottom: auto;
}
.coop-pill {
  top: 88px;
}
.rug {
  left: 420px;
  top: 395px;
}

/* --------------------- settings tab (side) --------------------- */
.hint {
  display: none;
}

.side-tab {
  position: absolute;
  right: 0;
  top: 46%;
  z-index: 2300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 3px solid var(--wood-dark);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(#fdf3e2, #ecd3ac);
  box-shadow: -2px 3px 0 rgba(60, 35, 20, 0.3);
  color: #5a3a1e;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  pointer-events: auto;
}

.side-tab:hover {
  background: linear-gradient(#fff8e8, #f3ddb9);
}

.side-tab .gear { font-size: 15px; line-height: 1; }

.side-tab .tab-label {
  writing-mode: vertical-rl;
  text-transform: uppercase;
  font-size: 10px;
}

.side-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 322px;
  z-index: 2400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 18px;
  border-left: 4px solid var(--wood-dark);
  background: linear-gradient(#fdf5e6, #f0dcb9);
  box-shadow: -10px 0 24px rgba(30, 18, 12, 0.45);
  color: #4a3120;
  pointer-events: auto;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: #5a3a1e;
  padding-bottom: 6px;
  border-bottom: 3px solid rgba(90, 58, 36, 0.25);
}

.side-body {
  overflow-y: auto;
  padding-right: 4px;
}

.side-body h3 {
  margin: 12px 0 4px;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8a5a33;
}

.side-body p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #573c26;
}

.side-body .controls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-body .controls li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.3;
}

.side-body .controls li span { margin-left: 4px; color: #63452c; }

.side-body kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  padding: 1px 4px;
  border: 2px solid #5a3a24;
  border-radius: 5px;
  background: linear-gradient(#fff8e6, #edd6b2);
  box-shadow: 0 2px 0 rgba(60, 35, 20, 0.35);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
}

.side-body .btn {
  margin-top: 14px;
  width: 100%;
}

/* --- rush hour + see-through tables + full menu board --- */
.table {
  transition: opacity 0.16s ease;
}
.table.see-through img {
  opacity: 0.45;
}

.rush-pill {
  position: absolute;
  left: 50%;
  top: 122px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border: 3px solid #5a3a24;
  border-radius: 9px;
  background: linear-gradient(#ffd9a8, #f0b264);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #5a3a1e;
  white-space: nowrap;
  pointer-events: none;
  animation: bubbleIn 0.28s ease both;
}

.shop-grid {
  min-height: 0;
  flex: 1;
}

.shop-item .name {
  font-size: 11px;
  line-height: 1.2;
}

/* ---------------------- specials board ---------------------- */
.menu-board {
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}

.menu-board li.empty {
  justify-content: center;
  font-size: 8.5px;
  letter-spacing: 0.2px;
  color: rgba(237, 224, 196, 0.7);
  font-style: italic;
}

.menu-board:hover {
  box-shadow: 0 6px 0 rgba(50, 30, 18, 0.35), inset 0 0 0 2px rgba(255, 240, 205, 0.3);
}

.modal-foot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.modal-foot-row .modal-foot {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.3;
}

#btn-specials {
  flex: none;
  font-size: 11px;
  padding: 5px 10px;
}

.special-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
}

.special-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 5px 5px;
  border: 3px solid #a37c56;
  border-radius: 9px;
  background: linear-gradient(#fdf3e0, #f2e0c0);
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.25);
  font-family: inherit;
  font-size: 10px;
  color: #4a3120;
  text-align: center;
  cursor: pointer;
}

.special-item img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.special-item span {
  line-height: 1.15;
  min-height: 24px;
}

.special-item i {
  font-style: normal;
  font-size: 9px;
  color: #8a5a33;
}

.special-item.chosen {
  border-color: #5b8a44;
  background: linear-gradient(#e9f6d8, #cfe6b4);
  box-shadow: 0 0 0 2px rgba(120, 180, 90, 0.4), 0 3px 0 rgba(60, 35, 20, 0.2);
}

.special-item.chosen::after {
  content: "on the board ♡";
  font-size: 8px;
  color: #4e7a35;
}

.special-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 11px;
  color: #6b4a2c;
}

/* keep the board grids tall enough to be usable */
.shop-grid {
  flex: none;
  min-height: 0;
  max-height: 330px;
}

.special-grid {
  flex: none;
  min-height: 0;
  max-height: 320px;
}

.menu-board li span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.menu-board li i {
  flex: none;
  margin-left: 6px;
}

/* ==================================================================
   responsive / mobile
   On small screens the panels leave the scaled 960x600 stage and are
   laid out full size over the whole viewport, so text stays readable.
   ================================================================== */
:root { --ui-inv: 1; }

#overlays {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
}

#overlays > * { pointer-events: auto; }
#overlays > .toast { pointer-events: none; }

html, body { height: 100%; }

body {
  min-height: 100dvh;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px), (max-height: 520px) {

  body.mobile-ui #stage {
    border-radius: 0;
    box-shadow: 0 0 0 3px #3d2617;
  }

  /* ---- HUD: smaller set, but big enough to read and tap ---- */
  body.mobile-ui .hud-card.hearts,
  body.mobile-ui .hud-card.score,
  body.mobile-ui .quest-card,
  body.mobile-ui .carry,
  body.mobile-ui .key-hint,
  body.mobile-ui .hint { display: none; }

  body.mobile-ui .hud-top {
    left: 8px;
    right: 8px;
    top: 8px;
    justify-content: space-between;
    gap: 6px;
  }

  body.mobile-ui .hud-card.clock {
    margin: 0;
    padding: 3px 10px;
  }

  body.mobile-ui .hud-card.clock span:last-child { font-size: 14px; }

  body.mobile-ui .hud-right {
    transform: scale(var(--ui-inv, 1));
    transform-origin: top right;
    gap: 9px;
  }

  body.mobile-ui .hud-card.coins { font-size: 15px; }

  body.mobile-ui .hud-right .btn.tiny {
    font-size: 15px;
    padding: 8px 12px;
  }

  body.mobile-ui .hud-right .btn.icon {
    width: 46px;
    font-size: 18px;
  }

  body.mobile-ui .coop-pill,
  body.mobile-ui .rush-pill {
    left: 10px;
    top: 76px;
    transform: scale(var(--ui-inv, 1));
    transform-origin: top left;
    font-size: 13px;
  }

  body.mobile-ui .rush-pill { top: 142px; }

  /* ---- toast ---- */
  #overlays > .toast {
    position: fixed;
    top: auto;
    bottom: calc(18px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
    padding: 9px 16px;
    font-size: 13px;
    transform: translate(-50%, 12px);
  }

  #overlays > .toast.show { transform: translate(-50%, 0); }

  /* ---- title screen ---- */
  body.mobile-ui .title-inner {
    flex-direction: column;
    width: min(720px, calc(100vw - 16px));
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    gap: 16px;
    padding: 16px 16px 18px;
    text-align: center;
  }

  body.mobile-ui .title-art { width: min(230px, 56vw); }

  body.mobile-ui .title-copy { width: 100%; }

  body.mobile-ui .title-copy h1 { font-size: clamp(26px, 8.5vw, 40px); }

  body.mobile-ui .title-copy .sub { font-size: 13.5px; }

  body.mobile-ui .name-row { gap: 8px; }

  body.mobile-ui .name-row label { flex: 1; }

  body.mobile-ui .name-row input {
    width: 100%;
    font-size: 16px;
  }

  body.mobile-ui .mode-row {
    flex-direction: column;
    gap: 10px;
  }

  body.mobile-ui .mode-row .btn { width: 100%; }

  body.mobile-ui .btn.big {
    font-size: 15px;
    padding: 12px 18px;
  }

  /* ---- story sheet becomes a bottom sheet ---- */
  body.mobile-ui .sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    max-height: 68dvh;
    transform: none;
    animation: none;
    border-width: 4px 0 0;
    border-radius: 14px 14px 0 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  body.mobile-ui .sheet-portrait { width: 88px; }

  body.mobile-ui .story-text { font-size: 14px; }

  body.mobile-ui .choice {
    font-size: 13px;
    padding: 8px 11px;
  }

  body.mobile-ui .sheet-foot { font-size: 11.5px; }

  /* ---- modals ---- */
  body.mobile-ui .modal {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(30, 17, 10, 0.74);
  }

  body.mobile-ui .modal-card {
    width: min(560px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
    padding: 14px 15px 12px;
    border-width: 3px;
    overscroll-behavior: contain;
  }

  body.mobile-ui .modal-card.narrow { width: min(430px, calc(100vw - 20px)); }

  body.mobile-ui .modal-head h2 { font-size: 18px; }

  body.mobile-ui .modal-sub {
    font-size: 13px;
    line-height: 1.45;
  }

  body.mobile-ui .shop-grid {
    grid-template-columns: 1fr;
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  body.mobile-ui .shop-item img { width: 44px; height: 44px; }

  body.mobile-ui .shop-item .name { font-size: 13px; }

  body.mobile-ui .shop-item .price { font-size: 12px; }

  body.mobile-ui .shop-item .buy {
    font-size: 13px;
    padding: 7px 11px;
  }

  body.mobile-ui .modal-foot-row { flex-wrap: wrap; }

  body.mobile-ui .special-grid {
    grid-template-columns: repeat(3, 1fr);
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  body.mobile-ui .special-item {
    font-size: 11px;
    padding: 8px 5px 6px;
  }

  body.mobile-ui .special-item img { width: 34px; height: 34px; }

  body.mobile-ui .journal-stats { gap: 6px; }

  body.mobile-ui .stat b { font-size: 17px; }

  body.mobile-ui .stat span { font-size: 9px; }

  body.mobile-ui .memory span { font-size: 12px; }

  body.mobile-ui .memories {
    flex: 1 1 auto;
    min-height: 0;
  }

  body.mobile-ui .join-fields { flex-direction: column; }

  body.mobile-ui .field input,
  body.mobile-ui .name-row input { font-size: 16px; }

  body.mobile-ui .role { font-size: 13px; padding: 8px; }

  /* ---- settings ---- */
  body.mobile-ui .side-tab {
    top: 40%;
    padding: 14px 8px;
    font-size: 12px;
  }

  body.mobile-ui .side-panel {
    width: min(380px, 88vw);
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
  }

  body.mobile-ui .side-body p { font-size: 13px; }

  body.mobile-ui .side-body .controls li { font-size: 12px; }
}

/* a phone held sideways: keep the title screen a row so it fits the height */
@media (orientation: landscape) and (max-height: 520px) {
  body.mobile-ui .title-inner {
    flex-direction: row;
    text-align: left;
    gap: 18px;
    padding: 14px 18px;
  }

  body.mobile-ui .title-art { width: min(170px, 26vw); }

  body.mobile-ui .title-copy h1 { font-size: 28px; }

  body.mobile-ui .title-copy .sub {
    margin: 6px 0 10px;
    font-size: 12px;
  }

  body.mobile-ui .name-row { margin-bottom: 10px; }

  body.mobile-ui .mode-row { flex-direction: row; }

  body.mobile-ui .mode-row .btn {
    flex: 1 1 0;
    width: auto;
  }

  body.mobile-ui .btn.big {
    font-size: 13px;
    padding: 9px 12px;
  }
}

/* ---------------------- touch controls (phones only) ---------------------- */
.touch-ui { display: none; }

#overlays > #touch-ui {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none;
}

body.mobile-ui #overlays > #touch-ui { display: flex; }

.touch-pad {
  position: relative;
  width: 152px;
  height: 152px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  pointer-events: none;
}

.touch-key {
  pointer-events: auto;
  touch-action: none;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: inherit;
  font-size: 15px;
  color: #4a2a18;
  border: 3px solid #5b3a24;
  border-radius: 10px;
  background: linear-gradient(rgba(253, 243, 226, 0.92), rgba(236, 213, 172, 0.92));
  box-shadow: 0 3px 0 rgba(60, 35, 20, 0.35);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-key.up { grid-area: 1 / 2; }
.touch-key.left { grid-area: 2 / 1; }
.touch-key.right { grid-area: 2 / 3; }
.touch-key.down { grid-area: 3 / 2; }

.touch-key.pressed {
  background: linear-gradient(#f8b6c6, #e2849a);
  transform: translateY(2px);
  box-shadow: none;
}

.touch-buttons {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.touch-act {
  pointer-events: auto;
  touch-action: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid #7d3f52;
  background: linear-gradient(#f8b6c6, #e2849a);
  box-shadow: 0 4px 0 #b96a80;
  color: #4a2029;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-act.small {
  width: 54px;
  height: 54px;
  font-size: 14px;
  border-color: #5b3a24;
  background: linear-gradient(#fdf3e2, #ecd3ac);
  box-shadow: 0 3px 0 #a37c56;
}

.touch-act.pressed {
  transform: translateY(2px);
  box-shadow: none;
}
