:root {
  --bg: #fbf7ef;
  --surface: #ffffff;
  --surface-2: #f4efe5;
  --ink: #17352f;
  --muted: #6d7e78;
  --line: #ded8cb;
  --accent: #f0a84a;
  --accent-dark: #d98928;
  --green: #2f765f;
  --green-dark: #225847;
  --mint: #dfeee7;
  --danger: #a54b42;
  --shadow: 0 24px 60px rgba(49, 63, 57, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(240, 168, 74, 0.12), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(47, 118, 95, 0.1), transparent 30rem),
    var(--bg);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(240, 168, 74, 0.38);
  outline-offset: 3px;
}

.site-header,
.page-shell,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--green);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.08);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: #465b54;
  font-size: 0.93rem;
  font-weight: 800;
}

.site-nav a:hover { color: var(--green); }

.page-shell { padding: 36px 0 80px; }

.hero {
  margin: 28px 0 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow,
.panel-kicker,
.toolbar-label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  line-height: .95;
  letter-spacing: -.055em;
}

.hero-copy {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}

.primary-button {
  min-height: 52px;
  padding: 0 22px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 0 var(--green-dark);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 0 var(--green-dark);
}

.primary-button:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 3px 0 var(--green-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.secondary-button {
  min-height: 48px;
  padding: 0 20px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  color: var(--green);
  background: transparent;
  border: 1px solid rgba(47,118,95,.25);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 1.2rem;
}

.rules-panel {
  margin-bottom: 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.7);
}

.rules-panel div {
  padding: 14px;
  border-radius: 15px;
  background: var(--surface);
}

.rules-panel strong,
.rules-panel span { display: block; }

.rules-panel span {
  margin-top: 6px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.game-card {
  overflow: hidden;
  border: 1px solid rgba(38, 66, 57, .12);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.game-toolbar {
  min-height: 70px;
  padding: 13px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.game-toolbar > :last-child { justify-self: end; }

.status-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #53665f;
  text-align: center;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(240,168,74,.16);
}

.plinko-wrap {
  padding: 28px 28px 22px;
  background:
    radial-gradient(circle at center top, rgba(255,255,255,.9), rgba(255,255,255,0) 44%),
    linear-gradient(180deg, #e9f4ef 0%, #f5f1e7 100%);
  border-bottom: 1px solid var(--line);
}

.plinko-board {
  position: relative;
  width: min(760px, 100%);
  height: 470px;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(47,118,95,.18);
  border-radius: 28px;
  background:
    linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,.22)),
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.65), transparent 45%);
  box-shadow: inset 0 12px 35px rgba(47,118,95,.07);
}

.drop-zone {
  position: absolute;
  z-index: 4;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 74px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(47,118,95,.35);
  border-radius: 18px 18px 11px 11px;
}

