:root {
  --bg: #f2c4bd;
  --cream: #fbf3e4;
  --ink: #3b2a2e;
  --soft: #7a6264;
  --burgundy: #8a2f3c;
  --gold: #b88a2c;
  --line: rgba(59, 42, 46, .55);
  --display: "Jost", Futura, "Avenir Next", sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  font: 16px/1.45 var(--display);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { background: var(--bg); transition: background .8s ease; }
body { margin: 0; min-height: 100vh; padding: 18px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px dashed var(--burgundy); outline-offset: 3px; }

/* the proscenium: a cream double-ruled frame, everything centered */
.frame {
  position: relative; max-width: 1180px; min-height: calc(100vh - 36px); margin: 0 auto;
  padding: 26px 40px 30px; background: var(--cream);
  border: 1px solid var(--line); outline: 1px solid var(--line); outline-offset: -8px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  box-shadow: 0 30px 60px -30px rgba(59, 42, 46, .35);
}
.tiny { font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: var(--soft); }

.masthead { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.contents { display: flex; gap: 6px; }
.contents button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  font-size: 11px; letter-spacing: .05em; font-weight: 600; transition: background .2s, transform .15s;
}
.contents button.done { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.contents button.on { background: var(--ink); color: var(--cream); }
.contents button:hover { transform: translateY(-2px); }

.titlecard { margin-top: 18px; }
.titlecard .num { margin: 0; font-size: 13px; letter-spacing: .45em; text-transform: uppercase; color: var(--burgundy); font-weight: 600; }
.titlecard h1 {
  margin: 6px 0 0; font-size: clamp(30px, 4.4vw, 52px); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; line-height: 1.05;
}
.subtitle { margin: 8px 0 0; font-family: var(--type); font-style: italic; color: var(--soft); }
.titlecard.enter > * { animation: slate .9s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes slate { from { opacity: 0; letter-spacing: .6em; } }

/* the mast: finial, pole and flag, centered as a group */
.stage { width: 100%; display: flex; justify-content: center; padding: 22px 0 24px; }
.mast { position: relative; display: flex; align-items: flex-start; padding-left: 12px; margin-right: 12px; }
.pole {
  position: absolute; left: 0; top: -8px; bottom: -16px; width: 9px; border-radius: 4px;
  background: linear-gradient(90deg, #8c6a3c, #e3c27b 45%, #7c5a2e);
}
.finial {
  position: absolute; left: -5px; top: -24px; width: 19px; height: 19px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fbe7a6, #c9962f 60%, #8c6a3c);
}
#flag {
  display: block; height: calc(min(34vh, 300px) * (0.55 + 0.45 * var(--hoist, 1)));
  width: auto; transform-origin: left center; animation: flutter 5s ease-in-out infinite;
  filter: drop-shadow(0 14px 14px rgba(59, 42, 46, .18));
}
@keyframes flutter {
  0%, 100% { transform: perspective(900px) rotateY(0deg) skewY(0deg); }
  50% { transform: perspective(900px) rotateY(-9deg) skewY(-1.2deg); }
}

.body { width: 100%; max-width: 980px; margin-top: 26px; }
.body.enter { animation: dolly .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes dolly { from { opacity: 0; transform: translateX(40px); } }

/* option cards, each with a live miniature of the flag */
.cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.card {
  width: 128px; padding: 12px 10px 10px; background: #fffaf0; border: 1px solid var(--line); border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s, background .2s;
}
.card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 10px 18px -10px rgba(59, 42, 46, .45); }
.card:nth-child(even):hover { transform: translateY(-4px) rotate(1deg); }
.card:active { transform: scale(.97); }
.card.on { background: var(--bg); box-shadow: inset 0 0 0 2px var(--ink); }
.card b { font-weight: 600; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.thumb { height: 62px; display: flex; align-items: center; justify-content: center; }
.thumb svg { height: 100%; width: auto; max-width: 104px; }
.mystery {
  width: 62px; height: 62px; border: 1px dashed var(--line); border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; font-weight: 300; color: var(--soft);
}

/* the narrator: a typewritten caption, like subtitles */
.narrator {
  min-height: 3em; max-width: 640px; margin: 22px auto 6px; font-family: var(--type); font-style: italic;
  font-size: 16px; color: var(--ink);
}

/* colors: paint chips with names, one row per part of the flag */
.palette { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.slot { width: 150px; text-align: right; padding-right: 10px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); }
.chip {
  width: 60px; padding: 4px 4px 3px; background: #fff; border: 1px solid rgba(59, 42, 46, .25);
  display: flex; flex-direction: column; gap: 3px; transition: transform .15s;
}
.chip i { display: block; height: 26px; }
.chip small { font-size: 8.5px; line-height: 1.15; min-height: 2.3em; letter-spacing: .08em; text-transform: uppercase; display: grid; place-items: center; }
.chip:hover { transform: translateY(-2px); }
.chip.on { box-shadow: 0 0 0 2px var(--ink); transform: translateY(-3px); }

/* tickets: the buttons */
.ticket {
  position: relative; border: 1px solid var(--ink); background: var(--cream); padding: 10px 22px;
  font-size: 12px; font-weight: 600; letter-spacing: .25em; text-transform: uppercase;
  transition: background .2s, color .2s, transform .15s;
  box-shadow: inset 0 0 0 3px var(--cream), inset 0 0 0 4px var(--ink);
}
.ticket:hover:not(:disabled) { background: var(--ink); color: var(--cream); box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px var(--cream); }
.ticket:active:not(:disabled) { transform: scale(.97); }
.ticket:disabled { opacity: .45; cursor: not-allowed; }
.ticket.small { padding: 8px 18px; font-size: 11px; }
.ticket.big { padding: 14px 28px; background: var(--burgundy); color: var(--cream); border-color: var(--burgundy); box-shadow: inset 0 0 0 3px var(--burgundy), inset 0 0 0 4px var(--cream); }
.ticket.big:hover:not(:disabled) { background: var(--ink); }

.nav { margin-top: auto; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding-top: 20px; }
#prev { justify-self: start; }
#next { justify-self: end; }
#prev[hidden], #next[hidden] { display: block !important; visibility: hidden; }
.pricetag { font-family: var(--type); font-size: 15px; color: var(--soft); font-variant-numeric: tabular-nums; }

.pill {
  border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 5px 12px;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
}
.pill.on { background: var(--ink); color: var(--cream); }
.artbar, .initials { margin-top: 18px; display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.artbar .colors { display: flex; gap: 6px; }

.clubname { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.clubname span, .initials span { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
.clubname input, .initials input {
  width: min(460px, 90%); border: 0; border-bottom: 1px solid var(--ink); background: transparent; text-align: center;
  font: 500 26px var(--display); letter-spacing: .08em; padding: 6px 4px; color: var(--ink);
}
.initials input { width: 120px; text-transform: uppercase; letter-spacing: .3em; }
.clubname input::placeholder { color: rgba(59, 42, 46, .3); }
.clubname input:focus, .initials input:focus { outline: none; border-bottom-width: 2px; }

/* the inspector's memos */
.memo {
  max-width: 560px; margin: 16px auto 0; padding: 10px 16px; font-family: var(--type); font-size: 14px; text-align: left;
  background: #fffdf6; border-left: 3px solid var(--gold);
}
.memo span { display: block; font-family: var(--display); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); margin-bottom: 2px; }
.memo.bad { border-left-color: #b23a3a; }
.memo.ok { border-left-color: #4f7a5a; }
.memo a { color: var(--burgundy); }

/* the certificate */
.certificate {
  position: relative; max-width: 620px; margin: 0 auto; padding: 30px 40px 26px; background: #fffaf0;
  border: 1px solid var(--gold); outline: 1px solid var(--gold); outline-offset: -7px;
}
.certificate h2 { margin: 8px 0; font-size: clamp(26px, 3.6vw, 40px); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--burgundy); }
.ledger { list-style: none; padding: 0; margin: 20px auto 6px; max-width: 420px; font-family: var(--type); font-size: 14px; text-align: left; }
.ledger li { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px dotted rgba(59, 42, 46, .35); }
.ledger span { width: 90px; flex: none; font-family: var(--display); font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--soft); padding-top: 3px; }
.stamp {
  position: absolute; right: -34px; top: -34px; width: 112px; height: 112px; border-radius: 50%; background: rgba(255, 250, 240, .85);
  display: grid; place-content: center; transform: rotate(-14deg);
  font-weight: 700; font-size: 15px; letter-spacing: .2em; text-transform: uppercase; line-height: 1.1;
  border: 3px double currentColor; opacity: .82; animation: thump .5s .3s cubic-bezier(.3, 1.6, .5, 1) both;
}
.stamp small { font-size: 8px; letter-spacing: .25em; font-weight: 600; }
.stamp.approved { color: #3f6f4c; }
.stamp.returned { color: #b23a3a; }
@keyframes thump { from { opacity: 0; transform: rotate(-14deg) scale(2.2); } }
.commission { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; text-align: left; }
.commission strong { display: block; font-size: 34px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.commission .tiny { display: block; letter-spacing: .2em; }
.exports { margin: 18px 0 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.exports a { color: var(--soft); }

@media (max-width: 720px) {
  body { padding: 8px; }
  .frame { padding: 18px 16px 20px; }
  .card { width: 104px; }
  .slot { width: 100%; text-align: center; padding: 0; }
  .chip { width: 52px; }
  .stamp { position: static; margin: 12px auto 0; }
  .certificate { padding: 24px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }
.masthead a { color: inherit; text-decoration: none; }
.sealink { border-bottom: 1px dotted var(--soft); }
.sealink:hover { color: var(--burgundy); }

/* join mode */
.card.locked { opacity: .35; cursor: not-allowed; filter: grayscale(.6); }
.card.locked:hover { transform: none; box-shadow: none; }
.joining { font-family: var(--type); font-size: 18px; }
.joining a, .memo a, .ocean a { color: var(--burgundy); }

/* claiming */
.claim { margin: 26px auto 4px; padding: 18px 0 4px; border-top: 1px dotted var(--gold); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.claim label { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.claim label span { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
.claim input {
  width: min(340px, 100%); border: 0; border-bottom: 1px solid var(--ink); background: transparent; text-align: center;
  font: 500 20px var(--display); letter-spacing: .06em; padding: 4px; color: var(--ink);
}
.claim input:focus { outline: none; border-bottom-width: 2px; }
.claim input::placeholder { color: rgba(59, 42, 46, .28); }
.claim .memo { margin: 0; }
.claim.done p { font-family: var(--type); margin: 0 0 4px; }
.claim.done { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.claim.done p { width: 100%; }
.claim a.ticket { text-decoration: none; display: inline-block; }
.fine { margin: 0; font-family: var(--type); font-size: 12px; color: var(--soft); }
.stamp.registered { color: #2f5d8a; }
.pricetag a.ticket { text-decoration: none; color: var(--ink); font-family: var(--display); }

/* the sea: one harbor per club, boats bobbing */
body.at-sea .frame { max-width: 1320px; }
.ocean {
  position: relative; border-radius: 6px; padding: 30px 24px 40px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='24'%3E%3Cpath d='M0 12 Q15 4 30 12 T60 12 T90 12 T120 12' fill='none' stroke='%23ffffff' stroke-opacity='.35' stroke-width='1.5'/%3E%3C/svg%3E") 0 0 / 120px 24px,
    linear-gradient(#bcd8ea, #7fb0d2);
  display: flex; flex-wrap: wrap; gap: 36px 48px; justify-content: center; align-content: center; min-height: 340px;
  animation: swell 14s linear infinite;
}
@keyframes swell { to { background-position: 120px 0, 0 0; } }
.ocean.calm { min-height: 240px; place-content: center; font-family: var(--type); font-size: 18px; }
.harbor { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.buoy {
  font-size: 11px; font-weight: 600; letter-spacing: .25em; text-transform: uppercase; text-decoration: none; color: var(--ink);
  background: var(--cream); padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px;
}
.buoy:hover { background: var(--ink); color: var(--cream); }
.fleet { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; justify-content: center; max-width: 420px; }
.boat {
  display: flex; flex-direction: column; align-items: center; text-decoration: none;
  animation: bob 3.2s ease-in-out infinite; animation-delay: calc(var(--d) * -1);
}
.boat .rig { display: block; height: 60px; padding-left: 4px; border-left: 2px solid #6b4b2a; }
.boat .rig svg { height: 44px; width: auto; display: block; }
.boat .hull { width: 78px; margin-top: -2px; fill: var(--cream); stroke: var(--ink); stroke-width: 1; }
.boat:hover .hull { fill: var(--bg); }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(calc(var(--r) * -2deg)); }
  50% { transform: translateY(5px) rotate(calc(var(--r) * 2deg)); }
}

/* a club's roster */
.roster { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.member {
  width: 150px; padding: 12px 10px; background: #fffaf0; border: 1px solid var(--line); border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.member .thumb svg { max-width: 120px; }
.member b { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.member i { font-family: var(--type); font-size: 12px; color: var(--soft); }
.member small { font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: var(--burgundy); }
.joinbar { margin-top: 24px; }

/* ---------- the open sea ---------- */
body.at-sea .frame { max-width: 1400px; }
.seaview {
  position: relative; width: 100%; height: min(66vh, 640px); overflow: hidden; overflow: clip; border-radius: 6px; outline: none;
  border: 1px solid var(--line); background: #8fbad6;
}
.world {
  position: absolute; left: 0; top: 0; will-change: transform;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='40'%3E%3Cpath d='M0 20 Q20 10 40 20 T80 20 T120 20 T160 20' fill='none' stroke='%23ffffff' stroke-opacity='.35' stroke-width='1.6'/%3E%3C/svg%3E") 0 0 / 160px 40px,
    radial-gradient(ellipse at 50% 50%, #c4dcec, #8fbad6 70%, #78a7c9);
}
.lighthouse {
  position: absolute; width: 40px; height: 90px;
  background:
    linear-gradient(#c8242b 0 18%, #fbf3e4 18% 36%, #c8242b 36% 54%, #fbf3e4 54% 72%, #c8242b 72% 100%);
  clip-path: polygon(30% 0, 70% 0, 90% 100%, 10% 100%);
}
.islet { position: absolute; width: 140px; height: 34px; border-radius: 50%; background: radial-gradient(ellipse at 50% 30%, #f1e2bd, #d9c08a); box-shadow: 0 0 0 6px rgba(255, 255, 255, .35); }
.harborname { position: absolute; transform: translateX(-50%); white-space: nowrap; z-index: 1; opacity: .9; }
.calmnote { position: absolute; width: 320px; text-align: center; font-family: var(--type); font-size: 18px; }
.seaboat {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 100%;
}
.seaboat .bob { display: block; animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.seaboat .vessel { display: block; overflow: visible; filter: drop-shadow(0 6px 4px rgba(30, 50, 70, .25)); }
.seaboat:hover .vessel, .seaboat:focus-visible .vessel { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 6px rgba(255, 255, 255, .9)); }
.seaboat.underway .bob::after {
  content: ""; position: absolute; right: -30px; bottom: 4px; width: 60px; height: 6px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, .85), transparent 70%);
}
.youtag {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font-size: 9px; letter-spacing: .3em;
  text-transform: uppercase; font-weight: 700; color: var(--cream); background: var(--burgundy); padding: 2px 8px; border-radius: 99px;
}
.seaboat[style*="scaleX(-1)"] .youtag { transform: translateX(-50%) scaleX(-1); }
.hud { position: absolute; z-index: 9000; }
.hud.tl {
  left: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: rgba(251, 243, 228, .92); border: 1px solid var(--line); padding: 10px 14px; border-radius: 4px;
}
.hud.tl b { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
.hud.tl i { font-family: var(--type); font-size: 12px; color: var(--soft); margin-bottom: 4px; }
.hud.tl .pill { text-decoration: none; color: var(--ink); }
.hud.br { right: 12px; bottom: 10px; background: rgba(251, 243, 228, .85); padding: 4px 10px; border-radius: 99px; }
.dpad { display: none; }
@media (pointer: coarse) {
  .hud.br { display: none; }
  .dpad {
    position: absolute; right: 14px; bottom: 14px; z-index: 9000; display: grid;
    grid-template: "a u b" 44px "l d r" 44px / 44px 44px 44px; gap: 4px;
  }
  .dpad button { border: 1px solid var(--ink); background: rgba(251, 243, 228, .92); font-size: 18px; border-radius: 6px; touch-action: none; }
  .dpad [data-dir=up] { grid-area: u; } .dpad [data-dir=left] { grid-area: l; } .dpad [data-dir=down] { grid-area: d; } .dpad [data-dir=right] { grid-area: r; }
}

/* the captain's card */
.boatcard {
  position: absolute; z-index: 9500; right: 14px; top: 14px; width: min(320px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow: auto;
  background: #fffaf0; border: 1px solid var(--gold); outline: 1px solid var(--gold); outline-offset: -6px;
  padding: 22px 20px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  box-shadow: 0 20px 40px -20px rgba(30, 40, 60, .5); animation: dolly .35s cubic-bezier(.2, .7, .2, 1) both;
}
.boatcard .x { position: absolute; right: 8px; top: 4px; border: 0; background: none; font-size: 22px; color: var(--soft); }
.boatcard .cardflag svg { height: 90px; width: auto; }
.boatcard h3 { margin: 0; font-size: 20px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.boatcard .tiny a { color: var(--burgundy); }
.vesselname { margin: 0; font-family: var(--type); font-size: 13px; }
.vesselname span { display: block; font-family: var(--display); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
.boatcard label { display: flex; flex-direction: column; width: 100%; gap: 2px; }
.boatcard label span { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
.boatcard input { border: 0; border-bottom: 1px solid var(--ink); background: transparent; text-align: center; font: 500 17px var(--display); padding: 4px; }
.boatcard input:focus { outline: none; border-bottom-width: 2px; }
.boatcard .memo { margin: 0; }

.vtypes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.vtype {
  width: 96px; padding: 8px 4px 6px; border: 1px solid var(--line); background: #fff; border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.vtype svg { width: 84px; height: 46px; }
.vtype b { font-size: 9px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
.vtype.on { background: var(--bg); box-shadow: inset 0 0 0 2px var(--ink); }
.keylink { max-width: 100%; word-break: break-all; }
.keylink a { color: var(--burgundy); }
.member .pill { margin-top: 6px; }

.waypoint {
  position: absolute; width: 26px; height: 10px; margin: -5px 0 0 -13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9); opacity: 0; pointer-events: none; z-index: 2;
}
.waypoint.enter { animation: ripple 1.1s ease-out; }
@keyframes ripple { from { opacity: 1; transform: scale(.4); } to { opacity: 0; transform: scale(2.4); } }
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.seaview { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html, body { overflow-x: hidden; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  body { padding: 0; }
  .frame { min-height: 100svh; padding: 14px 12px 0; outline-offset: -5px; border: 0; box-shadow: none; }
  .masthead .tiny { font-size: 9.5px; letter-spacing: .2em; line-height: 1.8; }
  .contents { gap: 4px; }
  .contents button { width: 30px; height: 30px; font-size: 10px; }
  .titlecard { margin-top: 12px; }
  .titlecard .num { font-size: 11px; letter-spacing: .35em; }
  .titlecard h1 { font-size: 24px; letter-spacing: .04em; }
  .subtitle { font-size: 13px; }
  .stage { padding: 14px 0 18px; }
  .mast { margin-right: 0; }
  #flag { width: min(calc(100vw - 130px), 290px); height: auto; }
  .body { margin-top: 14px; }

  /* options swipe sideways instead of stacking */
  .cards, .chiprow, .vtypes {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -12px; padding: 6px 12px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .cards::-webkit-scrollbar, .chiprow::-webkit-scrollbar, .vtypes::-webkit-scrollbar { display: none; }
  .card, .chip, .vtype { flex: none; scroll-snap-align: center; }
  .card { width: 112px; }
  .card:hover { transform: none; box-shadow: none; }
  .palette { gap: 4px; align-items: stretch; }
  .row { flex-direction: column; align-items: stretch; gap: 0; }
  .slot { width: auto; text-align: left; padding: 0; }
  .chip { width: 58px; }
  .chip small { font-size: 8px; }

  .narrator { font-size: 14px; margin: 14px auto 4px; min-height: 2.6em; }
  .memo { font-size: 13px; }

  /* the next/previous tickets stay under your thumb */
  .nav {
    position: sticky; bottom: 0; z-index: 9800; margin: 10px -12px 0; width: calc(100% + 24px);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(251, 243, 228, .96);
    border-top: 1px solid var(--line); backdrop-filter: blur(6px);
  }
  .ticket { padding: 11px 14px; font-size: 11px; letter-spacing: .18em; }
  .ticket.big { padding: 13px 18px; }

  .certificate { padding: 22px 14px; }
  .certificate h2 { font-size: 24px; }
  .ledger span { width: 70px; }
  .claim input, .clubname input { font-size: 18px; }
  .clubname input { width: 100%; }

  /* the sea fills the screen; the boat card becomes a bottom sheet */
  body.at-sea .titlecard h1 { font-size: 22px; }
  body.at-sea .titlecard { margin-top: 6px; }
  .seaview { height: calc(100svh - 250px); min-height: 340px; margin: 0 -12px; width: calc(100% + 24px); border-radius: 0; border-left: 0; border-right: 0; }
  .hud.tl { padding: 6px 10px; }
  .hud.tl b { font-size: 12px; }
  .boatcard {
    left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 78%;
    animation: sheet .3s cubic-bezier(.2, .7, .2, 1) both;
  }
  .boatcard .cardflag svg { height: 70px; }
  .roster { gap: 10px; }
  .member { width: calc(50% - 5px); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
@media (max-width: 720px) and (pointer: coarse) {
  .dpad { bottom: 10px; right: 10px; grid-template: "a u b" 40px "l d r" 40px / 40px 40px 40px; opacity: .85; }
}

/* ---------- visiting a boat ---------- */
.titlecard .subtitle a, .unsaid + a { color: var(--burgundy); }
.unsaid { color: var(--soft); font-style: italic; }
.boatactions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 22px 0 6px; }
.boatactions a.ticket { text-decoration: none; color: var(--ink); }
.quietbuy { margin: 26px 0 0; font-family: var(--type); font-size: 13px; color: var(--soft); }
.quietbuy a { color: var(--burgundy); }
.cardmotto { margin: 0; font-family: var(--type); font-style: italic; }
.boatcard a.ticket { text-decoration: none; color: var(--cream); }

/* cutaway: the ship sliced open, Life Aquatic style */
.cutaway { max-width: 760px; margin: 0 auto; position: relative; }
.deckline { border-bottom: 3px solid var(--ink); padding-bottom: 6px; text-align: left; }
.rooms {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 3px solid var(--ink); border-top: 0;
  clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%); background: var(--ink);
}
.room { padding: 20px 26px 24px; text-align: left; min-height: 150px; margin: 0 1.5px 3px; }
.room h4, .postcard h4, .manifest h4, .logbook h4, .gazette h4 {
  margin: 0 0 8px; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; font-weight: 600; color: var(--burgundy);
}
.room p { margin: 0; font-family: var(--type); font-size: 15px; line-height: 1.5; }
.room .motto { font-size: 19px; font-style: italic; }
.r1 { background: #f3dccb; } .r2 { background: #bcdcc8; } .r3 { background: #f2c4bd; } .r4 { background: #ecc860; }
.r3, .r4 { padding-bottom: 40px; }
.portline small, .manifest small { display: block; font-family: var(--display); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--soft); margin-top: 4px; }
.portholes { position: absolute; left: 12%; right: 12%; bottom: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.portholes i { width: 14px; height: 14px; border-radius: 50%; background: #cfe3ee; border: 2px solid var(--ink); }

/* postcard */
.postcard {
  max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; background: #fffaf0; text-align: left;
  border: 1px solid var(--line); box-shadow: 0 18px 30px -18px rgba(59, 42, 46, .45); transform: rotate(-1deg);
}
.pc-front {
  padding: 34px 28px; background: linear-gradient(160deg, #b9d3e3, #f2c4bd); display: flex; flex-direction: column; justify-content: center;
}
.pc-front h4 { font-size: 34px; letter-spacing: .04em; color: var(--ink); text-transform: uppercase; margin: 4px 0 10px; line-height: 1.05; }
.pc-front .motto { font-family: var(--type); font-style: italic; font-size: 16px; margin: 0; }
.pc-back { position: relative; padding: 26px 24px; border-left: 1px dashed var(--line); font-family: var(--type); font-size: 14px; }
.pc-back p { margin: 0 0 12px; }
.pc-back .tiny { display: block; letter-spacing: .25em; }
.pc-stamp { float: right; margin: 0 0 8px 10px; padding: 6px; background: #fff; outline: 2px dashed #d9cdb5; outline-offset: -3px; }
.pc-stamp svg { height: 46px; width: auto; display: block; }
.sig { font-style: italic; }
.postmark {
  position: absolute; right: 70px; top: 18px; width: 92px; height: 92px; border-radius: 50%; border: 2px solid rgba(124, 42, 54, .5);
  color: rgba(124, 42, 54, .7); font-family: var(--display); font-size: 9px; letter-spacing: .15em; text-transform: uppercase;
  display: grid; place-content: center; text-align: center; transform: rotate(-12deg); pointer-events: none;
}

/* manifest */
.manifest {
  max-width: 640px; margin: 0 auto; padding: 28px 34px; background: #fffdf3; border: 1px solid var(--line);
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(59, 42, 46, .08) 27px 28px); text-align: left;
}
.manifest h4 { font-size: 16px; text-align: center; color: var(--ink); }
.manifest > .tiny { text-align: center; }
.manifest ul { list-style: none; padding: 0; margin: 18px 0; font-family: var(--type); font-size: 14px; }
.manifest li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px dotted rgba(59, 42, 46, .35); }
.manifest li > span { font-family: var(--display); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); padding-top: 3px; }
.manifest a { color: var(--burgundy); }
.seaworthy {
  display: inline-block; margin: 0; padding: 6px 12px; border: 2px solid #3f6f4c; color: #3f6f4c; transform: rotate(-3deg);
  font-size: 11px; letter-spacing: .25em; text-transform: uppercase; font-weight: 700;
}

/* logbook */
.logbook { max-width: 640px; margin: 30px auto 0; text-align: left; }
.logbook h4 { text-align: center; }
#sign-form textarea, #sign-form input, .boateditor input, .boateditor textarea {
  width: 100%; border: 1px solid var(--line); background: #fffdf6; font: 16px/1.4 var(--type); padding: 10px 12px; color: var(--ink); border-radius: 2px;
}
#sign-form textarea:focus, #sign-form input:focus, .boateditor input:focus, .boateditor textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.signrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; }
.signrow input { flex: 1; }
.entries { list-style: none; padding: 0; margin: 18px 0 0; }
.entries li { padding: 12px 0; border-bottom: 1px dotted rgba(59, 42, 46, .35); }
.entries p { margin: 0 0 4px; font-family: var(--type); font-size: 15px; }
.entries span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--soft); }
.entries a { color: var(--burgundy); }
.entries .empty { font-family: var(--type); font-style: italic; color: var(--soft); text-align: center; }
.strike { border: 0; background: none; color: var(--soft); text-decoration: underline; font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }

/* editor */
.boateditor { max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.boateditor > .tiny { text-align: center; }
.boateditor label { display: flex; flex-direction: column; gap: 4px; }
.boateditor label > span { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--soft); }
.boateditor label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; }
.boateditor label.check input { width: auto; }
.portedit { padding: 14px; border: 1px dashed var(--line); }
.portedit #port-now { margin: 4px 0 8px; font-family: var(--type); font-size: 17px; }
.portedit .row2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.portedit .row2 input { flex: 1; min-width: 140px; }
.layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.layoutpick { border: 1px solid var(--line); background: #fff; padding: 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; border-radius: 4px; }
.layoutpick.on { background: var(--bg); box-shadow: inset 0 0 0 2px var(--ink); }
.layoutpick i { width: 70px; height: 44px; display: block; border: 1px solid var(--ink); }
.lp-cutaway { background: linear-gradient(90deg, #f3dccb 50%, #bcdcc8 50%) top / 100% 50% no-repeat, linear-gradient(90deg, #f2c4bd 50%, #ecc860 50%) bottom / 100% 50% no-repeat; clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%); }
.lp-postcard { background: linear-gradient(160deg, #b9d3e3, #f2c4bd) left / 50% 100% no-repeat, #fffaf0; }
.lp-manifest { background: repeating-linear-gradient(#fffdf3 0 7px, #d9cdb5 7px 8px); }
.layoutpick b { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
.layoutpick small { font-family: var(--type); font-size: 11px; color: var(--soft); }

/* the gazette under the sea */
.gazette { max-width: 760px; margin: 26px auto 0; text-align: left; border-top: 3px double var(--ink); padding-top: 12px; }
.gazette h4 { text-align: center; font-size: 13px; }
.gazette ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 30px; }
.gazette li { break-inside: avoid; padding: 8px 0; border-bottom: 1px dotted rgba(59, 42, 46, .3); }
.gazette p { margin: 0; font-family: var(--type); font-size: 14px; }
.gazette span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--soft); }
.gazette a { color: var(--burgundy); }
.member { text-decoration: none; color: var(--ink); }
.member q { font-family: var(--type); font-size: 11px; font-style: italic; }

@media (max-width: 720px) {
  .rooms { grid-template-columns: 1fr; clip-path: polygon(0 0, 100% 0, 94% 100%, 6% 100%); }
  .room { min-height: 0; padding: 16px 22px 18px; }
  .r4 { padding-bottom: 44px; }
  .postcard { grid-template-columns: 1fr; transform: none; }
  .pc-back { border-left: 0; border-top: 1px dashed var(--line); }
  .pc-front h4 { font-size: 26px; }
  .postmark { right: auto; left: 46%; top: 12px; width: 76px; height: 76px; }
  .manifest { padding: 20px 16px; }
  .manifest li { grid-template-columns: 1fr; gap: 2px; }
  .gazette ul { columns: 1; }
  .layouts { grid-template-columns: 1fr; }
  .layoutpick { flex-direction: row; text-align: left; }
  .signrow { flex-direction: column; align-items: stretch; }
}

/* Clear words, a toy sea, and postcards worth sending. */
:root { --type: "Jost", "Avenir Next", sans-serif; --soft: #675055; }
.subtitle, .narrator { font-style: normal; font-size: 17px; line-height: 1.55; }
.tiny { font-size: 12px; letter-spacing: .1em; }
.titlecard h1 { text-transform: none; letter-spacing: -.025em; line-height: 1.12; }
.titlecard.enter > *, .body.enter { animation: none; }
.card b, .vtype b { text-transform: none; font-size: 14px; letter-spacing: .015em; }
.fine { font-size: 14px; line-height: 1.5; }
.room p, .entries p, .pc-back, .manifest ul { font-size: 17px; line-height: 1.6; }
.ticket, .pill { min-height: 44px; }
[hidden] { display: none !important; }
.sea-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.sea-tools .pill { background: #fbf3e4; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.sea-place { position: absolute; transform: translate(-50%, -50%); width: 156px; border: 0; background: transparent; display: grid; justify-items: center; gap: 6px; z-index: 3000; }
.sea-place > span { font-size: 64px; filter: drop-shadow(0 8px 0 #ffffff55); }
.sea-place b { font-size: 13px; font-weight: 500; background: #fbf3e4ee; border-radius: 20px; padding: 5px 10px; }
.holiday-island { width: 230px; padding: 16px; border-radius: 50%; background: #ead49d; box-shadow: 0 0 0 10px #ffffff44, 0 0 0 23px #ffffff22; }
.holiday-island span { font-size: 90px; }
.party-time .holiday-island::after { content: '🎈 🎉 🎈'; position: absolute; top: -50px; font-size: 40px; animation: bob 1s infinite; }
.sea-dialog { color: var(--ink); background: var(--cream); border: 2px solid #b88a2c; padding: 32px; width: min(500px, calc(100% - 24px)); max-height: 90svh; overflow: auto; text-align: center; border-radius: 12px; box-shadow: 0 20px 90px #243f5555; }
.sea-dialog::backdrop { background: #263f5866; backdrop-filter: blur(3px); }
.sea-dialog h2 { font-size: 28px; font-weight: 500; margin: 5px 0 12px; line-height: 1.2; }
.sea-dialog p { font-size: 17px; line-height: 1.55; }
.sea-dialog p.fine { font-size: 14px; }
.dialog-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 26px; }
.encounter-icon { font-size: 80px; }
.destination-list { display: grid; gap: 10px; }
.destination-list .pill { white-space: normal; }
.sea-dialog input { width: 100%; padding: 12px; font: inherit; margin-bottom: 12px; }
.share-options, .share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0; }
.share-options .on { background: #b9d8e6; }
#share-preview img { display: block; max-width: 100%; max-height: 40svh; margin: auto; box-shadow: 0 4px 14px #263f5822; }
@media (max-width: 600px) {
 .at-sea .titlecard { margin-top: 12px; }
 .at-sea .titlecard h1 { font-size: 34px; }
 .at-sea .body { margin-top: 16px; }
 .sea-tools { gap: 6px; }
 .sea-tools .pill { font-size: 13px; padding: 6px 10px; }
 .sea-dialog { padding: 30px 20px 20px; }
 .seaview { height: max(420px, 64svh); }
 .hud.tl b { letter-spacing: 0; text-transform: none; font-size: 14px; }
 .dpad { display: grid; position: absolute; right: 12px; bottom: 16px; z-index: 9000; grid-template: 'a u b' 44px 'l d r' 44px / 44px 44px 44px; gap: 4px; }
 .dpad button { border: 1px solid var(--ink); background: #fbf3e4dd; border-radius: 8px; touch-action: none; }
 .dpad [data-dir=up] { grid-area: u; } .dpad [data-dir=left] { grid-area: l; } .dpad [data-dir=down] { grid-area: d; } .dpad [data-dir=right] { grid-area: r; }
 .hud.br { display: none; }
}
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation: none !important; transition: none !important; }
}
.share-options .on { color: var(--ink); }
.deck-decoration { font-size: 24px; margin: 0 0 12px; }
.deck-decoration:empty { display: none; }
.boateditor select { font: inherit; width: 100%; padding: 12px; background: #fffdf6; color: var(--ink); border: 1px solid var(--line); }
.sea-place > span { display: block; width: 140px; height: 108px; }
.sea-place svg { width: 100%; height: 100%; overflow: visible; }
.holiday-island > span { width: 190px; height: 145px; }
.sea-shell { position: absolute; width: 48px; height: 48px; padding: 4px; border: none; background: #ffffff33; border-radius: 50%; transform: translate(-50%, -50%); z-index: 2500; box-shadow: 0 0 0 6px #ffffff12; transition: transform .4s, opacity .4s; }
.sea-shell svg { width: 100%; height: 100%; }
.sea-shell:hover { background: #ffffff77; }
.sea-shell.collected-shell { transform: translate(-50%, -130%) scale(1.5); opacity: 0; pointer-events: none; }
.shell-toast { position: absolute; z-index: 9200; bottom: 120px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); background: #fbf3e4; color: var(--ink); border: 1px solid var(--gold); border-radius: 20px; padding: 10px 16px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.shell-toast.show { opacity: 1; }
.shell-collection { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.shell-collection svg { width: 100%; }
.seaboat.anchored::after { content: '⚓'; position: absolute; left: 50%; top: 100%; font-size: 24px; transform: translateX(-50%); }
#drop-anchor[aria-pressed=true] { background: #dfc47a; color: var(--ink); }
.pirate-signals { font-size: 44px; padding: 18px 0; }
.signal-button { min-width: 56px; min-height: 56px; font-size: 30px; border: 2px solid var(--ink); background: #fff8e4; margin: 4px; }
.cairn-garden { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.cairn-choice { display: grid; background: #e3eadf; border: 2px solid #3c515a; padding: 10px; }
.cairn-choice svg { width: 100%; height: 130px; }
.cairn-choice b { font-size: 15px; }
.cairn-choice span { font-size: 13px; }
.cairn-stack { height: 280px; width: 100%; }
.rock-control { display: grid; gap: 12px; font-size: 15px; }
.rock-control input { padding: 0; accent-color: #556f78; width: 100%; min-height: 44px; }
