:root {
  --ink: #132238;
  --muted: #667085;
  --line: #d9e2ec;
  --paper: #ffffff;
  --soft: #f4f7fb;
  --blue: #2364aa;
  --green: #2f9e75;
  --gold: #d99a2b;
  --danger: #bd3f32;
  --shadow: 0 20px 50px rgba(19, 34, 56, .12);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--soft); text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
main { width: min(1120px, calc(100% - 32px)); margin: 32px auto 64px; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(18px, calc((100vw - 1120px) / 2)); background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 20px; }
.brand span { color: var(--blue); }
nav { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.inline { display: inline; }
.inline button, nav a { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; }
.hero { min-height: 62vh; display: grid; align-items: center; background: linear-gradient(135deg, rgba(35,100,170,.12), rgba(47,158,117,.12)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='500' viewBox='0 0 800 500'%3E%3Crect fill='%23ffffff' width='800' height='500'/%3E%3Cg opacity='.18'%3E%3Crect x='270' y='115' width='250' height='210' rx='20' fill='%232364aa'/%3E%3Crect x='245' y='92' width='300' height='70' rx='16' fill='%23d99a2b'/%3E%3Cpath d='M395 92v233' stroke='%23fff' stroke-width='34'/%3E%3Cpath d='M245 164h300' stroke='%23fff' stroke-width='28'/%3E%3C/g%3E%3C/svg%3E") center/cover; border-radius: 8px; padding: clamp(32px, 6vw, 72px); }
.hero h1, .panel h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.02; margin: 0 0 18px; letter-spacing: 0; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 680px; }
.eyebrow { color: var(--green); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: 0; margin: 0 0 10px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: clamp(22px, 4vw, 40px); box-shadow: var(--shadow); }
.narrow { width: min(720px, 100%); margin: 0 auto; }
.readable { width: min(860px, 100%); margin: 0 auto; }
.checklist { padding: 0; margin: 22px 0; list-style: none; display: grid; gap: 12px; }
.checklist li { padding-left: 30px; position: relative; color: #28384f; line-height: 1.45; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); box-shadow: inset 0 0 0 5px #dff4ec; }
.primary, .ghost, .danger { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 8px; padding: 0 18px; border: 1px solid transparent; cursor: pointer; font-weight: 750; touch-action: manipulation; }
.primary { background: var(--blue); color: #fff; box-shadow: 0 10px 24px rgba(35,100,170,.25); }
.primary.huge { width: 100%; min-height: 64px; font-size: 20px; margin-top: 10px; position: sticky; bottom: 12px; z-index: 3; }
.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.danger { background: #fff5f3; border-color: #ffd0ca; color: var(--danger); }
.text-link { color: var(--blue); font-weight: 750; }
.notice, .alert { border-radius: 8px; padding: 12px 14px; background: #eef7f3; color: #17624a; }
.alert { background: #fff1ef; color: var(--danger); }
.form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; color: #344054; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; padding: 10px 12px; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: 18px; min-height: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.actions, .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat strong { font-size: 34px; }
table { width: 100%; border-collapse: collapse; margin: 14px 0 28px; font-size: 14px; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.cover { width: min(260px, 100%); aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.result-shell { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 26px; align-items: center; }
.result { text-align: left; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.meta div { background: var(--soft); border-radius: 8px; padding: 12px; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 4px 0 0; font-weight: 750; }
.box-animation { height: 360px; position: relative; display: grid; place-items: center; contain: layout paint; }
.box-body, .box-lid { position: absolute; width: 210px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), #2f9e75); box-shadow: var(--shadow); }
.box-body { height: 150px; bottom: 64px; }
.box-lid { height: 58px; bottom: 210px; background: linear-gradient(135deg, var(--gold), #f1bd56); transform-origin: center bottom; }
.glow { width: 210px; height: 210px; border-radius: 50%; background: radial-gradient(circle, rgba(217,154,43,.45), transparent 62%); opacity: .2; transform: scale(.6); }
.box-body, .box-lid, .glow { will-change: transform, opacity; }
.celebrate .box-animation::before, .celebrate .box-animation::after { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: -76px 54px #2364aa, 82px 38px #2f9e75, -32px -54px #c03968, 48px -72px #7c5cc4, 116px -18px #d99a2b, -116px -14px #2f9e75; opacity: 0; transform: translateY(18px) scale(.7); }
.celebrate .box-animation::before { animation: confetti 900ms ease-out 760ms both; }
.celebrate .box-animation::after { animation: confetti 900ms ease-out 900ms both; transform: rotate(24deg) translateY(18px) scale(.7); }
.celebrate .box-lid { animation: lid 1100ms cubic-bezier(.2,.8,.2,1) forwards; }
.celebrate .glow { animation: glow 1300ms ease-out forwards; }
.celebrate .result { animation: rise 600ms ease-out 900ms both; }
.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq p { color: var(--muted); line-height: 1.55; }
.available-prizes { margin: 26px 0; border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: linear-gradient(180deg, #fff, #f8fbff); box-shadow: 0 16px 34px rgba(19, 34, 56, .08); }
.prize-list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.available-prizes h2 { font-size: 22px; margin: 0; }
.available-prizes p { margin: 0; max-width: 300px; color: var(--muted); font-size: 13px; line-height: 1.45; text-align: right; }
.prize-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; counter-reset: prize; }
.prize-item { counter-increment: prize; position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 8px; padding: 14px 14px 14px 44px; box-shadow: 0 10px 24px rgba(19, 34, 56, .06); }
.prize-item::before { content: counter(prize, decimal-leading-zero); position: absolute; left: 12px; top: 14px; color: #98a4b3; font-size: 12px; font-weight: 900; }
.prize-item strong { display: block; line-height: 1.25; padding-right: 92px; font-weight: 850; }
.prize-item span { position: absolute; top: 10px; right: 10px; border-radius: 999px; padding: 4px 9px; color: var(--muted); background: var(--soft); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.rarity-ultra-rare { border-left-color: #b92961; background: linear-gradient(90deg, rgba(185,41,97,.13), #fff 48%); }
.rarity-ultra-rare strong { color: #8d2148; }
.rarity-ultra-rare span { color: #8d2148; background: #fde8f0; }
.rarity-rare { border-left-color: #6b4db4; background: linear-gradient(90deg, rgba(107,77,180,.13), #fff 48%); }
.rarity-rare strong { color: #4d338b; }
.rarity-rare span { color: #553895; background: #eee9ff; }
.rarity-special { border-left-color: #2364aa; background: linear-gradient(90deg, rgba(35,100,170,.12), #fff 48%); }
.rarity-special strong { color: #174c83; }
.rarity-special span { color: #174c83; background: #e5f0fb; }
.rarity-standard { border-left-color: #2f9e75; background: linear-gradient(90deg, rgba(47,158,117,.12), #fff 48%); }
.rarity-standard strong { color: #17624a; }
.rarity-standard span { color: #17624a; background: #e4f6ef; }
.rarity-common { border-left-color: #8a98aa; background: linear-gradient(90deg, rgba(138,152,170,.11), #fff 48%); }
.rarity-common strong { color: #344054; }
.rarity-common span { color: #516070; background: #eef2f6; }
.inline-tools { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.inline-tools label { min-width: 180px; }
.created-links { border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin: 18px 0; background: var(--soft); }
.copy-row { display: flex; gap: 8px; margin-top: 8px; align-items: stretch; }
.copy-row button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 0 14px; cursor: pointer; }

@keyframes lid { 0% { transform: translateY(0) rotate(0); } 60%,100% { transform: translateY(-90px) rotate(-12deg); } }
@keyframes glow { 0% { opacity: .2; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.3); } 100% { opacity: .35; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes confetti { 0% { opacity: 0; transform: translateY(18px) scale(.7); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(-92px) scale(1.05); } }

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

@media (max-width: 760px) {
  body { background: linear-gradient(180deg, #f7faff 0, #eef3f8 100%); }
  .topbar { height: auto; min-height: 64px; align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px 14px; }
  .brand { font-size: 18px; }
  nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a, .inline button { white-space: nowrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; }
  main { width: min(100% - 18px, 1120px); margin-top: 12px; margin-bottom: 34px; }
  .panel { border-radius: 8px; padding: 18px; box-shadow: 0 12px 28px rgba(19, 34, 56, .10); }
  .hero { min-height: 58vh; padding: 26px 22px; border-radius: 8px; }
  .hero h1, .panel h1 { font-size: 34px; line-height: 1.06; }
  .lead { font-size: 16px; line-height: 1.5; }
  .checklist { gap: 10px; margin: 18px 0; }
  .checklist li { font-size: 14px; padding-left: 28px; }
  .available-prizes { padding: 16px; margin: 20px -2px; }
  .admin-grid, .result-shell, .meta { grid-template-columns: 1fr; }
  .prize-list { grid-template-columns: 1fr; }
  .prize-list-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .available-prizes p { text-align: left; max-width: none; }
  .available-prizes h2 { font-size: 20px; }
  .prize-item { min-height: 64px; padding: 13px 12px 13px 40px; }
  .prize-item strong { padding-right: 0; }
  .prize-item span { position: static; display: inline-block; margin-top: 8px; }
  .primary.huge { min-height: 58px; font-size: 17px; box-shadow: 0 14px 30px rgba(35,100,170,.28); }
  .result-shell { gap: 14px; }
  .result { text-align: center; }
  .result .primary, .result .ghost { width: 100%; margin-top: 8px; }
  .cover { width: min(220px, 100%); }
  .meta { margin: 18px 0; }
  .section-head { align-items: flex-start; flex-direction: column; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .box-animation { height: 238px; transform: scale(.82); transform-origin: center; margin: -14px 0 -24px; }
  .box-body { bottom: 52px; }
  .box-lid { bottom: 198px; }
}

@media (max-width: 390px) {
  .panel { padding: 16px; }
  .hero h1, .panel h1 { font-size: 31px; }
  .prize-item strong { font-size: 14px; }
  .box-animation { transform: scale(.74); margin: -28px 0 -38px; }
  .copy-row { flex-direction: column; }
  .copy-row input, .copy-row button { min-height: 44px; }
}
