@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Gowun+Dodum&display=swap');

:root {
  --deep: #6B4FD6;
  --purple: #9B7FF0;
  --purple-mid: #C6B4FA;
  --purple-light: #EFE9FE;
  --lavender: #F6F3FF;
  --cream: #FFFCF2;
  --white: #FFFFFF;
  --text-dark: #362A5C;
  --text-soft: #837AA3;
  --gold: #F7C948;
  --leaf: #4FA97E;
  --shadow-deep: 0 10px 26px rgba(107, 79, 214, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Gowun Dodum', sans-serif;
  color: var(--text-dark);
  background: var(--lavender);
  overflow-x: hidden;
}

body { position: relative; }

.title-font { font-family: 'Baloo 2', sans-serif; font-weight: 800; }

/* ================= NAVBAR ================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(155,127,240,0.18);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--deep);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 18px;
}
.brand-icon { width: 30px; height: 30px; object-fit: contain; }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ================= LAYOUT ================= */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 18px 50px;
}

/* ================= HERO ================= */
.hero {
  position: relative;
  border-radius: 32px;
  background: linear-gradient(120deg, var(--deep) 0%, var(--purple) 65%, #B79CF7 100%);
  padding: 40px 34px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-deep);
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-text { color: #fff; max-width: 520px; }
.eyebrow {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.hero-text h1 {
  font-size: clamp(32px, 5.4vw, 48px);
  line-height: 1.12;
  margin: 4px 0 14px;
  text-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.hero-sub {
  font-size: 15px;
  color: rgba(255,255,255,0.92);
  line-height: 1.6;
  margin: 0;
}

.hero-mascot {
  position: relative;
  flex-shrink: 0;
}
.hero-mascot-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,0.18));
  animation: bob 3.4s ease-in-out infinite;
}
.speech-bubble {
  position: absolute;
  top: -14px;
  left: -18px;
  background: #fff;
  color: var(--deep);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  animation: pop-bubble 3.4s ease-in-out infinite;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 26px;
  width: 12px;
  height: 12px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
@keyframes pop-bubble {
  0%, 40%, 100% { transform: translateY(0); opacity: 1; }
  20% { transform: translateY(-4px); opacity: 1; }
  60%, 90% { opacity: 0.85; }
}

/* decorative floating mascots (pop out of the panels) */
.deco {
  position: absolute;
  pointer-events: none;
  object-fit: contain;
  z-index: 3;
  opacity: 1;
  filter: drop-shadow(0 8px 12px rgba(54,42,92,0.28));
}
.deco-hero-1 {
  width: 88px; height: 88px;
  left: -20px; bottom: -22px;
  animation: driftA 15s ease-in-out infinite;
}
.deco-hero-2 {
  width: 62px; height: 62px;
  right: 7%; top: -20px;
  animation: driftD 13s ease-in-out infinite;
}
.deco-board-1 {
  width: 92px; height: 92px;
  left: -34px; top: 26px;
  animation: driftC 17s ease-in-out infinite;
}
.deco-board-2 {
  width: 100px; height: 100px;
  right: -32px; bottom: -24px;
  animation: driftB 16s ease-in-out infinite;
}

/* slow, natural drifting movement for decorative mascots */
@keyframes driftA {
  0%, 100% { transform: translate(0,0) rotate(-14deg); }
  50% { transform: translate(12px,-16px) rotate(-6deg); }
}
@keyframes driftB {
  0%, 100% { transform: translate(0,0) rotate(10deg); }
  50% { transform: translate(-16px,14px) rotate(18deg); }
}
@keyframes driftC {
  0%, 100% { transform: translate(0,0) rotate(-6deg); }
  50% { transform: translate(10px,18px) rotate(3deg); }
}
@keyframes driftD {
  0%, 100% { transform: translate(0,0) rotate(14deg); }
  50% { transform: translate(-12px,-14px) rotate(6deg); }
}

/* ================= SIDE FLOATERS (margins, whole page) ================= */
.side-floaters {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.side-floaters img {
  position: absolute;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(54,42,92,0.20));
  opacity: 0.9;
}
.floater-1 { width: 78px; left: 2.4vw; top: 130px; animation: driftA 19s ease-in-out infinite; animation-delay: -2s; }
.floater-2 { width: 60px; right: 2.8vw; top: 360px; animation: driftD 22s ease-in-out infinite; animation-delay: -6s; }
.floater-3 { width: 70px; left: 3.2vw; top: 620px; animation: driftC 18s ease-in-out infinite; animation-delay: -9s; }
.floater-4 { width: 85px; right: 2.2vw; top: 840px; animation: driftB 21s ease-in-out infinite; animation-delay: -4s; }
.floater-5 { width: 58px; left: 2vw; top: 1080px; animation: driftD 17s ease-in-out infinite; animation-delay: -11s; }
.floater-6 { width: 66px; right: 3.4vw; top: 1260px; animation: driftA 20s ease-in-out infinite; animation-delay: -8s; }

@media (max-width: 1300px) {
  .side-floaters { display: none; }
}

/* ================= PILLS / BUTTONS ================= */
.pill {
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: 0 3px 0 rgba(107,79,214,0.10);
  border: 1px solid var(--purple-light);
}
.pill b { color: var(--deep); }

.btn {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 10px 20px;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(160deg, var(--purple), var(--deep));
  box-shadow: 0 5px 0 rgba(107,79,214,0.30);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(107,79,214,0.30); }
.btn.leaf { background: linear-gradient(160deg, #8FD3B6, var(--leaf)); box-shadow: 0 5px 0 rgba(79,169,126,0.30); }
.btn.leaf:active { box-shadow: 0 2px 0 rgba(79,169,126,0.30); }
.btn.gold { background: linear-gradient(160deg, #FBDD82, var(--gold)); box-shadow: 0 5px 0 rgba(180,130,10,0.30); color: #5b3f00; }
.btn.gold:active { box-shadow: 0 2px 0 rgba(180,130,10,0.30); }
.btn.outline {
  background: #fff;
  color: var(--deep);
  border: 2px solid var(--purple-mid);
  box-shadow: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ================= BOARD ================= */
.board-section { position: relative; }
.board-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 8px 24px rgba(107,79,214,0.10);
}

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 12px;
}
@media (max-width: 760px) {
  .board { grid-template-columns: repeat(5, 1fr); gap: 9px; }
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 16px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  background: linear-gradient(150deg, var(--purple) 0%, var(--deep) 100%);
  color: #fff;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 2.2vw, 19px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(107,79,214,0.35);
  transition: transform .12s ease;
}
.cell:hover { transform: translateY(-3px) scale(1.05); }
.cell:active { transform: translateY(2px) scale(0.97); }

.cell.opened {
  background: linear-gradient(150deg, #ECE7FA, #DCD3F2);
  color: #A398C4;
  box-shadow: 0 3px 0 #CBC0E6;
}
.cell.opened::before {
  content: "✓";
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 10px;
  color: #8B7EBF;
}

.cell.pop { animation: pop .35s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22) rotate(-3deg); }
  70% { transform: scale(0.93) rotate(3deg); }
  100% { transform: scale(1); }
}

/* ================= MODAL ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(54, 42, 92, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  padding: 20px;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal-card {
  background: #fff;
  border-radius: 26px;
  padding: 46px 30px 28px;
  width: min(88vw, 380px);
  text-align: center;
  position: relative;
  box-shadow: 0 20px 40px rgba(54,42,92,0.28);
  transform: translateY(14px) scale(0.94);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.show .modal-card { transform: translateY(0) scale(1); }

.modal-mascot {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.18));
}

.modal-card .num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--purple), var(--deep));
  color: #fff;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-bottom: 8px;
}

.modal-card h2 {
  font-family: 'Baloo 2', sans-serif;
  color: var(--deep);
  margin: 4px 0 6px;
  font-size: 21px;
}

.modal-card .prize-text {
  font-size: 18px;
  color: var(--text-dark);
  margin: 14px 0 22px;
  min-height: 26px;
  word-break: keep-all;
  line-height: 1.5;
}
.modal-card .prize-empty { color: var(--text-soft); font-size: 14px; }

/* ================= ADMIN ================= */
.admin-gate {
  max-width: 340px;
  margin: 60px auto;
  background: #fff;
  border-radius: 26px;
  padding: 40px 26px 26px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(107,79,214,0.14);
  position: relative;
}
.gate-mascot {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin-top: -70px;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.15));
}
.gate-title { font-size: 22px; color: var(--deep); margin: 10px 0; }
.login-error { color: #C24E63; font-size: 13px; margin-top: 10px; min-height: 16px; }
.admin-gate input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--purple-mid);
  font-size: 15px;
  margin: 14px 0;
  font-family: 'Gowun Dodum', sans-serif;
}

.admin-hero {
  position: relative;
  border-radius: 24px;
  background: linear-gradient(120deg, var(--deep), var(--purple));
  padding: 26px 28px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
}
.admin-hero-inner { position: relative; z-index: 1; color: #fff; }
.admin-hero h1 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 6px; }
.admin-hero .hero-sub { color: rgba(255,255,255,0.9); font-size: 14px; }

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 700px) {
  .admin-list { grid-template-columns: 1fr; }
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 3px 0 rgba(107,79,214,0.08);
  border: 1px solid var(--purple-light);
}
.admin-row.filled { border-color: rgba(79,169,126,0.4); background: #f4fbf6; }
.admin-row.opened { opacity: 0.55; }

.admin-row .row-num {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  background: linear-gradient(150deg, var(--purple), var(--deep));
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.admin-row.opened .row-num { background: #b7ace0; }

.admin-row input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: 'Gowun Dodum', sans-serif;
  color: var(--text-dark);
  padding: 4px 2px;
}
.admin-row input:focus { outline: none; border-bottom: 2px solid var(--purple-mid); }

.admin-row .tag { font-size: 11px; color: var(--deep); flex-shrink: 0; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--deep);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transition: all .25s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-title {
  font-family: 'Baloo 2', sans-serif;
  color: var(--deep);
  font-size: 18px;
  margin: 8px 0 12px;
}

.link-back { color: var(--text-soft); font-size: 13px; text-decoration: none; }
.link-back:hover { text-decoration: underline; }

/* ================= FOOTER ================= */
.footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  font-size: 12px;
  color: var(--text-soft);
  opacity: 0.85;
}
.footer-mascot { width: 26px; height: 26px; object-fit: contain; }

@media (max-width: 640px) {
  .hero-mascot-img { width: 110px; height: 110px; }
  .deco { opacity: 0.55 !important; }
  .deco-board-1, .deco-board-2 { width: 56px; height: 56px; }
  .deco-board-1 { left: -14px; }
  .deco-board-2 { right: -14px; }
}
