:root {
  --bg: #15131a; --panel: #1e1b25; --panel2: #272330; --line: #37323f;
  --text: #ece7df; --muted: #a39cab; --accent: #d9a441; --accent-ink: #1b1508;
  --good: #6fbf73; --bad: #e0685f; --crit: #f2c94c; --info: #7aa7d9;
  --radius: 10px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
#app { height: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 8px 14px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.ghost { background: transparent; }
button.small { padding: 3px 9px; font-size: 13px; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* 첫 화면 */
.home { max-width: 860px; margin: 0 auto; padding: 48px 16px; }
.home header { text-align: center; margin-bottom: 32px; }
.home h1 { font-size: 40px; letter-spacing: .04em; color: var(--accent); }
.home .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 18px; margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.settings { display: grid; gap: 6px; }
.settings label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; margin: 0; color: var(--text); font-size: 14px; }
.settings label:has(input:checked) { border-color: var(--accent); background: var(--panel2); }
.settings input { width: auto; margin-top: 5px; }
.settings small { display: block; color: var(--muted); }

/* 방 */
.room { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .title { font-weight: 700; color: var(--accent); }
.topbar .scene { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { font-family: ui-monospace, monospace; letter-spacing: .15em; background: var(--bg); border: 1px dashed var(--line); padding: 3px 10px; border-radius: 6px; }
.layout { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.main { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; min-width: 0; }
.banner { padding: 12px 16px; background: var(--panel2); border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.log { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.entry { max-width: 760px; width: 100%; margin: 0 auto; }
.entry.gm { background: var(--panel); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; }
.entry.gm p { margin: 0 0 .7em; } .entry.gm p:last-child { margin: 0; }
.entry.gm .who { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.entry.player { display: flex; justify-content: flex-end; }
.entry.player .bubble { background: #2c3a52; border-radius: var(--radius) var(--radius) 2px var(--radius); padding: 8px 14px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry.player .who, .entry.ooc .who { font-size: 12px; color: var(--info); font-weight: 700; }
.entry.ooc { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.entry.system { text-align: center; color: var(--muted); font-size: 13px; }
.entry.system.error { color: var(--bad); }
.entry.scene { text-align: center; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.entry.scene b { color: var(--accent); letter-spacing: .05em; }
.entry.roll { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.entry.roll.success { border-color: var(--good); } .entry.roll.fail { border-color: var(--bad); }
.entry.roll.crit { border-color: var(--crit); box-shadow: 0 0 0 1px var(--crit); } .entry.roll.fumble { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.roll .title { font-weight: 700; } .roll .reason { color: var(--muted); font-size: 13px; }
.roll .part { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.dice { display: inline-flex; gap: 3px; }
.dice { gap: 5px; }
.die { width: 30px; height: 30px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 4px; gap: 1px; background: linear-gradient(145deg, #fffaf0, #d9d0bf); border-radius: 6px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .4); }
.die i { border-radius: 50%; } .die i.on { background: #1b1508; }
.die.tumbling { animation: tumble .32s linear infinite; }
.dice .die.tumbling:nth-child(2n) { animation-duration: .27s; animation-direction: reverse; }
.dice .die.tumbling:nth-child(3n) { animation-duration: .38s; }
.die.landed { animation: land .28s ease-out; }
@keyframes tumble { 0% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-9px) rotate(90deg); } 50% { transform: translateY(0) rotate(180deg); } 75% { transform: translateY(-6px) rotate(270deg); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes land { 0% { transform: translateY(-8px) scale(1.25); } 60% { transform: translateY(2px) scale(.94); } 100% { transform: none; } }
.entry.roll.rolling { border-color: var(--accent); cursor: pointer; box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(217, 164, 65, .25); }
.roll .hide { visibility: hidden; }
.roll .total b { font-size: 17px; }
.roll .verdict { padding: 1px 9px; border-radius: 5px; border: 2px solid currentColor; font-size: 13px; letter-spacing: .05em; }
.roll .verdict.ok { color: var(--good); } .roll .verdict.no { color: var(--bad); }
.roll .verdict.crit { color: var(--crit); background: rgba(242, 201, 76, .12); } .roll .verdict.fumble { color: #fff; background: var(--bad); border-color: var(--bad); }
.roll .verdict.stamp { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 100% { transform: scale(1) rotate(-3deg); opacity: 1; } }
.roll .verdict { transform: rotate(-3deg); display: inline-block; }
.roll .reveal { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.entry.enter { animation: rise .35s ease-out; }
.roll .summary { margin-top: 8px; font-weight: 700; }
.roll.success .summary { color: var(--good); } .roll.fail .summary, .roll.fumble .summary { color: var(--bad); } .roll.crit .summary { color: var(--crit); }
.roll .effects { color: var(--muted); font-size: 13px; }
.live .cursor { display: inline-block; width: 7px; height: 1em; background: var(--accent); vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { text-align: center; color: var(--muted); font-size: 13px; }

.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 16px; }
.composer .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer select { width: auto; }
.composer textarea { min-height: 42px; max-height: 160px; }

.side { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 12px; }
.side h3 { font-size: 12px; color: var(--muted); letter-spacing: .1em; margin: 14px 4px 8px; }
.side h3:first-child { margin-top: 2px; }
.pc { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--panel2); }
.pc summary { list-style: none; cursor: pointer; padding: 10px 12px; }
.pc summary::-webkit-details-marker { display: none; }
.pc .name { font-weight: 700; } .pc.me { border-color: var(--accent); }
.pc .tags { font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.dot.off { background: var(--line); }
.bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--bad); } .bar.fp i { background: var(--info); }
.barlabel { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }
.sheet { padding: 0 12px 12px; font-size: 13px; }
.sheet .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0; }
.sheet .stat { background: var(--bg); border-radius: 6px; padding: 3px 6px; text-align: center; }
.sheet .stat b { display: block; font-size: 15px; } .sheet .stat span { font-size: 11px; color: var(--muted); }
.sheet dl { margin: 6px 0 0; } .sheet dt { color: var(--muted); font-size: 11px; margin-top: 6px; } .sheet dd { margin: 0; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin: 2px 2px 0 0; font-size: 12px; }
.chip.bad { border-color: var(--bad); color: var(--bad); } .chip.warn { border-color: var(--crit); color: var(--crit); }
.npc { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.npc.hostile { border-left: 3px solid var(--bad); }

/* 캐릭터 제작 */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: grid; place-items: center; padding: 16px; z-index: 10; }
.builder { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: min(920px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.builder > header, .builder > footer { padding: 12px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.builder > header { border-bottom: 1px solid var(--line); } .builder > footer { border-top: 1px solid var(--line); }
.builder .body { overflow-y: auto; min-height: 0; padding: 16px 18px; overscroll-behavior: contain; }
.builder section { margin-bottom: 22px; }
.builder section > h3 { font-size: 15px; color: var(--accent); margin-bottom: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.attrs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.attr { background: var(--panel2); border-radius: 8px; padding: 10px; text-align: center; }
.attr .val { font-size: 24px; font-weight: 700; margin: 0 10px; min-width: 1.4em; display: inline-block; }
.attr small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 4px; }
.derived { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 13px; } .derived b { color: var(--text); }
.skillgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.skillcat { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 8px; letter-spacing: .1em; }
.skill { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.skill .lv { width: 2em; text-align: right; font-weight: 700; } .skill.off .lv, .skill.off .nm { color: var(--muted); }
.skill .pts { width: 3.2em; text-align: center; font-size: 12px; color: var(--muted); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { border-radius: 999px; padding: 4px 12px; font-size: 13px; background: var(--bg); }
.toggle.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.toggle.neg.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.budget { font-weight: 700; } .budget.over { color: var(--bad); }
.errors { color: var(--bad); font-size: 13px; flex-basis: 100%; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--bad); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.ok { background: var(--good); color: #0b1a0c; }

@media (max-width: 860px) {
  .home .cols, .two, .skillgrid { grid-template-columns: 1fr; }
  .attrs { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { order: -1; border-left: 0; border-bottom: 1px solid var(--line); max-height: 34vh; }
  .topbar .scene { display: none; }
}

/* 툴팁 */
[data-tip] { cursor: help; }
button[data-tip] { cursor: pointer; }
#tip { position: fixed; z-index: 30; max-width: min(300px, calc(100vw - 16px)); background: #0d0c10; color: var(--text); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.5; white-space: pre-line; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s; }
#tip.show { opacity: 1; visibility: visible; }
#tip b { display: block; color: var(--accent); margin-bottom: 2px; }

/* 장면·이벤트 */
.mode { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-right: 6px; white-space: nowrap; }
.mode.combat { color: #fff; background: var(--bad); border-color: var(--bad); }
.mode.social { color: var(--info); border-color: var(--info); } .mode.rest { color: var(--good); border-color: var(--good); }
.entry.scene .mode { display: block; width: fit-content; margin: 0 auto 4px; }
.room[data-mode="combat"] .topbar { border-bottom-color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad); }
.entry.event { display: flex; gap: 10px; align-items: flex-start; padding: 8px 14px; border-radius: 8px; border-left: 3px solid var(--line); background: rgba(255, 255, 255, .03); font-size: 14px; --c: var(--muted); border-left-color: var(--c); }
.entry.event .icon { font-size: 18px; line-height: 1.4; }
.entry.event .tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--c); border: 1px solid var(--c); border-radius: 4px; padding: 0 5px; margin-right: 2px; }
.kind-clue, .kind-discovery { --c: var(--info); } .kind-objective, .kind-award, .kind-money, .kind-item_gain { --c: var(--accent); }
.kind-danger, .kind-threat, .kind-damage, .kind-combat_start, .kind-down, .kind-item_loss { --c: var(--bad); }
.kind-heal, .kind-combat_end { --c: var(--good); } .kind-twist { --c: #b98be0; } .kind-condition, .kind-fatigue { --c: var(--crit); }
.entry.event.kind-death { --c: #fff; background: #000; border: 1px solid #555; border-left: 3px solid #fff; }
.entry.event.kind-combat_start, .entry.event.kind-danger, .entry.event.kind-twist, .entry.event.kind-objective { background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid var(--c); border-left-width: 3px; }

#fx { position: relative; height: 0; z-index: 5; }
.fxbanner { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; padding: 12px 26px; border-radius: 12px; background: rgba(13, 12, 16, .94); border: 2px solid var(--c, var(--accent)); box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 30px color-mix(in srgb, var(--c, var(--accent)) 35%, transparent); animation: banner 2.6s ease both; pointer-events: none; max-width: 90%; }
.fxbanner .icon { font-size: 30px; } .fxbanner small { display: block; color: var(--c, var(--accent)); font-weight: 700; letter-spacing: .2em; font-size: 11px; } .fxbanner b { font-size: 18px; }
.fxbanner.kind-scene { --c: var(--accent); } .fxbanner.kind-combat, .fxbanner.kind-combat_start { --c: var(--bad); } .fxbanner.kind-death { --c: #fff; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -20px) scale(.9); } 10%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -10px); } }

.room.fx-crit .log { animation: critflash .9s ease-out; } .room.fx-fumble .log { animation: shake .5s; }
@keyframes critflash { 0% { box-shadow: inset 0 0 0 0 rgba(242, 201, 76, 0); } 25% { box-shadow: inset 0 0 90px 10px rgba(242, 201, 76, .45); } 100% { box-shadow: inset 0 0 0 0 rgba(242, 201, 76, 0); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.objective { border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 4px; background: rgba(217, 164, 65, .08); font-size: 13px; }
.objective span { display: block; font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: .08em; } .objective b { font-size: 14px; }
.pc { position: relative; }
.pc.hurt { animation: hurt .7s; } .pc.healed { animation: healed .7s; }
@keyframes hurt { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px var(--bad), 0 0 20px var(--bad); transform: translateX(-3px); } 60% { transform: translateX(3px); } }
@keyframes healed { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 2px var(--good), 0 0 20px var(--good); } }
.floater { position: absolute; right: 14px; top: 6px; font-weight: 800; font-size: 20px; pointer-events: none; animation: floatup 1.6s ease-out forwards; text-shadow: 0 1px 3px #000; }
.floater.neg { color: var(--bad); } .floater.pos { color: var(--good); }
@keyframes floatup { 0% { opacity: 0; transform: translateY(8px) scale(.7); } 15% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-34px); } }
@media (prefers-reduced-motion: reduce) { .die, .entry, .fxbanner, .pc, .floater, .roll .verdict { animation: none !important; } }

/* 토큰 사용량 */
#usagebtn { white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage { width: min(820px, 100%); }
.ucards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.ucards div { background: var(--panel2); border-radius: 8px; padding: 12px; text-align: center; }
.ucards b { display: block; font-size: 20px; color: var(--accent); font-variant-numeric: tabular-nums; } .ucards span { font-size: 12px; color: var(--muted); }
.utable { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.utable th, .utable td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.utable th { color: var(--muted); font-weight: 400; font-size: 12px; }
.utable th:first-child, .utable td:first-child, .utable td:nth-child(2):not(:last-child):has(+ td + td + td + td + td + td), .utable th:nth-child(2):has(+ th + th + th + th + th + th) { text-align: left; }
.utable tr.sum td { font-weight: 700; border-bottom: 0; }
.usage .small { font-size: 12px; margin: 8px 0 0; }
.usage .body { overflow-x: auto; }
@media (max-width: 860px) { .ucards { grid-template-columns: 1fr 1fr; } }

.entry.usage { text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; cursor: pointer; margin-top: -4px; }
.entry.usage span { opacity: .65; margin-left: 6px; } .entry.usage:hover { color: var(--accent); }
.usagecard { display: block; width: 100%; text-align: left; background: var(--panel2); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.usagecard .big { font-size: 13px; color: var(--muted); display: flex; align-items: baseline; gap: 5px; } .usagecard .big b { font-size: 20px; color: var(--accent); } .usagecard .big span { margin-left: auto; font-size: 16px; font-weight: 700; color: var(--text); }
.usagecard .line { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 3px; } .usagecard .line span:last-child { color: var(--text); }
.usagecard.busy, #usagebtn.busy { border-color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px rgba(217, 164, 65, .35); } }
.utable tr.livecost td { color: var(--accent); }

/* 초보자 모드 · 가이드 */
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; color: var(--text); font-size: 14px; cursor: pointer; }
label.check input { width: auto; margin-top: 5px; } label.check small { display: block; color: var(--muted); }
#beginnerbtn.on { border-color: var(--info); color: var(--info); }
.entry.guide { border: 1px dashed var(--info); border-radius: var(--radius); padding: 12px 16px; background: rgba(122, 167, 217, .07); }
.guide .gtitle { font-size: 12px; font-weight: 700; color: var(--info); letter-spacing: .08em; margin-bottom: 4px; }
.guide p { margin: 0 0 10px; }
.guide .gopts { display: flex; flex-direction: column; gap: 6px; }
.guide .gopts button { text-align: left; background: var(--panel2); border-color: var(--line); }
.guide .gopts button:hover { border-color: var(--info); }
.guide .ghint { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* 미니맵 */
.minimap { background: var(--panel2); border-radius: var(--radius); padding: 6px 6px 8px; }
.minimap svg { width: 100%; height: auto; display: block; }
.minimap .zone circle { fill: rgba(255, 255, 255, .04); stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 3; }
.minimap .zone.mine circle { stroke: var(--accent); fill: rgba(217, 164, 65, .08); }
.minimap text { text-anchor: middle; font-size: 10px; fill: var(--muted); font-family: inherit; pointer-events: none; }
.minimap .zone.mine .zl { fill: var(--accent); }
.minimap .tok circle { stroke: #0d0c10; stroke-width: 1.5; } .minimap .tok text { fill: #0d0c10; font-weight: 800; font-size: 10px; }
.minimap .tok.pc circle { fill: var(--accent); } .minimap .tok.me circle { stroke: #fff; stroke-width: 2; }
.minimap .tok.foe circle { fill: var(--bad); } .minimap .tok.npc circle { fill: #9aa3ad; }
.minimap .tok.out { opacity: .4; }
.minimap .legend { font-size: 11px; color: var(--muted); text-align: center; }
.minimap .legend .pc { color: var(--accent); } .minimap .legend .foe { color: var(--bad); } .minimap .legend .npc { color: #9aa3ad; }
.kind-map, .kind-move { --c: var(--info); }

.roll .need { font-size: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; white-space: nowrap; }

/* 룰 선택 · 5능력치 · 결의 */
.settings .lic { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; font-weight: 400; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.skill .sub { font-size: 11px; color: var(--muted); }
.skill .pts { width: 5.6em; }
.attrs.five { grid-template-columns: repeat(5, 1fr); }
.sheet .stats.five { grid-template-columns: repeat(5, 1fr); }
.sheet .stats.five .stat b { font-size: 14px; } .sheet .stats.five .stat span { font-size: 10px; }
.resolve { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); margin-top: 5px; }
.resolve .dots { display: inline-flex; gap: 4px; }
.resolve .dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--crit); }
.resolve .dots i.on { background: var(--crit); }
.die.num { display: grid; place-items: center; padding: 0; color: #1b1508; font-size: 13px; }
.die.dropped { opacity: .35; filter: grayscale(1); transform: scale(.85); }
@media (max-width: 860px) { .attrs.five { grid-template-columns: 1fr 1fr; } }

/* Fate */
.die.fate { background: linear-gradient(145deg, #f3f0ff, #c9c3e6); } .die.fate b { font-size: 19px; line-height: 1; color: #1b1530; }
.fline { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 5px; flex-wrap: wrap; }
.fline .fp { margin-left: auto; color: var(--crit); letter-spacing: 1px; } .fline .fp b { color: var(--text); letter-spacing: 0; }
.fboxes { display: inline-flex; gap: 3px; margin-right: 6px; }
.fboxes i { width: 17px; height: 17px; border: 1.5px solid var(--muted); border-radius: 3px; font-style: normal; font-size: 10px; display: grid; place-items: center; color: var(--muted); }
.fboxes i.on { background: var(--bad); border-color: var(--bad); color: #fff; text-decoration: line-through; }
.aspect { background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 4px 8px; margin-top: 4px; }
.aspect span { display: block; font-size: 10px; color: var(--muted); } .aspect.blank { border-left-color: var(--line); color: var(--muted); font-size: 12px; }
.frow { display: flex; gap: 4px; align-items: baseline; flex-wrap: wrap; margin-top: 3px; } .frow .rate { font-size: 11px; color: var(--accent); min-width: 6.5em; }
.conseq { display: flex; justify-content: space-between; gap: 8px; background: var(--bg); border-radius: 6px; padding: 3px 8px; margin-top: 3px; font-size: 12px; }
.conseq span:first-child { color: var(--muted); white-space: nowrap; } .conseq.taken { border: 1px solid var(--bad); } .conseq.taken b { color: var(--bad); }
.saspect { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 5px 10px; margin-bottom: 5px; font-size: 13px; background: var(--panel2); }
.saspect.boost { border-left-color: var(--crit); border-style: dashed; } .saspect.compel { border-left-color: #b98be0; }
.saspect .free { color: var(--crit); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.kind-aspect { --c: var(--accent); } .kind-boost { --c: var(--crit); } .kind-compel { --c: #b98be0; }
.entry.event.kind-compel { background: color-mix(in srgb, #b98be0 12%, transparent); border: 1px solid #b98be0; border-left-width: 3px; }
.fxbanner.kind-compel { --c: #b98be0; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stuntrow { display: flex; gap: 10px; align-items: baseline; margin-top: 6px; } .stuntrow .sk { min-width: 3.2em; font-size: 12px; color: var(--muted); } .stuntrow.dim { opacity: .55; }
.custom { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.small { font-size: 12px; }
@media (max-width: 860px) { .three { grid-template-columns: 1fr; } }

.credit { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

/* ── SRD 5.2.1 ── */
.toggle .sub, .scorerow .sub { font-size: 11px; color: var(--muted); font-weight: 400; } .toggle.on .sub { color: inherit; opacity: .75; }
.fline .bar { flex: 1; min-width: 50px; margin-top: 0; } .fline b { color: var(--text); }
.abil { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0; }
.abil div { border: 1px solid var(--line); border-radius: 8px; text-align: center; padding: 3px 0; display: flex; flex-direction: column; line-height: 1.25; }
.abil span { font-size: 10px; color: var(--muted); } .abil b { font-size: 15px; } .abil i { font-style: normal; font-size: 10px; color: var(--muted); }
.scores { display: grid; gap: 4px; margin-top: 8px; }
.scorerow { display: grid; grid-template-columns: 5.5em 7.5em 1fr 6.5em; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 8px; }
.scorerow.prime { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.scorerow .ctl { display: flex; gap: 6px; align-items: center; } .scorerow .sv { min-width: 1.6em; text-align: center; }
.scorerow select { padding: 3px 6px; width: 5em; } .scorerow .boost { display: flex; gap: 4px; } .scorerow .fin { text-align: right; }
.toggle.small { padding: 2px 9px; font-size: 12px; }
.featbox { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; } .featbox > b { display: block; margin-bottom: 8px; }
.field label .hint { font-size: 12px; }
ol.init { margin: 0 4px; padding-left: 22px; font-size: 13px; } ol.init li { padding: 1px 0; }
@media (max-width: 640px) { .scorerow { grid-template-columns: 4.5em 1fr; } .scorerow .fin { text-align: left; } }

.chip.magic { border-color: var(--accent); } .chip.magic.dim { opacity: .6; border-style: dashed; } .chip .sub { font-size: 10px; color: var(--muted); }

/* ── Basic Roleplaying ── */
.skillgrid.brp { grid-template-columns: 1fr 1fr; gap: 3px 18px; margin-bottom: 10px; }
.skillgrid.brp .skill { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px; }
.skillgrid.brp .skill.prof { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.skillgrid.brp .skill.over .lv { color: var(--bad); }
.skillgrid.brp .skill input { width: 4.2em; padding: 2px 5px; font-size: 12px; text-align: right; }
.skillgrid.brp .skill .pts { width: 2em; text-align: right; font-size: 12px; } .skillgrid.brp .skill .lv { width: 3.2em; text-align: right; }
.skillgrid.brp .skill .nm { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skillcat { margin: 10px 0 4px; } .slots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; }
.slots select, .slots input { padding: 2px 6px; font-size: 12px; } .chip.dim { opacity: .65; }
@media (max-width: 860px) { .skillgrid.brp { grid-template-columns: 1fr; } }

.rsopts { display: grid; gap: 8px; } .rsopt { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.rsopt span, .rsopts .check span { display: flex; flex-direction: column; } .rsopt small, .rsopts .check small { color: var(--muted); font-size: 12px; font-weight: 400; } .rsopt select { max-width: 55%; }

/* Forged in the Dark */
.bdots { letter-spacing: 1px; font-size: 12px; }
.bboxes { display: inline-flex; gap: 2px; flex-wrap: wrap; vertical-align: middle; }
.bboxes i { width: 9px; height: 13px; border: 1px solid var(--line, #555); border-radius: 2px; display: inline-block; }
.bboxes i.on { background: var(--accent, #c9a45c); border-color: var(--accent, #c9a45c); }
.bboxes.hot i.on { background: #c0503c; border-color: #c0503c; }
.bboxes.xp i { width: 6px; height: 6px; border-radius: 50%; }
.bactions, .bbuild { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.battr .hd { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-bottom: 3px; flex-wrap: wrap; }
.bact { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 1px 0; font-size: 13px; }
.bact .sub { opacity: .55; font-size: 11px; }
.bbuild .bact { padding: 3px 0; }
.babil { display: grid; gap: 6px; }
.babil .toggle { text-align: left; display: grid; gap: 2px; white-space: normal; }
.babil .toggle span { font-size: 12px; opacity: .8; font-weight: normal; }
.bharm { display: flex; gap: 4px; align-items: center; margin: 2px 0; }
.bharm .lv { width: 14px; text-align: center; opacity: .6; }
.bharm .slot { flex: 1; min-height: 20px; border: 1px solid var(--line, #555); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
.bharm .slot.on { border-color: #c0503c; }
.bharm .pen { width: 62px; text-align: right; }
.chip.off { opacity: .4; text-decoration: line-through; }
.bcrew { display: grid; gap: 4px; padding: 0 4px 6px; font-size: 13px; }
.bclockrow, .bfaction { display: flex; align-items: center; gap: 6px; padding: 2px 4px; font-size: 13px; }
.bclockrow span:nth-child(2), .bfaction span:first-child { flex: 1; }
.bclock { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line, #555); background: conic-gradient(var(--accent, #c9a45c) var(--p), transparent 0); flex: none; }
.bfaction .st.pos { color: #6fae6f; } .bfaction .st.neg { color: #c0503c; }
@media (max-width: 560px) { .bactions, .bbuild { grid-template-columns: 1fr; } }

/* 단계 진행 */
.nextrow { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 6px 0 2px; }
.nextstep { border: 1px solid var(--accent, #c9a45c); background: transparent; color: var(--accent, #c9a45c); border-radius: 999px; padding: 8px 18px; font-size: 14px; cursor: pointer; animation: nextpulse 1.6s ease-in-out infinite; }
.nextstep small { opacity: .6; margin-left: 6px; font-size: 11px; }
.nextstep:hover { background: color-mix(in srgb, var(--accent, #c9a45c) 14%, transparent); }
@keyframes nextpulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .nextstep { animation: none; } }
@media (pointer: coarse) { .nextstep small { display: none; } .nextstep { padding: 12px 22px; } }

/* Dungeon World */
.dwbar { flex: 1; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--line, #555) 60%, transparent); overflow: hidden; }
.dwbar i { display: block; height: 100%; background: #b5483c; }
.dwstats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; text-align: center; }
.dwstats div { border: 1px solid var(--line, #555); border-radius: 6px; padding: 3px 0; display: grid; }
.dwstats span { font-size: 11px; opacity: .7; } .dwstats b { font-size: 15px; } .dwstats small { font-size: 10px; opacity: .55; }
.dwassign .row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.dwassign .nm { width: 96px; } .dwassign .sub { opacity: .55; font-size: 11px; } .dwassign .mod { width: 28px; text-align: right; font-weight: 600; }
.dwassign button.on { background: var(--accent, #c9a45c); color: #1a1408; border-color: var(--accent, #c9a45c); }
.dwassign button.dim { opacity: .4; }
.dwmove { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line, #555); }
@media (max-width: 560px) { .dwstats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 이어서 하기 */
.savelist { margin-bottom: 16px; }
.saverow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line, #333); }
.saverow:first-of-type { border-top: 0; }
@media (max-width: 560px) { .saverow { flex-wrap: wrap; } }

/* 한 달 사용량 */
.budget-card { margin-bottom: 16px; }
.budget-card .row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.budget-card .meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--line, #555) 60%, transparent); overflow: hidden; margin: 8px 0; }
.budget-card .meter i { display: block; height: 100%; background: var(--accent, #c9a45c); }
.budget-card.closed .meter i { background: #b5483c; }
