:root {
  --bg: #F3EEE3;
  --card: #ffffff;
  --ink: #2B211B;
  --muted: #65564A;
  --accent: #2F3E70;
  --accent-ink: #2F3E70;
  --accent-gradient: linear-gradient(135deg, #2F3E70 0%, #A3302B 100%);
  --accent-glow: rgba(47, 62, 112, 0.26);
  --line: #E0D6C4;
  --wash: #E7E6EE;
  --sand: #F3EBDD;
  --sand2: #E6DCB8;
  --pool-top: #1B5E55;
  --pool-bot: #144942;
  --stone-top: #FFFFFF;
  --stone-bot: #D8D0E5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1813;
    --card: #2B221B;
    --ink: #F1E8D6;
    --muted: #C9B9A0;
    --accent: #D6A54A;
    --accent-ink: #E3B867;
    --accent-glow: rgba(214, 165, 74, 0.22);
    --line: #3E3128;
    --wash: #2A211A;
    --sand: #362D24;
    --sand2: #2B231B;
    --pool-top: #123C36;
    --pool-bot: #0C2824;
    --stone-top: #362D47;
    --stone-bot: #231C30;
  }
}
* { box-sizing: border-box; }
img {
  max-width: 100%;
  height: auto;
}
body {
  margin: 0;
  padding: 48px 16px 80px;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 960px; margin: 0 auto; }
.hero { text-align: center; margin-bottom: 40px; }
.icon {
  width: 112px; height: 112px; margin: 0 auto 14px; display: block;
  border-radius: 22.5%;
  filter: drop-shadow(0 12px 24px rgba(28, 110, 140, 0.25));
}
h1 { font-size: 34px; margin: 0 0 6px; letter-spacing: -0.4px; }
.tagline { color: var(--muted); margin: 0; font-size: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 28px;
  margin-bottom: 20px;
}
h2 { font-size: 22px; margin: 0 0 12px; letter-spacing: -0.3px; }
h3 { font-size: 17px; margin: 22px 0 6px; }
p, li { color: var(--ink); }
p.note, li.note { color: var(--muted); }
ul, ol { padding-left: 22px; }
li { margin: 6px 0; }
a { color: var(--accent); }
code { font-size: 0.92em; }
nav.links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
nav.links a {
  text-decoration: none; font-weight: 500;
  border: 1px solid var(--line); background: var(--card);
  padding: 9px 16px; border-radius: 999px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
nav.links a:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
footer { text-align: center; color: var(--muted); font-size: 14px; margin-top: 36px; }
footer a { color: var(--muted); }

.hero-pill {
  display: inline-block; margin-bottom: 18px; padding: 6px 14px; border-radius: 999px;
  background: var(--wash); color: var(--accent); font-size: 14px; font-weight: 600;
}
.feature-list li strong { color: var(--ink); }

/* Hero: the app icon over showcase */
.app-icon { width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 10px 28px rgba(47, 62, 112, 0.26); margin: 6px auto 14px; display: block; }

/* Product captures & feature image */
.counters {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 16px 0 28px;
  flex-wrap: wrap;
}
.counters figure {
  margin: 0;
  width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s;
}
.counters figure:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 15%, transparent);
}
.counters figure.feature {
  width: 100%;
  max-width: 780px;
  padding: 10px;
  border-radius: 22px;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 16%, transparent);
}
.counters img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: #1C2A20;
}
.counters figure.feature img {
  aspect-ratio: 1024 / 500;
  width: 100%;
  height: auto;
}
.counters figure:not(.feature) img {
  aspect-ratio: 252 / 288;
  width: 100%;
  height: auto;
}
.counters figcaption {
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}
@media (max-width: 640px) {
  .counters {
    gap: 10px;
    margin: 12px 0 22px;
  }
  .counters figure {
    width: calc(33.333% - 7px);
    min-width: 96px;
    padding: 6px;
    border-radius: 14px;
  }
  .counters figcaption {
    font-size: 11.5px;
    margin-top: 5px;
    line-height: 1.25;
  }
  .counters figure.feature {
    width: 100%;
    padding: 6px;
  }
}

/* ==========================================================================
   CURLEW INTERACTIVE DEMO STYLES
   ========================================================================== */

