/* TIDEPOOL's own pieces: the rock pool, the tide clock, the bucket, the tide table, sticker cards and pebbles.
   Reads tokens.css. Everything is outlined in ink with a hard shadow, like a sticker on a beach map. */

body { background: var(--bg); }
h1, h2, .display { font-variation-settings: "opsz" 96; }
.accent { color: var(--accent); }
.lede { color: var(--ink-2); }

/* ---------- header and buttons: stickers ---------- */
#top { background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 2px solid var(--ink); }
.brand-mark { width: 34px; height: 34px; border: 0; border-radius: 0; }
.brand-word { height: 20px; width: auto; }
.foot-brand img { height: 24px; width: auto; }
.nav a { white-space: nowrap; font-weight: 500; }
.nav a:hover, .nav a[aria-current] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink); }
.demo-strip { background: var(--ink); color: var(--bg); }
.demo-strip b { color: #ffd27a; }
.btn { border: 2px solid var(--ink); background: var(--surface); box-shadow: 3px 3px 0 var(--ink); font-weight: 700; }
.btn:hover { border-color: var(--ink); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--ink); }
.btn.primary:hover { filter: none; }
.icon-btn:hover { background: var(--surface-2); }
.chip { border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); }
.chip.demo { color: var(--warn); border-color: currentColor; background: #fff3d6; }
.chip.done { color: var(--good); border-color: currentColor; background: #e4f4e9; }
.card, .coin-stats .stat, .faq details, .wallet-row, .menu, .modal-panel, .step { border: var(--border); box-shadow: var(--shadow); background: var(--surface); }
.card { border-radius: var(--r-lg); }
.modal-veil { background: rgba(19, 52, 59, 0.45); }
.toast { background: var(--ink); color: var(--bg); }
.input, .prefix { border: 2px solid var(--ink); background: var(--surface); }
.ca { border: 2px dashed var(--ink-2); background: var(--surface); }
.ca-soon { color: var(--accent); font-weight: 500; }
.h3.sub { margin-bottom: 14px; }
.label { color: var(--ink-2); }
#foot { border-top: 2px solid var(--ink); background: var(--bg-2); }
.foot-base { border-top: 1.5px solid var(--line-2); }
.tabbar { border: 2px solid var(--ink) !important; box-shadow: var(--shadow); background: var(--surface) !important; }

/* ---------- home: the beach ---------- */
.beach { position: relative; padding-top: clamp(28px, 4vw, 48px); }
.beach-top { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: start; }
.beach-copy h1 { font-size: clamp(42px, 6.4vw, 88px); line-height: 0.95; }
.beach-copy .lede { margin-top: 18px; max-width: 34em; }
.beach-copy .ctas { margin-top: 24px; }
.pool-frame { position: relative; margin-top: 26px; }
.pool-frame .chip.demo { position: absolute; right: 18px; bottom: 14px; z-index: 6; }
.pool-leader { position: absolute; left: 0; bottom: 6px; z-index: 6; }
.shells { position: absolute; inset: -10px 0 auto; pointer-events: none; }

/* the contract-address card, under the buttons */
.ca-card { display: grid; gap: 8px; margin-top: 22px; padding: 14px 16px; max-width: 560px; border: var(--border); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.ca-card-addr { font-size: 15px; font-weight: 500; text-align: left; word-break: break-all; border: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-2); color: var(--ink); cursor: copy; user-select: all; }
.ca-card.soon .ca-card-addr { color: var(--accent); cursor: default; background: none; padding: 0; font-size: 18px; }
.ca-card-note { font-size: 13px; color: var(--ink-2); }
.ca-card-actions { gap: 8px; }
.ca-card-actions .btn { box-shadow: 2px 2px 0 var(--ink); }

/* the pool itself */
.pool { position: relative; height: clamp(400px, 52vw, 600px); container-type: size; }
.pool-bg { position: absolute; inset: 0; }
.pool-scene { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pool-school { position: absolute; inset: 0; z-index: 2; container-type: size; }
.pool-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; color: #fff; font-weight: 700; text-align: center; padding: 20px 18%; }
.pool-empty[hidden] { display: none; }

.swimmer { position: absolute; display: grid; justify-items: center; gap: 2px; width: var(--size, 90px); transition: width 1.2s var(--ease), top 1s var(--ease), left 1s var(--ease); animation: swim var(--swim, 28s) ease-in-out var(--delay, 0s) infinite; }
.flip { display: block; width: 100%; animation: flip var(--swim, 28s) linear var(--delay, 0s) infinite; }
.bob { display: block; animation: bob var(--bob, 4s) ease-in-out infinite; }
.swimmer-art svg { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 8px 0 rgba(19, 52, 59, 0.18)); }
.swimmer-tag { font: 500 11.5px/1 var(--font-mono); padding: 5px 8px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); white-space: nowrap; border: 1.5px solid var(--ink); }
.swimmer .ring { display: none; }
.swimmer.champ .ring { display: block; position: absolute; left: -14%; top: -18%; width: 128%; height: 100%; color: var(--accent); pointer-events: none; }
.swimmer.champ .ring svg { width: 100%; height: 100%; overflow: visible; }
.swimmer.champ .swimmer-tag { background: var(--accent); color: var(--on-accent); }
.swimmer.champ .swimmer-tag::before { content: "♛ "; }
.swimmer:hover .swimmer-tag, .swimmer:focus-visible .swimmer-tag { box-shadow: 2px 2px 0 var(--ink); }
/* the swimmer and its tag travel together; only the art turns round at each end */
@keyframes swim { 0%, 100% { transform: translateX(0); } 48%, 52% { transform: translateX(var(--d)); } }
@keyframes flip { 0%, 49.9% { transform: scaleX(1); } 50%, 99.9% { transform: scaleX(-1); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-1.5deg); } }

