/* Little Empire — warm look: cream paper cards, cocoa text, a clear
   afternoon sky behind the 3D lumber yard. */

:root {
  --cream: #fff7ea;
  --cream-2: #f6ead6;
  --paper-edge: #e8d5b5;
  --cocoa: #3f2a1e;
  --cocoa-2: #7a5a45;
  --orange: #f2884b;
  --orange-deep: #d9692c;
  --green: #4fa36a;
  --green-deep: #3a8352;
  --gold: #f5b83d;
  --plum: #6e5a9e;
  --shadow: 0 10px 28px rgba(63, 42, 30, 0.22), 0 2px 6px rgba(63, 42, 30, 0.12);
  --radius: 18px;
  /* The play host floats ✕/🏆 over the top-right corner and, for guests, a
     sign-in banner along the bottom. Keep controls out of both. */
  --chrome-w: 118px;
  --chrome-h: 60px;
  --chrome-b: 56px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--cocoa);
  background: linear-gradient(180deg, #7fb0dc 0%, #a9cbe3 30%, #dfe6df 52%, #e9eadc 100%);
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; -webkit-touch-callout: none; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ── Floating "+$" labels ───────────────────────────────────────────── */
#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute;
  left: 0; top: 0;
  font-weight: 800;
  font-size: 15px;
  color: #fff6d8;
  text-shadow: 0 1px 0 #b0702a, 0 2px 6px rgba(80, 40, 10, 0.45);
  white-space: nowrap;
  will-change: transform, opacity;
}
.pop.big { font-size: 19px; color: #fff; }

/* ── HUD ────────────────────────────────────────────────────────────── */
#hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: calc(var(--chrome-w) + 6px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }

.hud-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--cream);
  border: 2px solid var(--paper-edge);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 13px;
}
.pill.icon { width: 38px; padding: 0; justify-content: center; }
.pill:active { transform: translateY(1px) scale(0.98); }
.dot {
  position: absolute; top: -3px; right: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--orange); border: 2px solid var(--cream);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.25); } }

/* ── Toasts ─────────────────────────────────────────────────────────── */
#toasts {
  position: fixed;
  top: calc(var(--chrome-h) + 64px);
  left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none;
  width: min(92vw, 380px);
  z-index: 20;
}
.toast {
  background: var(--cocoa);
  color: var(--cream);
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: toast-in 0.3s cubic-bezier(.2, 1.4, .4, 1), toast-out 0.4s ease 2.6s forwards;
}
@keyframes toast-in { from { transform: translateY(-10px) scale(0.9); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-8px); opacity: 0; } }

