:root {
  --bg: #F4F1EA; --surface: #FFFFFF; --text: #1C1C1E; --muted: #6B6B70;
  --line: #E4E0D6; --accent: #FEE500; --accent-text: #191600; --chat: #B9CCE0;
  --bubble: #FFFFFF; --mine: #FEE500;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121214; --surface: #1E1E22; --text: #F2F2F5; --muted: #9A9AA2;
    --line: #2E2E34; --chat: #23282F; --bubble: #2E333B; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent; }
#app { max-width: 460px; margin: 0 auto; padding: 24px 16px 48px; min-height: 100dvh; }
.hidden { display: none !important; }
.screen { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

h1 { font-size: 34px; line-height: 1.2; margin: 8px 0 12px; letter-spacing: -0.5px; }
h2 { font-size: 24px; margin: 8px 0; }
.sub { color: var(--muted); margin: 0 0 20px; line-height: 1.5; }
.tiny { color: var(--muted); font-size: 12px; text-align: center; }
.bubble-deco { font-size: 56px; margin-top: 24px; }

.field { display: block; margin: 20px 0 16px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.field input { width: 100%; font-size: 17px; padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); outline: none; }
.field input:focus { border-color: #E0C800; }

.btn { display: block; width: 100%; padding: 16px; font-size: 16px; font-weight: 700;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; margin-top: 10px; font-family: inherit; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.ghost { background: transparent; border-style: dashed; }

.invite { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px 16px; line-height: 1.5; font-size: 15px; }
.invite b { color: #C9A800; }
@media (prefers-color-scheme: dark) { .invite b { color: var(--accent); } }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.qnum { color: var(--muted); font-size: 14px; margin: 14px 0 8px; }
.chat { background: var(--chat); border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.msg .who { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.msg p { margin: 0; background: var(--bubble); padding: 12px 14px; border-radius: 4px 16px 16px 16px;
  font-size: 17px; line-height: 1.45; font-weight: 600; display: inline-block; }
.choices .btn { text-align: left; font-weight: 500; }
.choices .btn:hover { border-color: #E0C800; }

.card { border-radius: 24px; padding: 28px 22px; color: #fff; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.card .tag { font-size: 13px; opacity: .85; }
.card .emoji { font-size: 72px; margin: 10px 0 4px; }
.card .name { font-size: 30px; font-weight: 800; margin: 0; }
.card .line { display: inline-block; background: rgba(255,255,255,.22); padding: 8px 14px;
  border-radius: 16px; margin: 12px 0; font-weight: 600; }
.card .desc { line-height: 1.6; font-size: 15px; margin: 6px 0 16px; }
.card .pair { background: rgba(0,0,0,.15); border-radius: 14px; padding: 10px; font-size: 14px; line-height: 1.6; }

.room-list { display: grid; gap: 10px; }
.member { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.member .em { font-size: 30px; width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; flex: none; }
.member .nm { font-weight: 800; font-size: 16px; }
.member .rl { color: var(--muted); font-size: 14px; }
.member.me { border-color: #E0C800; }
.empty { background: var(--surface); border: 1.5px dashed var(--line); border-radius: 16px;
  padding: 14px; color: var(--muted); font-size: 14px; line-height: 1.6; margin-top: 10px; }
.actions { margin-top: 18px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1C1C1E; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; transition: .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gcard { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 12px;
  text-align: left; cursor: pointer; color: var(--text); font-family: inherit; }
.gcard .ge { font-size: 30px; }
.gcard .gn { font-weight: 800; font-size: 15px; margin: 6px 0 2px; }
.gcard .gl { color: var(--muted); font-size: 13px; line-height: 1.4; }
.gcard .gd { display: none; font-size: 13px; line-height: 1.5; margin-top: 8px; }
.gcard.open { grid-column: 1 / -1; }
.gcard.open .gd { display: block; }
.gcard.mine { border-color: #E0C800; }

/* 디스코드 모드 */
body.dc { --accent: #5865F2; --accent-text: #fff; --chat: #DDE0F0; }
@media (prefers-color-scheme: dark) {
  body.dc { --bg: #1E1F22; --surface: #2B2D31; --line: #3A3C42; --chat: #313338; --bubble: #383A40; }
}
body.dc .field input:focus, body.dc .member.me, body.dc .gcard.mine, body.dc .choices .btn:hover { border-color: #5865F2; }
body.dc .invite b { color: #5865F2; }
@media (prefers-color-scheme: dark) { body.dc .invite b { color: #949CF7; } }

/* 궁합 */
.compat { margin-top: 18px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px; }
.compat h3 { margin: 0 0 10px; font-size: 18px; }
.duo { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.duo:last-child { border-bottom: 0; }
.duo b { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px;
  padding: 8px 12px; font-size: 14px; cursor: pointer; font-family: inherit; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.compat-result { margin-top: 12px; text-align: center; padding: 14px; border-radius: 14px; background: var(--bg); }
.compat-result .pct { font-size: 40px; font-weight: 800; margin: 4px 0; }
.compat-result p { margin: 4px 0; line-height: 1.5; font-size: 14px; color: var(--muted); }
.links { display: grid; gap: 8px; margin-top: 18px; }
.links a { display: block; text-decoration: none; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 15px; }
.links a small { display: block; color: var(--muted); margin-top: 2px; }

/* 밸런스 게임 */
.vs { display: grid; gap: 10px; }
.vs .btn { text-align: center; padding: 22px 14px; font-size: 17px; line-height: 1.4; }
.vs .or { text-align: center; color: var(--muted); font-weight: 800; }
.split { margin: 10px 0; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.split .q { font-weight: 700; margin-bottom: 8px; }
.split .bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; font-size: 12px; font-weight: 700; }
.split .bar div { display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.split .a { background: var(--accent); color: var(--accent-text); }
.split .b { background: var(--line); color: var(--text); justify-content: flex-end; }
.split .who { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.5; }

.peek { margin: 10px 0; display: grid; gap: 6px; }
.peek div { background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.peek span { color: var(--muted); font-size: 13px; }
.peek .more { color: var(--muted); text-align: center; background: none; padding: 0; }
