/* Paco's Island. Daytime on Bahía Ixtaluz, a fictional bay.
   Bay #095565 is the play surface. Sun #FFC43A is the one action color.
   Fonts: PP Fuji Bold for the wordmark and numbers, PP Neue Montreal for
   everything people read. Owner-licensed files in /fonts.
   No dividers: sections are separated by space, type size and color. */

@font-face { font-family: 'PP Fuji'; src: url('../fonts/PPFuji-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'PP Neue Montreal'; src: url('../fonts/PPNeueMontreal-Book.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PP Neue Montreal'; src: url('../fonts/PPNeueMontreal-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'PP Neue Montreal'; src: url('../fonts/PPNeueMontreal-Semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bay: #095565;
  --bay-deep: #07475A;
  --bay-lift: #0E6678;
  --foam: #FFFFFF;
  --mist: #CDEFF5;
  --sun: #FFC43A;
  --sun-deep: #C98F12;
  --sun-lift: #FFD266;
  --ink: #0D2340;
  --sky: #8ED8EE;
  --leaf: #BDE66E;
  --coral: #F7A8CB;
  --bougain: #C21A68;
  --sab: env(safe-area-inset-bottom, 0px);
  --read: 'PP Neue Montreal', system-ui, -apple-system, sans-serif;
  --show: 'PP Fuji', 'PP Neue Montreal', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bay); }
body { margin: 0; color: var(--foam); background: var(--bay); font: 400 17px/1.45 var(--read); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { max-width: 560px; margin: 0 auto; padding-bottom: calc(40px + var(--sab)); }

/* the trip scene, with the score laid over it */
.scene { position: relative; background: var(--sky); aspect-ratio: 2 / 1; overflow: hidden; }
.scene canvas { display: block; width: 100%; height: 100%; }
.scene.no-scene { aspect-ratio: auto; height: 0; }
.hud { position: absolute; inset: 10px 10px auto 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud p { margin: 0; padding: 6px 10px; border-radius: 6px; background: var(--ink); }
.hud-where { font-weight: 500; font-size: 14px; line-height: 1.25; max-width: 60%; }
.hud-score { font: 700 22px/1 var(--show); color: var(--sun); font-variant-numeric: tabular-nums; }

.screen { padding: 28px 20px 0; }

/* title */
.wordmark { margin: 0 0 12px; font: 700 52px/0.95 var(--show); color: var(--sun); text-shadow: 3px 3px 0 var(--ink); }
.lede { margin: 0 0 28px; font-size: 19px; line-height: 1.4; max-width: 34em; }

.trips { margin: 0 0 28px; padding: 0; border: 0; }
.trips legend { padding: 0; margin-bottom: 12px; font-weight: 600; font-size: 18px; }
.trip { display: grid; grid-template-columns: 20px 64px 1fr; align-items: center; gap: 4px 12px; padding: 8px 0; }
.trip input { width: 20px; height: 20px; margin: 0; accent-color: var(--sun); }
.trip img { width: 64px; height: 40px; border-radius: 4px; }
.trip label { font-weight: 500; font-size: 18px; }
.trip .lock { grid-column: 3; font-size: 15px; color: var(--mist); }
.trip.locked img { opacity: 0.45; }
.trip.locked label { color: var(--mist); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border-radius: 8px; border: 1px solid transparent; font: 600 17px/1 var(--read); cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease; }
.btn.primary { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--sun-deep); }
.btn.primary:hover { background: var(--sun-lift); }
.btn.quiet { background: transparent; color: var(--foam); border-color: var(--mist); }
.btn.quiet:hover { background: var(--bay-lift); }
.btn.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }

.how { margin: 28px 0 0; }
.how summary { cursor: pointer; font-weight: 500; color: var(--mist); }
.how ul { margin: 12px 0 0; padding-left: 20px; }
.how li { margin-bottom: 8px; }
.credit { margin: 36px 0 0; font-size: 15px; color: var(--mist); }

/* play */
.q-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.q-count { margin: 0; font-weight: 500; color: var(--mist); font-size: 15px; }
.squares { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.squares li { font-size: 18px; line-height: 1; opacity: 1; }
.squares li:not([data-b]) { opacity: 0.4; }
.squares li.now { opacity: 1; }

.q-text { margin: 0 0 22px; font-weight: 600; font-size: 25px; line-height: 1.22; }
.q-text:focus { outline: none; }
.answer label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 15px; color: var(--mist); }
.answer-row { display: flex; gap: 8px; }
.answer input { flex: 1; min-width: 0; min-height: 52px; padding: 0 14px; border-radius: 8px; border: 2px solid var(--ink); background: var(--foam); color: var(--ink); font: 500 19px/1 var(--read); }

.clock { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.clock-track { flex: 1; height: 10px; border-radius: 5px; background: var(--bay-deep); overflow: hidden; }
.clock-fill { height: 100%; width: 100%; background: var(--sun); }
.clock.low .clock-fill { background: var(--coral); }
.clock-num { margin: 0; min-width: 2ch; text-align: right; font: 700 24px/1 var(--show); color: var(--sun); font-variant-numeric: tabular-nums; }
.clock.low .clock-num { color: var(--coral); }

.note { min-height: 1.45em; margin: 12px 0 0; color: var(--mist); }
.note.bad { color: var(--coral); }
.note.good { color: var(--leaf); }

.result { margin-top: 4px; }
.result p { margin: 0; }
.result-name { font-weight: 600; font-size: 22px; }
.result-pts { margin-top: 6px !important; font: 700 56px/1 var(--show); color: var(--sun); text-shadow: 3px 3px 0 var(--ink); font-variant-numeric: tabular-nums; }
.result-split { margin-top: 10px !important; font-weight: 500; }
.result-split .speed { color: var(--leaf); }
.result .btn { margin-top: 24px; }

/* end */
.end-head { margin: 0 0 8px; font: 700 34px/1.05 var(--show); color: var(--sun); text-shadow: 2px 2px 0 var(--ink); }
.end-head:focus { outline: none; }
.end-note { margin: 0 0 6px; color: var(--mist); }
.end-note:empty { display: none; }
.sub { margin: 32px 0 12px; font-weight: 600; font-size: 20px; }

.sheet-hint { margin: -4px 0 10px; color: var(--mist); font-size: 15px; }
.sheet { margin: 0; padding: 0; list-style: none; }
.sheet summary { display: grid; grid-template-columns: 16px 1fr auto 10px; gap: 2px 12px; align-items: baseline; padding: 9px 0; cursor: pointer; list-style: none; border-radius: 4px; }
.sheet summary::-webkit-details-marker { display: none; }
.sheet .sq { font-size: 18px; line-height: 1; align-self: center; }
.sheet .name { font-weight: 600; }
.sheet .name.none { color: var(--mist); font-weight: 400; }
.sheet .pts { font: 700 19px/1 var(--show); color: var(--sun); font-variant-numeric: tabular-nums; text-align: right; }
.sheet .caret { width: 7px; height: 7px; align-self: center; border-right: 2px solid var(--mist); border-bottom: 2px solid var(--mist); transform: translateY(-2px) rotate(45deg); }
.sheet details[open] .caret { transform: translateY(2px) rotate(-135deg); }
.sheet .split { grid-column: 2 / 4; font-size: 14px; color: var(--mist); }
.sheet .more { padding: 2px 22px 16px 28px; }
.a-q { margin: 0 0 10px; font-weight: 500; }
.a-head { margin: 0 0 6px; color: var(--mist); font-size: 15px; }
.all { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 24px; font-size: 15px; }
.all li { display: flex; justify-content: space-between; gap: 8px; break-inside: avoid; padding: 2px 0; }
.all li .pct { color: var(--mist); font-variant-numeric: tabular-nums; }
.all li.mine { color: var(--sun); font-weight: 600; }
.all li.mine .pct { color: var(--sun); }

.totals { margin: 16px 0 20px; padding: 14px 16px; border-radius: 8px; background: var(--bay-deep); }
.totals div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; }
.totals dt { color: var(--mist); }
.totals dd { margin: 0; font: 700 19px/1.2 var(--show); font-variant-numeric: tabular-nums; }
.totals .grand { margin: 8px 0; }
.totals .grand dt { color: var(--foam); font-weight: 600; font-size: 19px; }
.totals .grand dd { font-size: 40px; color: var(--sun); text-shadow: 2px 2px 0 var(--ink); }

.share { margin: 28px 0 8px; }
.share-text { margin: 0 0 12px; padding: 14px 16px; border-radius: 8px; background: var(--bay-deep); font: 400 16px/1.5 var(--read); white-space: pre-wrap; user-select: all; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.share-actions .btn { flex: 1 1 200px; }


dialog { max-width: min(480px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 10px; background: var(--bay-deep); color: var(--foam); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
dialog::backdrop { background: rgba(13, 35, 64, 0.6); }
dialog h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
dialog p { margin: 0 0 16px; }
#moveLink { width: 100%; min-height: 44px; margin-bottom: 12px; padding: 0 12px; border-radius: 8px; border: 2px solid var(--ink); background: var(--foam); color: var(--ink); font: 400 15px/1 var(--read); }

@media (max-width: 380px) {
  .wordmark { font-size: 44px; }
  .result-pts { font-size: 46px; }
  .all { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
