/* ==========================================================================
   제비뽑기 — design tokens
   ========================================================================== */
:root {
  --bg: #F3EEE4;
  --bg-dot: #E4DCCB;
  --card: #FFFCF6;
  --ink: #1E1A15;
  --ink-2: #4A433A;
  --muted: #8A8072;
  --line: #E4DBCB;
  --line-strong: #CFC3AE;
  --accent: #D9472B;
  --accent-hover: #C23A20;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE3DB;
  --slip: #FFFDF8;
  --slip-shade: #EDE4D3;
  --jar: #2E6B57;
  --jar-dark: #23523F;
  --jar-band: #E3AE3A;
  --focus: #2F6FEB;
  --shadow-sm: 0 1px 2px rgba(70, 48, 20, .08), 0 2px 6px -2px rgba(70, 48, 20, .12);
  --shadow: 0 1px 2px rgba(70, 48, 20, .06), 0 12px 32px -16px rgba(70, 48, 20, .28);
  --radius: 18px;
  --radius-sm: 10px;
  --t0: #D9472B; --t1: #2E6B57; --t2: #3E63B8; --t3: #C98A12;
  --t4: #8A4FB5; --t5: #1D8A9A; --t6: #B8436F; --t7: #5C6B2E;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130F; --bg-dot: #24201A; --card: #1F1B16; --ink: #F2EBDF; --ink-2: #D2C8B8;
    --muted: #978C7C; --line: #332D25; --line-strong: #4A4237; --accent: #F0674A;
    --accent-hover: #FF7C60; --accent-ink: #1A0D08; --accent-soft: #3A211A; --slip: #2A251E;
    --slip-shade: #3A3329; --jar: #3F8C72; --jar-dark: #2E6B57; --jar-band: #E3AE3A; --focus: #7FA6FF;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 12px 32px -16px rgba(0,0,0,.7);
    --t0: #F0674A; --t1: #4DAE8C; --t2: #7C9BEA; --t3: #E3AE3A;
    --t4: #B387DA; --t5: #4FC1D0; --t6: #E07AA0; --t7: #A3B860;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15130F; --bg-dot: #24201A; --card: #1F1B16; --ink: #F2EBDF; --ink-2: #D2C8B8;
  --muted: #978C7C; --line: #332D25; --line-strong: #4A4237; --accent: #F0674A;
  --accent-hover: #FF7C60; --accent-ink: #1A0D08; --accent-soft: #3A211A; --slip: #2A251E;
  --slip-shade: #3A3329; --jar: #3F8C72; --jar-dark: #2E6B57; --jar-band: #E3AE3A; --focus: #7FA6FF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 12px 32px -16px rgba(0,0,0,.7);
  --t0: #F0674A; --t1: #4DAE8C; --t2: #7C9BEA; --t3: #E3AE3A;
  --t4: #B387DA; --t5: #4FC1D0; --t6: #E07AA0; --t7: #A3B860;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  line-height: 1.55;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--slip-shade); padding: .05em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1140px; margin: 0 auto; padding: 14px 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* 가운데 정렬된 바의 배경을 화면 전체 폭으로 확장 */
  border-image: linear-gradient(color-mix(in srgb, var(--bg) 82%, transparent) 0 0) fill 0 // 0 100vw;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.seal {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-ink) 35%, transparent);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.topbar-actions { display: flex; gap: 8px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 650; font-size: 15px;
  transition: background-color .15s, border-color .15s, transform .1s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -8px var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.btn-icon { width: 42px; padding: 0; background: var(--card); border-color: var(--line); }
.btn-xl { height: 56px; padding: 0 40px; font-size: 18px; border-radius: 16px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ==========================================================================
   Hero + tabs
   ========================================================================== */
.hero { padding: 28px 0 24px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 46px); line-height: 1.15; letter-spacing: -.045em; font-weight: 850; }
.hero h1 em {
  font-style: normal; color: var(--accent);
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
}
.hero p { margin: 0; color: var(--muted); font-size: 16px; }

.tabs {
  position: relative; display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.tab {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 18px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 15px;
  transition: color .2s;
}
.tab[aria-selected="true"] { color: var(--accent-ink); }
.tab:hover:not([aria-selected="true"]) { color: var(--ink); }
.tab-emoji { font-size: 16px; }
.tab-indicator {
  position: absolute; top: 5px; bottom: 5px; left: 0; width: 0;
  background: var(--ink); border-radius: 12px;
  transition: transform .35s cubic-bezier(.3, 1.3, .5, 1), width .35s cubic-bezier(.3, 1.3, .5, 1);
}
:root[data-theme="dark"] .tab[aria-selected="true"] { color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-selected="true"] { color: var(--bg); } }

/* ==========================================================================
   Panels + cards
   ========================================================================== */
.panel { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; animation: fade-up .35s ease both; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-title { margin: 0 0 16px; font-size: 17px; letter-spacing: -.02em; }
.mini-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.settings { padding: 20px; position: sticky; top: 76px; }
.stage { padding: 20px; min-height: 420px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.field label small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field input[type="text"], .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field input[type="text"]:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { margin: 0; font-size: 13px; color: var(--muted); min-height: 1.2em; }
.hint.is-error { color: var(--accent); }

.stepper { display: grid; grid-template-columns: 42px 1fr 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; }
.stepper button { border: 0; background: transparent; font-size: 20px; color: var(--ink-2); }
.stepper button:hover { background: var(--slip-shade); }
.stepper input { width: 100%; min-width: 0; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: transparent; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 8px; text-align: center; border-radius: 9px; font-size: 14px; font-weight: 650; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); }

.switch { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; flex: none; width: 40px; height: 24px; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

.settings-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* ==========================================================================
   뽑기판 (slip board)
   ========================================================================== */
.stage-head { margin-bottom: 18px; }
.status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 10px; font-size: 15px; color: var(--muted); }
.status b { color: var(--ink); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.status .accent b { color: var(--accent); }
.status .done { color: var(--accent); font-weight: 700; }
.progress { height: 6px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }

.slip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.slip {
  position: relative; aspect-ratio: 3 / 4; padding: 0; border: 0; background: none;
  perspective: 900px; transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease;
  animation: drop-in .5s cubic-bezier(.2, 1.2, .4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 22ms);
  -webkit-tap-highlight-color: transparent;
}
.slip:hover:not(.is-open) { transform: rotate(0) translateY(-4px); }
.slip:hover:not(.is-open) .front { box-shadow: var(--shadow); }
.slip.is-open { cursor: default; transform: rotate(0); }
.slip-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.slip.is-open .slip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
}
.front {
  background:
    linear-gradient(135deg, transparent 0 calc(100% - 18px), var(--slip-shade) calc(100% - 18px)) ,
    linear-gradient(180deg, var(--slip) 0 49%, var(--slip-shade) 49.6% 50.4%, var(--slip) 51%);
  transition: box-shadow .2s;
}
.front::after { /* 접힌 귀퉁이 */
  content: ""; position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
  background: linear-gradient(315deg, var(--bg) 0 50%, transparent 50%);
  border-bottom-right-radius: var(--radius-sm);
}
.slip-no {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px dashed var(--line-strong); color: var(--muted);
  font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
}
.back { transform: rotateY(180deg); background: var(--slip); padding: 8px; text-align: center; }
.slip.is-win .back { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.slip.is-lose .back { color: var(--muted); }
.back-no { position: absolute; top: 6px; left: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.lose-text { font-size: 20px; font-weight: 800; transform: rotate(-4deg); }
.stamp {
  display: grid; place-items: center; padding: 6px;
  border: 3px solid var(--accent); color: var(--accent);
  font-weight: 850; letter-spacing: -.03em; line-height: 1.2;
  transform: rotate(-12deg);
  animation: stamp .45s .38s cubic-bezier(.3, 1.6, .5, 1) backwards;
}
.stamp.round { width: 72%; aspect-ratio: 1; border-radius: 50%; font-size: 20px; box-shadow: inset 0 0 0 2px var(--accent-soft), inset 0 0 0 3px var(--accent); }
.stamp.rect { max-width: 92%; border-radius: 8px; font-size: 14px; }

.board-log-wrap { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); }
.board-log { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; min-height: 30px; }
.board-log li { padding: 4px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); animation: pop .3s ease backwards; }
.board-log li.win { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 700; }
.board-log .empty-log { color: var(--muted); background: none; border: 0; padding: 4px 0; }

/* ==========================================================================
   이름 뽑기
   ========================================================================== */
.names-stage { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.jar-area { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.jar { width: 190px; height: auto; overflow: visible; transform-origin: 50% 90%; }
.jar-inner { fill: var(--jar-dark); }
.jar-slips rect { fill: #F6EFE1; stroke: #CFC3AE; stroke-width: 1.2; }
.jar-body { fill: var(--jar); }
.jar-rim { fill: none; stroke: color-mix(in srgb, #fff 30%, var(--jar)); stroke-width: 3; }
.jar-band { fill: none; stroke: var(--jar-band); stroke-width: 6; stroke-linecap: round; }
.jar-seal { fill: var(--accent); transform: rotate(-6deg); transform-origin: 100px 152px; }
.jar-seal-text { fill: var(--accent-ink); font-size: 16px; font-weight: 800; transform: rotate(-6deg); transform-origin: 100px 152px; }
.jar.shaking { animation: shake .16s ease-in-out infinite alternate; }
.jar.shaking .jar-slips { animation: jiggle .12s ease-in-out infinite alternate; }

.ticker { height: 40px; font-size: 26px; font-weight: 850; letter-spacing: -.03em; color: var(--ink); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker.is-rolling { color: var(--muted); filter: blur(.4px); }

.names-result { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.result-papers { display: flex; flex-wrap: wrap; gap: 12px; min-height: 120px; align-content: flex-start; }
.result-papers .empty { width: 100%; }
.paper {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  min-width: 140px; padding: 18px 22px 16px; border-radius: 6px;
  background: var(--slip); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: unroll .6s cubic-bezier(.2, .9, .3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 140ms);
}
.paper::before, .paper::after { content: ""; position: absolute; top: -1px; bottom: -1px; width: 8px; background: var(--slip-shade); border: 1px solid var(--line); }
.paper::before { left: -6px; border-radius: 6px 0 0 6px; }
.paper::after { right: -6px; border-radius: 0 6px 6px 0; }
.paper-no { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .06em; }
.paper-name { font-size: 26px; font-weight: 850; letter-spacing: -.03em; line-height: 1.25; word-break: break-all; }

.history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.history li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.history .h-round { flex: none; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.history .h-time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.history .h-names { color: var(--ink); font-weight: 600; }
.history .empty-log { background: none; padding: 0; color: var(--muted); }

/* ==========================================================================
   팀 나누기
   ========================================================================== */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.team {
  --c: var(--t0);
  border-radius: 14px; background: var(--bg); border: 1px solid var(--line); overflow: hidden;
  animation: fade-up .45s cubic-bezier(.2, 1.1, .4, 1) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.team-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 5px solid var(--c); }
.team-name { font-weight: 850; font-size: 17px; color: var(--c); letter-spacing: -.02em; }
.team-size { font-size: 12px; color: var(--muted); font-weight: 600; }
.team ul { margin: 0; padding: 0 10px 12px; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.team li { padding: 5px 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; animation: pop .3s ease backwards; animation-delay: calc(var(--i, 0) * 70ms + var(--j, 0) * 40ms + 150ms); }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 48px 16px; color: var(--muted); text-align: center; grid-column: 1 / -1; }
.empty p { margin: 0; }
.empty-emoji { font-size: 34px; }

/* ==========================================================================
   마니또
   ========================================================================== */
.rules { margin: 0 0 16px; padding: 12px 14px 12px 30px; border-radius: var(--radius-sm); background: var(--bg); font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.status .warn { color: var(--accent); font-weight: 700; }

.manitto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.m-card {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
  animation: fade-up .4s ease backwards; animation-delay: calc(var(--i, 0) * 35ms);
}
.m-avatar {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800;
}
.m-card.is-checked .m-avatar { background: var(--jar); color: #fff; }
.m-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-name { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.m-card.is-checked .m-state { color: var(--jar); font-weight: 650; }
.m-actions { display: flex; gap: 6px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-sm.btn-icon { width: 34px; padding: 0; }
.btn-sm svg { width: 16px; height: 16px; }

.manitto-chain { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); animation: fade-up .35s ease both; }
.m-chain { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.m-chain li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.m-chain .arrow { color: var(--accent); font-weight: 800; }

.m-dialog {
  width: min(400px, calc(100vw - 32px)); padding: 32px 24px 24px;
  border: 1px solid var(--line); border-radius: 24px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); text-align: center;
}
.m-dialog[open] { animation: dialog-in .35s cubic-bezier(.2, 1.2, .4, 1); }
.m-dialog::backdrop { background: rgb(20 16 10 / .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.m-step { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.m-step h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.m-step p { margin: 0; color: var(--muted); }
.m-step .btn { width: 100%; }
.m-emoji { font-size: 44px; line-height: 1; }
.m-paper { align-items: center; min-width: 220px; margin: 10px 0 6px; }
.m-paper .paper-name { font-size: 34px; }

/* 비대면(링크) 모드 */
.steps { margin: 0 0 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.step .field { margin-bottom: 0; }
.step .field input[type="text"], .step .field textarea { background: var(--card); }
.step-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; letter-spacing: -.02em; }
.step-no { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 800; }
.btn-block { width: 100%; }
.m-card.is-warn { border-color: var(--accent); }
.m-card.is-warn .m-state { color: var(--accent); font-weight: 650; }
.secure-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; padding: 14px 16px; border-radius: 14px; background: var(--bg); font-size: 13px; color: var(--ink-2); }
.secure-note p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.join-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.join-form input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 12px; text-align: center; font-size: 18px; font-weight: 700;
  background: var(--bg); border: 1px solid var(--line); outline: none;
}
.join-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-box {
  display: block; width: 100%; max-height: 96px; overflow: auto; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px dashed var(--line-strong); font-size: 12px; line-height: 1.5; text-align: left;
  word-break: break-all; user-select: all; -webkit-user-select: all;
}
.notice { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2) !important; font-size: 13px; text-align: left; }
.m-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.m-event { font-size: 13px; font-weight: 700; color: var(--accent) !important; }
.m-event:empty { display: none; }
.n-message { line-height: 1.7; }

/* ==========================================================================
   Footer, toast, confetti
   ========================================================================== */
.footer { padding-top: 36px; padding-bottom: 40px; color: var(--muted); font-size: 13px; text-align: center; }
.footer p { margin: 4px 0; }
.footer a { color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-14px) rotate(calc(var(--tilt, 0deg) * 4)); } }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }
@keyframes stamp { from { opacity: 0; transform: scale(2.3) rotate(-12deg); } }
@keyframes unroll { from { opacity: 0; clip-path: inset(0 50% 0 50%); transform: translateY(-16px); } to { clip-path: inset(0 -10px 0 -10px); } }
@keyframes shake { from { transform: rotate(-6deg) translateX(-3px); } to { transform: rotate(6deg) translateX(3px); } }
@keyframes jiggle { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .names-stage { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .panel { grid-template-columns: 1fr; }
  .settings { position: static; }
  .br-desktop { display: none; }
}
@media (max-width: 520px) {
  .wrap, .topbar { padding-left: 16px; padding-right: 16px; }
  .topbar-actions .btn-ghost span { display: none; }
  .topbar-actions .btn-ghost { width: 42px; padding: 0; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 0 4px; font-size: 14px; }
  .tab-emoji { display: none; }
  .stage, .settings { padding: 16px; }
  .slip-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
  .stamp.round { font-size: 16px; }
  .stamp.rect { font-size: 12px; }
  .paper { min-width: 0; flex: 1 1 120px; }
}
