/* Faucet page: one screen, never scrolls. */
html:has(body.faucet-page), body.faucet-page { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.faucet-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; touch-action: manipulation; }

.stage {
  --pool: 58px;
  --slot-w: 300px;
  --tap-w: 150px;                                   /* tap picture width */
  --tap-out: 12px;                                  /* how far its pipe end runs past the window edge */
  --lane: calc(var(--tap-w) - var(--tap-out));      /* strip on each side kept free for the tap and its drops */
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--lane) minmax(0, var(--slot-w)) minmax(0, 1fr) minmax(0, var(--slot-w)) var(--lane);
  gap: 0 24px;
  padding: 18px 0 calc(var(--pool) + 12px);
}

/* ---- ads ---- */
.ads { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 16px; min-height: 0; container-type: size; }
.ads-left, .ads-right { height: calc(100% - 70px); }
.ads-left { grid-column: 2; }
.ads-right { grid-column: 4; }
.slot {
  display: block; position: relative; flex: none;
  width: min(var(--slot-w), 100cqw, calc((100cqh - 16px) / 2 * 1.2));
  aspect-ratio: 6 / 5;
  border-radius: 8px; overflow: hidden;
  background: #0b1d31; border: 1px solid var(--line);
  margin: 0 auto;
}
.slot img { display: block; width: 100%; height: 100%; object-fit: contain; background: #06111e; }
.slot.empty { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; border-style: dashed; padding: 12px; }
.slot.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.slot:hover { border-color: #3aa0ff88; text-decoration: none; }
.slot .ad-tag { position: absolute; right: 6px; top: 5px; font: 600 9px/1 var(--mono); letter-spacing: .1em; color: #ffffffa0; background: #00000066; padding: 3px 5px; border-radius: 4px; }
.ads-mid { display: none; }

/* ---- centre ---- */
.center { grid-column: 3; position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 0; }
.taps-row { width: 100%; max-width: 400px; margin-top: 10px; }
/* Taps hug the window edges at every width; everything else stays between the two lanes. */
.tap { position: absolute; z-index: 3; top: 28px; width: var(--tap-w); height: auto; user-select: none; pointer-events: none; filter: drop-shadow(0 0 12px #3aa0ff59) drop-shadow(0 6px 14px #0008) brightness(1.12); }
.tap-left { left: calc(-1 * var(--tap-out)); }
.tap-right { right: calc(-1 * var(--tap-out)); transform: scaleX(-1); }

.card {
  background: linear-gradient(#0f2741, #0b1f35); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px 10px; box-shadow: 0 10px 30px #0007; width: 100%; margin-top: 18px;
}
.card .row { display: flex; gap: 8px; }
.card input { font-family: var(--mono); font-size: 13px; height: 42px; }
.card.code-mode input { border-color: #ffc85788; }
.card.code-mode .btn { background: linear-gradient(#ffc857, #e0a52e); color: #201500; }
.status { font-size: 14px; }
.status:not(:empty) { margin-top: 10px; }
.status .line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.status .timer { font: 700 22px/1 var(--mono); letter-spacing: .02em; }
.meta { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.meta .link { font-size: 12.5px; white-space: nowrap; }
.notice { margin: 12px 0 0; font-size: 13px; color: var(--warn); text-align: center; max-width: 420px; }

/* ---- latest claims / best guessers (desktop only: fills the space under the wallet box) ---- */
.feed { display: none; }
@media (min-width: 1200px) {
  .feed {
    display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
    width: min(340px, 100%); margin: 22px 0 64px;
    -webkit-mask-image: linear-gradient(#000 70%, #0000); mask-image: linear-gradient(#000 70%, #0000);
  }
  .tabs { display: flex; justify-content: center; gap: 4px; margin: 0 0 8px; }
  .tabs button { background: none; border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer; font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .tabs button:hover { color: var(--text); }
  .tabs button[aria-selected="true"] { color: var(--text); background: #3aa0ff22; }
  .feed ol { list-style: none; margin: 0; padding: 0; }
  .feed li { display: grid; grid-template-columns: 1fr auto 76px; gap: 10px; align-items: baseline; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
  .feed li.new { animation: feed-in .6s ease-out; }
  .feed .who { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
  .feed .amt { font-family: var(--mono); font-weight: 700; color: #bfe6ff; }
  .feed .amt small { font-weight: 400; color: var(--muted); margin-left: 6px; }
  .feed .amt small.win { color: var(--ok); font-weight: 700; }
  .feed .ago { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
  .feed .none { display: block; text-align: center; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
  .feed .board li { grid-template-columns: 22px 1fr auto; }
}
.board .rank { font-family: var(--mono); color: var(--muted); }
.board .who { font-family: var(--mono); }
.board .score { font-family: var(--mono); font-weight: 700; color: #bfe6ff; white-space: nowrap; }
.board .score small { font-weight: 400; color: var(--muted); }
@keyframes feed-in { from { opacity: 0; transform: translateY(-8px); background: #3aa0ff33; } to { opacity: 1; transform: none; background: #3aa0ff00; } }

/* ---- guess popup ---- */
.guess {
  position: absolute; z-index: 7; left: 50%; width: min(340px, calc(100% - 24px)); transform: translateX(-50%);
  background: linear-gradient(#12304f, #0c2239); border: 1px solid #3aa0ff66; border-radius: 12px;
  padding: 14px 14px 12px; box-shadow: 0 16px 44px #000a; text-align: center; animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.97); } to { opacity: 1; transform: translateX(-50%); } }
.guess h2 { margin: 0 0 4px; font-size: 17px; }
.guess p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.guess p b { color: var(--text); }
.guess .pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guess .pick .btn { height: 46px; font-size: 15px; }
.guess .skip { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.guess .x { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px; cursor: pointer; }
.guess .x:hover { color: var(--text); }
.guess .big { font: 800 24px/1.2 var(--mono); color: #bfe6ff; margin: 6px 0 4px; }
.guess .big.win { color: var(--ok); text-shadow: 0 0 18px #3ddc9766; }
.guess .board { list-style: none; margin: 12px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); text-align: left; font-size: 12.5px; }
.guess .board::before { content: "Best guessers"; display: block; font: 600 9.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; text-align: center; }
.guess .board li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; padding: 3px 2px; }
.guess .board:empty { display: none; }

/* ---- water ---- */
/* Hands wait under the pool and only come up to catch a claim's drop. */
.hand {
  position: absolute; z-index: 1; bottom: calc(var(--pool) - 34px); width: 116px; height: auto; left: -400px;
  transform: translateY(calc(100% + 60px)); transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .3s;
  pointer-events: none; user-select: none; filter: drop-shadow(0 0 0 #3aa0ff00);
}
.hand.up { transform: translateY(0); }
.hand.glow { filter: drop-shadow(0 0 18px #8fd3ff) brightness(1.18); }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.gain { position: absolute; z-index: 6; font: 800 18px/1 var(--mono); color: #bfe6ff; text-shadow: 0 0 12px #3aa0ff; pointer-events: none; animation: gain 1.8s ease-out forwards; white-space: nowrap; }
.gain.win { color: var(--ok); text-shadow: 0 0 12px #3ddc97; }
@keyframes gain { 0% { opacity: 0; transform: translate(-50%, 0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60px); } }

.pool { position: absolute; left: 0; right: 0; bottom: 0; height: var(--pool); z-index: 4; overflow: hidden; pointer-events: none; }
.pool svg, .flood svg { position: absolute; left: 0; width: 200%; animation: wave 14s linear infinite; }
.pool svg { bottom: 0; height: 100%; }
.pool .w1, .flood .w1 { fill: #1b6fd1aa; }
.pool .w2, .flood .w2 { fill: #0d4a96; }
.pool::after { content: ""; position: absolute; inset: auto 0 0 0; height: 70%; background: linear-gradient(#0d4a9600, #082f61); }
@keyframes wave { to { transform: translateX(-50%); } }

/* ---- contest code: the pool rises over the whole page and spills past the top ---- */
.flood { position: fixed; z-index: 40; inset: 0; pointer-events: none; transform: translateY(calc(100% + 70px)); will-change: transform; }
.flood svg { top: -58px; height: 60px; animation-duration: 5s; }
.flood-body { position: absolute; inset: 0 0 -80px 0; background: linear-gradient(#0d4a96 0, #0b3f85 30%, #082f61 100%); }
.flood.go { animation: flood 4.4s cubic-bezier(.45,.05,.3,1) forwards; }
@keyframes flood {
  0% { transform: translateY(calc(100% + 70px)); }
  34% { transform: translateY(-90px); }
  40% { transform: translateY(-64px); }
  46% { transform: translateY(-90px); }
  76% { transform: translateY(-80px); }
  100% { transform: translateY(calc(100% + 70px)); }
}
.prize { position: fixed; z-index: 41; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 16px; animation: prize 4.4s ease-out forwards; }
.prize b { display: block; font: 800 clamp(34px, 9vw, 84px)/1.05 var(--mono); color: #fff; text-shadow: 0 0 34px #8fd3ff, 0 4px 0 #062a57; letter-spacing: -.02em; }
.prize span { display: block; margin-top: 12px; font: 600 clamp(11px, 1.6vw, 15px)/1.3 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #cfe9ff; }
@keyframes prize { 0%, 30% { opacity: 0; transform: scale(.7); } 40% { opacity: 1; transform: scale(1.06); } 46% { transform: scale(1); } 74% { opacity: 1; transform: scale(1); } 84%, 100% { opacity: 0; transform: scale(1.04); } }

/* ---- laptop ---- */
@media (max-width: 1360px) { .stage { --slot-w: 260px; --tap-w: 124px; --tap-out: 10px; gap: 0 20px; } .hand { width: 92px; } }
@media (max-height: 760px) and (min-width: 761px) { .stage { padding-top: 10px; } .taps-row { margin-top: 2px; } .tap { top: 12px; } }

/* ---- tablet: side columns go, two slots under the card ---- */
@media (max-width: 1199px) and (min-width: 761px) {
  .stage { grid-template-columns: minmax(0, 1fr); padding-left: calc(var(--lane) + 14px); padding-right: calc(var(--lane) + 14px); }
  .center { grid-column: 1; }
  .ads-left, .ads-right { display: none; }
  .hand { width: 92px; }
  .ads-mid { display: flex; flex-direction: row; justify-content: center; align-items: flex-start; gap: 16px; flex: 1; width: 100%; margin-top: 16px; min-height: 0; }
  .ads-mid .slot { width: min(300px, calc((100cqw - 16px) / 2), calc((100cqh - 40px) * 1.2)); margin: 0; }
}

/* ---- phone: taps on the window edges, the wallet box and the banner between them ---- */
@media (max-width: 760px) {
  .stage { --pool: 40px; --tap-w: 78px; --tap-out: 22px; display: block; padding: 8px calc(var(--lane) + 6px) calc(var(--pool) + 6px); }
  .ads-left, .ads-right { display: none; }
  .center { height: 100%; }
  .taps-row { margin: 0; max-width: 420px; }
  .tap { top: 8px; }
  .card { padding: 12px 12px 8px; margin: 0; position: relative; }
  .card input { font-size: 12px; }
  .meta { font-size: 12px; flex-wrap: wrap; justify-content: center; gap: 4px 12px; text-align: center; }
  .ads-mid { display: flex; flex: 1; min-height: 0; width: 100%; margin-top: 10px; align-items: flex-start; justify-content: center; }
  .ads-mid .slot { width: min(300px, 100cqw, calc(100cqh * 1.2)); }
  .ads-mid .slot-2 { display: none; }
  .hand { width: 60px; bottom: calc(var(--pool) - 24px); }
  .gain { font-size: 15px; }
  .notice { margin-top: 8px; }
}
/* ---- narrow phone: smaller taps, Check goes under the address field ---- */
@media (max-width: 480px) {
  .stage { --tap-w: 66px; --tap-out: 18px; }
  .card { padding: 10px 10px 8px; }
  .card .row { flex-direction: column; }
  .card .row .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pool svg, .flood svg, .feed li.new, .guess { animation: none; }
  .flood.go { animation: none; }
  .prize { animation: prize-still 4s linear forwards; background: #06111ecc; }
  .hand { transition: none; }
}
@keyframes prize-still { 0%, 90% { opacity: 1; } 100% { opacity: 0; } }