.btn-main {
  min-height: 50px; padding: 0 22px; border-radius: 14px;
  background: linear-gradient(180deg, #62b77d, var(--green-deep));
  color: #fff; font-weight: 900; font-size: 16px;
  box-shadow: 0 4px 0 #2c6a40;
}
.btn-main:active { transform: translateY(3px); box-shadow: 0 1px 0 #2c6a40; }
.btn-main[disabled] { background: #cdbfa8; box-shadow: 0 4px 0 #ad9e86; cursor: default; }
.btn-soft {
  min-height: 46px; padding: 0 18px; border-radius: 14px; background: var(--cream-2);
  font-weight: 800; color: var(--cocoa-2);
}

/* ── Modal ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(50, 30, 40, 0.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--chrome-h) + 4px) 14px calc(var(--chrome-b) + 6px);
  animation: fade 0.2s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.card {
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
  border: 2px solid var(--paper-edge);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
  animation: pop 0.25s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.card h2 { font-size: 21px; font-weight: 900; text-align: center; margin-bottom: 4px; }
.card .lead { font-size: 13.5px; text-align: center; color: var(--cocoa-2); font-weight: 600; margin-bottom: 14px; line-height: 1.4; }
.card .actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.card .hero-emoji { font-size: 52px; text-align: center; line-height: 1.1; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 14px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.steps li > b:first-child { font-size: 20px; line-height: 1; }

.sol {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid var(--paper-edge); border-radius: 14px;
  padding: 9px 10px; margin-bottom: 7px;
}
.sol .e { font-size: 26px; flex: none; width: 34px; text-align: center; }
.sol .m { flex: 1; min-width: 0; }
.sol .n { font-weight: 900; font-size: 14px; }
.sol .x { font-size: 12px; color: var(--cocoa-2); font-weight: 600; line-height: 1.3; }
.sol button {
  flex: none; min-width: 78px; min-height: 42px; border-radius: 12px; padding: 0 8px;
  font-weight: 900; font-size: 13px;
  background: linear-gradient(180deg, #62b77d, var(--green-deep)); color: #fff;
}
.sol button[disabled] { background: #d9ccb7; color: #8a7461; }
.tabs { display: flex; gap: 4px; background: var(--cream-2); border-radius: 12px; padding: 4px; margin: 6px 0 12px; }
.tab { flex: 1; min-height: 36px; border-radius: 9px; font-weight: 900; font-size: 12.5px; color: var(--cocoa-2); }
.tab.on { background: #fff; color: var(--cocoa); box-shadow: 0 1px 4px rgba(63, 42, 30, 0.15); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border: 2px dashed var(--paper-edge); border-radius: 12px; padding: 6px 4px; font-size: 22px; opacity: 0.55; }
.badge.got { border-style: solid; border-color: var(--gold); opacity: 1; }
.badge small { font-size: 10px; font-weight: 800; color: var(--cocoa-2); text-align: center; line-height: 1.15; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--paper-edge); font-size: 18px; }
.swatch.on { box-shadow: 0 0 0 3px var(--green); }
#yard-out, #yard-in { width: 100%; font: 12px/1.3 ui-monospace, monospace; padding: 8px; border: 2px solid var(--paper-edge); border-radius: 12px; background: #fff; color: var(--cocoa); resize: none; user-select: text; -webkit-user-select: text; word-break: break-all; }
#co-name { width: 100%; font: inherit; font-weight: 800; font-size: 15px; padding: 10px 12px; border: 2px solid var(--paper-edge); border-radius: 12px; background: #fff; color: var(--cocoa); user-select: text; -webkit-user-select: text; }
.shop-area { font-weight: 900; font-size: 13px; color: var(--cocoa-2); margin: 12px 2px 6px; }
.sol.locked { opacity: 0.6; border-style: dashed; }
.sol.locked .e { filter: grayscale(1); }
.sol.can { border-color: var(--green); background: #f1fbec; }
.sol.done { opacity: 0.6; border-style: dashed; }
.sol.done button { background: none; color: var(--green-deep); }
.sol.hidden-sol .n { color: var(--cocoa-2); }

.kv { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; padding: 7px 2px; border-bottom: 1px dashed var(--paper-edge); }
.kv b { font-weight: 900; }

#nogl {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
  width: min(86vw, 340px);
  background: var(--cream); border-radius: var(--radius); padding: 14px; text-align: center;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}

/* (no side panel any more: the yard has the whole screen) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ── Labels over the world ─────────────────────────────────────────── */
.padlabel {
  position: absolute; left: 0; top: 0;
  width: 140px;
  text-align: center;
  background: rgba(255, 247, 234, 0.95);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 3px 6px 4px;
  font-size: 11px; font-weight: 700; line-height: 1.15;
  box-shadow: 0 3px 8px rgba(63, 42, 30, 0.22);
  transition: opacity 0.2s;
}
.padlabel b { display: block; font-size: 11.5px; font-weight: 900; }
.padlabel i { display: block; font-style: normal; font-weight: 900; font-size: 13px; color: var(--green-deep); }
.padlabel.ready { border-color: var(--green); background: #eefbea; animation: glow 1.4s ease-in-out infinite; }
.padlabel { overflow: hidden; }
.padlabel u { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--green); border-radius: 0 2px 2px 0; }
#btn-left, #btn-right { font-size: 17px; font-weight: 900; color: var(--cocoa-2); }
.padlabel small { display: block; font-size: 10px; font-weight: 700; color: var(--cocoa-2); line-height: 1.2; margin-top: 1px; }
/* far away: just the icon and the price, small, so a row of pads still fits */
.padlabel.far { width: auto; white-space: nowrap; padding: 1px 6px 2px; border-width: 1.5px; border-radius: 9px; opacity: 0.8; }
.padlabel.far i { font-size: 11.5px; }
.padlabel.far.ready { opacity: 1; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(79, 163, 106, 0.35); } }

.bubble {
  position: absolute; left: 0; top: 0;
  background: #fff; color: var(--cocoa);
  border-radius: 999px; padding: 2px 8px;
  font-size: 11px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(63, 42, 30, 0.25);
}
.bubble.order { background: var(--gold); font-size: 12px; }
.bubble.order::after { border-top-color: var(--gold); }
.bubble.mini { padding: 1px 5px; font-size: 13px; }
.bubble.mini::after { left: 8px; }
.bubble::after {
  content: ''; position: absolute; left: 34px; bottom: -5px;
  border: 5px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.chip {
  position: absolute; left: 0; top: 0;
  background: rgba(255, 247, 234, 0.9); color: var(--cocoa);
  border: 1.5px solid var(--paper-edge); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 2px 5px rgba(63, 42, 30, 0.18);
}
.chip.full { border-color: var(--orange); background: #fff0e2; }
.chip.me.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 40% { scale: 1.18; } }
.chip.me { background: rgba(255, 252, 240, 0.97); border-color: var(--gold); font-size: 13px; }

#guide {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 46px);
  left: 10px;
  right: calc(var(--chrome-w) + 6px);
  max-width: 420px;
  background: var(--cocoa); color: var(--cream);
  font-weight: 800; font-size: 13.5px; line-height: 1.3;
  padding: 8px 12px; border-radius: 14px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* ── The next goal, under the buttons ─────────────────────────────── */
#goal {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 46px);
  left: 10px;
  max-width: min(300px, calc(100vw - var(--chrome-w) - 20px));
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 8px 8px;
  background: var(--cream); border: 2px solid var(--paper-edge); border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden; text-align: left;
}
#goal[hidden] { display: none; }
#goal .gi { font-size: 22px; line-height: 1; }
#goal .gt { display: flex; flex-direction: column; min-width: 0; }
#goal b { font-size: 12.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goal i { font-style: normal; font-size: 11.5px; font-weight: 800; color: var(--green-deep); }
#goal u { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); transition: width 0.3s; }
#goal.ready { border-color: var(--green); animation: glow 1.4s ease-in-out infinite; }
#goal.ready u { background: var(--green); }
#goal:active { transform: scale(0.98); }

/* ── What you're doing: a bar over your head ───────────────────────── */
#act {
  position: fixed; left: 0; top: 0;
  width: 68px; height: 22px;
  background: rgba(63, 42, 30, 0.82); border-radius: 999px;
  pointer-events: none; overflow: hidden;
}
#act[hidden] { display: none; }
#act span { position: absolute; left: 4px; top: 1px; font-size: 14px; z-index: 1; }
#act i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #62b77d, #9be0a6); border-radius: 999px; transition: width 0.1s linear; }
#act.hot i { background: linear-gradient(90deg, #ff8a2a, #ffd04a); }

#flash.fade { animation: fade-white 1.6s ease-in-out; }
@keyframes fade-white { 0% { opacity: 0; } 35%, 55% { opacity: 1; } 100% { opacity: 0; } }
.pill.dial { position: relative; overflow: hidden; padding: 0; transition: background 2s; }
.dial i { position: absolute; font-style: normal; font-size: 13px; transform: translate(-50%, -50%); line-height: 1; }
.dial b { position: absolute; left: 50%; bottom: 1px; transform: translateX(-50%); font-size: 10px; line-height: 1; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 15; }
#flash.go { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.7; } 15% { opacity: 0.2; } 25% { opacity: 0.55; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #flash.go { animation: none; } }
/* Bigger labels, for easier reading */
body.big .padlabel { width: 170px; font-size: 13px; }
body.big .padlabel b { font-size: 14px; }
body.big .padlabel i { font-size: 15.5px; }
body.big .padlabel small { font-size: 12px; }
body.big .padlabel.far i { font-size: 14px; }
body.big .chip { font-size: 14.5px; }
body.big .bubble { font-size: 13.5px; }
body.big #goal b { font-size: 14.5px; }
body.big #goal i { font-size: 13.5px; }
body.big .toast { font-size: 16px; }
body.big #info { width: 170px; }
body.big #info b { font-size: 16px; }
body.big #info span, body.big #info i { font-size: 13px; }
/* on tour, the buttons and labels step aside */
body.touring #hud, body.touring #goal, body.touring #guide, body.touring #map, body.touring #turn, body.touring #fx { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
#fps {
  position: fixed; right: 10px; bottom: calc(var(--chrome-b) + max(10px, env(safe-area-inset-bottom)) + 48px);
  background: rgba(63, 42, 30, 0.75); color: var(--cream); font-size: 11px; font-weight: 800;
  padding: 2px 7px; border-radius: 8px; pointer-events: none;
}
#fps[hidden] { display: none; }

