:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --text: #1f1b16;
  --muted: #6f665b;
  --line: #e6dfd4;
  --accent: #e8573c;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e2;
  --ok: #2f8f5b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 27, 22, 0.06), 0 6px 20px rgba(31, 27, 22, 0.06);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f;
    --surface: #1f1b17;
    --surface-2: #2a251f;
    --text: #f3ede4;
    --muted: #a99f92;
    --line: #3a332b;
    --accent: #ff7a5c;
    --accent-ink: #1a0e0a;
    --accent-soft: #3a211a;
    --ok: #5fc48c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: inherit; }
.wrap { max-width: 520px; margin: 0 auto; padding: 20px 16px 96px; }
.wrap.wide { max-width: 960px; }
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 12px; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.3; margin: 28px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; font-size: 17px;
  cursor: pointer; text-decoration: none;
  transition: transform 0.06s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.line { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { min-height: 40px; font-size: 15px; width: auto; padding: 8px 14px; }

label.field { display: block; margin: 14px 0; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 13px 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button {
  font-size: 22px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
}
.emoji-grid button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }

.kit-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .kit-grid { grid-template-columns: 1fr 1fr; } }
.kit {
  display: block; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; font: inherit; color: inherit; cursor: pointer;
}
.kit[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.kit.soon { opacity: 0.55; cursor: default; }
.kit .em { font-size: 28px; }
.kit .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; vertical-align: middle; }

.phase-chip { display: inline-block; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.big-code { font-size: 40px; font-weight: 800; letter-spacing: 6px; text-align: center; margin: 8px 0; }
.qr { display: block; width: 220px; height: 220px; margin: 8px auto; border-radius: 12px; background: #fff; padding: 8px; }

.question { font-size: 24px; font-weight: 800; line-height: 1.35; margin: 12px 0 18px; letter-spacing: -0.01em; }
.opt {
  display: block; width: 100%; text-align: left; min-height: 64px; padding: 16px 18px; margin: 10px 0;
  border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; position: relative; overflow: hidden;
}
.opt[aria-pressed=true] { border-color: var(--accent); }
.opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); z-index: 0; transition: width 0.4s ease; }
.opt .lbl { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 10px; }
.opt .n { color: var(--muted); font-weight: 700; }

.topic { font-size: 22px; font-weight: 700; line-height: 1.4; padding: 26px 18px; text-align: center; }
.timer { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); }

.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 15px; }
.pick-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; margin: 8px 0; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.pick-list button[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }

.host-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.host-panel .inner { max-width: 520px; margin: 0 auto; }
.host-panel .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.host-panel .row .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.conn { position: fixed; top: 10px; right: 12px; font-size: 12px; color: var(--muted); z-index: 30; }

.dist-q { margin: 14px 0; }
.dist-q .q { font-weight: 700; margin-bottom: 6px; }
.dist-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 15px; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 2px 0 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font-size: 28px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }

.hero { padding: 36px 0 8px; }
.hero h1 { font-size: 34px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 18px 44px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; }
details { border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { cursor: pointer; font-weight: 700; }
footer { margin-top: 48px; color: var(--muted); font-size: 13px; text-align: center; }