/* the bucket tipped: rings spread across the water */
.splash { position: absolute; left: 50%; top: 50%; z-index: 4; pointer-events: none; }
.splash span { position: absolute; left: -40px; top: -24px; width: 80px; height: 48px; border-radius: 50%; border: 3px solid #fff; opacity: 0; animation: splash 2.2s var(--ease) calc(var(--i) * 0.25s) 1 both; }
@keyframes splash { 0% { transform: scale(0.3); opacity: 0.9; } 100% { transform: scale(4); opacity: 0; } }

/* ---------- the tide clock ---------- */
.tide-clock { display: grid; justify-items: center; gap: 10px; }
.dial-wrap { position: relative; width: 190px; height: 190px; filter: drop-shadow(4px 4px 0 var(--ink)); }
.dial-wrap .dial, .dial-wrap .hand, .dial-wrap .hand svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hand { transition: transform 1s linear; }
.dial-word { font: 700 10.5px var(--font-mono); letter-spacing: 0.14em; fill: var(--surface); }
.dial-num { font: 500 12px var(--font-mono); fill: var(--ink-2); }
.clock-read { display: grid; justify-items: center; gap: 2px; text-align: center; }
.clock-time { font-size: 34px; line-height: 1; letter-spacing: -0.02em; font-weight: 500; }
.clock-note { font-size: 13px; color: var(--ink-2); }

/* the leader, pinned like a note on the sand */
.note { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 14px; background: var(--surface); border: var(--border); box-shadow: var(--shadow); transform: rotate(-1.2deg); }
.note b { color: var(--accent); }
.note .muted { font-size: 13px; }

/* ---------- pebbles: the steps ---------- */
.pebbles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 22px; }
.pebble { display: grid; gap: 8px; align-content: start; }
.pebble-n { display: inline-grid; place-items: center; width: 52px; height: 44px; border: var(--border); background: var(--rock); color: #fff; font: 800 20px/1 var(--font-display); border-radius: 48% 52% 44% 56% / 56% 46% 54% 44%; box-shadow: 3px 3px 0 var(--ink); }
.pebble:nth-child(2) .pebble-n { background: var(--water-2); }
.pebble:nth-child(3) .pebble-n { background: var(--sand-2); color: var(--ink); }
.pebble:nth-child(4) .pebble-n { background: var(--accent); }
.pebble p { color: var(--ink-2); }

/* ---------- the bucket ---------- */
.pot-card { display: grid; grid-template-columns: 130px 1fr; gap: 22px; align-items: center; }
.bucket svg { width: 100%; height: auto; display: block; }
.pot-copy { display: grid; gap: 8px; align-content: start; }
.pot-copy p { color: var(--ink-2); }
.split { display: flex; height: 34px; border-radius: var(--r-sm); overflow: hidden; border: 2px solid var(--ink); margin-top: 4px; }
.split span { display: grid; place-items: center; background: var(--surface-2); font: 12px var(--font-mono); }
.split span + span { border-left: 2px solid var(--ink); }
.split .champ-side { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }

/* ---------- the tide table (the board) ---------- */
.board-wrap { overflow-x: auto; border-radius: var(--r-lg); border: var(--border); box-shadow: var(--shadow); background: var(--surface); }
.board { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 720px; }
.board th { text-align: left; font: 500 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bg); background: var(--ink); padding: 13px 16px; }
.board td { padding: 9px 16px; border-bottom: 1.5px dashed var(--line-2); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board .n { text-align: right; }
.board .rank { width: 52px; font-weight: 500; position: relative; }
.board tr.champ td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.board tr.champ .rank { color: var(--accent); }
/* the pencilled circle round the champion's rank: the hand-made detail */
.board tr.champ .rank::after { content: ""; position: absolute; left: 6px; top: 50%; width: 30px; height: 26px; margin-top: -14px; border: 2.5px solid var(--accent); border-radius: 52% 48% 55% 45% / 48% 55% 45% 52%; transform: rotate(-8deg); }
.board tbody tr:hover td { background: var(--surface-2); }
.who { display: inline-flex; align-items: center; gap: 12px; }
.who-id { display: grid; line-height: 1.25; }
.who-id .muted { font-size: 13px; }
.board-note { margin-top: 14px; max-width: 70ch; }
.creature { display: inline-block; flex: none; }
.creature svg { width: 100%; height: 100%; overflow: visible; }
.down { color: var(--bad); }

/* ---------- burns: the tide log ---------- */
.burns { display: grid; border-top: 2px solid var(--ink); }
.burn-row { display: grid; grid-template-columns: 26px 1fr auto 110px 70px; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1.5px dashed var(--line-2); font-size: 14.5px; }
.burn-dot { width: 22px; height: 12px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 12'%3E%3Cpath d='M1 7 q5 -6 10 0 t10 0' fill='none' stroke='%2346b1b2' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E"); border: 0; border-radius: 0; }
.burn-text { color: var(--ink-2); }
.burn-text b { color: var(--ink); }
.tx { justify-self: end; }
.seasons { display: grid; border-top: 2px solid var(--ink); }
.season-row { display: grid; grid-template-columns: 110px 220px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1.5px dashed var(--line-2); font-size: 14.5px; }

/* ---------- lists (hall of fame) ---------- */
.records { margin-top: 0; margin-bottom: 22px; }
.coin-stats .stat { border-radius: var(--r); }
.list { display: grid; }
.list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1.5px dashed var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .who { gap: 10px; }

/* ---------- closing: a wooden sign ---------- */
.closing { display: grid; justify-items: start; gap: 18px; padding: clamp(28px, 5vw, 52px); border-radius: var(--r-lg); border: var(--border); box-shadow: 6px 6px 0 var(--ink); background: var(--water-2); color: #fff; }
.closing .lede { color: #f1fbfa; }
.closing h2 { color: #fff; }
.closing .accent { color: var(--ink); }

/* ---------- specimen tag ---------- */
.specimen { position: relative; display: grid; gap: 2px; width: max-content; max-width: 100%; padding: 12px 18px 12px 34px; background: #fff7e4; color: var(--ink); border: 2px solid var(--ink); border-radius: 4px 14px 14px 4px; transform: rotate(-1.5deg); box-shadow: 3px 3px 0 var(--ink); }
.specimen-hole { position: absolute; left: 11px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink); }
.specimen-latin { font: 700 17px/1.2 var(--font-display); font-style: italic; }
.specimen-name { font-weight: 700; font-size: 14px; }
.specimen-meta { font-size: 11.5px; color: var(--ink-2); }

/* ---------- creature page ---------- */
.creature-head { display: grid; grid-template-columns: minmax(260px, 440px) 1fr; gap: 40px; align-items: center; padding-top: 36px; padding-bottom: 12px; }
.portrait { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; }
.portrait .pool-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait .creature { position: relative; z-index: 1; width: 58% !important; height: auto !important; }
.champ-chip { position: absolute; top: 6px; left: 6px; z-index: 2; background: var(--accent); color: var(--on-accent); }
.creature-title { display: grid; gap: 16px; justify-items: start; }
.creature-title h1 { font-size: clamp(38px, 4.8vw, 64px); }
.sym { font: 500 0.4em var(--font-mono); color: var(--ink-2); letter-spacing: 0; vertical-align: middle; }
.chart-line { stroke: var(--water-3); stroke-width: 2.5; }
.chart-area { fill: color-mix(in srgb, var(--water-2) 22%, transparent); }
.chart-window { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.banner { border: var(--border); box-shadow: var(--shadow); background: var(--surface); }
.banner.good { background: #e4f4e9; border-color: var(--ink); }

/* ---------- enter ---------- */
.enter-grid { display: grid; grid-template-columns: 1fr 380px; gap: 26px; align-items: start; }
.enter-form h2 { margin-bottom: 4px; }
.enter-preview { position: sticky; top: calc(var(--top-h) + 20px); display: grid; gap: 14px; padding: 18px; border-radius: var(--r-lg); border: var(--border); box-shadow: var(--shadow); background: var(--surface); }
.preview-pool { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; }
.preview-pool .pool-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-pool > .creature, .preview-pool > .preview-q { position: relative; z-index: 1; }
.preview-q { font: 800 64px/1 var(--font-display); color: #fff; }
.preview-copy { display: grid; gap: 4px; }
.preview-species { font: 800 28px/1.1 var(--font-display); letter-spacing: -0.02em; }
.enter-preview.taken .preview-species { color: var(--bad); }

/* ---------- how ---------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 22px; }
.rule { padding: 20px; border: var(--border); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 6px; align-content: start; }
.guide-note { margin-top: 8px; }
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 20px; }
.guide-item { display: grid; justify-items: center; gap: 8px; padding: 16px 8px; border-radius: var(--r); border: var(--border); background: var(--surface); box-shadow: 3px 3px 0 var(--ink); font-size: 14px; font-weight: 500; }

/* ---------- loading: three pebbles ---------- */
.loading-bubbles { display: flex; gap: 8px; }
.loading-bubbles span { width: 14px; height: 12px; border-radius: 50%; background: var(--rock); border: 2px solid var(--ink); animation: bob 1.2s ease-in-out infinite; }
.loading-bubbles span:nth-child(2) { animation-delay: 0.15s; background: var(--water-2); }
.loading-bubbles span:nth-child(3) { animation-delay: 0.3s; background: var(--sand-2); }

/* ---------- phones ---------- */
@media (max-width: 980px) {
  .creature-head, .enter-grid { grid-template-columns: 1fr; }
  .pebbles { grid-template-columns: 1fr 1fr; }
  .enter-preview { position: static; }
}
@media (max-width: 860px) {
  .burn-row { grid-template-columns: 26px 1fr 56px; }
  .burn-row > .num, .burn-row .tx { display: none; }
  .season-row { grid-template-columns: 1fr auto; }
  .season-row > :nth-child(2) { display: none; }
}
@media (max-width: 720px) {
  .beach-top { grid-template-columns: 1fr; }
  .tide-clock { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: 16px; }
  .dial-wrap { width: 120px; height: 120px; }
  .clock-read { justify-items: start; text-align: left; }
  .pool { height: 520px; }
  .pool-leader { position: static; margin-top: 10px; }
  .swimmer { width: calc(var(--size, 90px) * 0.66); }
  .swimmer-tag { font-size: 10px; padding: 3px 6px; }
  .pebbles { grid-template-columns: 1fr; }
  .pot-card { grid-template-columns: 90px 1fr; gap: 16px; }
  .list li { grid-template-columns: 40px 1fr auto; }
}
