/* Realmtable — parchment, ink and leather. */
@font-face { font-family: 'Vazirmatn'; src: url(../assets/fonts/Vazirmatn.woff2) format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+2010-2027, U+2E2E; }
@font-face { font-family: 'Fell SC'; src: url(../assets/fonts/IMFeENsc28P.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'Fell'; src: url(../assets/fonts/IMFeENrm28P.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'Fell'; src: url(../assets/fonts/IMFeENit28P.woff) format('woff'); font-style: italic; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../assets/fonts/AlegreyaSans-Regular.woff) format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../assets/fonts/AlegreyaSans-Italic.woff) format('woff'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../assets/fonts/AlegreyaSans-Medium.woff) format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../assets/fonts/AlegreyaSans-Bold.woff) format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../assets/fonts/AlegreyaSans-ExtraBold.woff) format('woff'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Alegreya SC'; src: url(../assets/fonts/AlegreyaSC-Medium.woff) format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya SC'; src: url(../assets/fonts/AlegreyaSC-Bold.woff) format('woff'); font-weight: 700; font-display: swap; }

:root {
  --ink: #2B1D12; --ink2: #5A4128; --ink3: #7A6448;
  --parch: #D9C495; --paper: #EFE3C4; --paper2: #F6EDD6;
  --rule: #8C6B3F; --rule2: #C9AE7C;
  --blood: #7A1F14; --blood2: #4E120B; --red: #A0301F;
  --gold: #B8862B; --goldL: #E8C877; --cream: #F3E6C8;
  --leather: #21170F; --night: #17110D;
  --green: #2E6B36; --green2: #3E7D45;
  --display: 'Fell SC', 'Palatino Linotype', Georgia, serif;
  --story: 'Fell', 'Palatino Linotype', Georgia, serif;
  --ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --num: 'Alegreya SC', Georgia, serif;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night) url(../assets/img/leather.jpg) 0 0 / 860px auto repeat;
  color: var(--ink); font-family: var(--ui); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; }
a { color: var(--blood); }
a:hover { color: var(--blood2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--goldL); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.warn { color: var(--blood); }
.ok { color: var(--green); }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--goldL); font-family: var(--story); font-style: italic; font-size: 20px; }

