:root {
  --ink: #16233b;
  --muted: #657089;
  --cream: #fffaf0;
  --paper: #ffffff;
  --primary: #ff4f64;
  --primary-dark: #d93249;
  --gold: #ffbf3f;
  --teal: #0aa7a2;
  --line: #dfe5ef;
  --shadow: 0 18px 45px rgba(31, 43, 69, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 191, 63, .18), transparent 26rem),
    radial-gradient(circle at 90% 15%, rgba(10, 167, 162, .12), transparent 24rem),
    #f3f8fb;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
}

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

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 54px);
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid rgba(218,225,236,.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #ff8a54);
  box-shadow: 0 8px 20px rgba(255,79,100,.25);
}

.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  text-decoration: none;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 750;
}
.nav a:hover, .nav a.active { color: var(--ink); background: #eef3f8; }

.page-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 22px auto 48px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(620px, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(215,223,234,.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.caller-panel {
  padding: 24px;
  position: sticky;
  top: 90px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.caller-panel h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.02;
}

.current-ball {
  width: min(210px, 72%);
  aspect-ratio: 1;
  margin: 28px auto 20px;
  display: grid;
  place-items: center;
  border: 11px solid white;
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.78), transparent 10%),
    linear-gradient(145deg, #ff796c, var(--primary) 48%, #c52344);
  box-shadow: 0 16px 34px rgba(221, 42, 76, .32), inset -12px -14px 24px rgba(123,0,35,.2);
  font-size: clamp(58px, 8vw, 90px);
  font-weight: 950;
  letter-spacing: -.06em;
}

.current-ball.empty {
  color: rgba(255,255,255,.8);
  background: linear-gradient(145deg, #87a0b8, #556d87);
}

.call-next {
  width: 100%;
  border: 0;
  border-radius: 15px;
  padding: 15px 18px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #ff7651);
  box-shadow: 0 10px 24px rgba(255,79,100,.28);
  font-weight: 900;
  cursor: pointer;
}
.call-next:hover { transform: translateY(-1px); }

.game-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.stat {
  padding: 12px;
  border-radius: 13px;
  background: #f3f7fa;
}
.stat strong { display: block; font-size: 21px; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }

.recent { margin-top: 20px; }
.recent-label { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.recent-balls { display: flex; gap: 8px; min-height: 42px; margin-top: 9px; flex-wrap: wrap; }
.mini-ball {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--teal);
  font-weight: 900;
}

.board-panel { padding: clamp(16px, 2vw, 26px); }
.board-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.board-top h2 { margin: 0; font-size: 24px; }
.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #17745c;
  background: #e7f8f0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
}
.live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22b17c;
  box-shadow: 0 0 0 5px rgba(34,177,124,.14);
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(42px, 1fr));
  gap: clamp(6px, .8vw, 10px);
}