.demo-wrapper {
  margin: -100px auto 44px;
  max-width: 860px;
  position: relative;
  z-index: 5;
}
@media (max-width: 640px) {
  .demo-wrapper {
    margin-top: -60px;
  }
}

.curlew-stage {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 26px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 60px rgba(47, 125, 79, 0.14), 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.curlew-stage-header {
  text-align: center;
  margin-bottom: 20px;
}
.curlew-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-ink) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent-ink) 28%, var(--line));
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.curlew-stage-title {
  font-size: clamp(20px, 3.2vw, 26px);
  font-weight: 750;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
  color: var(--ink);
}
.curlew-stage-sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.45;
}

/* Level pills / selector */
.curlew-levels {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.curlew-chip {
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  color: var(--ink);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.curlew-chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.curlew-chip.active {
  background: linear-gradient(135deg, #2F3E70 0%, #A3302B 100%);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(47, 125, 79, 0.35);
}

/* Play Area Container */
.curlew-board {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06), 0 12px 30px rgba(0, 0, 0, 0.08);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* Top: Sand bar with Nest */
.curlew-sandbar {
  height: 98px;
  background: radial-gradient(120% 90% at 50% 0%, var(--sand), var(--sand2));
  border-bottom: 2px solid rgba(46, 156, 140, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 16px;
}
.curlew-sandbar-label {
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: color-mix(in srgb, var(--ink) 45%, transparent);
}
.curlew-nest {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 4px solid transparent;
  background: linear-gradient(var(--sand), var(--sand)) padding-box, linear-gradient(140deg, #2F3E70, #A3302B) border-box;
  box-shadow: inset 0 4px 10px rgba(60, 40, 20, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}
.curlew-nest:hover {
  transform: scale(1.04);
}
.curlew-nest.target-hot {
  transform: scale(1.1);
  box-shadow: inset 0 4px 10px rgba(60,40,20,.18), 0 0 0 5px rgba(46,156,140,.45);
}
.curlew-nest.solved {
  box-shadow: inset 0 4px 10px rgba(60,40,20,.18), 0 0 0 8px rgba(46,156,140,.35), 0 0 28px rgba(46,156,140,.6);
  animation: curlewNestGlow 1.6s ease-in-out infinite alternate;
}
@keyframes curlewNestGlow {
  to {
    box-shadow: inset 0 4px 10px rgba(60,40,20,.18), 0 0 0 10px rgba(46,156,140,.45), 0 0 36px rgba(46,156,140,.75);
  }
}
.curlew-nest-target {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.2s;
}
.curlew-nest.solved .curlew-nest-target {
  display: none;
}
.curlew-nest-check {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #A3302B;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.curlew-nest.solved .curlew-nest-check {
  display: grid;
}

/* Bottom: Tide Pool */
.curlew-pool {
  height: 250px;
  position: relative;
  background: radial-gradient(75% 65% at 50% 20%, rgba(255,255,255,0.22), transparent 75%),
              linear-gradient(180deg, var(--pool-top) 0%, var(--pool-bot) 100%);
  overflow: hidden;
  touch-action: none;
}
.curlew-water-caustics {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background: repeating-radial-gradient(circle at 75% 25%, transparent 0 20px, rgba(255,255,255,0.25) 21px 22px, transparent 23px 44px);
}

/* Stones */
.curlew-stone {
  position: absolute;
  width: 66px;
  height: 62px;
  border-radius: 50% 50% 46% 54% / 56% 50% 50% 44%;
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: 5;
  background: radial-gradient(80% 80% at 35% 30%, var(--stone-top), var(--stone-bot));
  box-shadow: 0 6px 14px rgba(10, 25, 30, 0.32), inset 0 -3px 6px rgba(0,0,0,0.12);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  touch-action: none;
}
.curlew-stone::before {
  content: "";
  position: absolute;
  left: 18%;
  top: 14%;
  width: 32%;
  height: 20%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  filter: blur(1px);
  pointer-events: none;
}
.curlew-stone .curlew-num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: #1C2A20;
  font-variant-numeric: tabular-nums;
  position: relative;
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  .curlew-stone .curlew-num {
    color: #E6EEE6;
  }
}
.curlew-stone.selected {
  box-shadow: 0 0 0 4px #A3302B, 0 10px 24px rgba(46, 156, 140, 0.5);
  transform: translateY(-4px) scale(1.06);
}
.curlew-stone.dragging {
  cursor: grabbing;
  z-index: 20;
  transition: none !important;
  box-shadow: 0 16px 28px rgba(10, 25, 30, 0.45), 0 0 0 3px #A3302B;
  transform: scale(1.12);
}
.curlew-stone.target-over {
  box-shadow: 0 0 0 4px #A3302B, 0 8px 18px rgba(46, 156, 140, 0.6);
  transform: scale(1.08);
}
.curlew-stone.rough {
  background: radial-gradient(3px 3px at 30% 60%, rgba(0,0,0,.18) 60%, transparent 62%),
              radial-gradient(2px 2px at 66% 30%, rgba(0,0,0,.2) 60%, transparent 62%),
              radial-gradient(80% 80% at 35% 30%, #F5F1E9, #D2C8BA);
}
@media (prefers-color-scheme: dark) {
  .curlew-stone.rough {
    background: radial-gradient(3px 3px at 30% 60%, rgba(0,0,0,.35) 60%, transparent 62%),
                radial-gradient(2px 2px at 66% 30%, rgba(0,0,0,.35) 60%, transparent 62%),
                radial-gradient(80% 80% at 35% 30%, #3D3328, #2A231B);
  }
}
.curlew-stone.rough::before {
  display: none;
}
.curlew-stone.rough::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 20%;
  width: 14px;
  height: 12px;
  border-radius: 50%;
  background: var(--pool-top);
  opacity: 0.95;
}
.curlew-nest .curlew-stone {
  position: static;
  transform: scale(0.92) !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  cursor: default;
}
.curlew-nest .curlew-stone.rough::after {
  background: var(--sand);
}

/* Doubler Shell */
.curlew-shell {
  position: absolute;
  width: 64px;
  height: 56px;
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: 4;
  touch-action: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s;
  filter: drop-shadow(0 6px 12px rgba(10, 25, 30, 0.32));
}
.curlew-shell svg {
  width: 100%;
  height: 100%;
}
.curlew-shell .shell-x2 {
  position: absolute;
  left: 0;
  right: 0;
  top: 17px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #6E3452;
  pointer-events: none;
  text-shadow: 0 0 3px #FBE9F0, 0 0 3px #FBE9F0;
}
.curlew-shell.selected {
  filter: drop-shadow(0 0 0 #A3302B) drop-shadow(0 0 8px #A3302B);
  transform: translateY(-4px) scale(1.06);
}
.curlew-shell.target-over {
  filter: drop-shadow(0 0 0 #A3302B) drop-shadow(0 0 10px #A3302B);
  transform: scale(1.1);
}

/* Animations */
.curlew-flip-anim {
  animation: curlewFlip 0.38s ease-in-out;
}
@keyframes curlewFlip {
  0% { transform: scale(1) rotateY(0deg); }
  50% { transform: scale(1.15) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0deg); }
}

.curlew-ripple {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
  animation: curlewRipple 0.65s ease-out forwards;
  z-index: 10;
}
@keyframes curlewRipple {
  to {
    transform: scale(5);
    opacity: 0;
  }
}

.curlew-shake-anim {
  animation: curlewShake 0.4s ease-in-out;
}
@keyframes curlewShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* Celebration banner inside pool */
.curlew-banner {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(28, 24, 38, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease-out;
  pointer-events: none;
  z-index: 25;
}
.curlew-banner.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.curlew-banner.win {
  background: rgba(35, 122, 110, 0.94);
  box-shadow: 0 4px 18px rgba(35, 122, 110, 0.4);
}
.curlew-banner-btn {
  background: #ffffff;
  color: #2F3E70;
  border: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s;
  white-space: nowrap;
}
.curlew-banner-btn:hover {
  transform: scale(1.05);
}

/* Footer / Controls */
.curlew-board-footer {
  padding: 12px 16px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.curlew-hint-bar {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
  min-height: 20px;
}
.curlew-hint-bar strong {
  color: var(--ink);
}
.curlew-actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.curlew-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.curlew-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  transform: translateY(-1px);
}
.curlew-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