.drop-label {
  color: var(--green);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.peg-layer,
.bins {
  position: absolute;
  inset: 0;
}

.peg {
  position: absolute;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(47,118,95,.42);
  box-shadow: 0 2px 3px rgba(28,64,52,.12);
}

.ball {
  position: absolute;
  z-index: 6;
  top: 33px;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 999px;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(73,56,25,.24);
  opacity: 0;
  pointer-events: none;
}

.ball.is-ready { opacity: 1; }

.bins {
  top: auto;
  bottom: 0;
  height: 84px;
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  align-items: stretch;
  border-top: 2px solid rgba(47,118,95,.16);
}

.bin {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  border-right: 1px solid rgba(47,118,95,.16);
  background: rgba(255,255,255,.55);
  transition: background .18s ease, transform .18s ease;
}

.bin:last-child { border-right: 0; }

.bin-letter {
  width: clamp(30px, 5vw, 46px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(23,53,47,.12);
  box-shadow: 0 4px 0 rgba(23,53,47,.08);
  font-size: clamp(.88rem, 2.1vw, 1.25rem);
  font-weight: 900;
}

.bin:nth-child(1) .bin-letter,
.bin:nth-child(13) .bin-letter,
.bin:nth-child(2) .bin-letter,
.bin:nth-child(12) .bin-letter {
  background: #fff5df;
}

.bin:nth-child(6) .bin-letter,
.bin:nth-child(7) .bin-letter,
.bin:nth-child(8) .bin-letter {
  background: #e8e5f4;
}

.bin.is-hit {
  background: rgba(240,168,74,.27);
  transform: translateY(-3px);
}

.drop-controls {
  width: min(760px, 100%);
  margin: 20px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.drop-controls .primary-button {
  min-width: 210px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.button-counter {
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,.3);
  font-size: .8rem;
}

.drop-controls p {
  max-width: 350px;
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.45;
}

.play-area {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  gap: 22px;
}

.player-panel,
.dealer-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.dealer-panel { background: #f8f6f0; }

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.mini-score {
  min-width: 62px;
  text-align: right;
}

.mini-score span,
.mini-score strong { display: block; }

.mini-score span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-score strong {
  margin-top: 2px;
  font-size: 1.55rem;
  line-height: 1;
}

.rack {
  min-height: 72px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rack-placeholder,
.word-placeholder {
  color: #98a49f;
  font-weight: 700;
}

.tile {
  width: 54px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: var(--ink);
  background: #fff9e9;
  box-shadow:
    inset 0 0 0 1px rgba(111,90,38,.14),
    0 5px 0 #e2d5b6;
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform .14s ease, opacity .14s ease, box-shadow .14s ease;
}

.tile:hover:not(:disabled) { transform: translateY(-2px); }

.tile.is-used {
  opacity: .2;
  transform: scale(.92);
  cursor: default;
}

.tile.is-dealer {
  cursor: default;
  color: transparent;
  background:
    repeating-linear-gradient(45deg, #2f765f 0 8px, #356f60 8px 16px);
  box-shadow: 0 5px 0 #225847;
}

.tile.is-revealed {
  color: var(--ink);
  background: #fff9e9;
  box-shadow:
    inset 0 0 0 1px rgba(111,90,38,.14),
    0 5px 0 #e2d5b6;
}

.word-builder {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.word-builder-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

.word-builder-top label { color: var(--ink); }

.word-display {
  min-height: 72px;
  margin-top: 9px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: #fcfbf8;
}

.word-display .tile {
  width: 47px;
  height: 51px;
  font-size: 1.2rem;
}

.word-message {
  min-height: 22px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.word-message.error { color: var(--danger); }
.word-message.good { color: var(--green); }

.word-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.submit-button { min-width: 145px; }

.dealer-word-card {
  margin-top: 26px;
  padding: 18px;
  border-radius: 17px;
  color: #fff;
  background: var(--ink);
}

.dealer-word-card span,
.dealer-word-card strong,
.dealer-word-card small {
  display: block;
}

.dealer-word-card span,
.dealer-word-card small { color: rgba(255,255,255,.65); }

.dealer-word-card span {
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.dealer-word-card strong {
  margin: 6px 0 3px;
  font-size: 1.6rem;
  letter-spacing: .05em;
}

.dealer-word-card small { line-height: 1.4; }

.result-banner {
  margin: 0 28px 28px;
  padding: 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: #fff1cd;
  border: 1px solid #ecd595;
}

.result-banner.is-loss {
  background: #f7ece7;
  border-color: #e5c6bd;
}

.result-banner.is-tie {
  background: #edf1ef;
  border-color: #cfd8d4;
}

.result-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: var(--accent);
  font-size: 1.5rem;
  font-weight: 900;
}

.result-banner p,
.result-banner h2 { margin: 0; }

#resultEyebrow {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
}

#resultTitle { font-size: 1.55rem; }
#resultCopy { margin-top: 3px; color: var(--muted); }

.learning-note {
  max-width: 760px;
  margin: 72px auto 0;
  text-align: center;
}

.learning-note h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: -.035em;
}

.learning-note > p:last-child {
  margin: 16px auto 0;
  color: var(--muted);
  line-height: 1.75;
}

.site-footer {
  padding: 28px 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-top: 1px solid rgba(23,53,47,.12);
  color: var(--muted);
}

.footer-brand { color: var(--ink); }
.site-footer p { margin: 0; font-size: .9rem; }

@media (max-width: 820px) {
  .site-nav { display: none; }
  .rules-panel { grid-template-columns: 1fr; }
  .play-area { grid-template-columns: 1fr; }
  .plinko-board { height: 430px; }
  .drop-controls { flex-direction: column; text-align: center; }
  .game-toolbar { grid-template-columns: auto 1fr auto; }
  .status-wrap { justify-self: center; }
}

@media (max-width: 560px) {
  .site-header,
  .page-shell,
  .site-footer { width: min(100% - 20px, 1180px); }

  .page-shell { padding-top: 16px; }
  .hero { align-items: start; flex-direction: column; }
  .hero h1 { font-size: 3.5rem; }

  .game-card { border-radius: 22px; }
  .game-toolbar { padding-inline: 14px; }
  .status-wrap strong { font-size: .82rem; }

  .plinko-wrap { padding: 16px 10px 18px; }
  .plinko-board { height: 390px; border-radius: 20px; }
  .peg { width: 9px; height: 9px; }
  .bins { height: 68px; }
  .bin-letter { width: 26px; border-radius: 8px; font-size: .78rem; }

  .play-area { padding: 14px; gap: 14px; }
  .player-panel,
  .dealer-panel { padding: 17px; }

  .rack { gap: 6px; }
  .tile { width: 44px; height: 49px; font-size: 1.1rem; border-radius: 11px; }

  .word-display .tile { width: 41px; height: 45px; }

  .result-banner {
    margin: 0 14px 14px;
    grid-template-columns: auto 1fr;
  }

  .result-banner .primary-button {
    grid-column: 1 / -1;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   WORD DROP — DUAL BALL COLORS
   ========================================================= */

.player-ball {
  background: #f0a84a;
  border-color: #ffffff;
  box-shadow:
    0 4px 10px rgba(120, 76, 20, 0.28),
    0 0 0 3px rgba(240, 168, 74, 0.18);
}

.dealer-ball {
  background: #2f765f;
  border-color: #ffffff;
  box-shadow:
    0 4px 10px rgba(20, 70, 55, 0.3),
    0 0 0 3px rgba(47, 118, 95, 0.18);
}
