:root {
  --ink: #3d2a1c;
  --foam: #f6f1e6;
  --gold: #f0c45a;
  --sea: #1a7a92;
  --line: rgba(55, 36, 22, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #155e72;
  font-family: Nunito, "Trebuchet MS", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
  color: var(--foam);
}

#app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  height: 100dvh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  padding:
    calc(6px + env(safe-area-inset-top))
    8px
    calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
  background:
    radial-gradient(120% 70% at 50% -10%, #7ec9d8 0%, transparent 46%),
    linear-gradient(180deg, #2a9bb3 0%, #18748c 48%, #0f5366 100%);
  overflow: hidden;
}

#hud {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
}

.hud-chip, #btn-mute, #btn-sell, #btn-shop, #btn-games, #btn-help, .go, .gen, .pad,
.shop-row, .game-row, .mini-btn {
  font-weight: 800;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.hud-chip {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 16px;
  background: rgba(255, 248, 230, 0.92);
  color: var(--ink);
  font-size: 0.88rem;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(12, 40, 50, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hud-chip.energy { background: rgba(210, 244, 250, 0.95); }
.hud-chip.gold { background: linear-gradient(180deg, #ffe7a0, #f0c45a); }

#btn-shop, #btn-games, #btn-help {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 16px;
  background: rgba(255, 248, 230, 0.92);
  color: var(--ink);
  font-size: 0.88rem;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px rgba(12, 40, 50, 0.16);
}

#btn-shop { margin-left: auto; }

#btn-help {
  width: 44px;
  padding: 0;
  font-size: 1.15rem;
  font-weight: 900;
}

#btn-mute {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(255, 248, 230, 0.92);
  color: var(--ink);
  font-size: 1.05rem;
  border: 1px solid var(--line);
}

#lesson { min-height: 0; }

#story, .coach, .cust, .panel {
  background: linear-gradient(180deg, #fffaf0, #f3e6cf);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(12, 40, 50, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

#story {
  border-radius: 20px 18px 22px 16px;
  padding: 8px 12px;
}

.story-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 900;
  color: #0e5d75;
  text-transform: uppercase;
}

#story-text {
  margin: 2px 0 0;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
}

.story-goal {
  margin: 4px 0 0;
  font-size: 0.86rem;
  font-weight: 900;
  color: #8a4a12;
}

.story-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.25;
  color: #0e5d75;
}