.leather { background: var(--leather) url(../assets/img/leather.jpg) center / cover; color: #EADBB6; }
.parch {
  background: var(--parch) url(../assets/img/parchment.jpg) center / cover;
  color: var(--ink);
  border: 2px solid #4A3220; outline: 1px solid var(--rule); outline-offset: -6px;
  box-shadow: inset 0 0 36px rgba(90, 58, 24, .45), var(--shadow);
}

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 3px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.05); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 52px; font-size: 16px; }
.btn.primary { background: var(--blood); border-color: var(--blood2); color: var(--cream); }
.btn.primary:hover { color: var(--cream); }
.btn.gold { background: var(--gold); border-color: var(--goldL); color: #1E140A; }
.btn.good { background: var(--green); border-color: #1F4A25; color: var(--cream); }
.btn.danger { background: #8E1B10; border-color: var(--blood2); color: var(--cream); }
.btn.ember { background: #C2561A; border-color: #7A2E0C; color: #FFF3DC; }
.btn.ghost { background: transparent; }
.btn.ghost.light { color: #EADBB6; border-color: #8C6B3F; }
.btn.danger-t { color: var(--blood); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: #2B1D12; color: #9FD3A5; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.muted { color: #F0907E; }
.icon-btn.speaking { box-shadow: 0 0 0 3px #3E7D45; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; flex-wrap: wrap; }
.input, select, textarea { min-height: 42px; padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper2); color: var(--ink); border-radius: 3px; }
.input.sm { min-height: 36px; width: 80px; }
textarea.input { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink2); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--blood); }
.chip, .tag { display: inline-block; padding: 2px 8px; border: 1px solid var(--rule); background: var(--paper); font-size: 12px; font-weight: 700; border-radius: 2px; }
.tag.red { background: var(--blood); color: var(--cream); border-color: var(--blood2); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.seg button { min-height: 40px; padding: 0 14px; border: 1px solid #6B4A2B; background: #2B1D12; color: #EADBB6; font-family: var(--num); font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--blood); border-color: var(--goldL); color: var(--cream); }
.parch .seg button { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.parch .seg button.on { background: var(--blood); color: var(--cream); }
.seg.big button { min-height: 46px; }
.kicker { font-family: var(--num); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--blood); }
.kicker.red { color: var(--blood); }
.kicker.gold { color: var(--goldL); }
.h2 { margin: 14px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--rule); font-family: var(--display); font-weight: 400; font-size: 21px; }
.h2.red { color: var(--blood); border-color: var(--blood); }
.h2 small { font-family: var(--ui); font-size: 13px; }
.room-code { font-family: var(--num); font-weight: 700; letter-spacing: .12em; color: var(--goldL); }
.parch .room-code { color: var(--blood); }

/* ---------------------------------------------------------- toasts */
#toasts { position: fixed; z-index: 90; top: 74px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: 10px 14px; background: #2B1D12; color: var(--cream); border: 1px solid var(--goldL); box-shadow: var(--shadow); font-weight: 500; animation: toastIn .3s ease both; }
.toast.error { border-color: #F0907E; }
.toast.warn { border-color: #F0B47A; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .5s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------------------------------------------------------- lobby */
.lobby { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 28px; color: #EADBB6; }
.lobby-hero { text-align: center; max-width: 640px; }
.lobby-d20 { width: 84px; height: 84px; color: var(--goldL); filter: drop-shadow(0 0 18px rgba(232, 200, 119, .35)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(8deg); } }
.lobby h1 { margin: 6px 0; font-family: var(--display); font-weight: 400; font-size: clamp(44px, 8vw, 76px); line-height: 1; color: var(--goldL); text-shadow: 0 3px 0 #000; }
.lobby-hero p { font-family: var(--story); font-style: italic; font-size: 19px; color: #EADBB6; }
.lobby-cards { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; width: min(100%, 880px); }
.lobby-card { flex: 1 1 320px; padding: 22px 24px; display: flex; flex-direction: column; }
.lobby-card h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 28px; }
.lobby-card .btn { margin-top: auto; }
.input.code { font-family: var(--num); font-weight: 700; font-size: 22px; letter-spacing: .2em; text-transform: uppercase; }
.lobby-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.lobby-foot .muted { color: #C7B48C; font-size: 13px; }

/* ---------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 8px 18px; border-bottom: 2px solid var(--rule); box-shadow: 0 4px 18px rgba(0, 0, 0, .5); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--goldL); text-decoration: none; font-family: var(--display); font-size: 25px; }
.brand:hover { color: #F2CB7A; }
.brand svg { width: 32px; height: 32px; }
.top-title { display: flex; flex-direction: column; min-width: 160px; padding-left: 14px; border-left: 1px solid #6B4A2B; }
.top-title b { font-family: var(--story); font-weight: 400; font-size: 17px; color: var(--cream); }
.top-title small { color: #C7B48C; font-size: 12px; }
.topnav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.topnav a { padding: 10px 12px; color: #EADBB6; text-decoration: none; font-family: var(--num); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--goldL); }
.topnav a.on { color: var(--goldL); border-bottom-color: var(--goldL); }
.top-right { display: flex; align-items: center; gap: 10px; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: #3E7D45; box-shadow: 0 0 8px #3E7D45; }
.conn.bad { background: #F0907E; box-shadow: 0 0 8px #F0907E; animation: connblink 1.2s ease-in-out infinite; }
.conn.paused { background: #8C7B5F; box-shadow: none; }
@keyframes connblink { 50% { opacity: .35; } }
.view { padding: 14px 18px 28px; }

/* ---------------------------------------------------------- table layout */
.table-layout { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.stage-col { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.side-col { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.panel { padding: 14px 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); }
.panel-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; }

/* initiative */
.init-strip { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.init-title { display: flex; flex-direction: column; font-family: var(--display); font-size: 18px; line-height: 1.1; }
.init-title small { font-family: var(--ui); font-size: 12px; color: var(--ink2); }
.init-list { display: flex; gap: 8px; overflow-x: auto; flex: 1 1 300px; padding: 4px 2px; align-items: flex-end; min-height: 64px; }
.init-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 52px; }
.init-item.done { opacity: .5; }
.init-face { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ring); background: #F1E6CC; display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; color: var(--ink); }
.init-item.monster .init-face, .init-item.npc .init-face { background: #2B1D12; color: #F0D9A8; }
.init-item.now .init-face { width: 56px; height: 56px; box-shadow: 0 0 0 3px var(--parch), 0 0 0 5px var(--gold); }
.init-face img { width: 100%; height: 100%; object-fit: cover; }
.init-face svg { width: 62%; height: 62%; }
.init-val { font-family: var(--num); font-weight: 700; font-size: 13px; }
.init-item.now .init-val { color: var(--blood); }
.init-name { font-size: 11px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.init-x { position: absolute; top: -6px; right: -4px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper); font-size: 14px; line-height: 1; padding: 0; opacity: .0; transition: opacity .15s; }
.init-item:hover .init-x, .init-x:focus-visible { opacity: 1; }
.init-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* map */
.map-wrap { position: relative; height: clamp(380px, 66vh, 900px); border: 3px solid #2B1D12; outline: 1px solid var(--gold); outline-offset: 3px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); background: #120d09; overflow: hidden; }
.map-wrap.shake { animation: shake .55s ease-out; }
.map-wrap.shake-strong { animation: shake 0.8s ease-out; }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 10% { transform: translate(-8px, 4px); } 22% { transform: translate(7px, -5px); } 34% { transform: translate(-6px, 3px); } 46% { transform: translate(5px, -3px); } 58% { transform: translate(-3px, 2px); } 70% { transform: translate(2px, -1px); } }
.viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.viewport.panning { cursor: grabbing; }
.viewport[data-tool="measure"], .viewport[data-tool="ping"], .viewport[data-tool="fog"], .viewport[data-tool="trap"] { cursor: crosshair; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.map-img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.grid-canvas, .fog-canvas, .fx-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fog-canvas:not(.gm) { filter: blur(3px); }
.fog-canvas.gm { opacity: 1; }
.trap-layer, .token-layer, .ping-layer { position: absolute; inset: 0; }
.trap-layer { pointer-events: none; }

.token { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; transition: left .3s cubic-bezier(.2, .8, .2, 1), top .3s cubic-bezier(.2, .8, .2, 1); cursor: pointer; touch-action: none; z-index: 2; }
.token.dragging { transition: none; z-index: 5; cursor: grabbing; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .6)); }
.token.dragging::after { content: attr(data-ft); position: absolute; left: 50%; top: -28px; transform: translateX(-50%) scale(calc(1 / var(--zoom, 1))); padding: 1px 8px; background: #2B1D12; border: 1px solid var(--goldL); color: var(--cream); font: 700 14px var(--num); white-space: nowrap; }
.tk-face { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--ring); background: #F1E6CC; color: var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 4px 10px rgba(0, 0, 0, .7); }
.token.monster .tk-face, .token.npc .tk-face { background: #2B1D12; color: #F0D9A8; }
.tk-face img { width: 100%; height: 100%; object-fit: cover; }
.tk-glyph { width: 64%; height: 64%; }
.tk-label { font-family: var(--display); font-size: 1em; }
.token.sel .tk-face { box-shadow: 0 0 0 2px #2B1D12, 0 0 0 4px var(--goldL), 0 4px 10px rgba(0, 0, 0, .7); }
.token.turn::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 2px dashed var(--goldL); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.token.speaking .tk-face { box-shadow: 0 0 0 3px #3E7D45, 0 0 16px 4px rgba(111, 207, 142, .7); }
.token.hidden-tk { opacity: .55; }
.token.hidden-tk .tk-face { border-style: dashed; }
.token.down .tk-face { filter: grayscale(.8) brightness(.7); }
.tk-hp { position: absolute; left: 8%; right: 8%; bottom: -7px; height: 5px; background: #2B1D12; border: 1px solid #000; }
.tk-hp i { display: block; height: 100%; }
.tk-name { position: absolute; left: 50%; top: 100%; margin-top: 6px; transform: translateX(-50%); padding: 0 5px; background: rgba(23, 17, 13, .85); color: var(--cream); font-size: 11px; font-weight: 700; white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.token:hover .tk-name, .token.sel .tk-name, .token.monster.turn .tk-name { opacity: 1; }
.tk-conds { position: absolute; top: -6px; right: -6px; display: flex; gap: 1px; }
.tk-conds span { width: 14px; height: 14px; border-radius: 50%; background: var(--blood); color: var(--cream); font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 1px solid var(--cream); }

.trap-mark { position: absolute; transform: translate(-50%, -50%); width: calc(var(--g) * .7); height: calc(var(--g) * .7); border: 0; background: none; padding: 0; pointer-events: auto; z-index: 1; }
.trap-mark b { position: absolute; inset: 15%; transform: rotate(45deg); background: #2B1D12; border: 2px solid var(--goldL); box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.trap-mark.sprung b { background: var(--blood); border-color: var(--cream); }
.trap-mark .pulse { position: absolute; inset: -40%; border-radius: 50%; border: 2px solid var(--goldL); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.trap-mark span { position: absolute; left: 50%; top: 105%; transform: translateX(-50%); padding: 0 5px; background: #2B1D12; color: var(--goldL); font-size: 10px; font-weight: 700; white-space: nowrap; border: 1px solid var(--goldL); }

.ping { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 6; }
.ping i { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--c); animation: pingA 1.4s ease-out 2; }
.ping i + i { animation-delay: .35s; }
.ping span { position: absolute; left: 0; top: 36px; transform: translateX(-50%); padding: 0 6px; background: #2B1D12; color: var(--cream); font-size: 12px; font-weight: 700; white-space: nowrap; animation: fadeOut 2.6s ease forwards; }
@keyframes pingA { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes fadeOut { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.map-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 7; }
.map-flash.go { animation: flash .9s ease-out; }
@keyframes flash { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }

/* trap effects */
.fx-layer { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 6; }
.fx-layer i { position: absolute; display: block; }
.fx-layer .dart { width: calc(var(--g) * 1.2); height: 3px; background: linear-gradient(90deg, #F3E6C8, #9FD3A5); border-radius: 2px; transform-origin: 0 50%; left: 0; top: 0; animation: dart .45s cubic-bezier(.5, 0, 1, 1) both; }
@keyframes dart { from { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 1; } 90% { opacity: 1; } to { transform: translate(0, 0) rotate(var(--rot)); opacity: 0; } }
.fx-layer .burst { left: calc(var(--g) * -1.5); top: calc(var(--g) * -1.5); width: calc(var(--g) * 3); height: calc(var(--g) * 3); border-radius: 50%; border: 4px solid #9FD3A5; animation: burst .9s ease-out .35s both; }
.fx-layer .burst.dust { border: 0; background: radial-gradient(circle, rgba(200, 180, 140, .8), rgba(120, 100, 70, 0) 70%); animation-delay: 0s; }
.fx-layer .burst.dust.big { left: calc(var(--g) * -3); top: calc(var(--g) * -3); width: calc(var(--g) * 6); height: calc(var(--g) * 6); }
.fx-layer .burst.fire { border: 0; background: radial-gradient(circle, rgba(255, 230, 140, .95), rgba(255, 120, 30, .7) 40%, rgba(160, 30, 10, 0) 70%); left: calc(var(--g) * -2.5); top: calc(var(--g) * -2.5); width: calc(var(--g) * 5); height: calc(var(--g) * 5); animation-delay: 0s; animation-duration: 1.4s; }
@keyframes burst { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.fx-layer .pit { left: calc(var(--g) * -.9); top: calc(var(--g) * -.9); width: calc(var(--g) * 1.8); height: calc(var(--g) * 1.8); border-radius: 50%; background: radial-gradient(circle, #000 40%, #1a0f08 60%, rgba(0, 0, 0, 0) 72%); animation: pit 2.6s ease-out both; }
@keyframes pit { 0% { transform: scale(0); } 20% { transform: scale(1.1); } 30%, 80% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }
.fx-layer .debris, .fx-layer .ember { left: 0; top: 0; width: 7px; height: 7px; border-radius: 2px; background: #6B4A2B; animation: debris 1.2s ease-out both; }
.fx-layer .ember { width: 9px; height: 9px; border-radius: 50%; background: #FFB347; box-shadow: 0 0 10px #FF7A1A; animation-duration: 1.5s; }
@keyframes debris { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.fx-layer .rock { left: var(--sx); top: calc(var(--g) * -4); width: var(--sz); height: var(--sz); background: #5E4A36; border: 1px solid #2B1D12; border-radius: 30% 45% 35% 50%; animation: rock .7s cubic-bezier(.6, 0, 1, 1) both; }
@keyframes rock { from { transform: translateY(0) rotate(0); opacity: 1; } 85% { opacity: 1; } to { transform: translateY(calc(var(--g) * 4)) rotate(160deg); opacity: 0; } }
.fx-layer .net { left: calc(var(--g) * -1.5); top: calc(var(--g) * -1.5); width: calc(var(--g) * 3); height: calc(var(--g) * 3); background: repeating-linear-gradient(45deg, rgba(232, 200, 119, .9) 0 2px, transparent 2px 12px), repeating-linear-gradient(-45deg, rgba(232, 200, 119, .9) 0 2px, transparent 2px 12px); border-radius: 12%; animation: net 2.8s ease-out both; }
@keyframes net { 0% { transform: scale(1.8) translateY(-40px); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.fx-layer .sphere { left: calc(var(--g) * -1); top: calc(var(--g) * -1); width: calc(var(--g) * 2); height: calc(var(--g) * 2); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #A08870, #4A3220 70%); border: 2px solid #1a0f08; animation: sphere 1.2s cubic-bezier(.4, 0, .9, .6) both; }
@keyframes sphere { from { transform: translateX(calc(var(--g) * -10)) rotate(-540deg); opacity: 1; } 90% { opacity: 1; } to { transform: translateX(calc(var(--g) * 3)) rotate(180deg); opacity: 0; } }

/* rails over the map */
.tool-rail, .zoom-rail { position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 5px; border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 6px 16px rgba(0, 0, 0, .6); z-index: 8; }
.tool-rail { left: 10px; top: 10px; }
.zoom-rail { right: 10px; top: 10px; }
.tool-rail button, .zoom-rail button { width: 44px; height: 44px; border-radius: 3px; border: 1px solid transparent; background: transparent; color: #EADBB6; display: flex; align-items: center; justify-content: center; }
.tool-rail button.on { border-color: var(--goldL); background: #4A3220; color: var(--cream); }
.tool-rail button:hover, .zoom-rail button:hover { background: #3A2818; }
.fog-pop { position: absolute; left: 66px; top: 10px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; z-index: 8; max-width: 280px; }
.fog-pop .seg { margin: 4px 0; }
.fog-pop .seg button { min-height: 36px; padding: 0 10px; font-size: 13px; }
.fog-pop .check { color: #EADBB6; margin: 4px 0 0; }
.map-caption { position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; background: rgba(23, 17, 13, .85); border: 1px solid var(--rule); color: #EADBB6; font-size: 12px; z-index: 8; pointer-events: none; }

/* trap card */
.trap-card-wrap { position: absolute; right: 66px; top: 12px; width: min(380px, calc(100% - 140px)); z-index: 9; }
.trap-card { padding: 14px 16px; border-color: var(--blood); outline-color: var(--goldL); animation: cardIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.trap-head { display: flex; gap: 12px; align-items: center; }
.trap-gem { width: 36px; height: 36px; transform: rotate(45deg); background: var(--blood); border: 2px solid var(--goldL); display: flex; align-items: center; justify-content: center; color: var(--cream); font-family: var(--display); font-size: 20px; flex-shrink: 0; }
.trap-gem span { transform: rotate(-45deg); line-height: 1; }
.trap-name { font-family: var(--display); font-size: 25px; line-height: 1.05; }
.trap-rolls { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.read { font-family: var(--story); font-style: italic; font-size: 17px; line-height: 1.5; margin: 6px 0; }

/* narration */
.narration { padding: 12px 18px; }
.narration .read { margin: 2px 0 0; font-size: 18px; }
.narration.fresh { animation: glow 2.4s ease-out; }
@keyframes glow { 0% { box-shadow: inset 0 0 36px rgba(90, 58, 24, .45), 0 0 0 3px var(--goldL), var(--shadow); } 100% { box-shadow: inset 0 0 36px rgba(90, 58, 24, .45), var(--shadow); } }

/* hotbar */
.hotbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 12px 16px; }
.hot-empty { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--ink2); }
.hot-who { display: flex; gap: 10px; align-items: center; }
.hot-name { font-family: var(--display); font-size: 21px; line-height: 1.1; }
.medal { width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--ring, var(--gold)); background: #F1E6CC; color: var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.medal.monster, .medal.npc { background: #2B1D12; color: #F0D9A8; --ring: #A0301F; }
.medal img { width: 100%; height: 100%; object-fit: cover; }
.medal svg { width: 62%; height: 62%; }
.medal .tk-label { font-size: 20px; }
.medal.big { width: 120px; height: 120px; border-width: 6px; box-shadow: 0 0 0 3px #2B1D12, 0 0 0 5px var(--gold), var(--shadow); }
.hot-stats { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat { min-width: 58px; padding: 3px 8px; text-align: center; border: 1px solid var(--rule); background: var(--paper); }
.stat b { display: block; font-family: var(--num); font-size: 21px; line-height: 1.1; }
.stat b small { font-size: 13px; color: var(--ink2); }
.stat span { font-size: 11px; color: var(--ink2); }
.hp-adjust { display: flex; gap: 4px; align-items: center; }
.hp-adjust input { width: 64px; min-height: 38px; padding: 4px 6px; border: 1px solid var(--rule); background: var(--paper2); }
.hot-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 280px; }
.act { display: flex; }
.act .btn:first-child { border-radius: 3px 0 0 3px; }
.act .btn + .btn { border-radius: 0 3px 3px 0; border-left: 0; }
.cond-row { flex-basis: 100%; display: flex; gap: 4px; flex-wrap: wrap; }

/* party */
.members { display: flex; flex-direction: column; gap: 8px; }
.member { display: flex; gap: 10px; align-items: center; }
.member.off { opacity: .55; }
.avatar { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; border: 3px solid var(--ring); background: #F1E6CC; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 17px; overflow: hidden; transition: box-shadow .15s; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 62%; height: 62%; }
.avatar.speaking { box-shadow: 0 0 0 3px #3E7D45, 0 0 14px rgba(111, 207, 142, .8); }
.m-body { flex: 1; min-width: 0; }
.m-top { display: flex; justify-content: space-between; gap: 6px; }
.m-stat { font-size: 12px; color: var(--ink2); white-space: nowrap; }
.m-stat.ok { color: var(--green); font-weight: 700; }
.bar { height: 6px; margin-top: 3px; background: #CDB98C; border: 1px solid var(--rule); }
.bar i { display: block; height: 100%; background: var(--green2); }
.vol input { width: 100%; accent-color: var(--blood); }
.voice-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.voice-row .btn { flex: 1; }

/* dice tray */
.dice-color select { min-height: 34px; padding: 2px 6px; font-size: 13px; }
.dice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.die-btn { position: relative; min-height: 56px; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-family: var(--num); font-weight: 700; font-size: 13px; transition: transform .12s; }
.die-btn:hover { transform: translateY(-2px); }
.die-btn.hero { background: var(--blood); border-color: var(--blood2); color: var(--cream); }
.die-btn.adv { background: #E2E6C6; border-color: var(--green); color: #1F4A25; font-family: var(--ui); }
.die-btn.dis { background: #F1D9C6; border-color: var(--blood); color: var(--blood); font-family: var(--ui); }
.die-btn i { position: absolute; top: 3px; right: 5px; min-width: 20px; height: 20px; border-radius: 10px; background: #2B1D12; color: var(--goldL); font-style: normal; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.die-btn.adv, .die-btn.dis { grid-column: span 1; }
.pool-row { display: flex; gap: 8px; align-items: center; margin: 10px 0 8px; }
.pool { flex: 1; min-height: 42px; padding: 8px 10px; background: #2B1D12; color: var(--goldL); border: 1px solid var(--gold); font-family: var(--num); font-weight: 700; }
.pool .muted { color: #C7B48C; font-family: var(--ui); font-weight: 400; }
.modbox input { width: 70px; min-height: 42px; padding: 4px 8px; border: 1px solid var(--rule); background: var(--paper2); text-align: center; font-weight: 700; }

/* chronicle */
.chat-row { display: flex; gap: 6px; margin-bottom: 8px; }
.chat-row .input { flex: 1; min-width: 0; }
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.log { padding: 6px 9px; background: var(--paper); border: 1px solid var(--rule2); font-size: 14px; }
.log-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.log-top span { color: var(--ink2); text-align: right; }
.log-main { display: flex; align-items: baseline; gap: 8px; }
.log-total { font-family: var(--num); font-weight: 700; font-size: 24px; }
.log.tone-crit { border-color: var(--gold); background: #F6E7B8; }
.log.tone-good .log-main b { color: var(--green); }
.log.tone-bad .log-main b { color: var(--blood); }
.log.sys { background: transparent; border: 0; color: var(--ink2); font-style: italic; padding: 2px 4px; font-size: 13px; }
.log.trap { background: var(--blood); color: var(--cream); border-color: var(--blood2); font-weight: 700; }
.log.chat b { margin-right: 4px; }

/* GM panel */
#gmPanel { border-color: var(--gold); }
#gmPanel textarea { width: 100%; min-height: 72px; }

/* dice overlay & banner */
.dice-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; perspective: 1100px; perspective-origin: 50% 35%; overflow: hidden; transform-style: preserve-3d; opacity: 0; transition: opacity .22s; }
.dice-layer.on { opacity: 1; }
.die { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.die-face { position: absolute; left: 0; top: 0; transform-origin: 0 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.die-face svg { display: block; overflow: visible; }
.die-num { font-family: var(--num); font-weight: 700; }
.die-shadow { position: absolute; left: 0; top: 0; border-radius: 50%; background: rgba(10, 6, 3, .75); filter: blur(7px); will-change: transform, opacity; }
.roll-banner { position: fixed; z-index: 61; left: 50%; bottom: 22px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 14px; padding: 9px 20px 9px 10px; max-width: min(92vw, 640px); background: rgba(23, 17, 13, .94); border: 1px solid var(--edge, var(--goldL)); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); color: var(--cream); transition: opacity .35s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.roll-banner.show { opacity: 1; transform: translate(-50%, 0); }
.roll-banner.crit { box-shadow: 0 0 0 2px var(--goldL), 0 0 40px rgba(232, 200, 119, .6); }
.rb-total { min-width: 66px; height: 66px; padding: 0 8px; border-radius: 50%; border: 2px solid var(--edge, var(--goldL)); color: var(--edge, var(--goldL)); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 36px; }
.rb-label { font-family: var(--num); font-weight: 700; font-size: 13px; letter-spacing: .05em; color: #C7B48C; }
.rb-out { font-weight: 800; color: var(--edge, var(--goldL)); }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(10, 6, 3, .7); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { position: relative; width: min(480px, 100%); max-height: 90vh; overflow-y: auto; padding: 20px 22px; animation: cardIn .3s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(860px, 100%); }
.modal-x { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 26px; color: var(--ink2); }
.modal .h2 { margin-top: 0; padding-right: 40px; }
.cond-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.cond-opt { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border: 1px solid var(--rule2); background: var(--paper); cursor: pointer; }
.cond-opt input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--blood); flex-shrink: 0; }
.cond-opt small { display: block; font-size: 12px; color: var(--ink2); }
.trap-pick, .map-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.trap-opt { text-align: left; padding: 10px 12px; border: 1px solid var(--rule); background: var(--paper); }
.trap-opt:hover { border-color: var(--blood); }
.trap-opt b { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; }
.trap-opt small { color: var(--ink2); }
.map-opt { display: flex; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--rule); background: var(--paper); text-align: left; cursor: pointer; min-height: 64px; }
.map-opt.on { border: 2px solid var(--blood); background: #F3E2B0; }
.map-opt img { width: 72px; height: 52px; object-fit: cover; border: 1px solid #2B1D12; }
.map-opt span { font-family: var(--story); font-size: 16px; line-height: 1.1; }
.map-opt small { display: block; font-family: var(--num); font-weight: 700; font-size: 11px; color: var(--blood); letter-spacing: .08em; }
.map-opt.upload { justify-content: center; border-style: dashed; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid3 .field input { width: 100%; }

/* ---------------------------------------------------------- pages */
.page { max-width: 1320px; margin: 0 auto; }
.page-head { margin-bottom: 10px; color: #EADBB6; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 42px); color: var(--goldL); }
.page-head p { margin: 2px 0 0; }
.page-head .muted, .page > .muted { color: #C7B48C; }
.page-sub { color: var(--goldL); border-color: var(--rule); }
.box { padding: 16px 18px; }
.two-col { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.two-col > :first-child { flex: 3 1 560px; min-width: 0; }
.two-col > :last-child { flex: 2 1 320px; min-width: 0; }
.side-stack { display: flex; flex-direction: column; gap: 12px; }
.tabs { margin-bottom: 12px; }

/* story */
.prose p { margin: 6px 0; }
.title { margin: 2px 0 10px; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; }
.secret { padding: 12px 16px; background: #2B1D12; color: var(--cream); border: 1px solid var(--gold); }
.read-box { margin: 8px 0; padding: 10px 14px; border: 1px solid var(--rule); background: var(--paper); font-family: var(--story); font-style: italic; font-size: 17px; display: flex; flex-direction: column; gap: 8px; }
.read-box .btn { align-self: flex-start; font-family: var(--ui); font-style: normal; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; font-size: 14px; }
.room { padding: 8px 10px; border: 1px solid var(--rule2); background: var(--paper); }
.room b { color: var(--blood); }
.npc { margin-bottom: 10px; font-size: 14px; }
.clues { margin: 0; padding-left: 18px; }
.kv { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--rule); padding: 3px 0; font-size: 14px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.rule p { margin: 0; font-size: 14px; }
.cond-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cond-cards .box { padding: 12px 14px; }
.cond-title { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--blood); }
.trap-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dotted var(--rule); }
.gem { width: 18px; height: 18px; transform: rotate(45deg); background: #2B1D12; border: 2px solid var(--goldL); flex-shrink: 0; }
.gem.sprung { background: var(--blood); }
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; font-size: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--blood); font-family: var(--num); border-bottom: 2px solid var(--blood); padding: 6px; }
.tbl td { padding: 6px; border-bottom: 1px dotted var(--rule); }
.tbl tbody tr:nth-child(odd) { background: rgba(239, 227, 196, .55); }
.enc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.enc-list li { display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px dotted var(--rule); }
.enc-list li b { font-family: var(--num); font-size: 18px; color: var(--blood); min-width: 20px; }
.enc-list li.hit { background: #2B1D12; color: var(--cream); border: 1px solid var(--goldL); }
.enc-list li.hit b { color: var(--goldL); }
.notes { min-height: 140px; font-family: var(--story); font-size: 16px; }

/* bestiary */
.search .input { width: 220px; }
.best-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.best-list { flex: 3 1 460px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.mon { display: flex; gap: 10px; align-items: center; padding: 10px 12px; text-align: left; outline-offset: -5px; box-shadow: inset 0 0 22px rgba(90, 58, 24, .4); }
.mon.on { border-color: var(--blood); outline: 1px solid var(--goldL); }
.mon .medal { width: 44px; height: 44px; border-width: 3px; }
.mon b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; line-height: 1.1; }
.mon small { color: var(--ink2); font-size: 12px; }
.cr { text-align: center; }
.cr b { font-family: var(--num); color: var(--blood); font-size: 18px; }
.cr small { display: block; }
.statblock { flex: 2 1 380px; min-width: 0; padding: 18px 22px; outline: none; }
.statblock h2 { margin: 6px 0 0; font-family: var(--display); font-weight: 400; font-size: 32px; color: var(--blood); line-height: 1.05; }
.sb-type { font-family: var(--story); font-style: italic; }
.bar-top { height: 5px; background: var(--blood); margin: 2px 0; }
.taper { display: block; width: 100%; height: 5px; margin: 8px 0; fill: var(--blood); }
.sb-lines { color: var(--blood); font-size: 15px; }
.sb-lines b { color: var(--blood); }
.sb-lines div { color: var(--ink); }
.sb-lines div b { color: var(--blood); margin-right: 4px; }
.sb-abil { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); text-align: center; }
.sb-abil button { border: 0; background: none; padding: 4px 0; border-radius: 3px; }
.sb-abil button:hover { background: rgba(122, 31, 20, .08); }
.sb-abil b { display: block; color: var(--blood); font-size: 13px; }
.sb-abil span { font-size: 13px; }
.sb-trait { margin: 4px 0; font-size: 14px; }
.statblock h3 { margin: 10px 0 4px; padding-bottom: 2px; border-bottom: 1px solid var(--blood); font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--blood); }
.sb-act { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin: 6px 0; }
.sb-act p { margin: 0; font-size: 14px; flex: 1; }
.add-row { margin-top: 12px; }

/* campaign map */
.world-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.world-tabs button { display: flex; gap: 10px; align-items: center; padding: 6px; border: 1px solid #6B4A2B; background: #2B1D12; color: #EADBB6; text-align: left; min-height: 64px; }
.world-tabs button.on { background: var(--parch) url(../assets/img/parchment.jpg) center / cover; color: var(--ink); border: 2px solid var(--blood); outline: 1px solid var(--goldL); outline-offset: 2px; }
.world-tabs img { width: 72px; height: 52px; object-fit: cover; border: 1px solid #2B1D12; }
.world-tabs span { font-family: var(--story); font-size: 17px; line-height: 1.1; }
.world-tabs small { display: block; font-family: var(--num); font-weight: 700; font-size: 11px; letter-spacing: .08em; color: var(--goldL); }
.world-tabs button.on small { color: var(--blood); }
.world-frame { position: relative; border: 3px solid #2B1D12; outline: 1px solid var(--gold); outline-offset: 3px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); background: #2B1D12; }
.world-frame > img { display: block; width: 100%; height: auto; }
.world-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -110%); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; box-shadow: 0 6px 14px rgba(0, 0, 0, .6); }
.pin.party { background: #2B1D12; color: var(--cream); border: 2px solid var(--goldL); }
.pin.quest { background: var(--blood); color: var(--cream); border: 2px solid var(--cream); }

/* character sheet */
.sheet-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 18px 22px; margin-bottom: 14px; }
.sheet-head h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1; }
.sheet-head .sub { font-family: var(--story); font-style: italic; font-size: 17px; color: var(--ink2); }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.vitals.small3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vital { padding: 6px 4px; text-align: center; border: 1px solid var(--rule); background: var(--paper); }
.vital b { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; }
.vital b small { font-size: 15px; color: var(--ink2); }
.vital span { display: block; font-size: 12px; font-weight: 700; color: var(--ink2); }
.vital small { display: block; font-size: 11px; color: var(--ink3); }
.vital.roll { cursor: pointer; border-color: var(--blood); }
.vital.roll:hover { background: #F3E2B0; }
.abil-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.abil { display: flex; flex-direction: column; align-items: center; padding: 8px 4px 0; border: 1px solid var(--rule); background: var(--paper); border-radius: 6px 6px 40% 40%; }
.abil:hover { border-color: var(--blood); }
.abil span { font-family: var(--num); font-weight: 700; font-size: 13px; color: var(--ink2); }
.abil b { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.1; }
.abil i { margin-bottom: -10px; padding: 0 12px; font-style: normal; font-weight: 700; background: var(--paper2); border: 1px solid var(--rule); border-radius: 999px; }
.abil-grid { padding-bottom: 12px; }
.list2 { display: flex; flex-direction: column; }
.line { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border: 0; border-bottom: 1px dotted var(--rule); background: none; text-align: left; }
.line:hover { background: rgba(122, 31, 20, .07); }
.line i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--rule); flex-shrink: 0; }
.line.prof i { background: var(--blood); border-color: var(--blood); }
.line span { flex: 1; }
.line b { font-family: var(--num); font-size: 15px; }
.atk-list { display: flex; flex-direction: column; gap: 8px; }
.atk { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--rule2); background: var(--paper); }
.feats { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.char-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.char-card { display: flex; gap: 12px; align-items: center; padding: 14px; text-align: left; }
.char-card b { font-family: var(--display); font-weight: 400; font-size: 21px; }

/* builder */
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.steps button { min-height: 38px; padding: 0 12px; border: 1px solid #6B4A2B; background: transparent; color: #C7B48C; font-family: var(--num); font-weight: 700; font-size: 13px; }
.steps button.done { border-color: var(--green2); color: #9FD3A5; }
.steps button.on { background: var(--gold); border-color: var(--goldL); color: #1E140A; }
.builder-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.builder-grid > section { flex: 3 1 520px; min-width: 0; }
.builder-grid > .preview { flex: 1 1 280px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: sticky; top: 76px; }
.preview h2 { margin: 10px 0 0; font-family: var(--display); font-weight: 400; font-size: 26px; }
.preview p { margin: 0; }
.preview .vitals { width: 100%; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt-grid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.opt { min-height: 72px; padding: 8px; border: 1px solid var(--rule); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.opt b { font-size: 15px; }
.opt small { font-size: 12px; }
.opt.on { border: 2px solid var(--blood); background: #F3E2B0; }
.opt-glyph { width: 32px; height: 32px; color: var(--blood); }
.opt-glyph svg { width: 100%; height: 100%; }
.tip { margin: 10px 0; padding: 8px 12px; border-left: 0; background: rgba(239, 227, 196, .7); border: 1px solid var(--rule2); font-family: var(--story); font-style: italic; font-size: 16px; }
.abil-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ae { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper); }
.ae > span { font-family: var(--num); font-weight: 700; color: var(--ink2); font-size: 13px; }
.ae select { width: 100%; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 40px; height: 40px; border: 1px solid var(--rule); background: var(--paper2); font-size: 20px; font-weight: 700; }
.stepper b { font-family: var(--display); font-weight: 400; font-size: 26px; min-width: 32px; text-align: center; }
.skill-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 10px; }
.skill-pick .granted { opacity: .7; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--rule); }
.swatch.on { border-color: #2B1D12; box-shadow: 0 0 0 2px var(--goldL); }
.mini-abil { width: 100%; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); text-align: center; gap: 2px; margin: 6px 0; }
.mini-abil span { display: block; font-size: 11px; font-weight: 800; color: var(--blood); }
.mini-abil b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; }
.mini-abil i { font-style: normal; font-size: 12px; color: var(--ink2); }
.nav-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }


/* ================================================================ v2: campaign */
/* stat block extras */
.sb-head { display: flex; gap: 14px; align-items: center; }
.sb-portrait { flex-shrink: 0; width: 76px; height: 76px; padding: 0; border-radius: 50%; overflow: hidden; border: 3px solid var(--blood); box-shadow: 0 0 0 2px var(--goldL), 0 4px 12px rgba(0,0,0,.4); background: #2B1D12; }
.sb-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.sb-portrait:hover img { transform: scale(1.08); }
.sb-note { margin: 4px 0 0; padding: 6px 10px; background: rgba(122, 31, 20, .08); border-left: 3px solid var(--blood); font-size: 14px; font-style: italic; }
.sb-src { margin: 8px 0 2px; font-size: 12px; color: var(--ink2); font-style: italic; text-align: right; }
.sb-act .row { flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 46%; }
.statblock .btn.sm { min-height: 32px; padding: 0 9px; }
.modal .statblock { box-shadow: none; border: 0; outline: 0; background: none; padding: 0; }

/* adventure runner */
.view-adventure { padding: 0; }
.adv { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 58px); }
.adv-side { overflow-y: auto; padding: 14px 14px 30px; border-right: 2px solid #4A3220; }
.adv-title b { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--goldL); line-height: 1; }
.adv-title small { color: #C7B48C; font-size: 13px; }
.party-box { margin: 12px 0; padding: 10px 12px; border: 1px solid #6B4A2B; background: rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 6px; }
.party-box .muted { color: #C7B48C; }
.xpbar { position: relative; height: 22px; background: #120c08; border: 1px solid #6B4A2B; }
.xpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8C6B3F, var(--goldL)); }
.xpbar span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 700; line-height: 20px; color: #fff; text-shadow: 0 1px 2px #000; }
.chip-btn { border: 1px solid #6B4A2B; background: #2B1D12; color: #EADBB6; padding: 3px 9px; font-size: 12px; font-weight: 700; min-height: 28px; }
.chip-btn.on { background: var(--blood); border-color: var(--goldL); color: var(--cream); }
.seg.small button { min-height: 32px; font-size: 13px; padding: 0 10px; }
.adv-tree { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.tp-head b { display: block; font-family: var(--num); color: var(--goldL); font-size: 15px; }
.tp-head small { color: #A8936B; font-size: 12px; }
.tree-scene { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-left: 2px solid #4A3220; color: #E4D3AC; padding: 6px 8px; font-size: 14px; min-height: 34px; }
.tree-scene i { width: 10px; height: 10px; border: 2px solid #8C6B3F; border-radius: 50%; flex-shrink: 0; }
.tree-scene.done i { background: var(--green2); border-color: #9FD3A5; }
.tree-scene.done span { color: #A8B98F; }
.tree-scene em { margin-left: auto; font-style: normal; color: #C2561A; font-size: 12px; }
.tree-scene:hover { background: rgba(232, 200, 119, .08); }
.tree-scene.on { background: var(--blood); border-left-color: var(--goldL); color: var(--cream); }
.cast { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.cast-item { display: flex; gap: 10px; font-size: 13px; }
.cast-item b { color: var(--goldL); font-family: var(--num); font-size: 15px; }
.cast-item small { display: block; color: #A8936B; }
.cast-item p { margin: 3px 0; color: #E4D3AC; }
.cast-img { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; border: 2px solid var(--gold); padding: 0; flex-shrink: 0; background: #2B1D12; }
.cast-img img { width: 100%; height: 100%; object-fit: cover; }
.cast-img.none { display: block; border-style: dashed; opacity: .4; }
.link { background: none; border: 0; padding: 0; color: var(--goldL); text-decoration: underline; font-size: 13px; }
.parch .link, .adv-main .link { color: var(--blood); }
.adv-main { overflow-y: auto; padding: 22px clamp(14px, 3vw, 44px) 60px; background: var(--parch) url(../assets/img/parchment.jpg) center / 900px auto; box-shadow: inset 0 0 60px rgba(90, 58, 24, .5); }
.adv-main > * { max-width: 980px; margin-left: auto; margin-right: auto; }
.scene-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; border-bottom: 3px double var(--blood); padding-bottom: 8px; }
.scene-head h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 46px); line-height: 1; color: var(--blood); }
.kicker { font-family: var(--num); font-weight: 700; font-size: 13px; color: var(--ink2); letter-spacing: .02em; }
.part-summary { font-family: var(--story); font-size: 18px; font-style: italic; color: var(--ink2); margin: 12px auto; }
.scene-art { position: relative; margin: 16px auto; border: 3px solid #2B1D12; box-shadow: 0 0 0 2px var(--gold), 0 12px 30px rgba(0, 0, 0, .5); background: #120c08; }
.scene-art img { display: block; width: 100%; max-height: 380px; object-fit: cover; }
.scene-art .btn { position: absolute; right: 10px; bottom: 10px; }
.adv-block { margin: 18px auto; }
.adv-block > h3 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--blood); border-bottom: 1px solid var(--rule); }
.readbox { margin: 10px 0; padding: 12px 16px 12px 18px; background: #F2E6C6; border: 1px solid #C9AE7C; border-left: 6px solid #6B8E5A; box-shadow: 0 2px 6px rgba(60, 40, 20, .2); }
.readbox p { margin: 0 0 8px; font-family: var(--story); font-size: 18px; font-style: italic; line-height: 1.5; }
.rb-label { font-family: var(--num); font-weight: 700; font-size: 12px; color: #4D6B40; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.flash-ok { animation: flashok .8s; }
@keyframes flashok { 0% { box-shadow: 0 0 0 0 rgba(232, 200, 119, .9); } 100% { box-shadow: 0 0 0 14px rgba(232, 200, 119, 0); } }
.notes p { margin: 8px 0; font-size: 15.5px; line-height: 1.55; }
.notes b { color: var(--blood); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 6px 10px; border: 1px solid var(--rule); background: var(--paper); min-width: 170px; max-width: 280px; font-size: 14px; }
.check-chip b { font-family: var(--num); color: var(--blood); }
.check-chip small { color: var(--ink2); font-size: 12px; }
.check-chip:hover { border-color: var(--blood); background: var(--paper2); }
.enc { padding: 10px 12px; border: 1px solid #4A3220; background: rgba(43, 29, 18, .06); margin-bottom: 10px; box-shadow: inset 0 0 0 1px rgba(232, 200, 119, .4); }
.enc.npc { background: rgba(47, 106, 154, .07); }
.enc-head b { font-family: var(--display); font-weight: 400; font-size: 20px; }
.enc-head small { display: block; color: var(--ink2); font-size: 12px; }
.foes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.foe { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--rule); background: var(--paper2); border-radius: 30px; font-size: 13px; }
.foe img, .foe-dot { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--red); background: #2B1D12; display: block; }
.foe small { color: var(--ink2); }
.foe:hover { border-color: var(--blood); }
.handout-row { display: flex; flex-wrap: wrap; gap: 12px; }
.handout { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; width: 190px; padding: 8px; border: 1px solid var(--rule); background: var(--paper2); text-align: left; }
.handout img { width: 100%; height: 150px; object-fit: cover; object-position: top; border: 1px solid var(--rule2); }
.handout-row.big .handout { width: 220px; }
.handout-row.big .handout img { height: 260px; }
.quest-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dotted var(--rule); }
.quest-row p { margin: 2px 0 0; font-size: 14px; }
.xp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.xp-row .btn { flex-direction: column; align-items: flex-start; min-height: 54px; padding: 6px 14px; text-align: left; }
.xp-row .btn b { font-family: var(--num); font-size: 18px; }
.xp-row .btn small { font-size: 12px; opacity: .9; }
.loot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.loot { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--rule); background: var(--paper2); }
.loot img { width: 44px; height: 62px; object-fit: cover; border-radius: 3px; box-shadow: 0 2px 5px rgba(0, 0, 0, .4); }
.loot b { display: block; font-size: 14px; }
.loot small { color: var(--ink2); font-size: 12px; }
.loot.given { opacity: .62; }
.loot-plain, .coin-ico { width: 44px; height: 62px; display: grid; place-items: center; background: #2B1D12; color: var(--goldL); font-size: 22px; border-radius: 3px; }
.coin-ico { height: 44px; border-radius: 50%; border: 2px solid var(--gold); }
.tag.bad { background: #8E1B10; color: var(--cream); border-color: var(--blood2); }
.tag.good { background: var(--green); color: var(--cream); border-color: #1F4A25; }
.scene-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px !important; padding-top: 14px; border-top: 3px double var(--blood); }
.bonds { margin: 0; padding-left: 22px; }
.bonds li { margin: 6px 0; }
.rumors { margin: 0; padding-left: 20px; }
.rumors li { margin: 5px 0; }
.qa dt { font-weight: 800; color: var(--blood); margin-top: 8px; }
.qa dd { margin: 2px 0 0 0; font-family: var(--story); font-style: italic; font-size: 16px; }
.enc-table { margin: 0 0 8px; padding-left: 22px; }
.inf-out ul { margin: 6px 0; padding-left: 18px; }
.inf-out li.good { color: var(--green); }
.inf-out li.bad { color: var(--blood); }
.inf-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; font-size: 13px; }
.inf-tables ul { padding-left: 16px; margin: 4px 0; }
.storm { justify-content: center; margin-top: 10px; }

/* siege tracker */
.siege { display: flex; flex-direction: column; gap: 10px; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.sg-card { padding: 10px 12px; background: var(--paper2); border: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }
.sg-card.wide { grid-column: 1 / -1; }
.sg-card h4 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 19px; color: var(--blood); }
.stepper-row { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.stepper-row span { flex: 1; }
.stepper-row b { min-width: 34px; text-align: center; font-family: var(--num); font-size: 17px; }
.mini { min-width: 30px; min-height: 30px; border: 1px solid var(--rule); background: var(--paper); font-weight: 800; }
.mini.on { background: var(--blood); color: var(--cream); }
.gate-bar, .hpbar { position: relative; height: 22px; background: #2B1D12; border: 1px solid #4A3220; overflow: hidden; }
.gate-bar i { position: absolute; inset: 0 0 0 auto; width: 0; right: 0; left: auto; background: repeating-linear-gradient(45deg, #8E1B10 0 8px, #6E150C 8px 16px); transition: width .5s; }
.gate-bar { background: linear-gradient(90deg, #6B4A2B, #8C6B3F); }
.gate-bar span, .hpbar b { position: absolute; inset: 0; text-align: center; line-height: 20px; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
.hpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #3E7D45, #6FA061); transition: width .5s; }
.gol { display: flex; align-items: center; gap: 6px; }
.gol > span { width: 78px; font-size: 13px; font-weight: 700; }
.gol .hpbar { flex: 1; }
.input.xs { width: 58px; min-height: 30px; padding: 2px 6px; }
.sg-last { margin: 0; padding: 8px 12px; background: #2B1D12; color: var(--goldL); font-family: var(--story); font-style: italic; font-size: 16px; border-left: 4px solid var(--blood); }
.egg-viz { display: flex; gap: 16px; align-items: center; }
.egg-viz > div:last-child { flex: 1; }
.egg-shape { width: 70px; height: 92px; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; background: radial-gradient(circle at 35% 30%, #C79BDB, #6B2F86 55%, #2B1236); box-shadow: 0 0 calc(10px + var(--p) * 40px) rgba(150, 90, 220, calc(.3 + var(--p) * .6)); animation: eggbeat calc(1.6s - var(--p) * 1.1s) ease-in-out infinite; }
@keyframes eggbeat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.06, 1.03); } }

/* siege HUD on the map */
.siege-hud-wrap { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 8; pointer-events: none; max-width: calc(100% - 140px); }
.siege-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 14px; background: rgba(23, 17, 13, .88); border: 1px solid var(--gold); box-shadow: var(--shadow); color: #EADBB6; font-size: 13px; }
.siege-hud .hud-item { display: flex; align-items: center; gap: 6px; }
.siege-hud .hud-item b { font-family: var(--num); color: var(--goldL); }
.siege-hud .gate-bar.sm, .siege-hud .hpbar.sm { width: 110px; height: 14px; }
.siege-hud .hpbar.sm { width: 60px; }
.siege-hud .gate-bar.sm span { line-height: 12px; font-size: 10px; }
.siege-hud em { flex-basis: 100%; font-family: var(--story); font-size: 15px; color: var(--cream); }
.siege-hud.egg .pips { display: flex; gap: 4px; }
.siege-hud.egg .pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #9CC4FF; }
.siege-hud.egg .pips i.on { background: #9CC4FF; box-shadow: 0 0 8px #9CC4FF; }

/* journal */
.j-level { padding: 8px 14px; text-align: center; min-width: 170px; }
.j-level b { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--blood); line-height: 1; }
.j-level small { color: var(--ink2); }
.j-level .row { justify-content: center; margin-top: 4px; }
.coins-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: 6px 0 14px; }
.coins-bar b { font-family: var(--num); font-size: 20px; }
.coins-bar small { display: block; color: var(--ink2); }
.coin-big { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #F5DE8C, #B8862B 60%, #6E4F18); color: #4A3510; font-size: 22px; box-shadow: 0 3px 8px rgba(0, 0, 0, .4); }
.inv-group h2 { color: var(--goldL); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.inv-item { display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 0; color: #EADBB6; text-align: center; }
.inv-item:hover .loot-card { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 14px 26px rgba(0, 0, 0, .55); }
.inv-name { font-size: 13px; font-weight: 700; }
.loot-card { margin: 0; aspect-ratio: 375 / 523; border-radius: 9px; overflow: hidden; box-shadow: 0 6px 16px rgba(0, 0, 0, .5); transition: transform .2s, box-shadow .2s; background: #111; }
.loot-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.loot-card.plain { background: var(--parch) url(../assets/img/parchment.jpg) center / cover; border: 6px solid #1a1410; outline: 1px solid var(--gold); outline-offset: -10px; color: var(--ink); padding: 14px 12px; display: flex; flex-direction: column; text-align: left; gap: 6px; }
.lc-title { font-family: var(--display); font-size: 18px; line-height: 1.05; color: var(--blood); border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.lc-kind { font-size: 11px; font-weight: 800; color: var(--ink2); }
.lc-text { font-size: 11.5px; line-height: 1.35; overflow: hidden; }
.loot-card.full { width: min(320px, 80vw); flex-shrink: 0; }
.loot-card.full.plain .lc-title { font-size: 24px; }
.loot-card.full.plain .lc-text { font-size: 14px; }
.item-view { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.iv-body { flex: 1 1 260px; }
.iv-body .h2 { margin-top: 0; }
.quest { display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-bottom: 10px; }
.quest b { font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--blood); }
.quest p { margin: 2px 0 0; font-size: 14px; }
.quest.done { opacity: .75; }
.quest.done b { text-decoration: line-through; text-decoration-color: rgba(122, 31, 20, .5); }
.ho-pages { display: flex; flex-direction: column; gap: 12px; align-items: center; max-height: 72vh; overflow-y: auto; }
.ho-pages img { max-width: 100%; box-shadow: var(--shadow); }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-list .btn { justify-content: flex-start; gap: 8px; }
.pick-list .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dot, var(--gold)); display: inline-block; }
.big-num { font-family: var(--num); font-size: 26px; color: var(--blood); margin: 6px 0; }
.coin-edit { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.coin-edit .input { width: 100px; }
.topnav a[data-badge]:not([data-badge=""])::after { content: attr(data-badge); display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--blood); color: var(--cream); font-size: 11px; line-height: 18px; text-align: center; }
.carried { display: flex; flex-wrap: wrap; gap: 10px; }
.carry { width: 92px; padding: 0; background: none; border: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; text-align: center; }
.carry .loot-card { border-radius: 5px; }
.carry .loot-card.plain { padding: 6px; border-width: 3px; }
.carry .lc-text, .carry .lc-kind { display: none; }
.carry .lc-title { font-size: 12px; }
.npc-img { float: left; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; margin: 0 8px 4px 0; border: 2px solid var(--gold); }
.npc { overflow: hidden; }
details.bonus { margin-top: 18px; padding: 10px 14px; border: 1px dashed var(--rule); }
details.bonus summary { cursor: pointer; font-family: var(--num); font-weight: 700; color: var(--blood); }

/* cipher */
.cipher-help { padding: 12px 16px; margin-bottom: 12px; }
.cipher-help p { margin: 0 0 8px; }
.solved { color: var(--green); font-weight: 800; font-size: 18px; }
.cipher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin-bottom: 14px; }
.cl { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; background: rgba(23, 17, 13, .6); border: 1px solid #6B4A2B; }
.cl-c { font-family: var(--num); font-weight: 700; color: var(--goldL); font-size: 16px; }
.cl i { width: 10px; background: linear-gradient(#B8862B, #6B4A2B); display: block; }
.cl input { width: 36px; height: 36px; text-align: center; font-family: var(--num); font-weight: 700; font-size: 18px; text-transform: uppercase; border: 1px solid var(--rule); background: var(--paper2); color: var(--blood); }
.cipher-text { padding: 18px 22px; font-family: 'Courier New', monospace; font-size: 16px; line-height: 1.9; word-break: break-word; }
.cipher-text .cx { color: #8A7556; }
.cipher-text .px { color: var(--blood); font-weight: 800; }
.cipher-text .px.ok { color: var(--green); }
.cipher-text .px.wrong { color: #C2561A; text-decoration: underline wavy; }

/* showcase */
.showcase { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; background: radial-gradient(circle at 50% 45%, rgba(23, 17, 13, .75), rgba(5, 3, 2, .96)); opacity: 0; transition: opacity .45s; }
.showcase.on { opacity: 1; }
.sc-frame { position: relative; max-width: min(1100px, 96vw); padding: 10px; background: #120c08; border: 2px solid var(--gold); box-shadow: 0 0 0 4px #2B1D12, 0 0 0 6px #8C6B3F, 0 30px 80px rgba(0, 0, 0, .8); transform: scale(.92) translateY(14px); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.showcase.on .sc-frame { transform: none; }
.sc-frame img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.sc-imgs { display: flex; gap: 10px; justify-content: center; }
.sc-frame.many { width: min(1100px, 96vw); }
.sc-frame.many .sc-imgs { overflow-x: auto; justify-content: flex-start; }
.sc-frame.many .sc-imgs img:first-child { margin-left: auto; }
.sc-frame.many .sc-imgs img:last-child { margin-right: auto; }
.sc-cap { text-align: center; }
.sc-frame.many img { height: min(62vh, 900px); width: auto; max-width: none; max-height: none; flex: 0 0 auto; margin: 0; }
.sc-frame.many .sc-cap { padding-top: 8px; }
.sc-frame.many .sc-cap h2 { font-size: 28px; }
.sc-frame.item img { max-height: 72vh; border-radius: 12px; }
.sc-cap { padding: 10px 6px 2px; text-align: center; color: var(--cream); }
.sc-cap h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3.4vw, 40px); color: var(--goldL); }
.sc-cap p { margin: 4px auto 0; max-width: 760px; font-family: var(--story); font-style: italic; font-size: 17px; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.level-banner { position: fixed; left: 50%; top: 32%; z-index: 95; transform: translate(-50%, -50%); padding: 22px 50px; text-align: center; background: radial-gradient(circle, #2B1D12, #120c08); border: 2px solid var(--goldL); box-shadow: 0 0 60px rgba(232, 200, 119, .5), var(--shadow); color: var(--cream); animation: lvlin .8s cubic-bezier(.2, .8, .2, 1) both; pointer-events: none; }
.level-banner small { display: block; font-family: var(--story); font-style: italic; font-size: 18px; color: #C7B48C; }
.level-banner b { display: block; font-family: var(--display); font-weight: 400; font-size: 64px; line-height: 1; color: var(--goldL); text-shadow: 0 0 24px rgba(232, 200, 119, .7); }
.level-banner span { font-size: 14px; }
.level-banner.out { transition: opacity 1s, transform 1s; opacity: 0; transform: translate(-50%, -60%); }
@keyframes lvlin { from { opacity: 0; transform: translate(-50%, -40%) scale(.8); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* new trap effects */
.fx-layer .bolt-svg { position: absolute; overflow: visible; filter: drop-shadow(0 0 8px #9CC4FF); animation: boltin .5s ease-out both; }
.fx-layer .burst.bolt { border: 0; background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(156, 196, 255, .6) 35%, rgba(60, 90, 200, 0) 70%); left: calc(var(--g) * -2.2); top: calc(var(--g) * -2.2); width: calc(var(--g) * 4.4); height: calc(var(--g) * 4.4); animation-delay: .1s; animation-duration: 1s; }
.fx-layer .spark { left: 0; top: 0; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #9CC4FF, 0 0 2px #fff; animation: debris .8s ease-out both; }
.fx-layer .spore { left: calc(var(--sz) / -2); top: calc(var(--sz) / -2); width: var(--sz); height: var(--sz); border-radius: 50%; background: radial-gradient(circle, rgba(170, 200, 120, .55), rgba(110, 140, 80, 0) 70%); animation: spore 3s ease-out both; }
.fx-layer .sand { left: calc(var(--g) * -1.6); top: calc(var(--g) * -1.6); width: calc(var(--g) * 3.2); height: calc(var(--g) * 3.2); border-radius: 50%; border: 3px solid rgba(110, 85, 50, .8); animation: sand 2.6s ease-in both; }
.fx-layer .sand.s2 { animation-delay: .35s; }
.fx-layer .sand.s3 { animation-delay: .7s; }
@keyframes boltin { 0% { opacity: 0; } 10% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes spore { 0% { opacity: 0; transform: translate(0, 0) scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.4); } }
@keyframes sand { 0% { opacity: 0; transform: scale(1.2) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(.1) rotate(270deg); } }
.sky-bolt { position: absolute; top: 0; z-index: 7; pointer-events: none; }
.sky-bolt .bolt-svg { position: relative; left: 0 !important; top: 0 !important; width: 320px !important; height: 70vh !important; filter: drop-shadow(0 0 14px #9CC4FF); animation: boltin .7s ease-out both; }

/* ---------------------------------------------------------- small screens */
@media (max-width: 760px) {
  .view { padding: 10px 8px 24px; }
  .topbar { padding: 6px 10px; gap: 8px; }
  .top-title { display: none; }
  .topnav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .topnav a { white-space: nowrap; padding: 8px 10px; }
  .map-wrap { height: 62vh; }
  .trap-card-wrap { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; }
  .fog-pop { left: 10px; top: auto; bottom: 46px; }
  .grid3 { grid-template-columns: 1fr; }
  .hot-actions { flex-basis: 100%; }
  .adv { grid-template-columns: 1fr; height: auto; }
  .adv-side { max-height: 46vh; border-right: 0; border-bottom: 2px solid #4A3220; }
  .adv-main { overflow: visible; padding: 16px 12px 40px; }
  .sb-act { flex-direction: column; }
  .sb-act .row { max-width: none; justify-content: flex-start; }
  .inf-tables { grid-template-columns: 1fr; }
  .siege-hud-wrap { max-width: calc(100% - 20px); top: 6px; }
  .inv-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
