:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: rgba(17, 26, 43, 0.82);
  --panel-strong: #111a2b;
  --line: rgba(255,255,255,.12);
  --text: #f6f8fc;
  --muted: #a8b2c6;
  --accent: #67e8f9;
  --accent2: #8b5cf6;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0,0,0,.34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(103,232,249,.12), transparent 30rem),
    radial-gradient(circle at 86% 18%, rgba(139,92,246,.15), transparent 28rem),
    linear-gradient(180deg, #070b14, #0a1020 55%, #070b14);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.hero { padding: 72px 0 38px; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(103,232,249,.22);
  border-radius: 999px;
  background: rgba(103,232,249,.07);
  color: #c7f9ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .05em;
}
.hero h1 {
  max-width: 900px;
  margin: 22px auto 14px;
  font-size: clamp(32px, 7vw, 64px);
  line-height: 1.08;
  letter-spacing: -.045em;
}
.hero h1 span {
  display: block;
  margin-top: 9px;
  background: linear-gradient(90deg, var(--accent), #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0 auto; max-width: 680px; color: var(--muted); line-height: 1.75; }

.ball-wrap { width: 118px; height: 118px; margin: 34px auto 4px; filter: drop-shadow(0 18px 28px rgba(103,232,249,.17)); }
.ball { width: 100%; height: 100%; animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

.status-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 26px 0 8px;
}
.updated {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  font-size: 14px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(52,211,153,.1); }

.btn {
  min-height: 44px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(103,232,249,.38); background: rgba(103,232,249,.09); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { border: 0; color: #06101a; background: linear-gradient(135deg, var(--accent), #c4b5fd); }
.btn-danger { border-color: rgba(251,113,133,.32); color: #fecdd3; background: rgba(251,113,133,.08); }
.btn-small { min-height: 36px; padding: 0 11px; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; padding: 28px 0 34px; }
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(17,26,43,.93), rgba(12,18,31,.86));
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}
.panel-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.division-counts { display: flex; justify-content: flex-end; align-items: center; gap: 7px; flex-wrap: wrap; }
.count { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; font-weight: 900; font-size: 13px; white-space: nowrap; }
.count-confirmed { color: #bbf7d0; border-color: rgba(52,211,153,.25); background: rgba(52,211,153,.08); }
.count-waiting { color: var(--accent); border-color: rgba(103,232,249,.25); background: rgba(103,232,249,.08); }
.waitlist { list-style: none; margin: 0; padding: 10px 14px 16px; }
.wait-item {
  display: grid;
  grid-template-columns: 72px minmax(0,1fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
}
.rank { color: var(--accent); font-weight: 900; font-size: 14px; }
.team { overflow-wrap: anywhere; font-weight: 800; line-height: 1.45; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); line-height: 1.7; }
.loading { opacity: .65; }

.notice { margin: 10px 0 72px; padding: 24px; }
.notice h2 { margin: 0 0 12px; font-size: 20px; }
.notice p { margin: 8px 0; color: var(--muted); line-height: 1.7; }
.notice a { color: var(--accent); font-weight: 800; }
.footer { padding: 24px 0 42px; text-align: center; color: #7c879d; font-size: 13px; }
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #111827;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(251,113,133,.45); color: #fecdd3; }

/* 관리자 */
.admin-body { background: #080d17; }
.admin-shell { width: min(1260px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 60px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.admin-title h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); letter-spacing: -.04em; }
.admin-title p { margin: 7px 0 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-card { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.admin-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.summary-box { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); }
.summary-box span { display: block; color: var(--muted); font-size: 12px; }
.summary-box strong { display: block; margin-top: 7px; font-size: 24px; }
.summary-confirmed strong { color: #bbf7d0; }
.summary-waiting strong { color: var(--accent); }
.tabs { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-weight: 900; }
.tab.active { background: rgba(103,232,249,.1); border-color: rgba(103,232,249,.35); color: var(--text); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 860px; border-collapse: collapse; }
.admin-table th { padding: 13px 10px; color: var(--muted); font-size: 12px; text-align: left; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.16); }
.admin-table td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table input, .admin-table select {
  width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: rgba(0,0,0,.22); color: var(--text); outline: none;
}
.admin-table input:focus, .admin-table select:focus { border-color: rgba(103,232,249,.5); box-shadow: 0 0 0 3px rgba(103,232,249,.08); }
.order-cell { width: 64px; text-align: center; color: var(--accent); font-weight: 900; }
.action-cell { width: 150px; }
.row-actions { display: flex; gap: 5px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.04); color: var(--text); }
.icon-btn:hover { border-color: rgba(103,232,249,.42); }
.table-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px; border-top: 1px solid var(--line); }
.save-state { color: var(--muted); font-size: 13px; }
.save-state.dirty { color: var(--warning); }

.login-screen {
  position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 10%, rgba(103,232,249,.13), transparent 26rem), #080d17;
}
.login-screen[hidden] { display: none; }
.login-box { width: min(420px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: #111a2b; box-shadow: var(--shadow); }
.login-box h1 { margin: 0 0 8px; font-size: 28px; }
.login-box p { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }
.login-box input { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: rgba(0,0,0,.25); color: var(--text); outline: none; }
.login-box .btn { width: 100%; margin-top: 10px; }
.login-error { min-height: 22px; margin-top: 10px; color: #fecdd3; font-size: 13px; }
.hidden-input { display: none; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1120px); }
  .hero { padding-top: 48px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .panel { border-radius: 19px; }
  .panel-head { align-items: flex-start; padding: 20px 18px 15px; }
  .division-counts { max-width: 180px; }
  .count { min-height: 28px; padding-inline: 9px; font-size: 12px; }
  .waitlist { padding-inline: 9px; }
  .notice { margin-bottom: 46px; padding: 20px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar { width: 100%; }
  .toolbar .btn { flex: 1; }
  .table-footer { align-items: stretch; flex-direction: column; }
  .table-footer .btn { width: 100%; }
}

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