#customers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.cust {
  min-height: 78px;
  padding: 7px 8px;
  border-radius: 22px 18px 20px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.cust.empty {
  background: rgba(255, 248, 234, 0.18);
  color: #e7fbff;
  box-shadow: none;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.cust.story { background: linear-gradient(180deg, #ffe9b8, #f3d48a); }

.face-art {
  width: 46px;
  height: 52px;
  flex: none;
  object-fit: cover;
  object-position: top center;
  border-radius: 14px 12px 16px 12px;
  border: 1px solid var(--line);
  background: #1a3340;
}
.face {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 42% 36% 40% 38%;
  background: radial-gradient(circle at 35% 30%, #fff3c8, #f0c56a);
  border: 1px solid var(--line);
  font-size: 1.5rem;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.cname {
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.1;
}

.stay {
  font-size: 0.68rem;
  font-weight: 800;
  color: #0e5d75;
}

.needs { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

.need {
  min-width: 70px;
  min-height: 62px;
  padding: 5px 6px 4px;
  border-radius: 18px 14px 16px 12px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.72);
  line-height: 1;
}

.need b {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.need .pay {
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  color: #8a4a12;
}

.need.done { opacity: 0.5; }

#stage {
  min-height: 0;
  overflow: hidden;
  position: relative;
  border-radius: 28px 22px 30px 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 220, 160, 0.22), transparent 40%),
    linear-gradient(135deg, #c99252 0%, #b0783c 42%, #9a6430 100%);
  border: 1px solid rgba(80, 42, 12, 0.28);
  box-shadow: inset 0 2px 10px rgba(255, 230, 180, 0.2), 0 10px 22px rgba(8, 30, 40, 0.28);
  touch-action: none;
}

#board {
  --cell: 44px;
  --gap: 4px;
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(9, var(--cell));
  gap: var(--gap);
  width: calc(8 * var(--cell) + 7 * var(--gap) + 16px);
  height: calc(9 * var(--cell) + 8 * var(--gap) + 16px);
  padding: 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  will-change: transform;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: var(--cell);
  height: var(--cell);
  border-radius: 18px 14px 16px 12px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 214, 150, 0.35), transparent 42%),
    linear-gradient(180deg, rgba(176, 112, 52, 0.42), rgba(92, 48, 16, 0.34));
  box-shadow: inset 0 2px 6px rgba(40, 18, 4, 0.28);
}
.cell.fog {
  background: rgba(90, 112, 122, 0.42);
  box-shadow: inset 0 0 12px rgba(20, 30, 40, 0.35);
}
.cell.fog::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 22px 16px 20px 14px;
  background:
    linear-gradient(180deg, rgba(210, 224, 230, 0.28), rgba(120, 140, 150, 0.18));
  pointer-events: none;
}
.cell.fog .item {
  z-index: 1;
  filter: saturate(0.55) brightness(0.92);
  opacity: 0.9;
}
.cell.crate::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 2;
  border-radius: 12px 10px 12px 9px;
  background:
    linear-gradient(#c9a46a 0 18%, #8a6230 18% 22%, #c9a46a 22% 78%, #8a6230 78% 82%, #c9a46a 82% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.cell.fog::before { display: none; }
.cell.fog.edge.crate::before { display: block; z-index: 1; }
.cell.ready {
  box-shadow: 0 0 0 2px #ffe14a, inset 0 2px 6px rgba(40, 18, 4, 0.28);
  animation: pulse 0.9s ease infinite;
}
.cell.lock {
  background: rgba(40, 28, 16, 0.42);
}
.cell.lock .lock-tag {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 900;
  color: #fff8ea;
  text-shadow: 0 1px 2px #000;
  background: rgba(30, 24, 18, 0.45);
  border-radius: 22px 16px 20px 14px;
  pointer-events: none;
}

.item, .ghost {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  border: 1px solid var(--line);
  box-shadow:
    0 7px 14px rgba(20, 30, 40, 0.22),
    inset 0 2px 5px rgba(255, 255, 255, 0.38);
}

.item {
  position: absolute;
  inset: 2px;
  border-radius: 42% 32% 40% 34% / 36% 42% 30% 40%;
  -webkit-tap-highlight-color: transparent;
}

.ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  border-radius: 42% 32% 40% 34% / 36% 42% 30% 40%;
}
.ghost.hidden { display: none; }

.iname {
  font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  text-transform: uppercase;
  background: rgba(255, 252, 245, 0.92);
  border-radius: 999px;
  padding: 2px 5px;
  max-width: 96%;
  text-align: center;
  line-height: 1.1;
}

.glyph {
  width: 42%;
  height: 36%;
  position: relative;
  flex: none;
  display: block;
}

.need .glyph { width: 28px; height: 22px; }