/* ── Who's this? ───────────────────────────────────────────────────── */
#info {
  position: fixed; left: 0; top: 0; width: 140px;
  background: var(--cream); border: 2px solid var(--gold); border-radius: 12px;
  padding: 5px 8px 6px; text-align: center; pointer-events: none;
  box-shadow: 0 4px 12px rgba(63, 42, 30, 0.28); z-index: 5;
}
#info[hidden] { display: none; }
#info b { display: block; font-size: 14px; font-weight: 900; }
#info i { display: block; font-style: normal; font-size: 11px; font-weight: 800; color: var(--orange-deep); }
#info span { display: block; font-size: 11.5px; font-weight: 700; color: var(--cocoa-2); line-height: 1.25; }
#info.wide { width: 200px; }
#info.wide::after { left: 92px; }
#info::after { content: ''; position: absolute; left: 62px; bottom: -7px; border: 7px solid transparent; border-top-color: var(--gold); border-bottom: 0; }

/* ── Milestone banner ─────────────────────────────────────────────── */
#banner {
  position: fixed; left: 50%; top: 32%;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  border: 3px solid #fff; border-radius: 20px;
  padding: 12px 22px; text-align: center;
  box-shadow: 0 12px 30px rgba(63, 42, 30, 0.35);
  pointer-events: none; z-index: 30;
}
#banner[hidden] { display: none; }
#banner b { display: block; font-size: 24px; font-weight: 900; color: var(--cocoa); }
#banner i { display: block; font-style: normal; font-weight: 800; font-size: 14px; color: var(--cocoa-2); }
#banner.go { animation: banner 3.6s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes banner {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.08) rotate(2deg); opacity: 1; }
  20%, 85% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(0.9); opacity: 0; }
}

