:root {
      color-scheme: light;
      --ink: #123047;
      --muted: #62798c;
      --sea: #1186c8;
      --sea-deep: #0874a9;
      --sky: #16b8ef;
      --sand: #ffe4ad;
      --sand-deep: #f4c674;
      --paper: rgba(255, 250, 240, 0.97);
      --line: #f3bf66;
      --orange: #ff6b23;
      --coral: #ff5f8d;
      --teal: #0c8d91;
      --gold: #f6b21d;
      --green: #42af6b;
      --danger: #d9494f;
      --shadow: 0 18px 44px rgba(18, 48, 71, 0.18);
      --radius: 18px;
    }

    * { box-sizing: border-box; }
    html { min-height: 100%; }
    body {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      background:
        linear-gradient(rgba(4, 76, 116, 0.08), rgba(255, 243, 204, 0.08)),
        url("assets/backgrounds/shell-tide-bg-02-board-play-beach.png") center / cover fixed,
        linear-gradient(180deg, #16b8ef 0 28%, #fff0c9 28% 100%);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      line-height: 1.45;
      overflow-x: hidden;
    }

    button, input, select { font: inherit; }
    button { -webkit-tap-highlight-color: transparent; }
    button:focus-visible, input:focus-visible, select:focus-visible {
      outline: 4px solid rgba(255, 95, 141, 0.38);
      outline-offset: 3px;
    }
    button:disabled { cursor: not-allowed; opacity: 0.52; }

    .app {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      min-height: 100vh;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 50;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 10px clamp(12px, 3vw, 32px);
      border-bottom: 1px solid rgba(255, 255, 255, 0.45);
      background: rgba(7, 104, 152, 0.86);
      backdrop-filter: blur(14px);
      box-shadow: 0 6px 22px rgba(5, 65, 98, 0.18);
      color: #fff;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }
    .brand-mark {
      display: grid;
      place-items: center;
      width: 42px;
      height: 42px;
      flex: 0 0 42px;
      border-radius: 50%;
      background: radial-gradient(circle at 35% 28%, #fff7a7, #ffd12a 58%, #f59b22 60%);
      box-shadow: inset 0 0 0 4px rgba(255,255,255,.32), 0 7px 16px rgba(2,49,76,.2);
      font-size: 21px;
    }
    .brand-copy { min-width: 0; }
    .brand strong { display: block; font-size: 17px; line-height: 1.05; }
    .brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.82); font-size: 11px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
    .icon-button, .small-button, .primary-button, .choice-button, .map-node, .booster-button {
      border: 0;
      cursor: pointer;
      font-weight: 900;
    }
    .icon-button {
      min-width: 42px;
      min-height: 42px;
      padding: 8px 12px;
      border: 1px solid rgba(255,255,255,.36);
      border-radius: 999px;
      background: rgba(255,255,255,.16);
      color: white;
    }
    .icon-button:hover { background: rgba(255,255,255,.26); }
    .icon-button.active { background: #fff; color: var(--sea-deep); }

    .wallet-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      min-width: 86px;
      background: linear-gradient(135deg, rgba(255,255,255,.24), rgba(255,224,109,.22));
      font-variant-numeric: tabular-nums;
    }
    .wallet-button strong { color: #fff7a7; }
    .wallet-button::after { content: "NP"; font-size: 9px; letter-spacing: .04em; opacity: .76; }

    .main-shell {
      width: min(1520px, 100%);
      margin: 0 auto;
      padding: clamp(12px, 2.4vw, 28px);
      display: grid;
      grid-template-columns: minmax(260px, 330px) minmax(0, 1fr) minmax(260px, 330px);
      gap: clamp(12px, 2vw, 24px);
      align-items: start;
    }

    .panel {
      border: 1px solid rgba(243,191,102,.78);
      border-radius: var(--radius);
      background: var(--paper);
      box-shadow: var(--shadow);
      overflow: hidden;
    }
    .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 14px 16px;
      border-bottom: 1px solid rgba(243,191,102,.52);
      background: linear-gradient(180deg, rgba(255,245,214,.88), rgba(255,250,240,.5));
    }
    .panel-head h2, .panel-head h3 { margin: 0; font-size: 15px; }
    .panel-body { padding: 14px; }

    .map-panel, .coach-panel { position: sticky; top: 76px; }
    .map-meta { display: grid; gap: 9px; margin-bottom: 13px; }
    .map-title { font-size: 21px; font-weight: 950; line-height: 1; }
    .map-subtitle { color: var(--muted); font-size: 13px; font-weight: 720; }
    .restoration-bar, .bond-track, .objective-bar, .charge-track {
      height: 11px;
      overflow: hidden;
      border-radius: 999px;
      background: #e4edf1;
      box-shadow: inset 0 1px 3px rgba(18,48,71,.14);
    }
    .restoration-fill, .bond-fill, .objective-fill, .charge-fill {
      height: 100%;
      border-radius: inherit;
      transition: width .35s ease;
    }
    .restoration-fill { background: linear-gradient(90deg, #efb948, #54c87d, #1ea9d2); }
    .bond-fill { background: linear-gradient(90deg, var(--coral), var(--gold)); }
    .objective-fill { background: linear-gradient(90deg, var(--gold), var(--orange)); }
    .charge-fill { background: linear-gradient(90deg, var(--teal), var(--sky)); }

    .map-route {
      position: relative;
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      grid-template-rows: repeat(4, 64px);
      gap: 8px;
      min-height: 280px;
      padding: 12px;
      border-radius: 16px;
      background:
        radial-gradient(circle at 74% 18%, rgba(255,255,255,.82) 0 7%, transparent 7.4%),
        linear-gradient(145deg, rgba(255,238,179,.82), rgba(252,210,127,.78));
      isolation: isolate;
    }
    .map-route::before {
      content: "";
      position: absolute;
      z-index: -1;
      inset: 28px 28px;
      border: 9px solid rgba(17,134,200,.22);
      border-left-color: transparent;
      border-right-color: transparent;
      border-radius: 42% 58% 46% 54%;
      transform: rotate(-7deg);
    }
    .map-node {
      position: relative;
      display: grid;
      place-items: center;
      width: 54px;
      height: 54px;
      justify-self: center;
      align-self: center;
      border: 4px solid #fff;
      border-radius: 50%;
      background: #d8e3e7;
      color: #516876;
      box-shadow: 0 6px 14px rgba(18,48,71,.2);
      transition: transform .16s ease, filter .16s ease;
    }
    .map-node:hover:not(:disabled) { transform: translateY(-3px) scale(1.05); }
    .map-node.unlocked { background: linear-gradient(145deg, #fff5a6, #f6b21d); color: #6c4200; }
    .map-node.completed { background: linear-gradient(145deg, #81e29e, #24a961); color: #fff; }
    .map-node.current { animation: nodePulse 1.7s infinite; }
    .map-node.chest { background: linear-gradient(145deg, #ffc0d4, #ff5f8d); color: #fff; }
    .map-node.gate { background: linear-gradient(145deg, #72e4ea, #0c8d91); color: #fff; }
    .map-node span { font-size: 11px; line-height: 1; }
    .map-node .node-reward {
      position: absolute;
      right: -8px;
      top: -10px;
      display: grid;
      place-items: center;
      min-width: 24px;
      height: 24px;
      padding: 0 4px;
      border: 2px solid white;
      border-radius: 999px;
      background: var(--coral);
      color: #fff;
      font-size: 12px;
    }
    @keyframes nodePulse { 50% { box-shadow: 0 0 0 9px rgba(255,95,141,.2), 0 8px 18px rgba(18,48,71,.22); } }

    .next-reward {
      margin-top: 12px;
      padding: 11px 12px;
      border-left: 5px solid var(--orange);
      border-radius: 12px;
      background: #fff1df;
      color: #75401f;
      font-size: 13px;
    }
    .map-scene-note {
      display: grid;
      grid-template-columns: 50px minmax(0,1fr);
      align-items: center;
      gap: 10px;
      margin-top: 12px;
      padding: 11px;
      border: 1px dashed rgba(12,141,145,.38);
      border-radius: 13px;
      background: rgba(225,252,248,.62);
    }
    .map-scene-note .scene-icon { font-size: 35px; }
    .map-scene-note strong { display: block; font-size: 13px; }
    .map-scene-note span { color: var(--muted); font-size: 12px; }

    .game-column { min-width: 0; display: grid; gap: 13px; }
    .hud {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 12px;
      padding: 15px 17px;
      border-radius: var(--radius);
      background: rgba(255,250,240,.97);
      border: 1px solid rgba(243,191,102,.78);
      box-shadow: var(--shadow);
    }
    .level-copy { min-width: 0; }
    .level-kicker { color: var(--orange); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: .05em; }
    .level-copy h1 { margin: 3px 0 4px; font-size: clamp(22px, 3vw, 34px); line-height: 1; }
    .level-copy p { margin: 0; color: var(--muted); font-size: 13px; }
    .hud-stats { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
    .stat {
      min-width: 77px;
      padding: 8px 10px;
      border: 1px solid #f0d497;
      border-radius: 13px;
      background: #fffdf7;
      text-align: center;
    }
    .stat span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
    .stat strong { display: block; margin-top: 2px; font-size: 19px; line-height: 1; }
    .stat.warning { border-color: #ffaaa4; background: #fff0ee; color: var(--danger); animation: warningPulse .8s infinite alternate; }
    @keyframes warningPulse { to { transform: translateY(-2px); } }

    .objective-row { display: grid; grid-template-columns: auto minmax(120px,1fr) auto; align-items: center; gap: 10px; padding: 0 2px; }
    .objective-row strong { font-size: 12px; }
    .objective-row span { font-size: 12px; font-weight: 850; color: var(--muted); }

    .board-card {
      position: relative;
      padding: clamp(12px, 2vw, 22px);
      overflow: hidden;
      border-radius: 28px;
      border: 3px solid rgba(255,255,255,.75);
      background:
        linear-gradient(180deg, rgba(79,204,238,.2), transparent 32%),
        linear-gradient(180deg, rgba(255,248,218,.96), rgba(245,202,116,.96));
      box-shadow: 0 24px 55px rgba(5,67,102,.22);
    }
    .board-card::before, .board-card::after {
      content: "";
      position: absolute;
      width: 160px;
      height: 160px;
      border: 20px solid rgba(255,255,255,.3);
      border-radius: 50%;
      pointer-events: none;
    }
    .board-card::before { left: -92px; top: -95px; }
    .board-card::after { right: -92px; bottom: -105px; }

    .board-instructions {
      position: relative;
      z-index: 2;
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      margin-bottom: 13px;
      color: #33576d;
      font-size: 12px;
      font-weight: 800;
    }
    .board-instructions .turn-path { color: var(--sea-deep); }

    .board-scroll {
      position: relative;
      z-index: 2;
      overflow-x: auto;
      overflow-y: hidden;
      padding: 3px 2px 8px;
      scrollbar-width: thin;
    }
    .board-grid {
      position: relative;
      display: grid;
      grid-template-columns: repeat(6, minmax(86px, 1fr));
      grid-template-rows: repeat(2, 108px);
      gap: 11px;
      min-width: 640px;
      isolation: isolate;
    }

    .route-layer {
      position: absolute;
      inset: 0;
      z-index: 8;
      pointer-events: none;
      overflow: visible;
    }
    .route-segment {
      position: absolute;
      height: 7px;
      border-radius: 999px;
      transform-origin: 0 50%;
      opacity: .72;
      animation: routeIn .2s ease both;
    }
    .route-segment.left { background: rgba(255,95,141,.63); box-shadow: 0 0 0 3px rgba(255,255,255,.44); }
    .route-segment.right { background: rgba(17,134,200,.68); box-shadow: 0 0 0 3px rgba(255,255,255,.44); }
    .route-segment.active { height: 9px; opacity: 1; filter: saturate(1.25); }
    @keyframes routeIn { from { transform: scaleX(.08) rotate(var(--route-angle)); opacity: 0; } }

    .cup {
      position: relative;
      z-index: 3;
      display: grid;
      align-content: center;
      justify-items: center;
      gap: 5px;
      min-width: 86px;
      min-height: 108px;
      padding: 9px 7px;
      border: 3px solid rgba(132,87,29,.26);
      border-radius: 39% 42% 45% 41% / 45% 44% 52% 48%;
      background: radial-gradient(ellipse at 50% 52%, #f6d59d 0 54%, #d9a862 58% 64%, #f4ca83 66%);
      color: var(--ink);
      cursor: pointer;
      box-shadow: inset 0 6px 14px rgba(104,65,17,.16), 0 6px 11px rgba(118,74,23,.14);
      transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
      touch-action: pan-y;
    }
    .cup:nth-child(1) { grid-column: 1; grid-row: 1; }
    .cup:nth-child(2) { grid-column: 2; grid-row: 1; }
    .cup:nth-child(3) { grid-column: 3; grid-row: 1; }
    .cup:nth-child(4) { grid-column: 4; grid-row: 1; }
    .cup:nth-child(5) { grid-column: 5; grid-row: 1; }
    .cup:nth-child(6) { grid-column: 6; grid-row: 1; }
    .cup:nth-child(7) { grid-column: 6; grid-row: 2; }
    .cup:nth-child(8) { grid-column: 5; grid-row: 2; }
    .cup:nth-child(9) { grid-column: 4; grid-row: 2; }
    .cup:nth-child(10) { grid-column: 3; grid-row: 2; }
    .cup:nth-child(11) { grid-column: 2; grid-row: 2; }
    .cup:nth-child(12) { grid-column: 1; grid-row: 2; }
    .cup:hover:not(:disabled) { transform: translateY(-4px); filter: brightness(1.04); }
    .cup.selected { border-color: var(--coral); box-shadow: 0 0 0 7px rgba(255,95,141,.18), inset 0 6px 14px rgba(104,65,17,.14); }
    .cup.route-left { box-shadow: 0 0 0 5px rgba(255,95,141,.18), inset 0 6px 14px rgba(104,65,17,.14); }
    .cup.route-right { box-shadow: 0 0 0 5px rgba(17,134,200,.18), inset 0 6px 14px rgba(104,65,17,.14); }
    .cup.stop-left::after, .cup.stop-right::after {
      content: "STOP";
      position: absolute;
      z-index: 15;
      top: -12px;
      padding: 3px 6px;
      border: 2px solid white;
      border-radius: 999px;
      color: white;
      font-size: 9px;
      font-weight: 1000;
      letter-spacing: .04em;
      animation: popIn .2s ease;
    }
    .cup.stop-left::after { left: 5px; background: var(--coral); }
    .cup.stop-right::after { right: 5px; background: var(--sea); }
    .cup.critical-empty { animation: criticalGlow .75s ease-in-out infinite alternate; }
    .cup.capture-preview { animation: captureTremble .18s linear infinite alternate; border-color: var(--gold); }
    .cup.sowing { animation: dropPulse .25s ease; }
    .cup.captured { animation: capturePop .36s ease; }
    .cup.hint-area { box-shadow: 0 0 0 7px rgba(246,178,29,.38), 0 0 28px rgba(246,178,29,.55), inset 0 6px 14px rgba(104,65,17,.14); }
    .cup.locked { filter: saturate(.65); }
    .cup.wet-pit {
      border-color: rgba(255,255,255,.58);
      border-radius: 45% 50% 48% 42% / 55% 44% 52% 46%;
      background:
        radial-gradient(ellipse at 47% 45%, rgba(192,249,255,.86) 0 20%, transparent 21%),
        radial-gradient(ellipse at 50% 56%, #68daf1 0 42%, #1598c5 44% 63%, #c09052 65% 73%, #f0c478 75%);
      box-shadow: inset 0 6px 16px rgba(1,80,119,.22), 0 7px 12px rgba(1,91,131,.2);
      cursor: default;
    }
    .cup.wet-pit::before {
      content: "HỐ ƯỚT";
      position: absolute;
      left: 50%;
      bottom: 5px;
      transform: translateX(-50%);
      padding: 2px 6px;
      border-radius: 999px;
      background: rgba(5,77,112,.72);
      color: white;
      font-size: 8px;
      font-weight: 950;
      letter-spacing: .04em;
      white-space: nowrap;
    }
    .cup.wet-pit:hover { transform: none; filter: none; }
    .cup.sand-cup::before {
      content: "Ô CÁT";
      position: absolute;
      left: 50%;
      bottom: 5px;
      transform: translateX(-50%);
      color: rgba(99,59,12,.5);
      font-size: 8px;
      font-weight: 950;
      letter-spacing: .04em;
      white-space: nowrap;
    }
    @keyframes criticalGlow { to { filter: brightness(1.13); box-shadow: 0 0 0 8px rgba(255,255,255,.48), 0 0 26px rgba(246,178,29,.65); } }
    @keyframes captureTremble { from { transform: translateX(-2px); } to { transform: translateX(2px); } }
    @keyframes dropPulse { 50% { transform: scale(1.08); } }
    @keyframes capturePop { 50% { transform: scale(.88); filter: brightness(1.2); } }
    @keyframes popIn { from { transform: scale(.3); opacity: 0; } }

    .cup-index {
      position: absolute;
      left: 7px;
      top: 6px;
      display: grid;
      place-items: center;
      width: 19px;
      height: 19px;
      border-radius: 50%;
      background: rgba(255,255,255,.75);
      color: #536879;
      font-size: 10px;
      font-weight: 950;
    }
    .modifier-badge {
      position: absolute;
      right: 5px;
      top: 4px;
      display: grid;
      place-items: center;
      min-width: 24px;
      height: 24px;
      padding: 0 4px;
      border: 2px solid white;
      border-radius: 999px;
      background: var(--orange);
      color: white;
      font-size: 12px;
      font-weight: 950;
      box-shadow: 0 3px 7px rgba(18,48,71,.2);
    }
    .modifier-badge.current { background: var(--sea); }
    .modifier-badge.secret { background: #753c9e; }

    .tokens {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      gap: 2px;
      max-width: 76px;
      max-height: 70px;
      overflow: hidden;
    }
    .token {
      position: relative;
      display: inline-grid;
      place-items: center;
      width: 26px;
      height: 26px;
      flex: 0 0 26px;
      font-size: 20px;
      line-height: 1;
      filter: drop-shadow(0 2px 2px rgba(18,48,71,.22));
      transition: transform .15s ease;
    }
    .token img { width: 100%; height: 100%; object-fit: contain; }
    .token.starfish { width: 30px; height: 30px; flex-basis: 30px; font-size: 25px; }
    .token.starfish.thirsty { animation: starWorry .46s ease-in-out infinite alternate; }
    .token.pearl { animation: pearlGlow 1.2s ease-in-out infinite alternate; }
    @keyframes starWorry { to { transform: rotate(5deg) translateY(-2px); } }
    @keyframes pearlGlow { to { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 12px #7eeeff); } }
    .token-count {
      position: absolute;
      right: 3px;
      bottom: 5px;
      padding: 2px 6px;
      border-radius: 999px;
      background: rgba(18,48,71,.82);
      color: white;
      font-size: 10px;
      font-weight: 900;
    }

    .rescue-zone {
      position: relative;
      z-index: 2;
      display: grid;
      grid-template-columns: auto minmax(0,1fr) auto;
      align-items: center;
      gap: 11px;
      margin-top: 14px;
      padding: 11px 13px;
      border: 2px solid rgba(255,255,255,.74);
      border-radius: 18px;
      background: linear-gradient(135deg, rgba(78,210,238,.86), rgba(17,134,200,.86));
      color: white;
      box-shadow: inset 0 0 0 3px rgba(255,255,255,.14), 0 8px 18px rgba(7,100,142,.17);
    }
    .rescue-zone strong { display: block; font-size: 13px; }
    .rescue-zone span { display: block; margin-top: 2px; color: rgba(255,255,255,.82); font-size: 11px; }
    .rescue-zone-icon { font-size: 29px; }
    .rescue-zone-tokens { display: flex; align-items: center; justify-content: flex-end; min-height: 35px; max-width: 160px; overflow: hidden; }
    .rescue-zone-tokens .token { margin-left: -5px; animation: rescuePop .42s ease both; }
    @keyframes rescuePop { from { transform: translateY(-28px) scale(.2) rotate(-18deg); opacity: 0; } }

    .preview-controls {
      position: relative;
      z-index: 2;
      display: grid;
      grid-template-columns: repeat(2, minmax(0,1fr));
      gap: 10px;
      margin-top: 13px;
    }
    .choice-button {
      min-height: 58px;
      padding: 9px 12px;
      border: 2px solid transparent;
      border-radius: 16px;
      color: #fff;
      text-align: left;
      box-shadow: 0 8px 18px rgba(18,48,71,.16);
    }
    .choice-button.left { background: linear-gradient(135deg, #ff799f, #e84577); }
    .choice-button.right { background: linear-gradient(135deg, #36bce8, #087ab5); }
    .choice-button:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-2px); }
    .choice-button strong { display: block; }
    .choice-button span { display: block; margin-top: 2px; color: rgba(255,255,255,.84); font-size: 11px; font-weight: 760; }
    .choice-button.best { border-color: #fff69e; box-shadow: 0 0 0 4px rgba(246,178,29,.28), 0 8px 18px rgba(18,48,71,.16); }

    .combo-layer, .particle-layer {
      position: fixed;
      z-index: 100;
      inset: 0;
      pointer-events: none;
      overflow: hidden;
    }
    .combo-popup {
      position: absolute;
      left: 50%;
      top: 42%;
      transform: translate(-50%, -50%);
      padding: 13px 22px;
      border: 5px solid white;
      border-radius: 999px;
      color: white;
      background: linear-gradient(135deg, var(--orange), var(--coral));
      box-shadow: 0 16px 36px rgba(18,48,71,.28);
      font-size: clamp(25px, 5vw, 50px);
      font-weight: 1000;
      text-shadow: 0 3px 0 rgba(126,53,16,.35);
      animation: comboPop .95s cubic-bezier(.2,.95,.25,1) both;
    }
    @keyframes comboPop {
      0% { transform: translate(-50%,-50%) scale(.25) rotate(-8deg); opacity: 0; }
      32% { transform: translate(-50%,-50%) scale(1.09) rotate(2deg); opacity: 1; }
      100% { transform: translate(-50%,-72%) scale(.92); opacity: 0; }
    }
    .particle {
      position: absolute;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      background: currentColor;
      animation: particleFly var(--duration, .8s) ease-out both;
    }
    @keyframes particleFly { to { transform: translate(var(--dx), var(--dy)) scale(.1) rotate(240deg); opacity: 0; } }

    .coach-card { display: grid; gap: 13px; }
    .coach-portrait {
      position: relative;
      display: grid;
      grid-template-columns: 76px minmax(0,1fr);
      gap: 12px;
      align-items: center;
      padding: 12px;
      border-radius: 16px;
      background: linear-gradient(135deg, #e7fbff, #fff5df);
      border: 1px solid #cfe6e5;
    }
    .coach-avatar {
      display: grid;
      place-items: center;
      width: 76px;
      height: 76px;
      overflow: hidden;
      border: 4px solid white;
      border-radius: 50%;
      background: #8ee3f1;
      box-shadow: 0 7px 16px rgba(18,48,71,.18);
      font-size: 44px;
    }
    .coach-avatar img { width: 100%; height: 100%; object-fit: cover; }
    .coach-name { font-weight: 1000; font-size: 18px; }
    .coach-role { color: var(--muted); font-size: 12px; }
    .coach-badge { display: inline-block; margin-top: 5px; padding: 3px 8px; border-radius: 999px; background: #fff; color: var(--teal); font-size: 10px; font-weight: 950; }

    .coach-bubble {
      position: relative;
      min-height: 68px;
      padding: 13px 14px;
      border: 1px solid #f0d18d;
      border-radius: 16px;
      background: #fffdf7;
      color: #385266;
      font-size: 14px;
      font-weight: 680;
    }
    .coach-bubble::before {
      content: "";
      position: absolute;
      left: 22px;
      top: -9px;
      width: 16px;
      height: 16px;
      transform: rotate(45deg);
      border-left: 1px solid #f0d18d;
      border-top: 1px solid #f0d18d;
      background: #fffdf7;
    }
    .coach-bubble strong { color: var(--orange); }
    .coach-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
    .primary-button, .small-button, .booster-button {
      min-height: 44px;
      padding: 9px 13px;
      border-radius: 13px;
    }
    .primary-button { background: linear-gradient(135deg, var(--sea), var(--teal)); color: white; box-shadow: 0 8px 17px rgba(17,134,200,.22); }
    .small-button { border: 1px solid #e5c986; background: #fff; color: var(--ink); }
    .small-button:hover:not(:disabled) { background: #fff7e8; }
    .coach-switcher { display: flex; gap: 6px; flex-wrap: wrap; }
    .coach-switch {
      min-width: 42px;
      min-height: 42px;
      border: 2px solid #d9e7e8;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      font-size: 21px;
    }
    .coach-switch.active { border-color: var(--coral); background: #fff0f5; }
    .coach-switch:disabled { filter: grayscale(1); }

    .bond-box { display: grid; gap: 7px; padding: 12px; border-radius: 14px; background: #fff2ed; border: 1px solid #f5c9b7; }
    .bond-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; font-weight: 900; }
    .bond-note { color: var(--muted); font-size: 11px; }
    .wallet-box {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      padding: 12px;
      border-radius: 14px;
      border: 1px solid rgba(246,178,29,.38);
      background: linear-gradient(135deg, #fff8d7, #fff1df);
    }
    .wallet-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
    .wallet-line strong { color: #8a5400; }
    .wallet-note { color: var(--muted); font-size: 11px; }

    .booster-section { display: grid; gap: 9px; }
    .booster-button {
      display: grid;
      grid-template-columns: 38px minmax(0,1fr) auto;
      gap: 9px;
      align-items: center;
      width: 100%;
      border: 1px solid #b8dfe5;
      background: #ecfbfd;
      color: var(--ink);
      text-align: left;
    }
    .booster-button .booster-icon { font-size: 27px; }
    .booster-button span { display: block; color: var(--muted); font-size: 11px; }
    .booster-count { min-width: 28px; padding: 3px 6px; border-radius: 999px; background: var(--teal); color: white; text-align: center; font-size: 11px; }

    .secret-box {
      display: grid;
      gap: 8px;
      padding: 12px;
      border: 1px dashed #ad82c7;
      border-radius: 14px;
      background: rgba(246,235,255,.72);
    }
    .secret-box strong { font-size: 12px; color: #6e3d8d; }
    .secret-box p { margin: 0; color: #765d84; font-size: 11px; }
    .secret-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
    .secret-toggle { min-height: 35px; border: 1px solid #cfb5df; border-radius: 10px; background: white; color: #593270; cursor: pointer; font-weight: 850; font-size: 11px; }
    .secret-toggle.active { background: #753c9e; color: white; }

    .status-toast {
      position: fixed;
      z-index: 150;
      left: 50%;
      bottom: 20px;
      transform: translateX(-50%) translateY(120px);
      max-width: min(520px, calc(100% - 30px));
      padding: 11px 16px;
      border-radius: 999px;
      background: rgba(18,48,71,.92);
      color: white;
      box-shadow: 0 14px 34px rgba(18,48,71,.25);
      font-weight: 820;
      text-align: center;
      transition: transform .25s ease;
    }
    .status-toast.show { transform: translateX(-50%) translateY(0); }

    .modal-backdrop {
      position: fixed;
      z-index: 200;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 18px;
      background: rgba(5,45,69,.62);
      backdrop-filter: blur(6px);
      opacity: 0;
      visibility: hidden;
      transition: opacity .2s ease;
    }
    .modal-backdrop.open { opacity: 1; visibility: visible; }
    .modal {
      width: min(640px, 100%);
      max-height: calc(100vh - 36px);
      overflow: auto;
      border: 4px solid rgba(255,255,255,.86);
      border-radius: 28px;
      background: #fffaf0;
      box-shadow: 0 30px 80px rgba(4,38,57,.38);
      transform: translateY(18px) scale(.96);
      transition: transform .22s ease;
    }
    .modal-backdrop.open .modal { transform: translateY(0) scale(1); }
    .modal-hero {
      padding: 25px 25px 20px;
      background:
        linear-gradient(rgba(10,116,157,.12),rgba(255,177,91,.15)),
        url("assets/backgrounds/shell-tide-bg-03-rescue-tide-sunset.png") center / cover,
        linear-gradient(135deg,#48c9e8,#ffd37c);
      color: white;
      text-shadow: 0 2px 6px rgba(18,48,71,.35);
    }
    .modal-hero h2 { margin: 0; font-size: clamp(27px,5vw,44px); line-height: 1; }
    .modal-hero p { margin: 8px 0 0; max-width: 520px; font-weight: 720; }
    .modal-body { padding: 19px 22px; }
    .result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
    .result-stat { padding: 11px; border: 1px solid #ead29f; border-radius: 14px; background: white; text-align: center; }
    .result-stat span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 850; }
    .result-stat strong { display: block; margin-top: 4px; font-size: 22px; }
    .recap-box { margin-top: 12px; padding: 12px; border-left: 5px solid var(--sea); border-radius: 12px; background: #eaf8fd; color: #315a70; }
    .modal-actions { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
    .modal-actions button { flex: 1 1 150px; }
    .shop-grid { display: grid; gap: 10px; margin-top: 12px; }
    .shop-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #ead29f; border-radius: 14px; background: #fff; }
    .shop-card h3 { margin: 0; font-size: 15px; }
    .shop-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
    .shop-price { font-weight: 950; color: #8a5400; white-space: nowrap; }
    .transaction-list { display: grid; gap: 6px; margin-top: 12px; max-height: 180px; overflow: auto; }
    .transaction-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 9px; background: #f5f9fa; font-size: 11px; }
    .transaction-row .gain { color: var(--green); font-weight: 950; }
    .transaction-row .spend { color: var(--danger); font-weight: 950; }

    .metrics-panel {
      position: fixed;
      z-index: 180;
      right: 14px;
      bottom: 14px;
      width: min(520px, calc(100% - 28px));
      max-height: min(70vh, 620px);
      overflow: hidden;
      border: 2px solid #b6dce4;
      border-radius: 18px;
      background: white;
      box-shadow: 0 22px 60px rgba(18,48,71,.3);
      display: none;
    }
    .metrics-panel.open { display: grid; grid-template-rows: auto minmax(0,1fr); }
    .metrics-log { overflow: auto; padding: 12px; font: 11px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; background: #102b3c; color: #d8f5ff; white-space: pre-wrap; }

    .dev-evidence {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      padding: 11px;
      border-radius: 13px;
      border: 1px solid #d7e2e5;
      background: #f7fbfc;
      color: #516b7a;
      font-size: 11px;
    }
    .dev-evidence code { color: #0b657f; font-weight: 850; }

    .visually-hidden {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0,0,0,0) !important;
      white-space: nowrap !important;
      border: 0 !important;
    }

    @media (max-width: 1180px) {
      .main-shell { grid-template-columns: minmax(230px, 290px) minmax(0,1fr); }
      .coach-panel { position: static; grid-column: 1 / -1; }
      .coach-card { grid-template-columns: minmax(250px, .8fr) minmax(310px, 1.2fr); }
      .coach-portrait { align-self: start; }
    }

    @media (max-width: 820px) {
      body { background-attachment: scroll; }
      .topbar { position: static; }
      .brand span { display: none; }
      .top-actions .label { display: none; }
      .main-shell { grid-template-columns: 1fr; padding: 10px; }
      .map-panel, .coach-panel { position: static; }
      .map-panel { order: 2; }
      .game-column { order: 1; }
      .coach-panel { order: 3; }
      .coach-card { grid-template-columns: 1fr; }
      .hud { grid-template-columns: 1fr; }
      .hud-stats { justify-content: flex-start; }
      .board-card { border-radius: 20px; }
      .preview-controls { grid-template-columns: 1fr; }
      .map-route { grid-template-rows: repeat(4, 58px); }
      .result-grid { grid-template-columns: 1fr; }
      .objective-row { grid-template-columns: auto minmax(80px,1fr) auto; }
    }

    @media (max-width: 460px) {
      .topbar { padding: 8px; gap: 7px; }
      .brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
      .brand strong { font-size: 15px; }
      .icon-button { min-width: 38px; min-height: 38px; padding: 7px 9px; }
      .wallet-button { min-width: 72px; }
      .main-shell { padding: 8px; }
      .hud { padding: 13px; }
      .hud-stats { display: grid; grid-template-columns: repeat(3,1fr); width: 100%; }
      .stat { min-width: 0; }
      .board-grid { grid-template-columns: repeat(6, 82px); min-width: 582px; grid-template-rows: repeat(2, 102px); }
      .cup { min-width: 82px; min-height: 102px; }
      .map-route { padding: 8px; }
      .map-node { width: 50px; height: 50px; }
      .coach-controls { grid-template-columns: 1fr; }
      .modal-body { padding: 15px; }
      .modal-hero { padding: 20px 18px; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
      }
    }