@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow/files/barlow-condensed-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow/files/barlow-condensed-latin-900-italic.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/fonts/dm-sans/files/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --chalk: #fff1c9;
  --muted: #d5dbc0;
  --gold: #ffd564;
  --ink: #392413;
  --body: "DM Sans", "Segoe UI", sans-serif;
  --display: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
  font-family: var(--body);
  color: var(--chalk);
  background: #253e37;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #ffeb96; outline-offset: 3px; }

.stage {
  min-height: 600px;
  height: 100svh;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #47abcc url("assets/island-horizon.webp") center 57% / cover no-repeat;
}
.stage.has-island { overflow: clip; }
#island { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.has-island #island { pointer-events: auto; touch-action: none; }
#foreground-occlusion { display: none; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.has-island #foreground-occlusion { display: block; }
.wave-wash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(165deg, #b5f3df, #47bcb6 52%, #268f9e);
}
.scene-status {
  position: absolute;
  top: 0;
  left: -10000px;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 8vw #24291732;
}
.world-control { z-index: 2; }
.world-interface { display: contents; }
.has-island .world-interface { display: block; position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.has-island .world-interface :is(.world-control, .wheel-hotspot) { pointer-events: auto; }
.has-island[data-tsunami="active"] .world-interface { visibility: hidden; }
.has-island[data-tsunami="restoring"] .world-interface { opacity: var(--tsunami-lettering-opacity, 0); }
.has-island[data-travel] .world-interface { opacity: var(--travel-sign-opacity, 1); }
.has-island .world-control { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.has-island .island-title { width: 246px; height: 115px; }
.spinner-choice { display: none; }
.has-island .spinner-choice {
  display: grid;
  align-content: start;
  padding-top: 6px;
  width: 139px;
  height: 49px;
  text-align: center;
  color: #f7e7bd;
  text-shadow: 1px 1px 1px #26362a;
}
.spinner-choice span { z-index: 1; pointer-events: none; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.spinner-choice select {
  position: absolute;
  top: -8px;
  left: 0;
  appearance: none;
  min-width: 0;
  width: 100%;
  height: calc(100% + 16px);
  padding: 15px 18px 2px 12px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 16px) 62% / 5px 5px no-repeat,
    linear-gradient(135deg, currentColor 50%, transparent 50%) calc(100% - 11px) 62% / 5px 5px no-repeat;
  color: #ffe7a2;
  font: 800 23px/.95 var(--display);
  text-align: center;
  text-transform: uppercase;
  text-shadow: inherit;
  cursor: pointer;
}
.spinner-choice select:disabled { opacity: .65; cursor: default; }
.spinner-choice option { background: #274b43; color: #fff0cb; }
.has-island .spin-station { width: 138px; height: 66px; }
.has-island .chalkboard { width: 320px; height: 380px; }
.has-island .view-button { width: 129px; height: 44px; }
.island-title {
  display: grid;
  align-content: center;
  justify-items: center;
  transform: rotate(-6deg);
  margin: 0;
  font: italic 900 55px/.76 var(--display);
  letter-spacing: .007em;
  text-transform: uppercase;
  color: #fff1b6;
  text-shadow: 1px 2px #5f371b, 2px 4px #452819, 2px 6px #392719a0;
  pointer-events: none;
}
.island-title span + span { color: #ffd25c; }
.wheel-hotspot {
  position: absolute;
  z-index: 3;
  left: var(--wheel-x, 32%);
  top: var(--wheel-y, 49%);
  width: var(--wheel-width, min(35vw, 380px));
  height: var(--wheel-height, auto);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  touch-action: manipulation;
}
.has-island .fallback-wheel { visibility: hidden; }
.fallback-wheel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 9px ridge #c48039;
  border-radius: 50%;
  background: #745033;
  box-shadow: 9px 15px 0 #573a22, 10px 23px 34px #203e2b7d;
}
.fallback-wheel canvas { width: 100%; height: 100%; border-radius: 50%; }
.fallback-hub { position: absolute; width: 16%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 38% 30%, #ffe69b, #e39a2e 64%, #934f28 68%); box-shadow: 0 2px 5px #4c3829; }
.fallback-pointer { position: absolute; left: 45%; top: -8%; width: 10%; height: 13%; background: #ffc83e; clip-path: polygon(0 0, 100% 0, 50% 100%); }

.prop-button {
  display: inline-flex;
  place-content: center;
  align-items: center;
  gap: 4px;
  padding: 0 3px;
  border: 1px solid #d2a86b;
  border-radius: 5px;
  color: #fff0c4;
  background: linear-gradient(#99612f, #6a3d28);
  box-shadow: 0 3px #513120;
  font-weight: 850;
  line-height: 1;
  touch-action: manipulation;
}
.has-island .prop-button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.prop-button:hover:not(:disabled) { color: #fffadc; }
.prop-button:active:not(:disabled) { text-shadow: 0 0 8px #fff1c977; }
.prop-button:disabled { opacity: .62; }
.spin-station {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}
.spin-label {
  color: #382512;
  text-transform: uppercase;
  font: italic 900 25px/1 var(--display);
  letter-spacing: .015em;
  white-space: nowrap;
}
.shortcut { color: #482e1c; margin: 4px 0 0; font-size: 12px; font-weight: 850; line-height: 1; }
.shortcut:empty { display: none; }
.lever-handle {
  position: relative;
  z-index: 4;
  width: clamp(44px, 5.2vw, 68px);
  height: clamp(44px, 5.2vw, 68px);
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.lever-handle:active:not(:disabled) { cursor: grabbing; }
.lever-handle:disabled { cursor: default; }
.fallback-lever {
  position: absolute;
  inset: 0;
  border: 3px solid #964428;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 27%, #ffaf70, #d3562f 58%, #94391f);
  box-shadow: 1px 5px 0 #6a3826;
  transform: translateY(calc(var(--lever-travel, 0) * 22px));
}
.has-island .fallback-lever { visibility: hidden; }
.tsunami-stone { display: none; }
.has-island .tsunami-stone {
  display: grid;
  place-items: center;
  width: 112px;
  height: 46px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #ffdf9a;
  font: 800 23px/1 var(--display);
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 2px 1px #3d3a2b;
}
.tsunami-stone:hover:enabled { color: #fff0c7; }
.travel-banner { display: none; }
.has-island .travel-banner {
  display: block;
  border: 0;
  border-radius: 9px;
  padding: 0;
  background: transparent;
  touch-action: manipulation;
}
.has-island .world-interface .travel-banner[data-offscreen] { pointer-events: none; }
.travel-banner:hover:enabled { box-shadow: inset 0 0 0 1px #fff1c957; }
.travel-clouds {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  background: #e4f2ec;
}
.travel-clouds::before, .travel-clouds::after {
  content: "";
  position: absolute;
  inset: -35%;
  background:
    radial-gradient(ellipse at 15% 49%, #fff9e9 2%, transparent 34%),
    radial-gradient(ellipse at 45% 16%, #fff 6%, transparent 37%),
    radial-gradient(ellipse at 79% 49%, #a8d0e1 3%, transparent 42%),
    radial-gradient(ellipse at 42% 76%, #fff 2%, transparent 39%);
  transform: translateY(var(--cloud-drift, 0%)) scale(var(--cloud-scale, 1));
}
.travel-clouds::after { rotate: 169deg; filter: blur(16px); opacity: .57; }
.travel-map {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}
.travel-map-heading {
  position: absolute;
  inset: clamp(20px, 4vw, 48px) clamp(20px, 4vw, 64px) auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.travel-map h2 {
  margin: 0;
  color: #fff1cb;
  font: 800 clamp(1.65rem, 4.3vw, 3.7rem)/.9 var(--display);
  text-transform: uppercase;
  text-shadow: 0 3px #0a1f31;
}
.travel-map button { pointer-events: auto; color: #fff1cb; }
#leave-travel {
  border: 1px solid #90b1bc;
  border-radius: 6px;
  padding: 8px 13px;
  min-height: 44px;
  background: #12283a;
  font: 800 1rem/1 var(--display);
  text-transform: uppercase;
}
.travel-zone {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  white-space: nowrap;
}
.zone-beacon {
  width: 16px;
  height: 16px;
  border: 2px solid #fff1b0;
  border-radius: 50%;
  background: #ffb34a;
  box-shadow: 0 0 0 4px #172f45, 0 0 14px 5px #ffce7d77;
}
.zone-name {
  padding: 7px 13px;
  border: 1px solid #edba72;
  border-radius: 5px;
  background: #12283a;
  box-shadow: 0 2px #081825;
  font: 800 clamp(1.03rem, 2vw, 1.4rem)/1 var(--display);
  text-transform: uppercase;
}
#leave-travel:hover, .travel-zone:hover .zone-name { background-color: #29485a; }
.view-button { display: none; font: 800 20px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }

.chalkboard { position: relative; color: var(--chalk); }
.chalk-heading {
  position: absolute;
  inset: 14px 15px auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chalk-heading h2, .chalk-history h2 {
  margin: 0;
  font: 800 31px/.94 var(--display);
  text-transform: uppercase;
  letter-spacing: .045em;
  text-shadow: 0 1px 1px #13231c;
}
.chalk-heading label { cursor: text; }
.count { flex: none; color: #ffdf8d; font-weight: 850; font-size: 13px; white-space: nowrap; }
.chalk-help, .bias-status, .local-status { position: absolute; left: 16px; right: 16px; margin: 0; }
.chalk-help { top: 51px; font-size: 13px; color: #dce3cd; }
#names {
  position: absolute;
  top: 73px;
  left: 16px;
  width: calc(100% - 32px);
  height: 155px;
  resize: none;
  overflow: auto;
  padding: 0 7px 0 3px;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(180deg, transparent 0 18px, #e7e7cc30 18px 19px);
  color: var(--chalk);
  font: 750 16px/19px var(--body);
  caret-color: var(--gold);
  scrollbar-color: #c6ceb280 transparent;
  scrollbar-width: thin;
}
#names::placeholder { color: #e2e6cf; font-style: italic; }
#names:focus-visible { outline: 1px dashed #ffeb96; outline-offset: 3px; }
.bias-status {
  top: 228px;
  color: #ffe298;
  font-size: 13px;
  font-weight: 750;
  line-height: 16px;
  overflow: auto;
  max-height: 18px;
  white-space: nowrap;
}
.chalk-actions {
  position: absolute;
  inset: 249px 15px auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: 34px;
}
.chalk-actions .prop-button { font-size: 13px; text-shadow: 0 1px 2px #241a15; }
.chalk-actions span { color: #ffdf80; font-size: 17px; }
.chalk-history { position: absolute; inset: 293px 16px 22px; overflow: hidden; }
.chalk-history h2 { font-size: 20px; }
.chalk-history h2 span { color: #ffdf80; font: 700 15px/1 var(--body); }
.chalk-history p { margin: 5px 0 0; color: #e1e4cf; font-size: 13px; }
.history-list {
  display: grid;
  grid-auto-rows: min-content;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px 8px;
  max-height: 42px;
  overflow: auto;
  scrollbar-color: #c6ceb280 transparent;
  scrollbar-width: thin;
  list-style: decimal;
  padding: 0 2px 0 17px;
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.36;
}
.history-list li { overflow-wrap: anywhere; }
.local-status { bottom: 4px; color: #dee2c8; font-size: 11px; }

.has-island[data-view="wheel"] :is(.chalkboard, #look-wheel),
.has-island[data-view="board"] :is(.island-title, .spinner-choice, .wheel-hotspot, .spin-station, .lever-handle, .tsunami-stone, #look-board) { visibility: hidden; pointer-events: none; }
.has-island:is([data-view="wheel"], [data-view="board"]) .view-button { display: inline-flex; }
body:has(dialog[open]) .has-island .world-interface {
  filter: brightness(.55);
}
body:has(#share-dialog[open]) .has-island .world-interface {
  clip-path: polygon(evenodd,
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    var(--popup-left) var(--popup-top), var(--popup-right) var(--popup-top),
    var(--popup-right) var(--popup-bottom), var(--popup-left) var(--popup-bottom),
    var(--popup-left) var(--popup-top), 0 0
  );
}
.has-island[data-ticket] .world-interface { clip-path: polygon(evenodd, var(--ticket-cutout)); }

.stage:not(.has-island) {
  height: auto;
  display: grid;
  grid-template-columns: minmax(300px, 1.22fr) minmax(300px, .78fr);
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 22px;
  padding: 32px min(7vw, 105px);
}
.stage:not(.has-island) .island-title { justify-self: start; align-self: start; font-size: clamp(45px, 7vw, 85px); }
.stage:not(.has-island) .spin-station, .stage:not(.has-island) .lever-handle { grid-column: 1; grid-row: 2; }
.stage:not(.has-island) .spin-station { padding: 8px 13px 8px 54px; min-width: 218px; border: 5px solid #9b6838; background: #e9b65b; border-radius: 8px; }
.stage:not(.has-island) .lever-handle { margin-right: 161px; align-self: start; }
.stage:not(.has-island) .chalkboard {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 336px;
  height: 396px;
  border: 8px ridge #b78043;
  border-radius: 6px;
  background: radial-gradient(ellipse at 30% 24%, #34594a, #263e35);
  box-shadow: 0 10px 18px #2236275e;
}

dialog {
  border: 7px ridge #d7a062;
  border-radius: 10px;
  padding: 21px;
  color: var(--chalk);
  background: repeating-linear-gradient(0deg, #fff2c805 0 1px, transparent 1px 7px), radial-gradient(ellipse at 25% 0%, #5e4c2f, #392d20);
  width: min(450px, calc(100% - 28px));
  box-shadow: 0 9px 0 #523322, 0 22px 62px #262218a8;
}
dialog::backdrop { background: #152c2596; backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 .7rem; font: 800 2.1rem/1 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.field-label { display: block; margin: .95rem 0 .35rem; font-weight: 800; }
dialog input, dialog select {
  display: block;
  width: 100%;
  background: #273c32;
  border: 1px solid #b5ad7d;
  border-radius: 4px;
  padding: .6rem .66rem;
  color: var(--chalk);
}
dialog select { appearance: none; padding-right: 29px; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-help, #share-feedback { font-size: .875rem; color: #e9d9b3; line-height: 1.45; margin: .45rem 0 0; }
#share-feedback:empty { margin: 0; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .7rem; margin-top: 1.15rem; }
.dialog-actions button { padding: .58rem .75rem; min-height: 39px; border: 1px solid #c19254; border-radius: 5px; font-size: .875rem; font-weight: 850; box-shadow: 0 3px #4a2b1b; }
.secondary-button { background: linear-gradient(#8f5e36, #6f452e); color: var(--chalk); }
.primary-button { background: linear-gradient(#ffdf71, #e6a534); color: var(--ink); }
.dialog-actions button:hover { filter: brightness(1.13); }
.winner-card { position: relative; text-align: center; }
.winner-card .dialog-actions { justify-content: center; }
.winner-card h2 { font-size: 1.65rem; }
.winner-emblem { color: var(--gold); font-size: 2.8rem; line-height: 1; margin-bottom: .55rem; text-shadow: 0 3px #8e5b2d; }
#winner-name { margin: 0; font: 800 clamp(2.2rem, 8vw, 3.55rem)/1.06 var(--display); color: var(--gold); overflow-wrap: anywhere; }
#confetti { position: fixed; z-index: 3; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.has-island ~ dialog {
  position: fixed;
  inset: 0 auto auto 0;
  max-width: none;
  max-height: none;
  margin: 0;
  transform-origin: 0 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.has-island ~ dialog::backdrop { background: transparent; backdrop-filter: none; }
.has-island ~ #share-dialog { width: 392px; height: 400px; padding: 20px 24px; }
.has-island ~ #winner-dialog { width: 446px; height: 250px; padding: 0; }
.has-island ~ dialog .dialog-actions {
  position: absolute;
  align-items: center;
  margin: 0;
  gap: 10px;
}
.has-island ~ #share-dialog .dialog-actions { right: 24px; bottom: 24px; }
.has-island ~ dialog .dialog-actions button { height: 40px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; }
.has-island ~ dialog .dialog-actions .primary-button { color: #241a11; }
.has-island ~ dialog .dialog-actions .secondary-button { text-shadow: 0 1px 2px #241a15; }
.has-island ~ #share-dialog #close-share { width: 82px; }
.has-island ~ #share-dialog #copy-link { width: 108px; }
.has-island ~ #winner-dialog .winner-card { position: static; }
.has-island ~ #winner-dialog :is(.winner-emblem, #winner-title, #winner-name) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.has-island ~ #winner-dialog .dialog-actions { inset: auto 0 2px; gap: 14px; }
.has-island ~ #winner-dialog .dialog-actions button { min-height: 0; height: 42px; }
.has-island ~ #winner-dialog #remove-winner { width: 148px; }
.has-island ~ #winner-dialog #done { width: 104px; }

@media (max-width: 889px) {
  .stage { min-height: 540px; }
  .stage:not(.has-island) {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 25px 11px;
  }
  .stage:not(.has-island) .wheel-hotspot { position: relative; inset: auto; width: min(64vw, 312px); transform: none; }
  .stage:not(.has-island) .lever-handle { align-self: center; margin: -61px 161px 4px 0; }
  .stage:not(.has-island) .chalkboard { width: min(336px, 100%); flex: 0 0 396px; }
}