/* ── Turn buttons, bottom right ────────────────────────────────────── */
#turn {
  position: fixed;
  right: 10px;
  bottom: calc(var(--chrome-b) + max(10px, env(safe-area-inset-bottom)));
  display: flex; gap: 6px;
}

/* ── Settings rows ─────────────────────────────────────────────────── */
.set-row {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  background: #fff; border: 2px solid var(--paper-edge); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 7px;
}
.set-row .e { font-size: 22px; width: 30px; text-align: center; }
.set-row .m { flex: 1; display: flex; flex-direction: column; }
.set-row b { font-size: 14px; font-weight: 900; }
.set-row .m i { font-style: normal; font-size: 12px; color: var(--cocoa-2); font-weight: 600; }
.sw { width: 44px; height: 26px; border-radius: 999px; background: #d9ccb7; position: relative; flex: none; transition: background 0.2s; }
.sw i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s; }
.sw.on { background: var(--green); }
.sw.on i { transform: translateX(18px); }

/* ── The map, bottom left, above the host's sign-in banner ────────── */
#map {
  position: fixed;
  left: 10px;
  bottom: calc(var(--chrome-b) + max(10px, env(safe-area-inset-bottom)));
  width: 180px; height: 72px;
  border-radius: 12px; overflow: hidden;
  border: 2px solid var(--cream);
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: pointer;
  opacity: 0.93;
}
#map svg { display: block; width: 100%; height: 100%; }
#map .blink { animation: blink 0.8s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
@media (max-width: 380px) { #map { width: 150px; height: 60px; } }

/* ── Arrows to things off screen ───────────────────────────────────── */
.edge {
  position: absolute; left: 0; top: 0;
  width: 44px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 247, 234, 0.92); border: 2px solid var(--gold);
  border-radius: 999px; font-size: 16px;
  box-shadow: 0 3px 8px rgba(63, 42, 30, 0.25);
}
.edge .ea { position: absolute; width: 12px; height: 14px; line-height: 14px; text-align: center; font-size: 12px; color: var(--orange-deep); text-shadow: 0 0 2px #fff; }
.edge.hot { border-color: #ff5a2a; animation: hot 0.6s ease-in-out infinite; }
@keyframes hot { 50% { box-shadow: 0 0 0 5px rgba(255, 90, 42, 0.35); } }

#stick {
  position: fixed; left: 0; top: 0;
  width: 110px; height: 110px; border-radius: 50%;
  border: 3px solid rgba(255, 247, 234, 0.85);
  background: rgba(63, 42, 30, 0.18);
  pointer-events: none;
}
#knob {
  position: absolute; left: 33px; top: 33px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 247, 234, 0.95);
  box-shadow: 0 2px 6px rgba(63, 42, 30, 0.35);
}

