/* Archipelago: a living Bay Blue sea, paper-white land, one tile per town */
:root {
  --font: "halyard-text", "Helvetica Neue", Arial, sans-serif;
  --display: "halyard-display", "Helvetica Neue", Arial, sans-serif;
  --sea: #14558f;
  --sea-deep: #0e3f6b;
  --land: #fbfbf9;
  --on-sea: #ffffff;
  --on-sea-2: #d7e4f0;
  --yes-ink: #2a6b44;
  --no-ink: #8e1230;
}
body { background: var(--paper); }
.sea { position: relative; height: 100vh; height: 100svh; min-height: 620px; overflow: hidden; background: var(--sea); color: var(--on-sea); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#water, #land { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#land { cursor: grab; }
.sea.holding #land { cursor: grabbing; }

/* top bar */
.seabar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 420px) auto; gap: 12px 28px; align-items: center; padding: 16px var(--pad); }
.seabar .wm { color: #fff; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.01em; white-space: nowrap; }
.find input { width: 100%; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); background: var(--land); border: 0; border-radius: 999px; padding: 11px 20px; box-shadow: 0 6px 22px rgba(0, 0, 0, .28); }
.find input::placeholder { color: #69737a; }
.find input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.seabar nav { display: flex; gap: 4px 20px; justify-self: end; font-weight: 650; font-size: 15px; }
.seabar nav a { color: var(--on-sea-2); text-decoration: none; border-bottom: 2px solid transparent; padding: 3px 0; }
.seabar nav a:hover { color: #fff; border-bottom-color: #fff; }

.seahead { position: absolute; left: var(--pad); top: 92px; z-index: 4; max-width: 520px; pointer-events: none; }
.seahead h1 { margin: 0 0 10px; font-family: var(--display); font-weight: 800; font-size: clamp(34px, 3.9vw, 62px); line-height: .98; letter-spacing: -.025em; color: #fff; text-wrap: balance; }
.seahead p { margin: 0; font-size: clamp(15px, 1.15vw, 17.5px); line-height: 1.45; color: var(--on-sea-2); max-width: 44ch; }
.seahead p strong { color: #fff; }
.sea.mapped .seahead h1 { opacity: .0; transform: translateY(-8px); }
.seahead h1 { transition: opacity .4s var(--ease), transform .5s var(--ease); }

/* question bar: nine tabs along the bottom */
.qbar { position: absolute; left: var(--pad); right: var(--pad); bottom: 22px; z-index: 5; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.qbar button { border: 0; border-radius: 14px; background: rgba(255, 255, 255, .12); color: #fff; padding: 9px 10px 10px; text-align: left; cursor: pointer; display: grid; gap: 2px; transition: background .25s, transform .25s var(--ease); min-width: 0; }
.qbar button:hover { background: rgba(255, 255, 255, .22); }
.qbar button .n { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1; display: flex; align-items: center; gap: 8px; }
.qbar button .n i { width: 9px; height: 9px; border-radius: 50%; }
.qbar button .n i.yes { background: #7fd39b; } .qbar button .n i.no { background: #ff8a9c; }
.qbar button .s { font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--on-sea-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbar button[aria-selected="true"] { background: var(--land); color: var(--ink); transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
.qbar button[aria-selected="true"] .s { color: var(--ink-2); }

.qnow { position: absolute; left: var(--pad); bottom: 102px; z-index: 4; max-width: 560px; pointer-events: none; }
.qnow .t { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 2vw, 30px); line-height: 1.08; letter-spacing: -.015em; color: #fff; margin: 0 0 6px; text-wrap: balance; }
.qnow .r { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0; font-size: 15px; color: var(--on-sea-2); }
.qnow .big { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 4.4vw, 72px); line-height: .9; letter-spacing: -.03em; color: #fff; }
.qnow .pill { font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--land); }
.qnow .pill.yes { color: var(--yes-ink); } .qnow .pill.no { color: var(--no-ink); }

.seatools { position: absolute; right: var(--pad); bottom: 104px; z-index: 5; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.hold { border: 0; border-radius: 999px; background: var(--land); color: var(--ink); font-weight: 800; font-size: 15px; padding: 12px 20px; cursor: pointer; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); transition: transform .2s var(--ease), background .2s; touch-action: none; }
.hold:hover { transform: translateY(-2px); }
.hold[aria-pressed="true"] { background: #fff; transform: scale(.96); }
.hold.ghost { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
.hold.ghost:hover { background: rgba(255, 255, 255, .24); }

/* island labels */
.isle-labels, .pins { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.il { position: absolute; transform: translate(-50%, -100%); text-align: center; color: #fff; transition: opacity .35s; white-space: nowrap; }
.sea.mapped .il { opacity: 0; }
.il .ov { display: inline-flex; gap: 3px; padding: 5px 7px; border-radius: 999px; background: rgba(14, 63, 107, .55); }
.il .ov i { width: 11px; height: 7px; border-radius: 50%; border: 1.5px solid #fff; }
.il .ov i.Y { background: #7fd39b; border-color: #7fd39b; } .il .ov i.N { background: #ff8a9c; border-color: #ff8a9c; }
.il .ov i.cur { transform: scale(1.35); }
.il .nm { display: block; font-weight: 700; font-size: 13px; margin-top: 4px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.il .ct { font-weight: 600; font-size: 12px; color: var(--on-sea-2); }

/* pins */
.pin { position: absolute; transform: translate(-50%, -100%); transition: opacity .3s; }
.pin .tag { display: block; background: var(--land); color: var(--ink); font-weight: 800; font-size: 13.5px; padding: 5px 10px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); white-space: nowrap; }
.pin .tag small { font-weight: 600; color: var(--ink-2); margin-left: 4px; }
.pin .stem { display: block; width: 2px; height: 22px; margin: 0 auto; background: var(--land); }
.pin.me .tag { background: var(--ink); color: #fff; } .pin.me .tag small { color: #d6d6d6; } .pin.me .stem { background: var(--ink); }

/* town card */
.tcard { position: absolute; right: var(--pad); top: 84px; z-index: 6; width: 340px; background: var(--land); color: var(--ink); border-radius: 22px; padding: 18px 18px 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .38); }
.tcard h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; letter-spacing: -.02em; }
.tcard .cty { font-size: 13.5px; color: var(--ink-2); margin: 4px 0 0; }
.tcard .x { position: absolute; top: 12px; right: 12px; border: 0; background: var(--paper-2); border-radius: 999px; width: 32px; height: 32px; cursor: pointer; font-size: 18px; line-height: 1; }
.tcard .rose { display: block; width: 100%; height: auto; margin: 6px 0 4px; }
.tcard .rose text { font-family: var(--font); }
.tcard .now { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.tcard .now b { white-space: nowrap; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -.02em; }
.tcard .isle { font-size: 13.5px; color: var(--ink-2); margin: 8px 0 0; }
.tcard .acts { display: flex; gap: 8px; margin-top: 12px; }
.tcard .acts button, .tcard .acts a { border: 0; border-radius: 999px; background: var(--paper-2); color: var(--ink); font-weight: 750; font-size: 13.5px; padding: 8px 14px; cursor: pointer; text-decoration: none; }
.tcard .acts button:hover, .tcard .acts a:hover { background: var(--ink); color: #fff; }

/* the ballot drawer */
.drawer { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(560px, 100vw); overflow: auto; background: var(--paper); box-shadow: 30px 0 80px rgba(0, 0, 0, .35); transform: translateX(-104%); transition: transform .5s var(--ease); }
.drawer:not(.open) { box-shadow: none; visibility: hidden; transition: transform .5s var(--ease), visibility 0s .5s, box-shadow .3s; }
.drawer.open { transform: none; visibility: visible; }
.drawer .ballot { border: 0; }
.drawer .ballot-head { padding-left: 18px; }
.drawer .writein, .drawer .tally { padding-left: 18px; }

/* the sections below stay on paper */
#returns .mini svg path { stroke: #fff; }

@media (max-width: 860px) {
  .seabar { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 16px; }
  .seabar nav { display: none; }
  .seabar .wm { font-size: 18px; }
  .seahead { top: 116px; left: 16px; right: 16px; }
  .seahead h1 { font-size: 30px; }
  .seahead p { font-size: 14.5px; }
  .qbar { left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); grid-template-columns: repeat(9, minmax(52px, 1fr)); overflow-x: auto; background: linear-gradient(transparent, rgba(14, 63, 107, .55)); scrollbar-width: none; }
  .qbar button { padding: 8px; }
  .qbar button .s { display: none; }
  .qnow { left: 16px; right: 16px; bottom: 82px; }
  .qnow .t { font-size: 19px; }
  .qnow .big { font-size: 40px; }
  .hold { font-size: 14px; padding: 10px 16px; }
  .tcard { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; max-height: 72vh; overflow: auto; }
  .il { display: none; }
  .seatools { left: 16px; right: 16px; bottom: 176px; flex-direction: row; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

.part-head h2, .verdict h3, .panel h3, .card h3, .ballot-head h2, .cert h4, .sign .wm, .qnum, .qtabs button .n, .mini .qn, .out, .oval-lbl, .res, thead th, .lab, .tally .big, .writein label {
  font-family: var(--display); font-stretch: normal; letter-spacing: -.01em;
}
.part-head h2 { text-transform: none; font-weight: 800; letter-spacing: -.03em; line-height: .95; }
.sign .wm { text-transform: none; letter-spacing: -.04em; }

/* ---- polish: quieter, more exact ---- */
.find input { border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.hold { border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); font-weight: 700; }
.qbar button { border-radius: 8px; }
.qbar button[aria-selected="true"] { box-shadow: 0 6px 16px rgba(0, 0, 0, .2); }
.qbar button .n i { width: 8px; height: 8px; border-radius: 2px; }
.qbar button .n i.yes { background: #8fd3a6; } .qbar button .n i.no { background: #f09aa8; }
.tcard { border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .26); }
.tcard .x { display: grid; place-items: center; border-radius: 8px; }
.tcard .acts button, .tcard .acts a { border-radius: 8px; }
.qnow .pill { border-radius: 6px; }
.src { margin: 6px 0 0; font-size: 12.5px; color: var(--on-sea-2); }
.tcard .src { color: var(--ink-2); margin-top: 10px; }
.seahead .key { margin: 14px 0 0; display: grid; gap: 7px; pointer-events: auto; }
.seahead .key div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.seahead .key dt, .seahead .key dd { margin: 0; }
.seahead .key dd { font-size: 13.5px; line-height: 1.35; color: var(--on-sea-2); }
.k-hex { display: block; width: 52px; height: 14px; border-radius: 2px; background: linear-gradient(90deg, #680a1d, #d28b8c, #e6e7e3, #8bab95, #173d27); outline: 1.5px solid #fbfbf9; }
.k-strip, .il .ov { display: inline-flex; gap: 2px; }
.k-strip i, .il .ov i { width: 5px; height: 12px; border-radius: 1px; background: #8fd3a6; }
.k-strip i.N, .il .ov i.N { background: #f09aa8; }
.il .ov i.cur { outline: 1.5px solid #fff; outline-offset: 1px; }
.k-hold { display: inline-block; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--land); border-radius: 6px; padding: 2px 8px; }
/* island keys: name first, ballot strip under it, no capsule */
.il { transform: translate(-50%, -100%); }
.il .ov { padding: 0; background: none; margin-top: 4px; }
.il .nm { margin: 0; font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.il .ct { font-weight: 500; color: var(--on-sea-2); font-size: 12.5px; }
.pin .tag { border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, .22); }
@media (max-width: 860px) {
  .il { display: block; }
  .il .ov, .il .ct { display: none; }
  .il .nm { font-size: 11.5px; }
  .seahead .key { display: none; }
}
@media (min-width: 861px) and (max-width: 1200px) {
  .seahead { max-width: 420px; }
  .seahead .key dd { font-size: 12.5px; }
}

/* tooltip, in the world's own language */
.tip { border: 0; border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .22); padding: 10px 12px; font-family: var(--font); }
.tip strong { font-family: var(--display); font-stretch: normal; text-transform: none; font-size: 17px; letter-spacing: -.01em; }

/* the ballot drawer: a sheet of paper, not a specimen ballot */
.drawer { border-radius: 0 16px 16px 0; }
.drawer .ballot, .drawer .ballot-head, .drawer .writein, .drawer .tally, .drawer .qrow { border: 0; }
.drawer .ballot-head { padding: 22px 22px 8px; }
.drawer .ballot-head h2 { font-family: var(--display); text-transform: none; font-stretch: normal; font-weight: 800; font-size: 30px; letter-spacing: -.02em; line-height: 1.05; }
.drawer .clr { border: 0; border-radius: 8px; background: var(--paper-2); font-weight: 700; }
.drawer .writein { background: none; padding: 10px 22px 14px; grid-template-columns: auto 1fr auto; }
.drawer .writein label { font-family: var(--font); text-transform: none; font-stretch: normal; font-weight: 700; font-size: 15px; }
.drawer .writein input { border-bottom: 2px solid var(--ink); font-size: 18px; }
.drawer .qrows { padding: 0 14px; display: grid; gap: 6px; }
.drawer .qrow { grid-template-columns: minmax(0, 1fr) 70px 70px; border-radius: 10px; background: #fff; }
.drawer .qrow .mark { display: none; }
.drawer .qtext { padding: 12px 12px 12px 14px; }
.drawer .qnum { font-family: var(--font); text-transform: none; font-stretch: normal; font-weight: 600; font-size: 13px; color: var(--ink-2); letter-spacing: 0; }
.drawer .qnum .out { font-family: var(--font); text-transform: none; font-stretch: normal; letter-spacing: 0; font-size: 12px; border-radius: 4px; }
.drawer .qtitle { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; }
.drawer .split { height: 5px; border-radius: 3px; overflow: hidden; }
.drawer .oval-cell { border-left: 0; }
.drawer .oval { width: 52px; height: 30px; border-radius: 8px; border: 1.5px solid #c9cdc8; background: var(--paper-2); }
.drawer .oval::after { border-radius: 6px; }
.drawer .oval-cell.yes .oval[aria-pressed="true"]::after { background: var(--yes-fill); }
.drawer .oval-cell.no .oval[aria-pressed="true"]::after { background: var(--no-fill); }
.drawer .oval-lbl { font-family: var(--font); text-transform: none; font-stretch: normal; font-weight: 700; font-size: 13px; }
.drawer .tally { margin: 10px 14px 18px; border-radius: 10px; background: var(--ink); color: #fff; padding: 16px; }
.drawer .tally .big { font-family: var(--display); text-transform: none; font-stretch: normal; font-weight: 800; letter-spacing: -.02em; }
.drawer .tally p { color: #d6d9db; }
.drawer .tally .twin { color: #fff; }
.drawer .tally button { border: 0; border-radius: 8px; background: #fff; color: var(--ink); }
@media (max-width: 860px) {
  .tcard { max-height: 58vh; padding: 14px 14px 12px; display: grid; grid-template-columns: 132px minmax(0, 1fr); column-gap: 12px; align-content: start; }
  .tcard > h2, .tcard > .cty, .tcard > .isle, .tcard > .acts, .tcard > .src { grid-column: 1 / -1; }
  .tcard h2 { font-size: 26px; padding-right: 40px; }
  .tcard .rose { grid-column: 1; grid-row: 3 / span 1; width: 132px; margin: 4px 0 0; }
  .tcard .now { grid-column: 2; grid-row: 3; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
  .tcard .now b { font-size: 28px; }
  .tcard .isle { font-size: 13px; }
}
.qclear { margin-left: 6px; font: inherit; font-weight: 700; color: #fff; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .55); }
.qclear:hover { text-decoration-color: #fff; }
