:root {
  --ink: #14201c;
  --ink-soft: #3a4a44;
  --paper: #f3efe6;
  --foam: #e8f2ee;
  --sea: #1a5c52;
  --sea-deep: #0d2e2a;
  --copper: #c45c26;
  --copper-bright: #e07a3a;
  --thread: #d4652a;
  --dot: #1f3d38;
  --edge: #2a8f7a;
  --glow: rgba(42, 143, 122, 0.35);
  --shadow: rgba(13, 46, 42, 0.18);
  --font-brand: "Syne", sans-serif;
  --font-body: "Sora", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sea-deep);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 15% 10%, rgba(42, 143, 122, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 20%, rgba(196, 92, 38, 0.16), transparent 50%),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(232, 242, 238, 0.08), transparent 55%),
    linear-gradient(165deg, #0a2421 0%, #123530 42%, #1a3f38 72%, #0f2a26 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: radial-gradient(circle, rgba(243, 239, 230, 0.45) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
}

.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2rem) 0.5rem;
  animation: rise 0.8s ease-out both;
}

.brand {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(2.8rem, 9vw, 5.2rem);
  letter-spacing: -0.04em;
  line-height: 0.92;
  color: var(--paper);
}

.tagline {
  margin: 0.85rem 0 0;
  max-width: 28rem;
  font-weight: 300;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  line-height: 1.55;
  color: rgba(243, 239, 230, 0.72);
}

.stage {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2rem) 3rem;
  display: grid;
  grid-template-columns: 1.4fr 0.85fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
  animation: rise 0.9s 0.12s ease-out both;
}

.board-panel {
  min-width: 0;
}

.board-wrap {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 1.25rem;
  background:
    linear-gradient(145deg, rgba(243, 239, 230, 0.96), rgba(232, 242, 238, 0.92));
  box-shadow:
    0 24px 60px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.thread-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.thread-path {
  stroke: var(--thread);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(212, 101, 42, 0.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: none;
}

.thread-path.drawing {
  animation: draw-thread var(--draw-ms, 1800ms) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes draw-thread {
  to {
    stroke-dashoffset: 0;
  }
}

.grid {
  position: absolute;
  inset: 6%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 0;
  z-index: 1;
}

.dot {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: default;
  display: grid;
  place-items: center;
}

.dot::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0.55;
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    opacity 0.25s ease,
    box-shadow 0.25s ease;
}

.dot.edge {
  cursor: pointer;
}

.dot.edge::before {
  background: var(--edge);
  opacity: 0.95;
  box-shadow: 0 0 0 0 transparent;
}

.dot.edge:hover::before,
.dot.edge:focus-visible::before {
  transform: scale(1.45);
  box-shadow: 0 0 0 6px var(--glow);
  outline: none;
}

.dot.selected::before {
  background: var(--copper);
  opacity: 1;
  transform: scale(1.55);
  box-shadow: 0 0 0 7px rgba(196, 92, 38, 0.28);
}

.dot.path::before {
  background: var(--copper);
  opacity: 0.85;
  transform: scale(1.2);
}

.dot.landing::before {
  background: var(--copper-bright);
  opacity: 1;
  transform: scale(1.7);
  box-shadow: 0 0 0 8px rgba(224, 122, 58, 0.3);
  animation: pulse-land 1.2s ease-in-out infinite;
}

.dot.dim::before {
  opacity: 0.22;
}

.dot:disabled {
  cursor: default;
}

@keyframes pulse-land {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(224, 122, 58, 0.25);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(224, 122, 58, 0.12);
  }
}

.hint {
  margin: 1rem auto 0;
  max-width: 560px;
  text-align: center;
  font-size: 0.88rem;
  color: rgba(243, 239, 230, 0.62);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.35rem;
}

.dial {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: 0.75rem;
  padding: 1.15rem 1.25rem;
  border-radius: 1rem;
  background: rgba(243, 239, 230, 0.08);
  border: 1px solid rgba(243, 239, 230, 0.12);
  backdrop-filter: blur(8px);
}

.dial-label {
  grid-column: 1;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(243, 239, 230, 0.55);
}

.dial-value {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 0.9;
  color: var(--paper);
  min-width: 2ch;
  text-align: right;
}

.dial-cap {
  font-size: 0.85rem;
  color: rgba(243, 239, 230, 0.5);
}

.btn-spin,
.btn-reset {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.35rem;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease,
    color 0.2s ease;
}

.btn-spin {
  background: var(--copper);
  color: #fff8f2;
}

.btn-spin:hover:not(:disabled) {
  background: #d66a2f;
  transform: translateY(-1px);
}

.btn-spin:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-reset {
  background: transparent;
  color: rgba(243, 239, 230, 0.75);
  border: 1px solid rgba(243, 239, 230, 0.22);
}

.btn-reset:hover {
  color: var(--paper);
  border-color: rgba(243, 239, 230, 0.4);
}

.reveal {
  margin-top: 0.35rem;
  padding: 1.35rem 1.3rem 1.45rem;
  border-radius: 1rem;
  background: linear-gradient(160deg, rgba(243, 239, 230, 0.97), rgba(232, 242, 238, 0.94));
  color: var(--ink);
  box-shadow: 0 18px 40px var(--shadow);
  animation: reveal-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal[hidden] {
  display: none;
}

.reveal-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sea);
}

.reveal-city {
  margin: 0.45rem 0 0.15rem;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
}

.reveal-country {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.reveal-blurb {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 820px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .controls {
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
  }

  .brand {
    font-size: clamp(2.4rem, 14vw, 3.6rem);
  }
}