/* ── The current contract, under the next goal ────────────────────── */
#quest {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 46px);
  left: 10px;
  max-width: min(300px, calc(100vw - var(--chrome-w) - 20px));
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 8px 8px;
  background: var(--cream); border: 2px solid var(--paper-edge); border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden; text-align: left;
}
#quest[hidden] { display: none; }
#quest .gi { font-size: 22px; line-height: 1; }
#quest .gt { display: flex; flex-direction: column; min-width: 0; }
#quest b { font-size: 12.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#quest i { font-style: normal; font-size: 11.5px; font-weight: 800; color: var(--green-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#quest u { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--green); transition: width 0.3s; }
#quest:active { transform: scale(0.98); }
#quest { padding-right: 24px; }
#quest em { font-style: normal; font-size: 11px; font-weight: 700; color: #6b5a44; line-height: 1.25; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
#quest em.stuck { color: #a5521b; }
#quest s { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); text-decoration: none;
  font-size: 20px; font-weight: 900; color: var(--green-deep); opacity: 0.55; }
#quest.done { animation: questDone 0.9s ease-out; }
@keyframes questDone {
  0% { transform: scale(1); box-shadow: var(--shadow); }
  25% { transform: scale(1.06); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242, 194, 48, 0.55), var(--shadow); }
  100% { transform: scale(1); box-shadow: var(--shadow); }
}
body.big #quest em { font-size: 13px; }

