* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --blue: #3182f6; --blue-dark: #1b64da; --bg: #f2f4f6; --card: #ffffff;
  --text: #191f28; --text2: #4e5968; --text3: #8b95a1; --line: #e5e8eb;
  --gold: #f5a623; --red: #f04452; --green: #04c159;
  --radius: 20px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: #dde1e6; color: var(--text);
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; box-shadow: 0 0 40px rgba(0,0,0,.12); }
.hidden { display: none !important; }
button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, textarea { font-family: inherit; }

/* ---------- 인증 ---------- */
.auth-view { padding: 60px 24px 40px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 32px; }
.auth-hero { text-align: center; }
.auth-logo { font-size: 64px; margin-bottom: 12px; }
.auth-hero h1 { font-size: 32px; font-weight: 800; }
.auth-hero h1 span { color: var(--blue); }
.auth-hero p { margin-top: 10px; color: var(--text2); font-size: 15px; line-height: 1.5; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
/* 카카오 간편 로그인 (카카오 브랜드 가이드: 노란 배경 #FEE500 + 검정 텍스트) */
.btn-kakao { background: #FEE500; color: #191600; padding: 16px; border-radius: 14px; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; transition: filter .15s; }
.btn-kakao:active { filter: brightness(.93); }
.kakao-icon { font-size: 19px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 6px 0; color: var(--text3); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 8px; }
.auth-tab { flex: 1; padding: 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text3); }
.auth-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.auth-card input { padding: 15px 16px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 15px; outline: none; }
.auth-card input:focus { border-color: var(--blue); }
.auth-error { color: var(--red); font-size: 13px; min-height: 16px; text-align: center; }
.auth-note { color: var(--text3); font-size: 12px; text-align: center; line-height: 1.6; }
.auth-note a, .mi-links a { color: var(--text3); text-decoration: underline; }
.mi-links { text-align: center; font-size: 12.5px; color: var(--text3); margin-top: 14px; }

.btn-primary { background: var(--blue); color: #fff; padding: 16px; border-radius: 14px; font-size: 16px; font-weight: 700; transition: background .15s; }
.btn-primary:active { background: var(--blue-dark); }
.btn-primary:disabled { background: #b0c9f0; }
.btn-lg { font-size: 17px; padding: 18px; width: 100%; }
.btn-small { background: var(--bg); color: var(--blue); padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.btn-ghost { color: var(--text3); margin-left: auto; }
.btn-outline { border: 1.5px solid var(--blue); color: var(--blue); padding: 12px; border-radius: 12px; font-size: 15px; font-weight: 700; width: 100%; background: #fff; }

/* ---------- 상단바 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(242,244,246,.92); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.topbar-brand { font-size: 19px; font-weight: 800; }
.icon-btn { font-size: 20px; position: relative; padding: 4px; }
.badge { position: absolute; top: 0; right: -4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 5px; min-width: 16px; text-align: center; }

.banner-notice { margin: 0 20px 4px; background: #e8f1fe; color: var(--blue-dark); padding: 12px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 600; }

/* ---------- 뷰 공통 ---------- */
.view { padding: 8px 20px 100px; }
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }

/* ---------- 홈 ---------- */
.wallet-card { background: var(--card); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; margin-bottom: 14px; }
.wallet-item { flex: 1; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.wallet-label { font-size: 13px; color: var(--text2); font-weight: 600; }
.wallet-value { font-size: 26px; font-weight: 800; }
.wallet-value.gold { color: var(--gold); }
.wallet-divider { width: 1px; height: 40px; background: var(--line); }
.filter-row { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.chip { background: var(--card); color: var(--text2); padding: 9px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.chip.active { background: var(--text); color: #fff; }
.room-list { display: flex; flex-direction: column; gap: 12px; }

/* 당첨 확인하기 카드 (미확인 추첨 결과 — 열기 전까지 결과 비공개) */
.result-card { background: linear-gradient(120deg, #4f46e5, #3182f6 55%, #6d9ff9); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; color: #fff; position: relative; overflow: hidden; transition: transform .1s; }
.result-card:active { transform: scale(.985); }
.result-card::after { content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(105deg, transparent, rgba(255,255,255,.28), transparent); animation: shine 2.4s ease-in-out infinite; }
@keyframes shine { 0% { left: -60%; } 60%, 100% { left: 120%; } }
.result-orb { font-size: 30px; width: 52px; height: 52px; background: rgba(255,255,255,.18); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; animation: orbPulse 1.6s ease-in-out infinite; }
@keyframes orbPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.result-info { flex: 1; min-width: 0; }
.result-title { font-size: 15px; font-weight: 800; }
.result-sub { font-size: 12.5px; opacity: .85; margin-top: 2px; }
.result-cta { background: #fff; color: var(--blue-dark); font-size: 12.5px; font-weight: 800; padding: 8px 12px; border-radius: 11px; white-space: nowrap; }
.room-card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .1s; }
.room-card:active { transform: scale(.985); }
.room-top { display: flex; align-items: center; gap: 14px; }
.room-emoji { font-size: 36px; width: 56px; height: 56px; background: var(--bg); border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.room-info { flex: 1; min-width: 0; }
.room-brand { font-size: 12.5px; color: var(--text3); font-weight: 600; }
.room-name { font-size: 16px; font-weight: 700; margin: 1px 0 3px; }
.room-meta { font-size: 12.5px; color: var(--text2); }
.room-pct { font-size: 21px; font-weight: 800; color: var(--blue); text-align: right; }
.room-pct.hot { color: var(--red); }
.room-pct small { display: block; font-size: 11px; color: var(--text3); font-weight: 600; }
.gauge { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.gauge-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #6ea8ff); border-radius: 5px; transition: width .5s ease; }
.gauge-fill.hot { background: linear-gradient(90deg, #ff6b3d, var(--red)); }
.room-badges { display: flex; gap: 6px; }
.mini-badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 8px; background: var(--bg); color: var(--text2); }
.mini-badge.mine { background: #e8f1fe; color: var(--blue); }
.mini-badge.vip { background: #fef3e0; color: var(--gold); }

/* ---------- 충전소 ---------- */
.charge-hero { background: var(--card); border-radius: var(--radius); padding: 28px 24px; text-align: center; margin-bottom: 14px; }
.charge-title { font-size: 16px; font-weight: 700; color: var(--text2); }
.charge-count { font-size: 36px; font-weight: 800; color: var(--blue); margin: 8px 0 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; font-size: 15.5px; font-weight: 700; margin-bottom: 14px; }
.attendance-row { display: flex; gap: 6px; }
.att-day { flex: 1; aspect-ratio: 1; border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--text3); font-weight: 600; gap: 2px; }
.att-day b { font-size: 13px; color: var(--text2); }
.att-day.done { background: #e8f1fe; color: var(--blue); }
.att-day.done b { color: var(--blue); }
.invite-count { font-size: 12.5px; color: var(--text3); font-weight: 600; }
.invite-desc { font-size: 13.5px; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.invite-row { display: flex; gap: 10px; align-items: center; }
.invite-code { flex: 1; background: var(--bg); border: 1.5px dashed var(--blue); border-radius: 12px; padding: 12px; text-align: center; font-size: 20px; font-weight: 800; letter-spacing: 4px; color: var(--blue); }
.gacha-canvas { width: 100%; height: 110px; background: linear-gradient(180deg, #eef3fa, #e3ecf7); border-radius: 14px; display: block; margin-bottom: 4px; }
.ow-title { font-size: 16px; font-weight: 800; }
.ow-desc { font-size: 14px; color: var(--text2); margin: 6px 0 14px; }
.ow-desc b { color: var(--blue); }
.ow-note { font-size: 11.5px; color: var(--text3); margin-top: 10px; text-align: center; }

/* ---------- 명예의 전당 ---------- */
.ticker-wrap { background: var(--text); border-radius: 14px; overflow: hidden; margin-bottom: 16px; height: 40px; display: flex; align-items: center; }
.ticker { white-space: nowrap; color: #fff; font-size: 13px; font-weight: 600; animation: tick 25s linear infinite; padding-left: 100%; }
@keyframes tick { to { transform: translateX(-100%); } }
.fame-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fame-head h2 { font-size: 20px; font-weight: 800; }
.review-feed { display: flex; flex-direction: column; gap: 12px; }
.review-card { background: var(--card); border-radius: var(--radius); padding: 20px; }
.review-img { height: 120px; background: linear-gradient(135deg, #f6f8fa, #e9eef4); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 48px; margin-bottom: 12px; }
.review-title { font-size: 15px; font-weight: 700; }
.review-text { font-size: 14px; color: var(--text2); margin: 6px 0 10px; line-height: 1.5; }
.review-meta { font-size: 12px; color: var(--text3); }

/* ---------- 보관함 ---------- */
.profile-card { background: var(--card); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-emoji { font-size: 34px; width: 56px; height: 56px; background: var(--bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.profile-nick { font-size: 17px; font-weight: 800; }
.profile-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }
.profile-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.myinfo-rows { background: var(--bg); border-radius: 14px; padding: 6px 16px; margin-bottom: 16px; }
.myinfo-row { display: flex; justify-content: space-between; padding: 10px 0; font-size: 14px; color: var(--text2); }
.myinfo-row b { color: var(--text); font-weight: 700; }
.mi-label { font-size: 13px; font-weight: 700; color: var(--text2); margin: 10px 0 8px; }
.mi-inline { display: flex; gap: 8px; align-items: stretch; }
.mi-inline input { flex: 1; margin-bottom: 0; }
.mi-inline .btn-small { flex-shrink: 0; }
.bc-photo { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 12px; max-height: 300px; object-fit: contain; background: #fff; }
.inbox-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.inbox-tab { background: var(--card); color: var(--text3); padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.inbox-tab.active { background: var(--text); color: #fff; }
.coupon-list { display: flex; flex-direction: column; gap: 12px; }
.coupon-card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.coupon-card.used { filter: grayscale(1); opacity: .65; }
.coupon-emoji { font-size: 32px; width: 52px; height: 52px; background: var(--bg); border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.coupon-info { flex: 1; }
.coupon-name { font-size: 15px; font-weight: 700; }
.coupon-sub { font-size: 12.5px; color: var(--text3); margin-top: 3px; }
.coupon-value { font-size: 15px; font-weight: 800; color: var(--blue); }
.empty-note { text-align: center; color: var(--text3); font-size: 14px; padding: 48px 0; }

/* ---------- 하단 탭바 ---------- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); z-index: 30; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text3); }
.tab span { font-size: 22px; filter: grayscale(1); opacity: .55; }
.tab.active { color: var(--blue); }
.tab.active span { filter: none; opacity: 1; }

/* ---------- 시트 / 모달 ---------- */
.sheet-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { align-items: center; }
.sheet { background: var(--card); width: 100%; max-width: 480px; border-radius: 24px 24px 0 0; padding: 12px 24px 32px; max-height: 82vh; overflow-y: auto; }
.sheet-handle { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 0 auto 16px; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.sheet-desc { font-size: 13.5px; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }
.sheet input, .sheet textarea { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; font-size: 15px; outline: none; margin-bottom: 10px; resize: none; }
.sheet textarea { height: 90px; }

/* 방 상세 */
.rs-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.rs-emoji { font-size: 44px; width: 68px; height: 68px; background: var(--bg); border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.rs-brand { font-size: 13px; color: var(--text3); font-weight: 600; }
.rs-name { font-size: 19px; font-weight: 800; margin: 2px 0; }
.rs-value { font-size: 14px; color: var(--blue); font-weight: 700; }
.rs-gauge-num { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); font-weight: 600; margin: 14px 0 6px; }
.rs-stats { display: flex; gap: 10px; margin: 16px 0; }
.rs-stat { flex: 1; background: var(--bg); border-radius: 14px; padding: 13px; text-align: center; }
.rs-stat b { display: block; font-size: 17px; font-weight: 800; }
.rs-stat span { font-size: 11.5px; color: var(--text3); font-weight: 600; }
.rs-prob-note { font-size: 11.5px; color: var(--text3); text-align: center; margin-bottom: 16px; }
.deposit-row { display: flex; gap: 8px; }
.deposit-btn { flex: 1; background: var(--bg); color: var(--text); padding: 14px; border-radius: 13px; font-size: 15px; font-weight: 700; }
.deposit-btn.primary { background: var(--blue); color: #fff; flex: 1.4; }
.deposit-note { font-size: 11.5px; color: var(--text3); text-align: center; margin-top: 10px; }

/* 광고 모달 */
.ad-box { background: #17181c; border-radius: 24px; padding: 28px; width: min(88%, 360px); text-align: center; }
.ad-label { color: #9aa0aa; font-size: 13px; font-weight: 600; }
.ad-screen { font-size: 64px; padding: 36px 0; }
.ad-progress { height: 6px; background: #2c2e35; border-radius: 3px; overflow: hidden; }
.ad-bar { height: 100%; width: 0%; background: var(--blue); transition: width .25s linear; }
.ad-timer { color: #fff; font-size: 22px; font-weight: 800; margin-top: 14px; }

/* 추첨 오버레이 */
.draw-box { background: var(--card); border-radius: 24px; padding: 24px 24px 28px; width: min(88%, 360px); text-align: center; }
#drawCanvas { display: block; margin: 0 auto; max-width: 100%; }
.draw-text { font-size: 17px; font-weight: 700; margin: 14px 0 18px; line-height: 1.5; white-space: pre-line; }
.draw-box .btn-primary { width: 100%; }

/* 전당 상단 칩 & 추첨 기록 */
.fame-chips { display: flex; gap: 8px; margin-bottom: 16px; }
.chip.discord { background: #5865f2; color: #fff; }
.fame-note { text-align: center; color: var(--text3); font-size: 12.5px; margin-top: 16px; }
.drawlog-method { background: var(--bg); border-radius: 14px; padding: 14px 16px; font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 14px; }
.drawlog-list { display: flex; flex-direction: column; }
.drawlog-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--bg); }
.drawlog-emoji { font-size: 24px; }
.drawlog-info { flex: 1; min-width: 0; }
.drawlog-title { font-size: 14px; font-weight: 700; }
.drawlog-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.drawlog-winner { font-size: 13px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.review-target { background: var(--bg); border-radius: 12px; padding: 12px 16px; font-size: 14.5px; font-weight: 700; margin-bottom: 10px; }

/* 알림 */
.notif-list { display: flex; flex-direction: column; gap: 4px; }
.notif-item { padding: 14px 4px; border-bottom: 1px solid var(--bg); }
.notif-item.unread { background: #f5f9ff; border-radius: 10px; padding: 14px 12px; }
.notif-title { font-size: 14.5px; font-weight: 700; }
.notif-body { font-size: 13px; color: var(--text2); margin-top: 3px; line-height: 1.45; }
.notif-time { font-size: 11.5px; color: var(--text3); margin-top: 4px; }

/* 바코드 */
.barcode-box { background: var(--card); border-radius: 24px; padding: 28px 24px; width: min(88%, 380px); text-align: center; }
.bc-name { font-size: 17px; font-weight: 800; }
.bc-value { font-size: 14px; color: var(--blue); font-weight: 700; margin: 4px 0 18px; }
/* 바코드는 항상 흰 배경 (다크모드에서도 리더기 스캔 가능해야 함) */
.bc-stripes { height: 84px; background-color: #fff; background-image: repeating-linear-gradient(90deg, #191f28 0 3px, transparent 3px 6px, #191f28 6px 8px, transparent 8px 13px); border-radius: 8px; margin-bottom: 12px; padding: 0 8px; background-clip: content-box; border: 8px solid #fff; box-sizing: border-box; }
.bc-num { font-size: 17px; font-weight: 700; letter-spacing: 1.5px; font-variant-numeric: tabular-nums; }
.bc-pin { font-size: 13px; color: var(--text2); margin-top: 6px; }
.bc-expire { font-size: 12px; color: var(--text3); margin: 8px 0 18px; }
.bc-actions { display: flex; flex-direction: column; gap: 8px; }
.bc-row { display: flex; gap: 8px; }
.bc-row button { flex: 1; }
.btn-gray { background: var(--bg); color: var(--text2); padding: 13px; border-radius: 12px; font-size: 14px; font-weight: 700; }

/* 전면 팝업 공지 */
.popup-box { background: var(--card); border-radius: 24px; padding: 30px 26px 20px; width: min(86%, 340px); text-align: center; }
.popup-emoji { font-size: 44px; margin-bottom: 10px; }
.popup-title { font-size: 18px; font-weight: 800; line-height: 1.4; }
.popup-body { font-size: 14px; color: var(--text2); margin: 10px 0 20px; line-height: 1.55; white-space: pre-line; }
.popup-box .btn-primary { width: 100%; }
.popup-hide { display: block; width: 100%; margin-top: 10px; color: var(--text3); font-size: 13px; padding: 8px; }

/* 토스트 */
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: rgba(25,31,40,.94); color: #fff; padding: 13px 22px; border-radius: 14px; font-size: 14px; font-weight: 600; z-index: 100; max-width: 85%; text-align: center; animation: toastIn .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 다크모드 (시스템 설정 자동 감지) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --card: #1e232b; --text: #ecf0f4; --text2: #aeb8c4;
    --text3: #6d7885; --line: #2c333d;
  }
  body { background: #0b0d10; }
  #app { box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .topbar { background: rgba(20,23,28,.92); }
  .tabbar { background: rgba(30,35,43,.96); border-top-color: var(--line); }
  .banner-notice { background: #1b2b47; color: #7fb0ff; }
  .att-day.done, .mini-badge.mine { background: #1b2b47; color: #7fb0ff; }
  .att-day.done b { color: #7fb0ff; }
  .mini-badge.vip { background: #3a2f16; color: var(--gold); }
  .ticker-wrap { background: #262c35; }
  .chip.active { color: #14171c; }
  .inbox-tab.active { color: #14171c; }
  .review-img { background: linear-gradient(135deg, #232933, #1b2027); }
  .gacha-canvas { background: linear-gradient(180deg, #1a2029, #161b22); }
  .auth-card input, .sheet input, .sheet textarea { background: var(--bg); color: var(--text); }
  .auth-tab.active { background: #2c333d; color: var(--text); }
  .btn-small { background: #2c333d; }
  .btn-outline { background: transparent; }
  .btn-gray { background: #2c333d; color: var(--text2); }
  .deposit-btn { background: #2c333d; }
  .rs-stat, .myinfo-rows, .drawlog-method, .invite-code, .review-target { background: #171b21; }
  .bc-photo { background: #fff; } /* 바코드 사진도 흰 배경 유지 */
}
