:root {
  --paper: #f6f0e6;
  --ink: #1b302b;
  --green: #234d43;
  --green-dark: #173a32;
  --coral: #e76f51;
  --gold: #d9a441;
  --line: rgba(27, 48, 43, 0.16);
  --white: #fffdf8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  z-index: 10;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  color: var(--paper);
  background: var(--green);
  border-radius: 50% 50% 45% 55%;
  font-family: "Playfair Display", serif;
  font-size: 13px;
}

.setup-screen { padding: 34px clamp(24px, 6vw, 88px) 50px; }
.setup-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(390px, 560px);
  gap: clamp(50px, 8vw, 130px);
  align-items: center;
  max-width: 1370px;
  min-height: calc(100vh - 90px);
  margin: 0 auto;
}

.hero-copy { position: relative; padding-bottom: 70px; }
.eyebrow { margin: 0 0 16px; color: #64756f; font-size: 11px; font-weight: 700; letter-spacing: 0.18em; }
h1, h2 { font-family: "Playfair Display", serif; }
h1 { margin: 0; font-size: clamp(58px, 7vw, 104px); line-height: 0.94; letter-spacing: -0.055em; }
h1 em { color: var(--coral); font-weight: 700; }
.intro { max-width: 470px; margin: 34px 0 0; color: #63726e; font-size: 17px; line-height: 1.65; }

.hero-balls { position: absolute; right: 5%; bottom: 0; display: flex; align-items: flex-end; }
.hero-balls span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-left: -10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.25), 0 12px 25px rgba(29,44,40,.14);
  font-family: "Playfair Display", serif;
  font-size: 25px;
  font-weight: 800;
  transform: rotate(-8deg);
}
.hero-balls span:nth-child(2) { width: 92px; height: 92px; color: white; background: var(--green); transform: translateY(18px) rotate(6deg); }
.hero-balls span:nth-child(3) { background: var(--coral); transform: rotate(12deg); }