/* ── Missions (2026-11-06) ── */
#quest em { display: block; font-style: normal; font-size: 11px; font-weight: 800; color: var(--cocoa-2); white-space: normal; line-height: 1.25; margin-top: 1px; }
#quest i { white-space: normal; line-height: 1.25; }
#quest .steps { display: flex; gap: 4px; margin-top: 4px; }
#quest .steps i { width: 14px; height: 5px; border-radius: 3px; background: var(--paper-edge); display: block; }
#quest .steps i.done { background: var(--green); }
#quest .steps i.now { background: var(--gold); }
#do {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--chrome-b) + max(10px, env(safe-area-inset-bottom)) + 84px);
  min-width: 150px; height: 62px; padding: 0 22px 0 14px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: linear-gradient(180deg, #ffd27a, var(--gold)); color: var(--cocoa);
  border: 3px solid #fff; box-shadow: 0 8px 22px rgba(63, 42, 30, 0.35);
  font-weight: 900; font-size: 18px; z-index: 12; touch-action: none;
}
#do[hidden] { display: none; }
#do b { font-size: 28px; line-height: 1; }
#do:not(.ready) { opacity: 0.6; filter: saturate(0.6); }
#do.hot { background: linear-gradient(180deg, #a6ef9a, var(--green)); color: #fff; animation: do-pulse 0.5s ease-in-out infinite alternate; }
#do:active { transform: translateX(-50%) scale(0.95); }
@keyframes do-pulse { from { box-shadow: 0 0 0 0 rgba(79, 163, 106, 0.6); } to { box-shadow: 0 0 0 12px rgba(79, 163, 106, 0); } }
.mlist { display: flex; flex-direction: column; gap: 6px; text-align: left; margin: 8px 0; }
.mrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--cream-2); }
.mrow .mi { font-size: 22px; line-height: 1.2; }
.mrow .mt { display: flex; flex-direction: column; min-width: 0; }
.mrow b { font-size: 14px; } .mrow i { font-style: normal; font-size: 12.5px; color: var(--cocoa-2); font-weight: 700; }
.mrow small { font-size: 12px; margin-top: 4px; line-height: 1.45; font-weight: 700; }
.mrow.now { background: #fff3d6; border: 2px solid var(--gold); }
.mrow.done { opacity: 0.6; } .mrow.locked { opacity: 0.75; }

/* ── Polish (2026-11-09): softer picture, clearer HUD ──────────────── */
/* a faint vignette over the 3D picture, under every label and button */
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 100% at 50% 45%, transparent 55%, rgba(40, 24, 30, 0.2) 100%),
    linear-gradient(180deg, rgba(255, 236, 200, 0.07), transparent 30%);
}