.number {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #5b6880;
  background: linear-gradient(180deg, white, #f7f9fb);
  font-size: clamp(14px, 1.7vw, 21px);
  font-weight: 850;
  transition: .18s ease;
}
.number.called {
  color: white;
  border-color: transparent;
  background: linear-gradient(145deg, var(--teal), #07837f);
  box-shadow: 0 7px 15px rgba(10,167,162,.22);
}
.number.latest {
  color: var(--ink);
  background: linear-gradient(145deg, #ffd768, var(--gold));
  box-shadow: 0 0 0 4px rgba(255,191,63,.22), 0 9px 20px rgba(230,158,17,.24);
  transform: scale(1.07);
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.content-card { padding: clamp(22px, 4vw, 42px); }
.content-card h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 48px); }
.subtitle { margin: 0; color: var(--muted); line-height: 1.6; }

.form-grid { display: grid; gap: 16px; margin-top: 26px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 7px; color: #435067; font-size: 13px; font-weight: 850; }
input, textarea, select {
  width: 100%;
  border: 1px solid #ccd5e2;
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
  outline: 0;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(10,167,162,.12);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 850;
}
.btn-primary { color: white; background: var(--primary); }
.btn-secondary { color: var(--ink); background: #e9eff5; }
.btn-danger { color: #a21f33; background: #ffe8ec; }
.btn-teal { color: white; background: var(--teal); }

.message { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.message.error { color: #ba223a; }
.message.success { color: #087b63; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .75fr);
  gap: 18px;
  margin-top: 24px;
}
.admin-box { padding: 22px; border-radius: 18px; background: #f5f8fb; }
.lucky-admin-box { margin-top: 18px; border: 1px solid #bce5f3; background: #eefaff; }
.lucky-chip { background: #ff247f; }
.admin-box h2 { margin: 0 0 7px; }
.queue-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; min-height: 38px; }
.queue-chip { padding: 8px 11px; border-radius: 999px; color: white; background: #596b84; font-weight: 850; }
.login-card { width: min(460px, calc(100% - 28px)); margin: 80px auto; padding: 34px; }

.tickets-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 24px;
}
.tickets-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.ticket {
  break-inside: avoid;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: white;
}
.ticket-head {
  display: flex;
  justify-content: space-between;
  padding: 8px 11px;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 850;
}
.ticket-grid { display: grid; grid-template-columns: repeat(9, 1fr); }
.ticket-cell {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-right: 1px solid #8790a0;
  border-bottom: 1px solid #8790a0;
  font-size: 18px;
  font-weight: 900;
}
.ticket-cell:nth-child(9n) { border-right: 0; }
.ticket-cell:nth-last-child(-n+9) { border-bottom: 0; }
.ticket-cell.blank { background: #edf1f5; }

@media (max-width: 900px) {
  .game-layout, .admin-grid { grid-template-columns: 1fr; }
  .caller-panel { position: static; }
  .caller-panel {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 12px 20px;
    align-items: center;
  }
  .caller-panel .current-ball { grid-column: 2; grid-row: 1 / span 3; width: 150px; margin: 0; }
  .caller-panel .call-next, .caller-panel .game-stats, .caller-panel .recent { grid-column: 1; }
  .number-grid { grid-template-columns: repeat(10, minmax(32px, 1fr)); }
}

@media (max-width: 620px) {
  .site-header { padding: 10px 14px; }
  .brand span:last-child { display: none; }
  .nav a { padding: 9px 8px; font-size: 13px; }
  .page-shell { width: min(100% - 16px, 1440px); margin-top: 10px; }
  .caller-panel { display: block; padding: 19px; }
  .caller-panel .current-ball { width: 150px; margin: 18px auto; }
  .number-grid { gap: 4px; }
  .number { border-radius: 8px; font-size: 12px; }
  .board-panel { padding: 10px; border-radius: 16px; }
  .two-col, .tickets-toolbar, .tickets-wrap { grid-template-columns: 1fr; }
}

@media print {
  body { background: white; }
  .site-header, .tickets-toolbar, .print-hide, .subtitle { display: none !important; }
  .page-shell { width: 100%; margin: 0; }
  .panel, .content-card { border: 0; box-shadow: none; padding: 0; }
  .tickets-wrap { grid-template-columns: repeat(2, 1fr); gap: 12mm 8mm; margin: 0; }
  .ticket-cell { min-height: 12mm; }
}

/* Reference-style public board */
.public-menu {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 18px;
  border-bottom: 1px solid #cae6ef;
  background: #e4f8ff;
}
.public-menu a {
  padding: 10px 22px;
  border-radius: 5px;
  color: #099fdc;
  text-decoration: none;
  font-size: 17px;
}
.public-menu a:hover, .public-menu a.active {
  color: #fff;
  background: #35b8e9;
}
.board-page {
  background: #f2fafd;
  color: #777;
  font-family: Arial, Helvetica, sans-serif;
}
.classic-board {
  width: min(1660px, calc(100% - 40px));
  margin: 16px auto 12px;
  display: grid;
  grid-template-columns: 250px minmax(720px, 1fr);
  gap: 78px;
  align-items: start;
}
.classic-caller { padding-top: 0; }
.classic-call-next {
  width: 180px;
  height: 52px;
  border: 1px solid #a7a7a7;
  border-radius: 5px;
  color: #fff;
  background: #35b8e9;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  font-size: 28px;
  cursor: pointer;
}
.classic-call-next:disabled { opacity: .65; cursor: default; }
.board-page .current-ball,
.call-message {
  width: 180px;
  height: 128px;
  margin: 24px 0 0;
  display: grid;
  place-items: center;
  border: 1px solid #c8c8c8;
  border-radius: 12px;
  color: #07a8ed;
  background: transparent;
  box-shadow: none;
  font-size: 76px;
  font-weight: 400;
  letter-spacing: 0;
}
.board-page .current-ball.empty { color: #07a8ed; background: transparent; }
.call-message {
  min-height: 70px;
  height: auto;
  padding: 12px 10px;
  margin-top: 14px;
  color: #07a8ed;
  font-size: 24px;
  line-height: 1.15;
  text-align: center;
}
.sound-toggle {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #b9dce9;
  border-radius: 5px;
  color: #159bcf;
  background: #e3f7ff;
  cursor: pointer;
}
.audio-controls {
  width: 180px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.audio-controls .sound-toggle {
  padding-inline: 5px;
  font-size: 11px;
}
.voice-toggle[aria-pressed="false"] {
  color: #db416b;
  border-color: #f1b7c7;
  background: #fff0f4;
}
.board-page .current-ball.spinning {
  color: #ff247f;
  border-color: #35b8e9;
  background: linear-gradient(180deg, #fff, #e8f9ff);
  box-shadow: inset 0 12px 22px rgba(53,184,233,.12), 0 0 0 4px rgba(53,184,233,.1);
  animation: reel-shake .1s linear infinite;
}
.board-page .current-ball.revealed {
  animation: reveal-pop .42s cubic-bezier(.2,.9,.25,1.35);
  box-shadow: 0 0 0 7px rgba(255,36,127,.13), 0 12px 30px rgba(255,36,127,.18);
}
.celebration {
  position: fixed;
  top: 200px;
  left: 215px;
  width: 1px;
  height: 1px;
  z-index: 50;
  pointer-events: none;
}
.celebration i {
  position: absolute;
  width: 9px;
  height: 15px;
  opacity: 0;
}
.celebration.pop i { animation: confetti-pop 1.15s ease-out forwards; }
@keyframes reel-shake {
  0%,100% { transform: translateY(-2px); }
  50% { transform: translateY(2px); }
}
@keyframes reveal-pop {
  0% { transform: scale(.72) rotate(-3deg); }
  65% { transform: scale(1.12) rotate(2deg); }
  100% { transform: scale(1); }
}
@keyframes confetti-pop {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(var(--x),var(--y)) rotate(var(--r)); opacity: 0; }
}
.classic-counts {
  width: 180px;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: #a8b0b4;
  font-size: 11px;
}
.classic-grid-wrap { min-width: 0; }
.board-page .number-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(70px, 1fr));
  gap: 4px;
}
.board-page .number {
  height: clamp(72px, 7.25vw, 90px);
  aspect-ratio: auto;
  border: 1px solid #cfcfcf;
  border-radius: 0;
  color: #cfcfcf;
  background: rgba(255,255,255,.62);
  box-shadow: none;
  font-size: clamp(31px, 3.5vw, 50px);
  font-weight: 300;
  transform: none;
}
.board-page .number.called {
  color: #fff;
  border-color: #12adeb;
  background: #35b8e9;
  box-shadow: none;
}
.board-page .number.latest {
  color: #fff;
  border-color: #ff1672;
  background: #ff247f;
  box-shadow: none;
  transform: none;
}
.board-tools {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 5px 20px;
  border: 1px solid #d4dfe3;
  background: #f2fafd;
}
.board-tools a, .board-tools button {
  min-width: 42px;
  border: 0;
  color: #abb3b6;
  background: transparent;
  font-size: 35px;
  text-decoration: none;
  cursor: pointer;
}
.board-tools a:first-child { color: #52cf72; }
.recent-strip { display: none; gap: 6px; }
.recent-strip.open { display: flex; }
.board-page .mini-ball {
  width: 35px; height: 35px; border-radius: 2px; background: #ff247f;
}
.board-footer {
  min-height: 64px;
  padding: 20px;
  border: 1px solid #d4dfe3;
  color: #35b8e9;
  font-size: 20px;
}
.board-footer a { color: inherit; text-decoration: none; }
.board-actions {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 8px 20px;
  border: 1px solid #d4dfe3;
  background: #f2fafd;
}
.board-actions button {
  border: 0;
  border-radius: 4px;
  padding: 9px 18px;
  color: #fff;
  background: #35b8e9;
  cursor: pointer;
}
.board-actions span { color: #57b97e; font-size: 13px; }
.board-actions span.offline { color: #e1772d; }

/* Full ticket designer */
.ticket-page {
  background: #fff;
  color: #16aeec;
  font-family: Arial, Helvetica, sans-serif;
}
.ticket-maker {
  display: grid;
  grid-template-columns: minmax(600px, 1fr) 450px;
  gap: 28px;
  align-items: start;
  padding: 2px;
}
.ticket-preview-area { min-width: 0; }
.ticket-sheet {
  --sheet-color: #fff;
  --spacing-lr: 18px;
  --spacing-tb: 16px;
  --ticket-gap: 18px;
  --ticket-border: #ff1a75;
  --ticket-opacity: .5;
  --cue-bg: #fff;
  --cue-text: #000;
  --cue-border: #19b7f1;
  --cue-opacity: .8;
  min-height: 620px;
  padding: 28px max(var(--spacing-lr), calc((100% - 560px) / 2));
  display: flex;
  flex-direction: column;
  gap: var(--ticket-gap);
  background-color: var(--sheet-color);
}
.ticket-sheet.design-floral {
  background:
    radial-gradient(circle at 14% 14%, #ffe8ee 0 18px, transparent 19px),
    radial-gradient(circle at 17% 11%, #ffd0dc 0 8px, transparent 9px),
    radial-gradient(circle at 80% 22%, #ffe7ee 0 22px, transparent 23px),
    radial-gradient(circle at 77% 19%, #ffcbd9 0 9px, transparent 10px),
    linear-gradient(115deg, rgba(232,104,151,.15) 18%, transparent 18% 44%, rgba(232,104,151,.12) 44% 49%, transparent 49%),
    #f8cbd8;
  background-size: 270px 260px,270px 260px,330px 310px,330px 310px,100% 100%,auto;
}
.ticket-sheet.design-dots {
  background-color: var(--sheet-color);
  background-image: radial-gradient(#8fdcf5 1.5px, transparent 1.5px);
  background-size: 18px 18px;
}
.ticket-sheet.design-stripes {
  background-color: var(--sheet-color);
  background-image: repeating-linear-gradient(135deg, rgba(255,197,64,.18) 0 18px, transparent 18px 36px);
}
.designer-ticket {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 9px;
  break-inside: avoid;
  color: var(--cue-text);
  border: 2px solid var(--ticket-border);
  background: color-mix(in srgb, var(--ticket-color) calc(var(--ticket-opacity) * 100%), transparent);
}
.ticket-sheet[data-style="rounded"] .designer-ticket { border-radius: 14px; overflow: hidden; }
.ticket-sheet[data-style="bold"] .designer-ticket { border-width: 5px; }
.ticket-sheet[data-style="minimal"] .designer-ticket { border-width: 1px; }
.designer-ticket header {
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  padding: 0 5px 5px;
  color: #555;
  font-size: 12px;
}
.designer-grid { display: grid; grid-template-columns: repeat(9, 1fr); border: 1px solid var(--cue-border); }
.designer-cell {
  min-height: 40px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--cue-border);
  border-bottom: 1px solid var(--cue-border);
  color: var(--cue-text);
  background-color: color-mix(in srgb, var(--cue-bg) calc(var(--cue-opacity) * 100%), transparent);
  font-size: 19px;
}
.ticket-sheet[data-pattern="checker"] .designer-cell:nth-child(even) { background-image: linear-gradient(45deg,rgba(0,0,0,.05) 25%,transparent 25% 75%,rgba(0,0,0,.05) 75%); }
.ticket-sheet[data-pattern="dots"] .designer-cell { background-image: radial-gradient(rgba(0,0,0,.08) 1px, transparent 1px); background-size: 7px 7px; }
.ticket-sheet[data-pattern="lines"] .designer-cell { background-image: repeating-linear-gradient(135deg,rgba(0,0,0,.04) 0 2px,transparent 2px 7px); }
.designer-cell:nth-child(9n) { border-right: 0; }
.designer-cell:nth-last-child(-n+9) { border-bottom: 0; }
.designer-cell.blank { color: transparent; }
.designer-ticket footer {
  min-height: 20px;
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 5px 0;
  color: #555;
  font-size: 11px;
}
.designer-ticket footer span { flex: 1; }
.designer-ticket footer span:last-child { text-align: right; }
.designer-ticket footer strong {
  flex: 1.5;
  text-align: center;
  font-weight: 500;
}
.ticket-message {
  padding: 4px 5px 0;
  color: #555;
  text-align: center;
  font-size: 11px;
}
.preview-actions { text-align: center; }
.camera-button {
  border: 0;
  padding: 8px 18px;
  background: transparent;
  font-size: 30px;
  cursor: pointer;
}
.ticket-controls { padding: 6px 18px 30px 0; color: #15b3ef; }
.settings-top { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; margin-bottom: 22px; }
.sky-button, .create-button {
  border: 1px solid #555;
  border-radius: 16px;
  color: #fff;
  background: #35b8e9;
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
  cursor: pointer;
}
.sky-button { padding: 7px 12px; font-size: 20px; }
.settings-top select { padding: 8px 12px; border: 1px solid #777; border-radius: 18px; }
.settings-panel {
  padding: 16px 12px 18px;
  border-radius: 18px;
  background: #e4f8ff;
  box-shadow: 3px 4px 8px rgba(0,0,0,.24);
}
.create-button { width: calc(100% - 18px); margin: 0 9px 12px; padding: 8px; border: 0; font-size: 15px; }
.settings-panel fieldset {
  margin: 10px 0 18px;
  padding: 13px 9px 15px;
  border: 1px solid #55ccf6;
}
.settings-panel legend { padding: 0 5px; font-size: 15px; }
.settings-panel label { display: flex; align-items: center; gap: 8px; color: #15b3ef; font-size: 15px; font-weight: 400; }
.settings-panel input, .settings-panel select {
  min-width: 0;
  border: 0;
  border-radius: 18px;
  padding: 7px 11px;
  background: linear-gradient(180deg,#ccc,#fff 45%,#e9fbff);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,.2);
}
.settings-panel input::placeholder { color: #777; opacity: 1; }
.control-grid { display: grid; gap: 10px; align-items: center; }
.control-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.control-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.control-grid label { justify-content: space-between; }
.wide-label { margin-top: 12px; }
.wide-label input { flex: 1; }
.settings-panel small { display: block; margin-top: 8px; line-height: 1.45; }
.color-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 12px; }
.color-grid label input { width: 82px; }
.pink-value { color: #fff !important; background: #ff1a75 !important; }
.blue-value { color: #111 !important; background: #19b7f1 !important; }
.black-value { color: #fff !important; background: #000 !important; }
.settings-note { margin: 0 5px; font-size: 13px; line-height: 1.5; }
.ticket-page-footer { padding: 16px 3px; }
.ticket-page-footer h1 { margin: 0 0 10px; font-size: 24px; font-style: italic; }
.ticket-page-footer nav { padding: 9px; background: #e4f8ff; text-align: right; }
.ticket-page-footer a { color: #079edb; text-decoration: none; }
.generated-banner { margin-top: 18px; padding: 25px; border-radius: 15px; color: #fff; background: #35b8e9; text-align: center; font-size: 20px; }

/* Lucky number lottery */
.lucky-page {
  min-height: 100vh;
  color: #13445d;
  background:
    radial-gradient(circle at 10% 16%, rgba(255,36,127,.15), transparent 22rem),
    radial-gradient(circle at 92% 10%, rgba(53,184,233,.22), transparent 24rem),
    #f2fafd;
  font-family: Arial, Helvetica, sans-serif;
}
.lucky-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 34px auto;
}
.lucky-card {
  position: relative;
  overflow: hidden;
  padding: clamp(25px, 5vw, 54px);
  border: 1px solid #c9e7f1;
  border-radius: 25px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 24px 60px rgba(28,102,133,.15);
  text-align: center;
}
.lucky-card::before,
.lucky-card::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  opacity: .14;
  pointer-events: none;
}
.lucky-card::before { top: -130px; left: -80px; background: #ff247f; }
.lucky-card::after { right: -90px; bottom: -150px; background: #35b8e9; }
.lucky-kicker {
  margin: 0 0 8px;
  color: #ff247f;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.lucky-card h1 {
  margin: 0;
  color: #0c9fd9;
  font-size: clamp(34px, 6vw, 62px);
}
.lucky-intro { margin: 12px auto 24px; color: #66899a; font-size: 17px; }
.lucky-count-picker {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}
.lucky-count-picker button {
  border: 1px solid #9dd7eb;
  border-radius: 999px;
  padding: 10px 18px;
  color: #168fbe;
  background: #e9f9ff;
  cursor: pointer;
  font-weight: 700;
}
.lucky-count-picker button.selected {
  color: #fff;
  border-color: #ff247f;
  background: #ff247f;
  box-shadow: 0 7px 18px rgba(255,36,127,.23);
}
.lucky-reels {
  --reel-count: 5;
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(var(--reel-count), minmax(95px, 1fr));
  gap: clamp(7px, 1.5vw, 15px);
  margin: 34px auto 28px;
  perspective: 800px;
}
.lucky-reel {
  position: relative;
  min-height: 164px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid #35b8e9;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(19,68,93,.09), transparent 25% 75%, rgba(19,68,93,.09)),
    #fff;
  box-shadow: inset 0 0 25px rgba(53,184,233,.12), 0 12px 24px rgba(28,102,133,.12);
}
.reel-label {
  position: absolute;
  top: 8px;
  color: #7da4b5;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.lucky-reel strong {
  color: #0aa7e3;
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 500;
}
.lucky-reel.rolling strong {
  color: #ff247f;
  filter: blur(.7px);
  animation: lucky-reel-shake .09s linear infinite;
}
.lucky-reel.winner {
  border-color: #ff247f;
  animation: lucky-winner .52s cubic-bezier(.2,.9,.25,1.35);
  box-shadow: 0 0 0 7px rgba(255,36,127,.12), 0 16px 32px rgba(255,36,127,.2);
}
.draw-lucky {
  min-width: min(390px, 100%);
  border: 0;
  border-radius: 12px;
  padding: 16px 25px;
  color: #fff;
  background: linear-gradient(135deg, #29b7ed, #079bd3);
  box-shadow: 0 12px 25px rgba(9,155,211,.25);
  cursor: pointer;
  font-size: 21px;
  font-weight: 800;
}
.draw-lucky:disabled { opacity: .65; cursor: wait; }
.lucky-sound {
  display: block;
  margin: 12px auto 0;
  border: 1px solid #b8dce8;
  border-radius: 999px;
  padding: 8px 18px;
  color: #168fbe;
  background: #e9f9ff;
  cursor: pointer;
}
.lucky-message {
  min-height: 26px;
  margin: 19px 0 0;
  color: #ff247f;
  font-size: 18px;
  font-weight: 700;
}
.lucky-history-card {
  margin-top: 17px;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #d1e7ee;
  border-radius: 16px;
  background: rgba(255,255,255,.82);
}
.lucky-history-card h2 { margin: 0 0 4px; color: #0c9fd9; }
.lucky-history-card p { margin: 0; color: #7795a2; }
.lucky-history { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; color: #86a0ad; }
.lucky-history span {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #35b8e9;
  font-weight: 800;
}
.lucky-celebration {
  position: fixed;
  top: 55%;
  left: 50%;
  width: 1px;
  height: 1px;
  z-index: 50;
  pointer-events: none;
}
.lucky-celebration i {
  position: absolute;
  width: 10px;
  height: 17px;
  opacity: 0;
}
.lucky-celebration.pop i {
  animation: lucky-confetti 1.5s ease-out var(--delay) forwards;
}
@keyframes lucky-reel-shake {
  0%,100% { transform: translateY(-5px); }
  50% { transform: translateY(5px); }
}
@keyframes lucky-winner {
  0% { transform: rotateX(30deg) scale(.7); }
  65% { transform: rotateX(-6deg) scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes lucky-confetti {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(var(--x),var(--y)) rotate(var(--r)); opacity: 0; }
}

@media (max-width: 1000px) {
  .classic-board { grid-template-columns: 170px minmax(600px,1fr); gap: 20px; }
  .classic-call-next, .board-page .current-ball, .call-message, .audio-controls, .classic-counts { width: 160px; }
  .ticket-maker { grid-template-columns: 1fr; }
  .ticket-controls { padding: 14px; }
}
@media (max-width: 760px) {
  .classic-board { width: calc(100% - 12px); grid-template-columns: 1fr; }
  .classic-caller { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center; }
  .classic-call-next, .board-page .current-ball, .call-message { width: 100%; margin: 0; height: 70px; font-size: 24px; }
  .audio-controls { width: 100%; margin: 8px 0 0; grid-column: 1 / -1; }
  .celebration { top: 150px; left: 50%; }
  .classic-counts { display: none; }
  .board-page .number-grid { grid-template-columns: repeat(10,1fr); gap: 2px; }
  .board-page .number { height: 9vw; min-height: 34px; font-size: clamp(13px,4vw,24px); }
  .board-tools { overflow-x: auto; }
  .ticket-maker { display: block; }
  .ticket-sheet { min-height: 0; padding: 14px 8px; }
  .ticket-controls { padding: 10px; }
  .settings-top { grid-template-columns: 1fr; }
  .control-grid.two, .control-grid.three, .color-grid { grid-template-columns: 1fr 1fr; }
  .public-menu { overflow-x: auto; justify-content: flex-start; }
  .public-menu a { padding: 9px 13px; white-space: nowrap; }
  .lucky-shell { margin-top: 14px; }
  .lucky-card { padding: 24px 10px; }
  .lucky-reels {
    grid-template-columns: repeat(var(--reel-count), minmax(55px, 1fr));
    gap: 4px;
  }
  .lucky-reel { min-height: 105px; border-width: 2px; border-radius: 10px; }
  .lucky-reel strong { font-size: clamp(28px, 10vw, 48px); }
  .reel-label { font-size: 8px; }
  .lucky-history-card { align-items: flex-start; flex-direction: column; }
  .lucky-history { justify-content: flex-start; }
}

@media print {
  .ticket-page { background: #fff; }
  .ticket-maker { display: block; padding: 0; }
  .ticket-preview-area { width: 100%; }
  .ticket-sheet { min-height: 0; padding: 8mm; background: var(--sheet-color) !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .designer-ticket { max-width: none; }
  .public-menu { display: none !important; }
}
