/* Mela, the app's design: wine background, jewel-tone accents, gold hairlines. */
@font-face { font-family: Unbounded; src: url(/fonts/Unbounded_700Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: Manrope; src: url(/fonts/Manrope_700Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: Manrope; src: url(/fonts/Manrope_800ExtraBold.ttf) format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --bg: #35092A; --surface: #4A1140; --raised: #5A1650; --ink: #FFF1DC; --muted: #E6B8C8; --faint: #B98AA2;
  --gold: #D9A441; --hair: rgba(217,164,65,.45); --marigold: #FFB627; --rani: #E5197E; --peacock: #12A39A;
  --parrot: #7FD34E; --sindoor: #C8102E;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 700 16px/1.4 Manrope, system-ui, -apple-system, sans-serif; min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
h1, h2, .display { font-family: Unbounded, system-ui, sans-serif; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
p { margin: 0; }
.brand { font-family: Unbounded, system-ui, sans-serif; font-size: 15px; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }
.hero { background: var(--rani); border: 1px solid var(--gold); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
label { font-size: 13px; color: var(--muted); }
input[type=text] {
  width: 100%; font: 800 18px Manrope, system-ui, sans-serif; color: var(--ink); background: var(--raised);
  border: 1px solid var(--hair); border-radius: 12px; padding: 14px; outline: none;
}
input[type=text]:focus { border-color: var(--marigold); }
input.code { font-family: Unbounded, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .2em; text-align: center; font-size: 26px; }
button {
  font: 800 16px Manrope, system-ui, sans-serif; border: 0; border-radius: 999px; padding: 15px 20px; cursor: pointer;
  background: var(--marigold); color: var(--bg); width: 100%;
}
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--hair); }
button:disabled { opacity: .45; cursor: default; }
.hidden { display: none !important; }

/* The current call */
.call { display: flex; align-items: center; gap: 16px; }
.ball {
  flex: none; width: 104px; height: 104px; border-radius: 50%; background: var(--rani); border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px;
  font-family: Unbounded, system-ui, sans-serif; font-size: 40px; line-height: 1.05; overflow-wrap: anywhere;
}
.ball.word { font-size: 17px; }
.ball.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.recent { display: flex; flex-wrap: wrap; gap: 6px; }
.recent span { background: var(--raised); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--muted); }

/* Tambola ticket: 3 rows of 9 */
.ticket { display: grid; grid-template-columns: repeat(9, 1fr); border: 2px solid var(--gold); border-radius: 10px; overflow: hidden; background: var(--ink); }
.ticket div {
  aspect-ratio: 1 / 1.15; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e6cfa8; border-bottom: 1px solid #e6cfa8;
  color: var(--bg); font: 800 clamp(15px, 5vw, 24px) Manrope, system-ui, sans-serif; user-select: none;
}
.ticket div:nth-child(9n) { border-right: 0; }
.ticket div:nth-last-child(-n+9) { border-bottom: 0; }
.ticket .blank { background: #f3dfbd; }

/* Bingo card */
.bingo { display: grid; gap: 4px; }
.bingo div {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 3px;
  background: var(--ink); color: var(--bg); border-radius: 8px; font: 800 clamp(10px, 3vw, 14px)/1.15 Manrope, system-ui, sans-serif;
  overflow-wrap: anywhere; hyphens: auto; user-select: none;
}
.bingo .free { background: var(--marigold); font-family: Unbounded, system-ui, sans-serif; }
.letters { display: grid; gap: 4px; text-align: center; font-family: Unbounded, system-ui, sans-serif; color: var(--marigold); font-size: 18px; }

.cell { cursor: pointer; position: relative; }
.cell.marked { background: var(--rani) !important; color: var(--ink) !important; }
.cell.called:not(.marked)::after { content: ''; position: absolute; right: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--peacock); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.switch input { width: 20px; height: 20px; accent-color: var(--peacock); }

.wins li { list-style: none; display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.wins li:last-child { border-bottom: 0; }
.wins ul { margin: 0; padding: 0; }
.wins .prize { color: var(--marigold); }

.banner { border-radius: 14px; padding: 14px; text-align: center; font-size: 15px; }
.banner.ended { background: var(--raised); border: 1px solid var(--gold); }
.banner.warn { background: var(--sindoor); }
.status { font-size: 12px; color: var(--faint); text-align: center; }

/* Claim sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-top: 1px solid var(--gold); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.prizes { display: flex; flex-direction: column; gap: 8px; }
.prizes button { padding: 11px 20px; }
.prizes .hint { font-size: 13px; font-weight: 700; opacity: .75; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--bg); border-radius: 16px; padding: 12px 18px; font-size: 15px; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.toast.good { background: var(--parrot); }
.toast.bad { background: var(--sindoor); color: var(--ink); }
footer { text-align: center; font-size: 12px; color: var(--faint); }
footer a { color: var(--muted); }
