:root {
  --abyss: #061826;
  --deep: #0b2a3f;
  --sea: #124a63;
  --pearl: #f5f0e4;
  --pearl-2: #e3d8bf;
  --ink: #142433;
  --muted: #5d6f7c;
  --brass: #e8b64c;
  --brass-dark: #a4741a;
  --teal: #2ec4b6;
  --coral: #ff7a59;
  --good: #1f7a46;
  --bad: #c0392b;
  --radius: 16px;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: #061420; }
html, button, a { touch-action: manipulation; }
body {
  font-family: "Fredoka", system-ui, sans-serif;
  color: var(--pearl);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(120, 220, 255, 0.28), transparent 55%),
    repeating-linear-gradient(100deg, rgba(160, 230, 255, 0.05) 0 30px, transparent 30px 120px),
    linear-gradient(180deg, #13506b, #0b2a3f 45%, #061420);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: "Lilita One", "Fredoka", sans-serif; font-weight: 400; letter-spacing: 0.02em; }
h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
button { font-family: inherit; }
.muted { color: var(--muted); font-size: 0.88rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 0.65rem 1.1rem; font-size: 1rem; font-weight: 600;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  background: linear-gradient(180deg, #ffe08f, var(--brass)); box-shadow: 0 4px 0 var(--brass-dark), 0 6px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--brass-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.big { width: 100%; padding: 0.85rem 1.2rem; font-size: 1.12rem; margin-top: 0.9rem; }
.btn.sm { padding: 0.4rem 0.75rem; font-size: 0.88rem; border-radius: 10px; box-shadow: 0 3px 0 var(--brass-dark); }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: inherit; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); }
.panel .btn.ghost, .modal .btn.ghost { color: var(--ink); box-shadow: inset 0 0 0 2px #b9c8c9; background: rgba(255, 255, 255, 0.4); }
.btn.sea { background: linear-gradient(180deg, #5fe0d3, var(--teal)); box-shadow: 0 4px 0 #157f75; }
.btn.danger { background: linear-gradient(180deg, #ff9b80, var(--coral)); box-shadow: 0 4px 0 #b4492f; color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* ---------- panels ---------- */
.panel {
  background: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.55), transparent 60%), linear-gradient(180deg, var(--pearl), #ebe2cc);
  color: var(--ink); border-radius: var(--radius); padding: 0.9rem 1rem;
  box-shadow: 0 0 0 3px #3d7a86, 0 0 0 5px #15394a, 0 10px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- setup / home ---------- */
.setup { --gh-frame: #3d7a86; --gh-frame-2: #15394a; --gh-line: var(--pearl-2); --gh-accent: var(--brass); --gh-accent-soft: rgba(232, 182, 76, 0.4); }
.gh-shade { background: linear-gradient(180deg, rgba(4, 16, 28, 0) 38%, rgba(4, 16, 28, 0.85)); }
.gh-title h1 { color: #ffe08f; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5), 0 0 30px rgba(80, 220, 255, 0.45); }
.hero-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-bubbles i { position: absolute; bottom: -20px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(220, 250, 255, 0.7);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), transparent 60%); animation: bubble 9s linear infinite; }
@keyframes bubble { from { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } to { transform: translate(18px, -460px); opacity: 0; } }
.field { margin: 0.8rem 0; }
.label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; color: #2f4b5c; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg button { flex: 1 1 auto; border: 0; border-radius: 10px; padding: 0.55rem 0.8rem; font-size: 0.95rem; font-weight: 600; cursor: pointer; background: #fffdf7; color: var(--ink); box-shadow: inset 0 0 0 2px var(--pearl-2); }
.seg button.on { background: linear-gradient(180deg, #ffe08f, var(--brass)); box-shadow: 0 3px 0 var(--brass-dark); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.names input { width: 100%; padding: 0.55rem 0.7rem; border-radius: 10px; border: 2px solid var(--pearl-2); font: inherit; background: #fffdf7; }
.setup:not(.is-local) .local-only { visibility: hidden; }
.setup.is-local .ai-only { display: none; }
.setup.is-online .offline-only { display: none; }
.setup:not(.is-online) .online-only { display: none; }
.ol-gate { text-align: center; padding: 0.6rem 0 0.2rem; }
.ol-gate p { margin: 0 0 0.9rem; }

.ol-head { display: flex; align-items: center; justify-content: space-between; }
.ol-head .label { margin: 0; }
.ol-list { list-style: none; margin: 0.4rem 0 0.9rem; padding: 0; display: grid; gap: 0.4rem; }
.ol-game { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.55rem 0.75rem; border-radius: 12px; background: #fffdf6; box-shadow: inset 0 0 0 2px var(--parchment-2); }
.ol-game.mine, .ol-game.invite { background: #fff4d0; box-shadow: inset 0 0 0 2px #f0c75a; }
.ol-who small { display: block; color: #6b5a44; font-size: 0.85rem; margin-top: 0.1rem; }
.ol-you { color: #a15c00; }
.ol-btns { display: flex; gap: 0.35rem; flex-shrink: 0; }
.ol-empty { padding: 0.5rem 0.2rem; }
.ol-new { display: grid; gap: 0.5rem; }
.ol-new label { flex: 1; }
.ol-new input { width: 100%; padding: 0.55rem 0.7rem; border-radius: 10px; border: 2px solid var(--parchment-2); font: inherit; background: #fffdf6; }
.ol .small { font-size: 0.85rem; margin: 0.6rem 0 0; }
.ol-loading { text-align: center; padding: 4rem 1rem; color: #f4e6c8; font-size: 1.1rem; }
#app.ol-wait { cursor: progress; }
#app.ol-wait .act, #app.ol-wait button.btn:not([data-ol]):not([data-close]) { pointer-events: none; opacity: 0.85; }
.ol-new .seg.ol-mode { margin: 0; }
.seg.ol-mode button { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; flex: 1 1 12rem; }
.seg.ol-mode small { font-weight: 400; font-size: 0.78rem; opacity: 0.8; }
.ol-clock { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.85); color: #3b2a14; font-weight: 700; font-variant-numeric: tabular-nums; }
.ol-clock.mine { box-shadow: 0 0 0 2px var(--gold, #c9a227); }
.ol-clock.low { background: #ffe1dc; color: #a3241a; }
.online-soon { padding: 0.9rem 1rem; border-radius: 14px; background: #eaf6f5; box-shadow: inset 0 0 0 2px #b7dfdb; color: #1d4a52; }
.online-soon p { margin: 0.3rem 0 0; }
@media (max-width: 560px) { .names { grid-template-columns: 1fr; } .setup:not(.is-local) .local-only { display: none; } }

/* ---------- game layout ---------- */
.at { max-width: 1180px; margin: 0 auto; padding: 12px 16px 60px; display: grid; gap: 14px; }
.topbar {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem 1.4rem;
  padding: 0.65rem 1.2rem;
  background: linear-gradient(180deg, rgba(8, 44, 64, 0.97), rgba(4, 22, 34, 0.97));
  border-bottom: 3px solid #03111b; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.brand-logo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #e8b64c, 0 4px 10px rgba(0, 0, 0, 0.5); flex: none; }
.brand h1 { margin: 0; font-size: 1.5rem; line-height: 1; color: #ffe08f; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); white-space: nowrap; }
.brand small { display: block; font-size: 0.8rem; color: #cfe9f0; margin-top: 0.2rem; }
.top-mid { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.top-sea { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.top-actions { display: flex; gap: 0.5rem; }
.top-actions .btn { white-space: nowrap; display: inline-flex; align-items: center; }
.top-actions .gh-dice { width: 1.2rem; height: 1.2rem; vertical-align: -0.2em; }
.tracker { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.tracker-label { font-size: 0.8rem; color: #cfe9f0; margin-right: 6px; }
.pip { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-size: 0.8rem; font-weight: 700; opacity: 0.6; }
.pip.done { opacity: 0.3; }
.pip.cur { opacity: 1; background: rgba(232, 182, 76, 0.35); box-shadow: 0 0 0 2px var(--brass); transform: scale(1.15); }
.pip.heart { outline: 2px dashed rgba(120, 220, 255, 0.8); outline-offset: 1px; }

.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.co { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; align-items: center; padding: 0.7rem 0.9rem; border-radius: 16px;
  background: rgba(4, 20, 32, 0.55); box-shadow: inset 0 0 0 2px rgba(200, 240, 255, 0.15); cursor: pointer; transition: box-shadow 0.2s, transform 0.2s; }
.co.turn { box-shadow: inset 0 0 0 3px var(--pc), 0 0 24px color-mix(in srgb, var(--pc) 45%, transparent); }
.co.viewing { background: rgba(4, 20, 32, 0.8); }
.co-flag { width: 44px; height: 44px; border-radius: 12px; background: var(--pc); display: grid; place-items: center; font-size: 1.5rem; grid-row: span 2; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); }
.co-name { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.co-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-tag { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; background: rgba(255, 255, 255, 0.14); flex: none; }
.co-tag.turn { background: var(--pc); color: #fff; }
.co-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 0.8rem; font-size: 0.95rem; }
.co-stats b { font-variant-numeric: tabular-nums; }

.banner { text-align: center; padding: 0.6rem 1rem; border-radius: 14px; background: rgba(0, 0, 0, 0.3); font-weight: 600; box-shadow: inset 0 0 0 1.5px rgba(200, 240, 255, 0.2); }
.banner.mine { background: rgba(232, 182, 76, 0.22); box-shadow: inset 0 0 0 2px rgba(232, 182, 76, 0.65); }
.banner .dot { display: inline-block; width: 0.65em; height: 0.65em; border-radius: 50%; background: var(--pc); margin-right: 0.35rem; }

.main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .main { grid-template-columns: 1fr; } }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin: 0 0 0.7rem; }
.sec-head h2 { margin: 0; font-size: 1.35rem; }
.sea { padding: 0.9rem; border-radius: 18px; background: rgba(3, 18, 30, 0.5); box-shadow: inset 0 0 0 2px rgba(200, 240, 255, 0.14); }
.sea .sec-head h2 { color: #ffe08f; }
.sea .sec-head small { color: #bfe0ea; }

/* the chart */
.chart { position: relative; height: 640px; border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(127, 244, 255, 0.22), transparent 40%),
    linear-gradient(180deg, #1d6f88 0%, #12506a 25%, #0b3550 50%, #072338 75%, #040f1c 100%);
  box-shadow: inset 0 0 0 2px rgba(200, 240, 255, 0.14); }
.chart::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(100deg, rgba(160, 230, 255, 0.05) 0 24px, transparent 24px 90px); }
.chart-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-lines line { stroke: rgba(200, 240, 255, 0.18); stroke-width: 2; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.chart-lines line.route { stroke: rgba(255, 224, 143, 0.75); stroke-width: 2.5; stroke-dasharray: 6 5; }
.chart-lines line.done { stroke: color-mix(in srgb, var(--pc) 70%, #fff); stroke-width: 3; stroke-dasharray: none; }
.harbor { position: absolute; left: 50%; transform: translate(-50%, -50%); padding: 0.15rem 0.7rem; border-radius: 999px; background: rgba(4, 20, 32, 0.8);
  font-weight: 700; font-size: 0.85rem; box-shadow: inset 0 0 0 2px rgba(255, 224, 143, 0.6); }
.node { position: absolute; transform: translate(-50%, -32px); width: 112px; display: grid; justify-items: center; gap: 0.1rem; border: 0; padding: 0; background: none;
  color: #fff; font: inherit; cursor: pointer; text-align: center; animation: fadeIn 0.3s ease both; }
.nd-dot { position: relative; width: 60px; height: 60px; border-radius: 50%; background: var(--bg) center / cover; display: grid; place-items: center;
  box-shadow: 0 0 0 3px rgba(200, 240, 255, 0.45), 0 6px 14px rgba(0, 0, 0, 0.5); transition: transform 0.15s, box-shadow 0.15s; }
.nd-dot::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, transparent 35%, rgba(3, 14, 24, 0.55)); }
.nd-stars { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); font-size: 0.62rem; line-height: 1; padding: 0.1rem 0.3rem; border-radius: 999px;
  background: rgba(3, 14, 24, 0.85); color: #ffd24d; white-space: nowrap; }
.nd-flag { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); font-size: 1.1rem; box-shadow: 0 0 0 2px #fff; }
.nd-scout { position: absolute; top: -6px; left: -10px; font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.3rem; border-radius: 999px; background: #0d2c3e; color: #9ff6ff; }
.nd-name { margin-top: 0.25rem; font-weight: 700; font-size: 0.8rem; line-height: 1.1; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); max-width: 100%; }
.nd-meta { font-size: 0.72rem; line-height: 1; letter-spacing: 0.04em; }
.nd-haul { margin-right: 0.25em; font-weight: 800; color: #fff; letter-spacing: 0; }
.nd-haul .pearl { margin-right: 0.08em; }
.nd-odds { position: absolute; top: -8px; left: calc(50% + 16px); padding: 0.08rem 0.4rem; border-radius: 999px; font-weight: 700; font-size: 0.72rem; background: var(--oc, #555); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.node.open .nd-dot { box-shadow: 0 0 0 3px #ffe08f, 0 0 18px rgba(255, 224, 143, 0.55), 0 6px 14px rgba(0, 0, 0, 0.5); }
.node.far .nd-dot { filter: saturate(0.6) brightness(0.8); box-shadow: 0 0 0 2px rgba(200, 240, 255, 0.35), 0 6px 14px rgba(0, 0, 0, 0.5); }
.node.far .nd-name { opacity: 0.85; }
.node.done .nd-dot { box-shadow: 0 0 0 4px var(--pc), 0 6px 14px rgba(0, 0, 0, 0.5); filter: brightness(0.75); }
.node.done .nd-name { opacity: 0.75; }
.node.hidden .nd-dot { filter: grayscale(1) brightness(0.45); }
.node.heart .nd-dot { width: 72px; height: 72px; }
.node.heart.open .nd-dot, .node.heart.far .nd-dot { box-shadow: 0 0 0 3px #7ff4ff, 0 0 30px rgba(127, 244, 255, 0.7); filter: none; animation: heartGlow 2.4s ease-in-out infinite; }
@keyframes heartGlow { 50% { box-shadow: 0 0 0 3px #7ff4ff, 0 0 46px rgba(127, 244, 255, 0.95); } }
.node:hover .nd-dot, .node:focus-visible .nd-dot { transform: scale(1.08); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.6rem; font-size: 0.8rem; color: #bfe0ea; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.lg { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.lg.open { box-shadow: 0 0 0 2px #ffe08f; background: #12506a; }
.lg.far { box-shadow: 0 0 0 2px rgba(200, 240, 255, 0.35); background: #0b3550; }
.lg.done { background: linear-gradient(90deg, #e05a4f 50%, #3f8fd8 50%); }
.site-status { font-weight: 600; padding: 0.5rem 0.7rem; border-radius: 10px; background: #e8f1f3; border-left: 4px solid var(--pc, #3d7a86); }
.site-status.far { background: #fdf0e1; border-left-color: #e07b28; }

/* dive hall & commissions */
.lower { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .lower { grid-template-columns: 1fr; } }
.lower h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.lower h3 small { font-family: "Fredoka", sans-serif; font-weight: 500; color: var(--muted); font-size: 0.82rem; }
.lower .muted { margin: 0 0 0.6rem; }
.hall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.45rem; }
.hire { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: 12px; background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); }
.hire .pic { width: 58px; height: 58px; border-radius: 12px; background: #0d3b4f; display: grid; place-items: center; font-size: 1.6rem; }
.hire-main { display: grid; gap: 0.1rem; min-width: 0; }
.hire-main small { color: var(--muted); font-size: 0.78rem; }
.hire .btn { white-space: nowrap; }
.hire s, .hire-price s { opacity: 0.55; font-weight: 500; }
.hire-price { font-weight: 700; white-space: nowrap; }
.tag.deep { background: #dceaf7; color: #1d4466; }
.goal { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: 12px; margin-bottom: 0.4rem;
  background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); }
.goal small { display: block; color: var(--muted); font-size: 0.8rem; }
.goal.done { box-shadow: inset 0 0 0 3px var(--pc); background: color-mix(in srgb, var(--pc) 10%, #fffdf7); }
.goal.done small { text-decoration: line-through; }
.g-icon { font-size: 1.5rem; }
.g-pts { font-family: "Lilita One", sans-serif; font-size: 1.1rem; color: var(--brass-dark); white-space: nowrap; }
.pick .warn { display: block; font-style: normal; font-weight: 700; color: #b4492f; }
.pick button.risky { box-shadow: inset 0 0 0 2px #f2b8a8; }
.pick button.risky.on { box-shadow: inset 0 0 0 3px #e07b28; background: #fff0e3; }
.risk-note.deep { color: #ffb4a0; font-weight: 600; }

.stars { color: #ffd24d; letter-spacing: 0.05em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.haz { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.hz { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.78rem; font-weight: 600; padding: 0.12rem 0.45rem; border-radius: 999px; background: rgba(0, 0, 0, 0.5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.hz.ready { background: rgba(31, 122, 70, 0.75); }
.hz.risk { background: rgba(192, 57, 43, 0.75); }
/* company panel */
.company .tabs { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.company .tabs button { flex: 1; border: 0; border-radius: 10px; padding: 0.45rem 0.6rem; font-weight: 700; cursor: pointer; background: #fffdf7; color: var(--ink); box-shadow: inset 0 0 0 2px var(--pearl-2); }
.company .tabs button.on { background: var(--pc); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); }
.company h3 { display: flex; justify-content: space-between; align-items: baseline; margin: 0.8rem 0 0.45rem; }
.company h3 small { font-family: "Fredoka", sans-serif; font-weight: 500; color: var(--muted); font-size: 0.82rem; }
.cards { display: grid; gap: 0.45rem; }
.card { display: grid; grid-template-columns: auto 1fr auto; gap: 0.15rem 0.7rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: 12px; background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); }
.card.dim { opacity: 0.55; }
.card .pic { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; grid-row: span 2; background: #0d3b4f; display: grid; place-items: center; font-size: 1.9rem; }
.card b { font-size: 0.98rem; }
.card small { color: var(--muted); font-size: 0.8rem; }
.card .st { font-size: 0.75rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; background: #e3f4ef; color: #1f6b4f; white-space: nowrap; grid-row: span 2; align-self: center; }
.card .st.busy { background: #eceff3; color: #556; }
.card .st.out { background: #fde3dc; color: #8c2f1d; }
.tags { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.tag { font-size: 0.74rem; font-weight: 600; padding: 0.08rem 0.4rem; border-radius: 999px; background: #e8f1f3; color: #1c4655; }
.tag.spec { background: #dff3e6; color: #1f5f39; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.9rem; }
.acts .btn { width: 100%; }
.acts .end { grid-column: span 2; }
.wait-note { text-align: center; margin: 0.9rem 0 0.2rem; }
.empty { padding: 0.5rem; text-align: center; color: var(--muted); font-size: 0.9rem; }

.log { max-height: 260px; overflow-y: auto; font-size: 0.88rem; }
.log p { margin: 0 0 0.3rem; padding-left: 0.6rem; border-left: 3px solid var(--pc, #9ab); }
.log .tide { font-weight: 700; border-left-color: var(--brass); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(2, 10, 18, 0.66); backdrop-filter: blur(3px); animation: fadeIn 0.2s ease; }
.modal { position: relative; width: min(600px, 100%); max-height: 92vh; overflow-y: auto; color: var(--ink); border-radius: 20px; padding: 1.3rem 1.4rem;
  background: linear-gradient(180deg, var(--pearl), #ebe2cc); box-shadow: 0 0 0 4px #3d7a86, 0 0 0 7px #15394a, 0 30px 60px rgba(0, 0, 0, 0.6); animation: rise 0.3s var(--pop); }
.modal-back.wide .modal { width: min(900px, 100%); }
.modal h2 { margin: 0 0 0.5rem; padding-right: 2.4rem; }
.modal-x { position: absolute; top: 0.6rem; right: 0.7rem; border: 0; background: rgba(0, 0, 0, 0.06); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem; z-index: 2; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* dive planner */
.plan-head { display: grid; grid-template-columns: 110px 1fr; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; }
.plan-head img { width: 110px; height: 70px; object-fit: cover; border-radius: 10px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.4rem; }
.pick button { display: grid; grid-template-columns: auto 1fr; gap: 0 0.5rem; align-items: center; text-align: left; border: 0; border-radius: 12px; padding: 0.45rem 0.55rem; cursor: pointer;
  background: #fffdf7; color: var(--ink); box-shadow: inset 0 0 0 2px var(--pearl-2); font: inherit; }
.pick button .pic { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; grid-row: span 2; background: #0d3b4f; display: grid; place-items: center; font-size: 1.4rem; }
.pick button b { font-size: 0.9rem; }
.pick button small { font-size: 0.74rem; color: var(--muted); }
.pick button.on { background: #fff4cf; box-shadow: inset 0 0 0 3px var(--brass); }
.pick button:disabled { opacity: 0.45; cursor: not-allowed; }
.odds-box { margin-top: 0.9rem; padding: 0.8rem 0.9rem; border-radius: 14px; background: #0d2c3e; color: #eaf6f8; }
.odds-big { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.odds-big b { font-family: "Lilita One", sans-serif; font-size: 2rem; color: var(--oc); }
.odds-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; margin: 0.4rem 0 0.6rem; }
.odds-bar i { display: block; height: 100%; background: var(--oc); border-radius: inherit; transition: width 0.25s; }
.parts { display: grid; gap: 0.15rem; font-size: 0.88rem; }
.parts div { display: flex; justify-content: space-between; }
.parts .neg { color: #ff9b85; }
.parts .pos { color: #8ff0b4; }
.risk-note { margin-top: 0.5rem; font-size: 0.85rem; color: #ffd0c4; }
.risk-note.safe { color: #a8f0c4; }

/* dice */
.roll { text-align: center; padding: 0.4rem 0 0.2rem; }
.d20 { width: 120px; height: 120px; margin: 0.4rem auto 0.6rem; display: grid; place-items: center; position: relative; }
.d20 svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4)); }
.d20 span { position: relative; font-family: "Lilita One", sans-serif; font-size: 2.6rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.d20.spin svg { animation: dspin 0.25s linear infinite; }
.d20.land { animation: dland 0.45s var(--pop); }
@keyframes dspin { to { transform: rotate(360deg); } }
@keyframes dland { from { transform: scale(1.35); } to { transform: none; } }
.roll-sum { font-size: 1.1rem; font-weight: 600; min-height: 1.6rem; }
.roll-verdict { font-family: "Lilita One", sans-serif; font-size: 1.8rem; min-height: 2.4rem; }
.roll-verdict.ok { color: var(--good); }
.roll-verdict.fail { color: var(--bad); }
.roll-msgs p { margin: 0.25rem 0; }
.roll .who { font-weight: 700; }

/* shipyard / hall */
.shop { display: grid; gap: 0.5rem; }
.shop .card { grid-template-columns: auto 1fr auto; }
.shop .card .btn { grid-row: span 2; }
.shop h3 { margin: 0.9rem 0 0.3rem; }
.gold-line { font-weight: 700; }

/* rules */
.rules-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.8rem; }
.rules-tabs button { border: 0; border-radius: 999px; padding: 0.35rem 0.75rem; cursor: pointer; font-weight: 600; background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); color: var(--ink); }
.rules-tabs button.on { background: var(--brass); box-shadow: none; }
.rules-body p, .rules-body li { line-height: 1.45; }
.rules-body table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0; }
.rules-body th, .rules-body td { text-align: left; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--pearl-2); vertical-align: top; }

/* ---------- banners & toasts ---------- */
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 0.4rem; justify-items: center; pointer-events: none; }
.toast { background: #0d2c3e; color: var(--pearl); padding: 0.55rem 1rem; border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); animation: toastIn 0.3s var(--pop); font-size: 0.92rem; max-width: 90vw; }
.toast.bad { background: #7d1f2a; }
.toast.out { animation: toastOut 0.4s ease forwards; }
.toast .dot { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--pc); margin-right: 0.4rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti span { position: absolute; top: -10%; font-size: 1.6rem; animation: fall 3s linear both; }
@keyframes fall { to { transform: translateY(120vh) rotate(540deg); } }

/* ---------- final reveal ---------- */
.at-reveal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1.2rem; overflow-y: auto; cursor: pointer;
  background: radial-gradient(circle at 50% 30%, #17506b, #04101b 75%); color: #f5f0e4; animation: fadeIn 0.4s ease both; }
.at-reveal.decided { cursor: default; }
.hr-rays { position: absolute; inset: -50%; pointer-events: none; opacity: 0; transition: opacity 0.8s ease;
  background: repeating-conic-gradient(from 0deg, rgba(127, 244, 255, 0.1) 0 10deg, transparent 10deg 20deg); }
.at-reveal.announced .hr-rays { opacity: 1; animation: hrSpin 30s linear infinite; }
@keyframes hrSpin { to { transform: rotate(360deg); } }
.hr-stage { position: relative; width: min(680px, 100%); display: grid; gap: 1rem; justify-items: center; text-align: center; }
.hr-title { font-family: "Lilita One", sans-serif; font-size: clamp(1.8rem, 5vw, 2.6rem); color: #ffe08f; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); animation: hrDrop 0.7s var(--pop) both; }
@keyframes hrDrop { from { transform: translateY(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.hr-duel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.8rem; align-items: center; width: 100%; margin-top: 0.8rem; }
.hr-side { position: relative; display: grid; justify-items: center; gap: 0.35rem; padding: 1rem 0.6rem; border-radius: 18px; background: rgba(245, 240, 228, 0.08);
  box-shadow: 0 0 0 3px var(--pc); transition: transform 0.5s ease, filter 0.5s ease, box-shadow 0.5s ease; }
.hr-side img { width: clamp(72px, 16vw, 110px); height: clamp(72px, 16vw, 110px); border-radius: 20px; object-fit: cover; box-shadow: 0 0 0 4px var(--pc); }
.hr-name { font-weight: 700; font-size: 1.15rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-total { font-family: "Lilita One", sans-serif; font-size: clamp(2.4rem, 8vw, 3.4rem); line-height: 1; min-width: 2ch; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }
.hr-crown { position: absolute; top: -1.8rem; font-size: 2.4rem; opacity: 0; }
.hr-vs { font-family: "Lilita One", sans-serif; font-size: 1.8rem; color: #ff9b80; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6); }
.at-reveal.suspense .hr-side { animation: hrShake 0.35s ease-in-out infinite; }
@keyframes hrShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.at-reveal.announced .hr-side { animation: none; }
.hr-side.win { transform: scale(1.08); box-shadow: 0 0 0 4px #ffd24d, 0 0 50px rgba(255, 210, 77, 0.6); }
.hr-side.win .hr-total { color: #ffd24d; }
.hr-side.win .hr-crown, .hr-side.tie .hr-crown { animation: hrCrown 0.7s var(--pop) 0.2s both; }
@keyframes hrCrown { from { opacity: 0; transform: translateY(-50px) rotate(-20deg); } to { opacity: 1; transform: none; } }
.hr-side.lose { transform: scale(0.9); filter: grayscale(0.7) brightness(0.75); }
.hr-verdict { min-height: 4.4rem; display: grid; place-items: center; }
.hr-drum { font-family: "Lilita One", sans-serif; font-size: clamp(1.3rem, 4vw, 1.8rem); color: #ffe08f; }
.hr-drum i { font-style: normal; display: inline-block; animation: hrDot 0.9s ease-in-out infinite; }
.hr-drum i:nth-child(2) { animation-delay: 0.15s; }
.hr-drum i:nth-child(3) { animation-delay: 0.3s; }
@keyframes hrDot { 50% { transform: translateY(-6px); } }
.hr-head { font-family: "Lilita One", sans-serif; font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.1; color: #ffd24d; text-shadow: 0 4px 0 #6b3f0a, 0 0 30px rgba(255, 210, 77, 0.55); animation: hrDrop 0.6s var(--pop) both; }
.hr-sub { opacity: 0; transition: opacity 0.5s ease; }
.at-reveal.announced .hr-sub { opacity: 0.9; }
.hr-rows { display: grid; gap: 0.35rem; width: min(500px, 100%); }
.hr-row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem; border-radius: 12px; background: rgba(245, 240, 228, 0.08);
  opacity: 0; transform: translateY(10px); transition: opacity 0.35s ease, transform 0.45s ease; }
.hr-row.in { opacity: 1; transform: none; }
.hr-row small { color: rgba(245, 240, 228, 0.75); font-size: 0.9rem; }
.hr-row span { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hr-row span.lead { color: #ffd24d; }
.hr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; opacity: 0; pointer-events: none; transition: opacity 0.4s ease 0.5s; }
.at-reveal.decided .hr-actions { opacity: 1; pointer-events: auto; }
.hr-skip { position: fixed; right: 16px; bottom: 16px; background: rgba(245, 240, 228, 0.12); color: #f5f0e4; border: 1px solid rgba(245, 240, 228, 0.3); border-radius: 999px; padding: 0.4rem 0.9rem; font-weight: 600; cursor: pointer; }
.at-reveal.decided .hr-skip { display: none; }

/* ---------- game history ---------- */
.hist .hist-kind { margin-bottom: 0.9rem; }
.hist-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
.hist-stats .hs { text-align: center; padding: 0.55rem 0.3rem; border-radius: 12px; background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); }
.hist-stats .hs b { display: block; font-size: 1.35rem; line-height: 1.1; }
.hist-stats .hs small { color: var(--muted); font-size: 0.78rem; }
.hist-list { display: grid; gap: 0.45rem; }
.hg { border-radius: 12px; background: #fffdf7; box-shadow: inset 0 0 0 2px var(--pearl-2); }
.hg summary { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.8rem; cursor: pointer; list-style: none; }
.hg summary::-webkit-details-marker { display: none; }
.hg-icon { font-size: 1.4rem; }
.hg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hg-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hg-main small { color: var(--muted); }
.hg-res { flex: none; padding: 0.2rem 0.6rem; border-radius: 999px; font-weight: 700; font-size: 0.82rem; background: #e6e2d4; }
.hg-res.win { background: #cfeec0; color: #1f5b12; }
.hg-res.loss { background: #f6d0c8; color: #7a1f12; }
.hg-res.tie { background: #e6e0f5; color: #3d2f6b; }
.hg-table { display: grid; gap: 0.15rem; margin: 0 0.8rem 0.8rem; padding-top: 0.5rem; border-top: 1px solid var(--pearl-2); font-size: 0.9rem; }
.hg-table div { display: grid; grid-template-columns: 3rem 1fr 3rem; align-items: center; text-align: center; }
.hg-table span { font-weight: 700; }
.hg-table small { color: #3c5363; }
.hg-view { margin: 0 0.8rem 0.8rem; text-align: center; }
.hist-empty, .hist-note { text-align: center; }
@media (max-width: 560px) {
  .hist-stats { grid-template-columns: repeat(3, 1fr); }
  .scores { grid-template-columns: 1fr; gap: 8px; }
  .co { padding: 0.55rem 0.7rem; }
  .co-flag { width: 36px; height: 36px; font-size: 1.2rem; }
  .at { padding: 10px 10px 50px; }
  .chart { height: 600px; }
  .node { width: 72px; transform: translate(-50%, -24px); }
  .nd-dot { width: 46px; height: 46px; }
  .node.heart .nd-dot { width: 56px; height: 56px; }
  .nd-flag { width: 26px; height: 26px; font-size: 0.85rem; }
  .nd-name { font-size: 0.68rem; }
  .nd-meta { font-size: 0.62rem; letter-spacing: 0; }
  .nd-odds { font-size: 0.64rem; left: calc(50% + 10px); }
  .sea { padding: 0.6rem; }
  .hall-grid { grid-template-columns: 1fr; }
  .modal { padding: 1.1rem 1rem; }
  .plan-head { grid-template-columns: 80px 1fr; }
  .plan-head img { width: 80px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) { .hero-bubbles, .gh-hero-img { animation: none !important; } }

.loading-save { text-align: center; padding: 5rem 1rem; opacity: 0.8; }

/* Pearl: a smooth, round, softly lustrous bead used wherever pearls are counted. */
.pearl {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border-radius: 50%;
  vertical-align: -0.1em;
  background:
    radial-gradient(circle at 34% 30%, #fff 0 9%, rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 62% 74%, rgba(255, 214, 230, 0.55), rgba(255, 214, 230, 0) 45%),
    radial-gradient(circle at 40% 36%, #fdfbf7 0%, #efe8e6 38%, #d7cdd4 66%, #a99cad 100%);
  box-shadow: inset -0.06em -0.08em 0.14em rgba(80, 60, 100, 0.35), 0 0.05em 0.1em rgba(0, 0, 0, 0.3);
}
.confetti .pearl { width: 1em; height: 1em; }

/* Tide strip: which tide it is and what the sea is doing, always in view. */
.tide-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; padding: 0.55rem 0.9rem; border-radius: 14px; background: rgba(46, 196, 182, 0.14); box-shadow: inset 0 0 0 1.5px rgba(46, 196, 182, 0.45); font-size: 0.92rem; }
.tide-strip .ts-tide { font-weight: 700; white-space: nowrap; }
.tide-strip .ts-last { color: #ffcf6b; }
.tide-strip .ts-sea { flex: 1 1 18rem; }
.tide-strip .ts-next { opacity: 0.75; font-size: 0.85rem; white-space: nowrap; }

/* Between tides. */
.tide-report { text-align: left; }
.tr-turn { display: grid; justify-items: center; gap: 0.2rem; text-align: center; margin-bottom: 0.9rem; }
.tr-turn span { color: var(--muted); font-weight: 600; }
.tr-turn b { font-family: "Lilita One", sans-serif; font-size: 1.9rem; color: var(--sea); }
.tr-turn em { font-style: normal; font-weight: 800; color: var(--bad); }
.tr-sea { display: flex; gap: 0.9rem; align-items: center; padding: 0.8rem 1rem; border-radius: 14px; background: var(--deep); color: #eaf6f8; }
.tr-sea .tr-icon { font-size: 2.6rem; line-height: 1; }
.tr-sea b { font-family: "Lilita One", sans-serif; font-size: 1.3rem; }
.tr-sea p { margin: 0.2rem 0 0; }
.tr-heart { padding: 0.6rem 0.8rem; border-radius: 12px; background: rgba(46, 196, 182, 0.18); }
.tr-list { padding-left: 1.1rem; display: grid; gap: 0.35rem; }
.tr-list .bad { color: var(--bad); font-weight: 700; }
.tr-next, .tr-first { margin: 0.5rem 0; }

/* What the die has to show. */
.need-big { font-size: 1.15rem; text-align: center; margin-bottom: 0.45rem; }
.need-big b { color: var(--oc, var(--brass)); font-size: 1.35rem; }
.need-note { margin: 0.4rem 0 0; font-size: 0.8rem; opacity: 0.8; }
.d20-track { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; margin: 0.35rem 0 0.7rem; }
.d20-track i { font-style: normal; text-align: center; font-size: 0.68rem; font-weight: 700; padding: 0.22rem 0; border-radius: 4px; color: #fff; }
.d20-track i.ok { background: #1f9d55; }
.d20-track i.no { background: #9b3a30; opacity: 0.75; }
.d20-track i.hit { outline: 3px solid #ffd54a; outline-offset: 1px; transform: scale(1.25); position: relative; z-index: 1; opacity: 1; }
.roll-need { font-size: 1.15rem; }
.roll-need b { color: var(--sea); font-size: 1.3rem; }
#roll-track { max-width: 26rem; margin: 0 auto; }

/* What failure costs. */
.fail-box { margin-top: 0.6rem; padding: 0.6rem 0.75rem; border-radius: 12px; background: rgba(255, 122, 89, 0.12); box-shadow: inset 0 0 0 1.5px rgba(255, 122, 89, 0.45); font-size: 0.86rem; color: #ffe2d9; }
.fail-box ul { margin: 0.3rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }
.fail-box ul ul { margin-top: 0.25rem; }
.roll-msgs .loss { color: var(--bad); font-weight: 800; }
@media (max-width: 560px) {
  .d20-track i { font-size: 0.55rem; }
  .tr-turn b { font-size: 1.5rem; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0.6rem 0.8rem; }
  .top-mid { grid-column: 1 / -1; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; }
}
@media (max-width: 560px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr); gap: 0.45rem 0.5rem; padding: 0.5rem 0.65rem; }
  .brand { gap: 0.4rem; }
  .brand-logo { width: 30px; height: 30px; box-shadow: 0 0 0 2px #e8b64c; }
  .brand h1 { font-size: 1.05rem; }
  .brand small { display: none; }
  .top-actions { grid-row: 1; grid-column: 2; justify-content: flex-end; gap: 0.25rem; }
  .top-actions .bt { display: none; }
  .top-actions .btn { width: 31px; height: 31px; padding: 0; justify-content: center; font-size: 0.95rem; box-shadow: none; }
  .top-mid { grid-row: 2; }
  .tracker-label { display: none; }
  .pip { width: 21px; height: 21px; font-size: 0.68rem; }
  .top-sea .chip { font-size: 0.78rem; padding: 0.2rem 0.55rem; }
}
@media (max-width: 360px) { .brand-logo { display: none; } }
/* After a failed dive: the story, then the penalty. */
.what-box, .pen-box { text-align: left; margin: 0.6rem 0 0; padding: 0.65rem 0.85rem; border-radius: 12px; font-size: 0.95rem; }
.what-box { background: rgba(18, 74, 99, 0.08); box-shadow: inset 0 0 0 1.5px rgba(18, 74, 99, 0.25); }
.pen-box { background: rgba(192, 57, 43, 0.09); box-shadow: inset 0 0 0 2px rgba(192, 57, 43, 0.55); }
.pen-box.none { background: rgba(31, 122, 70, 0.1); box-shadow: inset 0 0 0 2px rgba(31, 122, 70, 0.5); }
.what-box h4, .pen-box h4 { margin: 0 0 0.35rem; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 1.1rem; letter-spacing: 0.02em; }
.pen-box h4 { color: var(--bad); }
.pen-box.none h4 { color: var(--good); }
.what-box p, .pen-box p { margin: 0.2rem 0; }
.pen-box ul { margin: 0.2rem 0 0.3rem; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.pen-plus, .pen-kept { font-size: 0.85rem; color: var(--muted); }
/* Rulebook */
.rulebook { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.rb-toc { position: sticky; top: 0; flex-direction: column; flex-wrap: nowrap; gap: 0.25rem; margin: 0; }
.rb-toc-head { font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 0.95rem; color: var(--muted); padding: 0 0.3rem 0.2rem; }
.rb-toc button { text-align: left; border-radius: 10px; padding: 0.4rem 0.6rem; display: flex; gap: 0.45rem; align-items: baseline; }
.rb-toc button span { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 1.2em; }
.rb-toc button.on span { color: var(--ink); }
.rb-ch { margin: 0 0 0.6rem; font-size: 1.5rem; border-bottom: 2px solid var(--pearl-2); padding-bottom: 0.35rem; }
.rb-ch small { display: block; font-family: "Fredoka", sans-serif; font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.rb-sec { margin: 1rem 0 0.35rem; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 1.1rem; letter-spacing: 0.02em; }
.rb-sec span { color: var(--brass-dark); margin-right: 0.25rem; }
.rb-flow { padding-left: 1.3rem; display: grid; gap: 0.3rem; }
.rb-flow li::marker { font-weight: 800; color: var(--brass-dark); }
.rb-ex { padding: 0.55rem 0.8rem; border-left: 4px solid var(--teal); background: rgba(46, 196, 182, 0.1); border-radius: 0 10px 10px 0; font-size: 0.93rem; }
.rb-key { text-align: center; padding: 0.5rem; border-radius: 10px; background: rgba(232, 182, 76, 0.18); }
.rb-video { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; padding: 0.6rem 0.8rem; border-radius: 12px; background: rgba(46, 196, 182, 0.1); font-size: 0.93rem; }
.rb-terms { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; margin: 0.4rem 0; }
.rb-terms dt { font-weight: 700; }
.rb-terms dd { margin: 0; }
.rb-nav { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 1.2rem; padding-top: 0.8rem; border-top: 2px solid var(--pearl-2); }
@media (max-width: 720px) {
  .rulebook { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
  .rb-toc { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.2rem; }
  .rb-toc-head { display: none; }
  .rb-toc button { flex: 0 0 auto; white-space: nowrap; }
  .rb-terms { grid-template-columns: 1fr; gap: 0.1rem; }
  .rb-terms dd { margin-bottom: 0.4rem; }
  .rules-body table { font-size: 0.78rem; display: block; overflow-x: auto; }
  .rules-body th, .rules-body td { padding: 0.25rem 0.3rem; }
  .rb-nav .btn { font-size: 0.8rem; }
}
/* Admin testing switch */
.top-actions .btn.on { background: rgba(232, 182, 76, 0.35); box-shadow: inset 0 0 0 2px var(--brass); }
.rig-note { color: var(--brass-dark); font-weight: 700; }
/* Divers as animated people: a gentle bob in the water, with bubbles rising past them. */
.pic.dv { position: relative; overflow: hidden; padding: 0; background: #0d3b4f; box-shadow: inset 0 0 0 2px rgba(200, 240, 255, 0.25); }
.pic.dv img { width: 100%; height: 100%; object-fit: cover; display: block; transform-origin: 50% 85%; animation: dvBob 4.2s ease-in-out infinite; animation-delay: var(--dl, 0s); }
.pic.dv.flip img { --fx: -1; }
.pic.dv::before, .pic.dv::after { content: ''; position: absolute; bottom: -8px; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid rgba(220, 248, 255, 0.85); opacity: 0; pointer-events: none; animation: dvBubble 3.4s linear infinite; }
.pic.dv::before { left: 18%; width: 4px; height: 4px; animation-delay: calc(var(--dl, 0s) - 1.7s); }
.pic.dv::after { left: 74%; animation-delay: var(--dl, 0s); }
.pic.dv.zz img { filter: grayscale(0.55) brightness(0.75); animation-duration: 9s; }
.pic.dv.zz::after { content: '💤'; border: 0; width: auto; height: auto; left: auto; right: 3px; top: 2px; bottom: auto; font-size: 0.75rem; animation: dvZz 2.6s ease-in-out infinite; }
.pic.dv.promo { box-shadow: inset 0 0 0 2px var(--brass), 0 0 8px rgba(232, 182, 76, 0.55); }
.pic.dv.promo::before { content: '🎖️'; border: 0; width: auto; height: auto; left: 2px; top: 1px; bottom: auto; font-size: 0.7rem; opacity: 1; animation: none; }
@keyframes dvBob { 0%, 100% { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(1.5px) rotate(-1.5deg); } 50% { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(-2.5px) rotate(1.5deg); } }
@keyframes dvBubble { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translate(4px, -72px); opacity: 0; } }
@keyframes dvZz { 0%, 100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(-3px); opacity: 1; } }
.hire:hover .pic.dv img, .pick button:hover .pic.dv img { animation-duration: 1.4s; }

/* The crew on the dice screen: they dive while the die spins, then cheer, slump or are lost. */
.roll-crew { display: flex; justify-content: center; gap: 0.6rem; margin: 0.3rem 0 0.4rem; }
.roll-crew .pic { width: 64px; height: 64px; border-radius: 16px; }
.roll-crew .pic.diving img { animation: dvDive 0.9s ease-in-out infinite; }
.roll-crew .pic.cheer img { animation: dvCheer 0.6s var(--pop) 3; }
.roll-crew .pic.cheer { box-shadow: inset 0 0 0 3px var(--good), 0 0 14px rgba(31, 122, 70, 0.5); }
.roll-crew .pic.sad img { filter: saturate(0.6) brightness(0.85); animation: dvSad 1.2s ease both; }
.roll-crew .pic.lost { box-shadow: inset 0 0 0 3px var(--bad); }
.roll-crew .pic.lost img { animation: dvLost 1.6s ease forwards; }
.roll-crew .pic.lost::after { content: '💀'; border: 0; width: auto; height: auto; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); font-size: 1.6rem; opacity: 0; animation: dvSkull 1.6s ease 0.6s forwards; }
@keyframes dvDive { 0%, 100% { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(-3px) rotate(-3deg); } 50% { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(4px) rotate(3deg); } }
@keyframes dvCheer { 0%, 100% { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(0); } 50% { transform: scale(1.14) scaleX(var(--fx, 1)) translateY(-8px); } }
@keyframes dvSad { to { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(4px) rotate(-4deg); } }
@keyframes dvLost { to { transform: scale(1.08) scaleX(var(--fx, 1)) translateY(16px); filter: grayscale(1) brightness(0.5); opacity: 0.45; } }
@keyframes dvSkull { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pic.dv img, .pic.dv::before, .pic.dv::after, .roll-crew .pic img { animation: none !important; }
}
.rb-face { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-right: 0.3rem; }