.setup-card { padding: clamp(28px, 4vw, 52px); background: var(--white); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(38, 48, 43, 0.08); }
.step-label { display: flex; align-items: center; gap: 10px; color: #6e7c78; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.step-label span { display: grid; place-items: center; width: 27px; height: 27px; color: white; background: var(--coral); border-radius: 50%; letter-spacing: 0; }
.setup-card h2 { margin: 24px 0 8px; font-size: 37px; letter-spacing: -.025em; }
.muted { margin: 0 0 34px; color: #73807c; line-height: 1.55; }
fieldset { padding: 0; margin: 0 0 30px; border: 0; }
legend { margin-bottom: 13px; font-size: 13px; font-weight: 700; }
.language-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.language-option { position: relative; display: flex; align-items: center; min-height: 75px; padding: 14px; border: 1px solid var(--line); cursor: pointer; transition: .2s ease; }
.language-option:hover, .language-option.selected { border-color: var(--green); background: rgba(35,77,67,.035); }
.language-option input { position: absolute; opacity: 0; }
.language-option span { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.language-option b { font-size: 14px; }
.language-option small { color: #7a8582; font-size: 11px; }
.language-option i { width: 16px; height: 16px; border: 1px solid #a1aaa7; border-radius: 50%; }
.language-option.selected i { border: 5px solid var(--green); }
.prize-entry { display: flex; }
.prize-entry input { flex: 1; min-width: 0; padding: 14px 16px; color: var(--ink); background: transparent; border: 1px solid var(--line); outline: none; }
.prize-entry input:focus { border-color: var(--green); }
.add-button { width: 48px; color: white; background: var(--green); border: 0; font-size: 24px; }
.prize-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.prize-chip { padding: 7px 10px; color: var(--green); background: #e5ece6; border: 0; border-radius: 30px; font-size: 11px; font-weight: 700; }
.prize-chip span { margin-left: 7px; color: #788581; }
.field-hint { display: block; margin-top: 8px; color: #87918e; font-size: 10px; }
.primary-button, .next-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 17px 20px; color: white; background: var(--coral); border: 0; font-weight: 700; transition: transform .2s, background .2s; }
.primary-button:hover, .next-button:hover { background: #d86144; transform: translateY(-2px); }
.primary-button span { font-size: 22px; }

.game-screen { background: var(--paper); }
.game-header { display: flex; align-items: center; justify-content: space-between; height: 82px; padding: 0 clamp(22px, 4vw, 60px); border-bottom: 1px solid var(--line); }
.game-actions { display: flex; gap: 9px; }
.icon-button, .outline-button { padding: 10px 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.game-layout { display: grid; grid-template-columns: minmax(300px, 37%) 1fr; min-height: calc(100vh - 82px); }
.draw-panel { padding: clamp(30px, 5vh, 58px) clamp(28px, 5vw, 75px); color: white; background: var(--green-dark); text-align: center; }
.draw-panel .eyebrow { color: #a9bdb7; }
.current-ball { display: grid; place-items: center; width: clamp(170px, 18vw, 230px); height: clamp(170px, 18vw, 230px); margin: 25px auto 20px; color: var(--ink); background: var(--gold); border: 8px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(255,255,255,.25), 0 18px 50px rgba(0,0,0,.25); font-family: "Playfair Display", serif; font-size: clamp(66px, 8vw, 108px); font-weight: 800; }
.current-ball.empty { color: #81948f; background: #dfe4de; }
.current-ball.pop { animation: ball-pop .65s cubic-bezier(.2,.9,.3,1.3); }
@keyframes ball-pop { 0% { opacity: 0; transform: scale(.2) rotate(-20deg); } 70% { transform: scale(1.08) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.call-caption { min-height: 27px; margin-bottom: 28px; font-family: "Playfair Display", serif; font-size: 20px; font-style: italic; }
.draw-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; max-width: 390px; margin: 0 auto; }
.next-button { min-width: 0; margin: 0; }
.next-button b { font-size: 18px; }
.number-draw-button { color: white; background: transparent; border: 1px solid rgba(255,255,255,.35); }
.number-draw-button:hover { background: rgba(255,255,255,.08); }
.next-button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.draw-status { min-height: 16px; margin: 10px 0 0; color: #a9bdb7; font-size: 10px; }
.remaining-count { color: #a9bdb7; font-size: 11px; }
.draw-divider { height: 1px; margin: 35px 0 25px; background: rgba(255,255,255,.12); }
.prizes-panel { text-align: left; }
.prizes-panel ul { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; margin: 0; list-style: none; }
.prizes-panel li { padding: 9px 11px; border: 1px solid rgba(255,255,255,.12); font-size: 12px; }
.prizes-panel li::before { content: "◆"; margin-right: 8px; color: var(--gold); font-size: 8px; }
.prize-claim-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.prize-claim-controls select { min-width: 0; padding: 11px; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); outline: none; }
.prize-called-button, .accept-prize-button, .reject-prize-button { padding: 11px 14px; border: 0; font-size: 11px; font-weight: 700; }
.prize-called-button, .accept-prize-button { color: var(--ink); background: var(--gold); }
.prize-called-button:disabled { cursor: not-allowed; opacity: .45; }
.prize-review { margin-top: 16px; padding: 16px; background: var(--paper); color: var(--ink); text-align: left; animation: review-in .25s ease; }
.prize-review small { display: block; margin-bottom: 6px; color: #70807b; font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.prize-review strong { font-family: "Playfair Display", serif; font-size: 20px; }
.prize-review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.reject-prize-button { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.all-prizes-awarded { margin: 16px 0 0; padding: 12px; color: var(--gold); border: 1px solid rgba(217,164,65,.4); font-size: 12px; text-align: center; }
@keyframes review-in { from { opacity: 0; transform: translateY(-8px); } }

.board-panel { padding: clamp(28px, 5vw, 70px); }
.board-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 25px; }
.board-heading h2 { margin: 0; font-size: clamp(28px, 3vw, 42px); }
.legend { color: #697873; font-size: 11px; }
.legend span { display: inline-block; width: 10px; height: 10px; margin-right: 5px; background: var(--coral); border-radius: 50%; }
.number-board { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.number-cell { display: grid; place-items: center; aspect-ratio: 1; color: #71807b; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: "Playfair Display", serif; font-size: clamp(14px, 1.5vw, 22px); font-weight: 700; transition: .25s ease; }
.number-cell.called { color: white; background: var(--coral); box-shadow: inset 0 0 0 3px var(--paper); }
.number-cell.latest { position: relative; z-index: 1; animation: cell-pulse .7s ease; }
@keyframes cell-pulse { 50% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(231,111,81,.2); } }

@media (max-width: 900px) {
  .setup-layout { grid-template-columns: 1fr; gap: 30px; padding-top: 70px; }
  .hero-copy { padding-bottom: 100px; }
  .game-layout { grid-template-columns: 1fr; }
  .draw-panel { min-height: auto; }
  .number-board { grid-template-columns: repeat(10, 1fr); }
}

@media (max-width: 560px) {
  .setup-screen { padding: 22px 16px 30px; }
  .setup-layout { padding-top: 55px; }
  .setup-card { padding: 25px 20px; }
  .language-options { grid-template-columns: 1fr; }
  .hero-balls { right: 0; }
  .game-header { padding: 0 15px; }
  .game-header .brand > span:last-child { display: none; }
  .game-layout { display: block; }
  .draw-panel { padding: 30px 20px; }
  .board-panel { padding: 28px 14px; }
  .number-board { grid-template-columns: repeat(10, 1fr); }
  .number-cell { font-size: 14px; }
}
