:root {
  --bg: #f6f5f2; --surface: #ffffff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e4e2dc;
  --accent: #2f5bea; --accent-ink: #ffffff; --good: #1f8a4c; --bad: #c23b3b; --warn: #b7791f;
  --chip: #efede7; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121214; --surface: #1c1c1f; --ink: #f2f2f4; --muted: #a0a0a8; --line: #2c2c31;
    --accent: #6d8bff; --accent-ink: #0d0d10; --good: #4cc27f; --bad: #ff7676; --warn: #e0a84a; --chip: #26262b;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; line-height: 1.55; -webkit-text-size-adjust: 100%; word-break: keep-all; overflow-wrap: anywhere; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 0 16px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 6px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.link { background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; padding: 6px; }
.hud { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0 10px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px; }
.hud[hidden] { display: none; }
.hud-year { font-size: 22px; font-weight: 800; }
.hud-meta { color: var(--muted); font-size: 14px; }
.feed { flex: 1; padding: 12px 0 140px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chip { font-size: 12px; background: var(--chip); color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.chip.future { color: var(--warn); }
.card h2 { font-size: 18px; margin: 2px 0 6px; letter-spacing: -.3px; }
.card h2 .ic { margin-right: 6px; }
.card p { margin: 6px 0; }
.stat { margin-top: 10px; padding: 10px 12px; background: var(--chip); border-radius: 12px; font-size: 14px; }
.stat b { font-size: 16px; }
.stat .src { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; margin-top: 3px; opacity: .75; }
.pix { display: block; width: 100%; height: auto; aspect-ratio: 96 / 40; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 10px; margin: -2px 0 10px; border: 2px solid #2b2b33; }
.hero-pix { margin: 4px 0 12px; }
.hud { flex-wrap: wrap; }
.hud-stats { margin-left: auto; display: flex; gap: 8px; }
.hud-stats .st { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; }
.hud-stats .tr { display: inline-block; width: 34px; height: 6px; border-radius: 9px; background: var(--chip); overflow: hidden; }
.hud-stats .tr i { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .4s; }
.fx { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.fxc { font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--chip); }
.fxc.up { color: var(--good); } .fxc.down { color: var(--bad); }
.bar .fill.alt { background: var(--good); }
.pending { display: grid; gap: 4px; margin: 0 0 10px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--chip); border-radius: 8px; font-size: 13px; color: var(--muted); }
.pending b { color: var(--ink); }
.out-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; animation: rise .25s ease-out; }
.out-box > div { width: 100%; font-size: 14px; }
.out-box .outcome { margin-top: 0; }
.outcome { margin-top: 8px; font-weight: 700; }
.outcome.good { color: var(--good); } .outcome.bad { color: var(--bad); }
.note { color: var(--muted); font-size: 12.5px; }
.actions { position: fixed; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 6; }
.actions > * { width: 100%; max-width: 528px; }
.actions:empty { display: none; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 16px; padding: 14px 16px; border-radius: 14px; cursor: pointer; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn small { display: block; font-weight: 500; font-size: 12.5px; opacity: .8; margin-top: 2px; }
.btn .warn { display: inline-block; font-size: 11px; font-weight: 700; color: var(--bad); }
.hud-stats .st.debt { color: var(--bad); font-weight: 800; }
.btn .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: rgba(127,127,127,.18); margin-right: 4px; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; }
select, .seg { font: inherit; font-size: 16px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
label.chk { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); margin-top: 8px; }
.hero { text-align: center; padding: 26px 8px 10px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -.6px; }
.hero p { color: var(--muted); margin: 0; }
.spin { font-size: 56px; font-weight: 900; text-align: center; letter-spacing: -1px; padding: 18px 0 6px; font-variant-numeric: tabular-nums; }
.tier { display: inline-block; font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.result { border: 2px solid var(--accent); }
.result .big { font-size: 34px; font-weight: 900; letter-spacing: -1px; margin: 4px 0; }
.result .nick { font-size: 18px; font-weight: 800; }
.result .path { margin: 6px 0 0; font-weight: 700; font-size: 15px; }
.bars { display: grid; gap: 8px; margin-top: 12px; }
.bar { display: grid; grid-template-columns: 92px 1fr 58px; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { display: block; height: 10px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.result-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.share-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.share-title { font-weight: 800; font-size: 15px; }
.share-box .btn { font-size: 15px; padding: 12px 10px; }
.share-box label.chk { margin-top: 0; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.bar .lbl { text-align: right; font-weight: 700; }
.summary { margin: 10px 0 0; padding-left: 18px; font-size: 14px; }
.compare { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--chip); font-size: 14px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); width: 100%; max-width: 560px; max-height: 80vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
.modal-body h3 { margin: 0 0 8px; } .modal-body li { font-size: 13.5px; margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

/* ---------- v0.7: 뽑기 연출·확률 막대·희귀 사건·칭호 ---------- */
:root { --gold: #b8860b; --gold-bg: #fff4d6; --purple: #6a3fd1; --purple-bg: #efe8ff; --blue-bg: #e7eeff; --red-bg: #ffe9e9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --gold: #f2c14e; --gold-bg: #3a2f12; --purple: #b79cff; --purple-bg: #2b2340; --blue-bg: #1d2645; --red-bg: #3a1c1c; }
}
:root[data-theme="dark"] { --gold: #f2c14e; --gold-bg: #3a2f12; --purple: #b79cff; --purple-bg: #2b2340; --blue-bg: #1d2645; --red-bg: #3a1c1c; }
.center { text-align: center; }
.spin.landed { animation: pop .45s ease-out; color: var(--accent); }
.gacha { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 4px; }
.grade { display: inline-block; font-weight: 900; font-size: 34px; letter-spacing: 1px; padding: 4px 22px; border-radius: 14px; border: 2px solid currentColor; animation: pop .5s ease-out; }
.grade.sm { font-size: 12px; padding: 0 7px; border-radius: 6px; border-width: 1.5px; animation: none; letter-spacing: 0; }
.g-ssr { color: var(--gold); background: var(--gold-bg); }
.g-sr { color: var(--purple); background: var(--purple-bg); }
.g-r { color: var(--accent); background: var(--blue-bg); }
.g-n { color: var(--muted); background: var(--chip); }
.gacha .g-ssr:not(.sm) { animation: pop .5s ease-out, shine 1.2s ease-in-out .5s 2; }
.grade-line { font-size: 14px; color: var(--muted); }
.spoon-slot { text-align: center; font-size: 34px; font-weight: 900; padding: 6px 0; font-variant-numeric: tabular-nums; }
.spoon-slot.landed { animation: pop .45s ease-out; }
.spoon-slot.s-gold { color: var(--gold); } .spoon-slot.s-silver { color: var(--purple); } .spoon-slot.s-dirt { color: var(--bad); }
.src-inline { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 65% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shine { 50% { box-shadow: 0 0 0 6px var(--gold-bg); } }

.roll { margin-top: 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 13px; }
.roll-lbl { color: var(--muted); font-weight: 700; }
.roll-track { position: relative; display: block; height: 14px; border-radius: 99px; background: var(--red-bg); overflow: visible; }
.roll-win { position: absolute; left: 0; top: 0; bottom: 0; background: var(--good); opacity: .55; border-radius: 99px; }
.roll-pin { position: absolute; top: -5px; width: 4px; height: 24px; margin-left: -2px; left: 50%; background: var(--ink); border-radius: 2px; transition: left .12s ease-out; }
.roll-res { grid-column: 1 / -1; font-weight: 800; font-size: 15px; min-height: 1em; }
.roll.win .roll-res { color: var(--good); } .roll.lose .roll-res { color: var(--bad); }
.roll.win .roll-res, .roll.lose .roll-res { animation: pop .35s ease-out; }
.card.crit { animation: crit .7s ease-out; border-color: var(--gold); }
@keyframes crit { 0%, 100% { transform: none; } 20% { transform: translateX(-4px) rotate(-.4deg); } 40% { transform: translateX(4px) rotate(.4deg); } 60% { transform: translateX(-2px); } }

.card.ev { border-width: 2px; animation: pop .45s ease-out; }
.card.ev-legend { border-color: var(--gold); background: var(--gold-bg); }
.card.ev-legend h2 { color: var(--gold); }
.card.ev-rare { border-color: var(--accent); }
.card.ev-curse { border-color: var(--bad); background: var(--red-bg); }
.card.ev .chip { font-weight: 800; color: var(--ink); }

.title-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.title-badge { display: inline-block; margin: 4px 0 8px; font-weight: 900; font-size: 22px; padding: 6px 14px; border-radius: 12px; border: 2px solid currentColor; animation: pop .5s ease-out; }
.title-badge.d-legend { color: var(--gold); background: var(--gold-bg); }
.title-badge.d-rare { color: var(--purple); background: var(--purple-bg); }
.title-badge.d-common { color: var(--accent); background: var(--blue-bg); }
.new { display: inline-block; font-size: 11px; font-weight: 900; color: #fff; background: var(--bad); padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.peer { font-size: 15px; }
.vs-res { margin: 8px 0; padding: 10px 12px; border-radius: 12px; font-weight: 900; font-size: 18px; text-align: center; background: var(--chip); animation: pop .5s ease-out; }
.vs-res.win { color: var(--good); } .vs-res.lose { color: var(--bad); }
.vs-card { border: 2px solid var(--bad); }
.btn.link-btn { border: 0; background: none; padding: 6px; font-size: 14px; color: var(--accent); text-decoration: underline; width: auto; }
.dex { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.dex-item { font-size: 13.5px; padding: 6px 8px; border-radius: 10px; background: var(--chip); opacity: .65; }
.dex-item.got { opacity: 1; }
.dex-item.got.d-legend { background: var(--gold-bg); } .dex-item.got.d-rare { background: var(--purple-bg); }
.dex-g { display: inline-block; font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: 6px; border: 1px solid currentColor; margin-right: 4px; }
.d-legend .dex-g { color: var(--gold); } .d-rare .dex-g { color: var(--purple); } .d-common .dex-g { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .grade, .spoon-slot.landed, .spin.landed, .card.ev, .card.crit, .title-badge, .vs-res, .roll-res { animation: none !important; } .roll-pin { transition: none; } }