/* keyboard users see where they are */
button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* top buttons: paper with a soft sheen, a lift under the mouse */
.pill {
  background: linear-gradient(180deg, #fffdf6, var(--cream) 55%, var(--cream-2));
  box-shadow: 0 6px 16px rgba(63, 42, 30, 0.2), 0 1px 3px rgba(63, 42, 30, 0.14), inset 0 1px 0 #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.pill.icon { font-size: 17px; }
#hud { z-index: 6; animation: hud-in 0.5s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes hud-in { from { transform: translateY(-14px); opacity: 0; } }
#turn .pill.icon { width: 44px; min-height: 44px; }
@media (hover: hover) and (pointer: fine) {
  button.pill:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 10px 20px rgba(63, 42, 30, 0.24), 0 2px 4px rgba(63, 42, 30, 0.14), inset 0 1px 0 #fff; }
  button.pill:active { transform: translateY(1px) scale(0.98); }
  /* what a button is, under the mouse */
  button.pill[aria-label]::after {
    content: attr(aria-label);
    position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%) translateY(-4px);
    background: var(--cocoa); color: var(--cream);
    font-size: 12px; font-weight: 800; line-height: 1; white-space: nowrap;
    padding: 6px 9px; border-radius: 8px;
    opacity: 0; pointer-events: none; transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 40;
  }
  button.pill[aria-label]:hover::after, button.pill[aria-label]:focus-visible::after { opacity: 1; transform: translateX(-50%); transition-delay: 0.35s; }
  #hud .hud-row button.pill:first-child::after { left: 0; transform: translateY(-4px); }
  #hud .hud-row button.pill:first-child:hover::after, #hud .hud-row button.pill:first-child:focus-visible::after { transform: none; }
  #turn button.pill[aria-label]::after { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; transform: translateY(4px); }
  #turn button.pill[aria-label]:hover::after, #turn button.pill[aria-label]:focus-visible::after { transform: none; }
  #goal:hover, #quest:hover { border-color: var(--gold); }
  .set-row:hover, .sol:hover { border-color: var(--gold); }
  .tab:hover { color: var(--cocoa); }
  .btn-main:hover:not([disabled]) { filter: brightness(1.06); }
  .btn-soft:hover { background: var(--paper-edge); color: var(--cocoa); }
  #map:hover { opacity: 1; transform: scale(1.03); }
}

/* the mission card: a title, the task, a clear bar, dots in a row */
#goal, #quest {
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf6, var(--cream));
  box-shadow: 0 8px 22px rgba(63, 42, 30, 0.2), 0 1px 3px rgba(63, 42, 30, 0.14), inset 0 1px 0 #fff;
  transition: border-color 0.2s ease;
}
#quest { max-width: min(330px, calc(100vw - var(--chrome-w) - 20px)); padding: 9px 26px 13px 9px; gap: 10px; align-items: flex-start; }
#quest .gi {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fff1cf, #ffe2a3); box-shadow: inset 0 0 0 2px rgba(245, 184, 61, 0.55);
}
#quest b { font-size: 13.5px; color: var(--cocoa); }
#quest i { font-size: 12px; color: var(--green-deep); margin-top: 1px; }
#quest em { color: var(--cocoa-2); }
#quest .steps { flex-direction: row; align-items: center; gap: 4px; margin-top: 6px; }
#quest .steps i { width: 16px; height: 6px; margin: 0; flex: none; }
#quest .steps i.now { animation: step-now 1.2s ease-in-out infinite; }
@keyframes step-now { 50% { opacity: 0.45; } }
#quest u, #goal u { height: 5px; border-radius: 0 3px 3px 0; }
#quest u { background: linear-gradient(90deg, var(--green-deep), #7fd093); }
#quest::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(63, 42, 30, 0.08); }
#guide { border-radius: 16px; background: rgba(63, 42, 30, 0.92); }

/* toasts */
.toast { background: rgba(63, 42, 30, 0.94); border: 1.5px solid rgba(255, 247, 234, 0.18); padding: 9px 18px; }

/* the map: a framed card, bigger where there is room */
#map {
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(63, 42, 30, 0.26), 0 0 0 1px var(--paper-edge);
  transition: transform 0.15s ease, opacity 0.15s ease;
  transform-origin: left bottom;
}
@media (min-width: 900px) and (min-height: 560px) { #map { width: 225px; height: 90px; } }

/* cards: a deeper backdrop, a thin scrollbar, the answer button always in reach */
.overlay { background: rgba(46, 28, 36, 0.5); backdrop-filter: blur(5px) saturate(1.1); }
.card {
  background: linear-gradient(180deg, #fffdf6, var(--cream) 120px);
  box-shadow: 0 24px 60px rgba(40, 24, 30, 0.38), 0 2px 8px rgba(63, 42, 30, 0.16), inset 0 1px 0 #fff;
  scrollbar-width: thin; scrollbar-color: var(--paper-edge) transparent;
}
.card .actions {
  position: sticky; bottom: -16px; z-index: 2;
  margin: 14px -18px -16px; padding: 14px 18px 16px;
  background: linear-gradient(180deg, rgba(255, 247, 234, 0), var(--cream) 30%);
}
.card .hero-emoji { filter: drop-shadow(0 4px 6px rgba(63, 42, 30, 0.2)); }
.steps li, .sol, .set-row { box-shadow: 0 1px 0 rgba(63, 42, 30, 0.06); transition: border-color 0.12s ease; }
.steps li { border: 1.5px solid var(--cream-2); }
.mrow { border: 2px solid transparent; }
.mrow.now { box-shadow: 0 4px 12px rgba(245, 184, 61, 0.3); }

/* the action button */
#do { box-shadow: 0 10px 26px rgba(63, 42, 30, 0.38), inset 0 2px 0 rgba(255, 255, 255, 0.55); }