.item.coffee { background: linear-gradient(160deg, #f3c892, #c9844a 55%, #8d5424); }
.item.bakery { background: linear-gradient(160deg, #fff0c0, #f0b85a 58%, #d4923a); }
.item.dock { background: linear-gradient(160deg, #d8f3ff, #62b4d2 58%, #2f86a8); }
.item.cooler { background: linear-gradient(160deg, #ffe8f4, #f7a0c8 55%, #c45a88); }
.item.part { background: linear-gradient(160deg, #efe4ff, #c2a6f0 58%, #8d6cc8); }

.item.coffee .glyph, .need.coffee .glyph {
  background: radial-gradient(circle at 30% 28%, #e8b07a, #6b3410 70%);
  border-radius: 60% 40% 58% 42%;
  transform: rotate(-22deg);
  box-shadow: inset -3px -3px 5px rgba(0, 0, 0, 0.28), inset 2px 2px 4px rgba(255, 255, 255, 0.3);
}
.item.coffee.lv1 .glyph, .need.coffee.lv1 .glyph,
.item.coffee.lv2 .glyph, .need.coffee.lv2 .glyph,
.item.coffee.lv3 .glyph, .need.coffee.lv3 .glyph {
  transform: none;
  width: 34%;
  height: 30%;
  border-radius: 22% 22% 30% 30% / 18% 18% 40% 40%;
  background: linear-gradient(#fff6e6, #e8c9a0);
  box-shadow: inset 0 -7px 0 #6b3a16;
}
.item.coffee.lv1 .glyph::after, .need.coffee.lv1 .glyph::after,
.item.coffee.lv2 .glyph::after, .need.coffee.lv2 .glyph::after {
  content: "";
  position: absolute;
  right: -26%;
  top: 16%;
  width: 26%;
  height: 46%;
  border: 2px solid rgba(90, 50, 20, 0.45);
  border-left: 0;
  border-radius: 0 90% 90% 0;
}
.item.coffee.lv4 .glyph, .need.coffee.lv4 .glyph,
.item.coffee.lv5 .glyph, .need.coffee.lv5 .glyph {
  transform: none;
  border-radius: 30% 30% 40% 40%;
  background: linear-gradient(#fff, #d9b48c);
  box-shadow: inset 0 -10px 0 #4a220c, 0 0 8px rgba(255, 220, 140, 0.5);
}
.item.coffee.lv6 .glyph, .item.coffee.lv7 .glyph,
.item.coffee.lv8 .glyph, .item.coffee.lv9 .glyph,
.item.coffee.lv10 .glyph, .item.coffee.lv11 .glyph,
.need.coffee.lv6 .glyph, .need.coffee.lv7 .glyph,
.need.coffee.lv8 .glyph, .need.coffee.lv9 .glyph,
.need.coffee.lv10 .glyph, .need.coffee.lv11 .glyph {
  transform: none;
  border-radius: 28% 28% 36% 36%;
  background: linear-gradient(#fff8d0, #c9a056);
  box-shadow: 0 0 10px rgba(255, 214, 90, 0.7), inset 0 -8px 0 #5a2e10;
}

.item.bakery .glyph, .need.bakery .glyph {
  background: linear-gradient(#fff3c2, #e0a24a);
  border-radius: 50% 50% 42% 42% / 62% 62% 38% 38%;
  box-shadow: inset 0 -4px 0 rgba(140, 70, 10, 0.25);
}
.item.bakery.lv0 .glyph, .need.bakery.lv0 .glyph {
  width: 18%;
  height: 42%;
  border-radius: 40% 40% 20% 20%;
  background: linear-gradient(#f0e08a, #b8943a);
  transform: rotate(8deg);
}
.item.bakery.lv1 .glyph, .need.bakery.lv1 .glyph {
  width: 42%;
  height: 36%;
  border-radius: 48% 48% 40% 40% / 58% 58% 40% 40%;
  background: linear-gradient(#fff6d0, #e39a3c);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.7), inset 0 -5px 0 rgba(140, 70, 10, 0.2);
}
.item.bakery.lv4 .glyph, .item.bakery.lv5 .glyph, .item.bakery.lv6 .glyph,
.need.bakery.lv4 .glyph, .need.bakery.lv5 .glyph, .need.bakery.lv6 .glyph {
  border-radius: 18% 18% 28% 28%;
  height: 40%;
  background: linear-gradient(#fff, #f2c2d8 40%, #f6e2a8 70%, #c9844a);
}
.item.bakery.lv7 .glyph, .item.bakery.lv8 .glyph, .item.bakery.lv9 .glyph,
.item.bakery.lv10 .glyph, .item.bakery.lv11 .glyph,
.need.bakery.lv7 .glyph, .need.bakery.lv8 .glyph, .need.bakery.lv9 .glyph,
.need.bakery.lv10 .glyph, .need.bakery.lv11 .glyph {
  height: 44%;
  border-radius: 16% 16% 24% 24%;
  background: linear-gradient(#fff, #f7b7d2 30%, #fff1b0 60%, #d4a056);
  box-shadow: 0 0 8px rgba(255, 200, 230, 0.6);
}

.item.dock .glyph, .need.dock .glyph {
  background: linear-gradient(135deg, #9fd7ef, #2f7ea3);
  border-radius: 60% 40% 55% 45% / 40% 60% 40% 60%;
  box-shadow: inset -4px 0 0 rgba(255, 255, 255, 0.25);
}
.item.dock.lv0 .glyph, .need.dock.lv0 .glyph {
  width: 12%;
  height: 40%;
  border-radius: 40%;
  background: #5a4030;
  transform: rotate(35deg);
}
.item.dock.lv2 .glyph, .item.dock.lv3 .glyph, .need.dock.lv2 .glyph, .need.dock.lv3 .glyph {
  border-radius: 30% 70% 40% 60%;
  background: linear-gradient(#ffe0b0, #e09050);
}
.item.dock.lv4 .glyph, .item.dock.lv5 .glyph, .item.dock.lv6 .glyph,
.need.dock.lv4 .glyph, .need.dock.lv5 .glyph, .need.dock.lv6 .glyph {
  border-radius: 48% 30% 52% 40%;
  background: linear-gradient(#ff8a6a, #c43a2a);
}
.item.dock.lv7 .glyph, .item.dock.lv8 .glyph, .item.dock.lv9 .glyph,
.item.dock.lv10 .glyph, .item.dock.lv11 .glyph,
.need.dock.lv7 .glyph, .need.dock.lv8 .glyph, .need.dock.lv9 .glyph,
.need.dock.lv10 .glyph, .need.dock.lv11 .glyph {
  background: linear-gradient(#ffe7a0, #f0b44a 50%, #2f7ea3);
  box-shadow: 0 0 10px rgba(255, 220, 120, 0.65);
}

.item.cooler .glyph, .need.cooler .glyph {
  background: linear-gradient(#fff, #ffd0e8 40%, #f090b8);
  border-radius: 50% 50% 42% 42% / 58% 58% 40% 40%;
  box-shadow: inset 0 -5px 0 rgba(180, 60, 100, 0.25);
}
.item.cooler.lv0 .glyph, .need.cooler.lv0 .glyph {
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #f7b7d2);
}
.item.cooler.lv1 .glyph, .need.cooler.lv1 .glyph {
  width: 22%;
  height: 40%;
  border-radius: 40% 40% 48% 48% / 30% 30% 70% 70%;
  background: linear-gradient(#fff8e8, #f2c2a0 55%, #e09070);
}
.item.cooler.lv2 .glyph, .item.cooler.lv3 .glyph, .need.cooler.lv2 .glyph, .need.cooler.lv3 .glyph {
  height: 40%;
  border-radius: 46% 46% 30% 30% / 55% 55% 40% 40%;
  background: linear-gradient(#fff, #f7c2e0 35%, #8ad0ef 70%, #f09070);
}
.item.cooler.lv4 .glyph, .item.cooler.lv5 .glyph, .item.cooler.lv6 .glyph,
.need.cooler.lv4 .glyph, .need.cooler.lv5 .glyph, .need.cooler.lv6 .glyph {
  height: 42%;
  border-radius: 20% 20% 28% 28%;
  background: linear-gradient(#fff, #c8f0ff 30%, #f7b7d2 65%, #d4a056);
}
.item.cooler.lv7 .glyph, .item.cooler.lv8 .glyph, .item.cooler.lv9 .glyph,
.item.cooler.lv10 .glyph, .need.cooler.lv7 .glyph, .need.cooler.lv8 .glyph,
.need.cooler.lv9 .glyph, .need.cooler.lv10 .glyph {
  height: 44%;
  border-radius: 18% 18% 26% 26%;
  background: linear-gradient(#fff8d0, #c8e8ff 35%, #f090c0 70%, #7a5aad);
  box-shadow: 0 0 10px rgba(200, 160, 255, 0.65);
}

.item.part .glyph {
  width: 28%;
  height: 28%;
  background: conic-gradient(#efe7ff, #7a5aad, #efe7ff);
  border-radius: 30%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.item.part.lv1 .glyph {
  width: 40%;
  height: 32%;
  border-radius: 28% 22% 26% 24%;
  background: linear-gradient(#fff, #d7c4f5);
}

.item.selected {
  box-shadow:
    0 0 0 3px rgba(255, 248, 210, 0.95),
    0 8px 16px rgba(20, 30, 40, 0.25);
}
.item.pop { animation: pop 0.22s ease; }
.item.spot, .gen.spot, .pad.spot, .cust.spot {
  box-shadow: 0 0 0 3px #ffe14a, 0 8px 16px rgba(20, 30, 40, 0.2);
  animation: pulse 0.9s ease infinite;
}

#dock {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

#gens {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 6px;
}

.gen, .pad, #btn-sell {
  min-height: 72px;
  max-height: 96px;
  border-radius: 20px 16px 18px 14px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 12px rgba(12, 40, 50, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.gen, .pad, #btn-sell {
  touch-action: manipulation;
}
.gen, .pad {
  background: linear-gradient(180deg, #fff6dc, #e8c36a);
  color: var(--ink);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.pad {
  background: linear-gradient(180deg, rgba(180, 210, 220, 0.75), rgba(130, 164, 176, 0.7));
  color: #163038;
}

.gen-icon { font-size: 1.35rem; line-height: 1; }
.gen-name { font-size: 0.76rem; font-weight: 900; text-transform: uppercase; }
.pips { letter-spacing: 1px; font-size: 0.68rem; color: #4a2a08; }

#btn-sell {
  width: 70px;
  background: linear-gradient(180deg, #ffd8d0, #f0a090);
  color: var(--ink);
  font-size: 0.95rem;
}

.gen:active, .pad:active, #btn-sell:active, .go:active, #btn-mute:active,
#btn-shop:active, #btn-games:active, #btn-help:active, .cust:active, .shop-row:active, .game-row:active, .mini-btn:active {
  transform: scale(0.98);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 36, 46, 0.5);
  display: grid;
  place-items: end center;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
}

.overlay.hidden, .panel.hidden, .coach.hidden, .toast.hidden, .ghost.hidden, .hidden {
  display: none !important;
}

.panel {
  width: min(100%, 430px);
  max-height: min(86dvh, 720px);
  overflow: auto;
  border-radius: 28px 22px 26px 20px;
  padding: 16px 14px 14px;
  text-align: center;
}

.kicker { margin: 0; font-weight: 800; color: #0e5d75; }

h1 {
  margin: 4px 0 8px;
  font-family: Bangers, Impact, "Arial Black", sans-serif;
  font-size: 2.3rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 0.95;
}

.lead, .warn { margin: 0 0 8px; font-weight: 800; }
.warn { font-size: 0.88rem; }

.go {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffe7a0, #f0c45a);
  color: var(--ink);
  font-size: 1.12rem;
  border: 1px solid var(--line);
  box-shadow: 0 6px 12px rgba(12, 40, 50, 0.16);
}

.go.alt { background: linear-gradient(180deg, #e4f7ff, #bfe8f4); }
.go.tiny { min-height: 44px; margin-top: 6px; font-size: 1rem; }

.shop-row, .game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 18px 14px 16px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  font: inherit;
  font-weight: 800;
}

.shop-row:disabled, .game-row:disabled { opacity: 0.45; }

.price {
  flex: none;
  background: linear-gradient(180deg, #ffe7a0, #f0c45a);
  border-radius: 14px;
  padding: 4px 8px;
}

.coach {
  position: relative;
  z-index: 2;
  border-radius: 16px 14px 16px 12px;
  padding: 6px 8px 8px;
  text-align: center;
  font-weight: 800;
  background: linear-gradient(180deg, #fff4c4, #f0d36a);
}

.coach-step {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #0e5d75;
}

#coach-text { margin: 3px 0 4px; font-size: 0.84rem; line-height: 1.2; }
.coach .go { margin-top: 2px; min-height: 44px; }

.finger {
  position: fixed;
  z-index: 36;
  width: 40px;
  height: 40px;
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
  animation: point 0.7s ease-in-out infinite;
}
.finger.hidden { display: none; }

@keyframes point {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, 8px); }
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 80;
  max-width: 92vw;
  padding: 10px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffe7a0, #f0c45a);
  color: var(--ink);
  font-weight: 800;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(12, 40, 50, 0.2);
}
.toast.hidden { display: none; }

#fish-track {
  position: relative;
  height: 54px;
  margin: 12px 0;
  border-radius: 20px;
  background: linear-gradient(180deg, #9bd7ef, #5aa8c6);
  overflow: hidden;
  border: 1px solid var(--line);
}

#fish-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38%;
  width: 24%;
  background: rgba(70, 200, 130, 0.85);
}

#fish-track, #fish-track .go, [data-act="catch"], .mini-btn, [data-act="boat"] {
  touch-action: manipulation;
}

#fish-mark {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 14px;
  margin-left: -7px;
  border-radius: 8px;
  background: #3d2a1c;
  left: 8%;
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.match-card {
  min-height: 72px;
  border-radius: 22px 16px 20px 14px;
  background: linear-gradient(180deg, #6ec0dc, #3d90b0);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 900;
  border: 1px solid var(--line);
}

.match-card.open, .match-card.done { background: #fff8ea; color: var(--ink); }
.match-card.done { background: #d4f5e2; }

#boat-stage {
  position: relative;
  height: 220px;
  margin: 8px 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #4eb3d4, #1482a6);
  overflow: hidden;
  border: 1px solid var(--line);
}

#boat {
  position: absolute;
  bottom: 10px;
  width: 54px;
  height: 34px;
  border-radius: 40% 40% 20% 20%;
  background: linear-gradient(180deg, #ffe7a0, #f0c45a);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  border: 1px solid var(--line);
}

.rock {
  position: absolute;
  width: 34px;
  height: 28px;
  border-radius: 40% 30% 45% 35%;
  background: #6a5040;
}

.boat-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-btn {
  min-height: 52px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe7a0, #f0c45a);
  color: var(--ink);
  font-size: 1.1rem;
  border: 1px solid var(--line);
}

@keyframes pop {
  0% { transform: scale(0.72); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 3px #fff, 0 8px 16px rgba(20, 30, 40, 0.2); }
}

.inbox {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 4px 6px;
  overflow-x: auto;
  border-radius: 14px;
  background: rgba(12, 40, 50, 0.38);
}
.inbox.hidden { display: none; }
.inbox-lab {
  flex: none;
  align-self: center;
  padding: 0 8px;
  font-weight: 900;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #fff8e6;
}
.inbox-bit {
  flex: none;
  min-width: 78px;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #efe4ff, #c2a6f0 58%, #8d6cc8);
  color: var(--ink);
  font-weight: 900;
  font-size: 0.68rem;
  text-transform: uppercase;
}
.cell.fog.deep::after {
  background: #24343c;
  opacity: 0.97;
}
.cell.fog.edge::after {
  background: rgba(210, 224, 230, 0.28);
}

.cinema {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  height: 100svh;
  z-index: 90;
  background: #0b2430;
  display: grid;
  grid-template-rows: 1fr auto;
}
.cinema.hidden { display: none !important; }
.cinema.loading,
.cinema.loaded:not(.talking) {
  grid-template-rows: 1fr;
}
.art {
  position: relative;
  overflow: hidden;
  min-height: 48vh;
  background: #0b2430;
}
.cinema.loading .art,
.cinema.loaded:not(.talking) .art {
  min-height: 100%;
  height: 100%;
}
.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.cast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  z-index: 2;
}
.cast-who {
  width: 34%;
  max-width: 140px;
  height: 38vh;
  object-fit: cover;
  object-position: top center;
  border-radius: 22px 18px 26px 16px;
  border: 3px solid rgba(255, 248, 230, 0.55);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  background: #1a2830;
}
.cinema.talking .cast-who { opacity: 0.55; height: 22vh; }
.cinema.talking .cast-who.speak {
  opacity: 1;
  border-color: #f0c45a;
  transform: translateY(-6px);
}
.load-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.88);
  color: var(--ink);
  font-weight: 900;
  z-index: 6;
}
.load-hint.hidden { display: none !important; }
.talk {
  margin: 0 10px 12px;
  padding: 10px;
  border-radius: 22px 18px 20px 16px;
  background: linear-gradient(180deg, #fffaf0, #f3e6cf);
  color: var(--ink);
  border: 1px solid var(--line);
  z-index: 7;
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: stretch;
}
.talk.hidden { display: none !important; }
#talk-portrait {
  width: 86px;
  height: 108px;
  object-fit: cover;
  object-position: top center;
  border-radius: 16px 12px 18px 12px;
  border: 1px solid var(--line);
  background: #1a3340;
}
.talk-copy { min-width: 0; }
.talk .who { font-weight: 900; font-size: 0.95rem; }
#talk-text { margin: 8px 0 10px; font-weight: 800; line-height: 1.3; }
#talk-next { margin-top: 0; }
