:root {
  --bg: #12141c;
  --card: #1c1f2b;
  --card-2: #262a3a;
  --text: #eef0f5;
  --text-dim: #9aa0b4;
  --accent: #ff7a59;
  --accent-2: #ffd166;
  --good: #4ade80;
  --bad: #4b5163;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f4f0;
    --card: #ffffff;
    --card-2: #f1eee8;
    --text: #201f24;
    --text-dim: #6b6f7d;
    --shadow: 0 8px 24px rgba(30, 20, 10, 0.08);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 18px 32px;
}

.screen.wide { max-width: 960px; }

.brand {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

h1 { font-size: 24px; margin: 0 0 8px; line-height: 1.3; }
h2 { font-size: 19px; margin: 0 0 10px; line-height: 1.35; }
p.lead { color: var(--text-dim); font-size: 14px; margin: 0 0 20px; line-height: 1.6; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }

input[type=text], input[type=number], input[type=password], input[type=tel] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-2);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff9f6b); color: #1a0f08; }
.btn-secondary { background: var(--card-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--card-2); }
.btn-danger { background: var(--danger); color: #2a0808; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.round-select { display: flex; gap: 8px; }
.round-pill {
  flex: 1;
  padding: 14px 0;
  border-radius: 12px;
  border: 2px solid var(--card-2);
  background: var(--card-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.round-pill.selected { border-color: var(--accent); background: rgba(255, 122, 89, 0.14); color: var(--accent); }

.choice-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.choice-btn {
  text-align: left;
  padding: 16px 16px;
  border-radius: 14px;
  border: 2px solid var(--card-2);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  min-height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.choice-btn .idx {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--card-2); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.choice-btn.selected { border-color: var(--accent); background: rgba(255, 122, 89, 0.12); }
.choice-btn.selected .idx { background: var(--accent); color: #1a0f08; }
.choice-btn[disabled] { opacity: 0.7; cursor: default; }

.choice-bar-row { margin-bottom: 12px; }
.choice-bar-row .label { font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; color: var(--text-dim); }
.choice-bar-track { height: 14px; border-radius: 8px; background: var(--card-2); overflow: hidden; }
.choice-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 8px; transition: width 0.4s ease; }

.progress-wrap { margin-top: auto; padding-top: 18px; }
.progress-label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; text-align: center; }
.progress-track { height: 16px; border-radius: 10px; background: var(--card-2); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s ease; }

.my-answers { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.my-answers .row { display: flex; gap: 8px; font-size: 13px; color: var(--text-dim); background: var(--card); border-radius: 10px; padding: 8px 10px; }
.my-answers .row b { color: var(--text); }

.pill { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--card-2); font-size: 12px; color: var(--text-dim); }
.pill.accent { background: rgba(255, 122, 89, 0.16); color: var(--accent-2); }

.center-msg { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.center-msg .big { font-size: 40px; }

/* 추첨 연출 */
.draw-stage {
  position: relative;
  height: 320px;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  margin: 16px 0;
}
.draw-ball {
  position: absolute;
  top: -60px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  animation: fall linear forwards;
}
@keyframes fall {
  to { top: 340px; }
}
.draw-winner-pop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: radial-gradient(circle, rgba(255,122,89,0.25), transparent 70%);
  animation: pop-in 0.5s ease;
}
@keyframes pop-in {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.draw-winner-pop .name { font-size: 26px; font-weight: 800; color: var(--accent-2); }

/* 로또 맞대조 연출 */
.compare-grid { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.compare-ball {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
  background: var(--card-2); color: var(--text-dim);
  opacity: 0; transform: scale(0.4);
  animation: ball-in 0.4s ease forwards;
}
.compare-ball.match { background: var(--good); color: #052e12; }
@keyframes ball-in { to { opacity: 1; transform: scale(1); } }

/* 빙고/최종 순위 */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--card); margin-bottom: 8px; }
.rank-row .rank-num { width: 30px; text-align: center; font-weight: 800; color: var(--text-dim); }
.rank-row.top .rank-num { color: var(--accent-2); }
.rank-row .who { flex: 1; }
.rank-row .who .team { font-size: 12px; color: var(--text-dim); }
.rank-row .score { font-weight: 800; color: var(--accent); }

/* 진행자 대시보드 */
.host-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 860px) { .host-grid { grid-template-columns: 1fr; } }
.participant-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.participant-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); font-size: 14px; }
.participant-row input[type=checkbox] { width: 18px; height: 18px; }
.participant-row .name { flex: 1; }
.participant-row .team-tag { font-size: 11px; color: var(--text-dim); }

.share-box { display: flex; gap: 8px; }
.share-box input { flex: 1; }

.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.top-bar .brand { margin-bottom: 0; }

a.link-reset { color: var(--accent-2); text-decoration: none; font-size: 13px; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }
