
:root {
  --ink: #1a120d;
  --paper: #f4e7c8;
  --paper-2: #e8d4a8;
  --oak: #24170f;
  --oak-2: #342117;
  --oak-3: #4a2f1f;
  --brass: #c9a45a;
  --brass-2: #e0c27a;
  --blood: #8f2f2a;
  --blood-2: #b3443a;
  --moss: #3f5c48;
  --smoke: rgba(244,231,200,.08);
  --line: rgba(201,164,90,.28);
  --shadow: 0 22px 60px rgba(0,0,0,.45);
  --radius: 10px;
  font-family: "Source Serif 4", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--paper); }
body {
  background:
    radial-gradient(900px 420px at 15% -5%, rgba(201,164,90,.14), transparent 55%),
    radial-gradient(700px 500px at 100% 0%, rgba(143,47,42,.14), transparent 50%),
    linear-gradient(180deg, #17100c 0%, #100b08 100%);
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--brass-2); text-decoration: none; }
a:hover { color: #fff1c8; }
h1,h2,h3,.brand { font-family: "Cinzel", "Palatino Linotype", serif; letter-spacing: .04em; }
.shell { position: relative; z-index: 1; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: rgba(16,11,8,.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.brand { color: var(--paper); font-size: 20px; line-height: 1.15; cursor: pointer; touch-action: manipulation; }
.brand small { display:block; font-size: 10px; color: var(--brass); letter-spacing: .2em; font-weight: 500; }
.nav { display:flex; gap: 10px; align-items:center; flex-wrap: wrap; }
.nav-link {
  border: 1px solid transparent; color: rgba(244,231,200,.78);
  padding: 8px 12px; border-radius: 999px; cursor: pointer; background: transparent;
  font: inherit; touch-action: manipulation;
}
.nav-link:hover, .nav-link.on { border-color: var(--line); color: var(--paper); background: rgba(201,164,90,.08); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--brass);
  background: radial-gradient(circle at 30% 30%, #6b4630, #2a1a12);
  color: var(--brass-2); display:grid; place-items:center;
  font-family: Cinzel, serif; cursor: pointer; position: relative;
}
.avatar-menu {
  position: absolute; right: 0; top: 48px; min-width: 220px;
  background: #2a1c14; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; display:none;
}
.avatar-menu.open { display:block; }
.avatar-menu button, .avatar-menu a {
  display:block; width:100%; text-align:left; background:transparent; border:0;
  color: var(--paper); padding: 10px 12px; border-radius: 8px; cursor:pointer; font: inherit;
}
.avatar-menu button:hover, .avatar-menu a:hover { background: rgba(201,164,90,.12); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 22px 90px; }
.hero {
  display:grid; grid-template-columns: 1.3fr .9fr; gap: 24px; align-items: stretch;
  margin-bottom: 34px;
}
@media (max-width: 900px){ .hero { grid-template-columns: 1fr; } .table-layout { grid-template-columns: 1fr !important; grid-template-rows: auto 1fr; height: calc(100vh - 74px) !important; } .party-col { overflow: auto; max-height: none; padding-right: 0 !important; } .table-resize-handle { display: none; } .map-panel { order: -1; } }

/* Legacy mobile support - superseded by new mobile section below */
.hero-copy {
  padding: 34px 32px; border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(74,47,31,.92), rgba(36,23,15,.96)),
    radial-gradient(circle at 80% 20%, rgba(201,164,90,.18), transparent 40%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero-copy h1 { margin: 0 0 12px; font-size: clamp(34px, 5vw, 54px); }
.hero-copy p { margin: 0 0 18px; color: rgba(244,231,200,.78); font-size: 18px; line-height: 1.55; }
.hero-side {
  border-radius: 16px; padding: 22px;
  background: linear-gradient(180deg, #3a2618, #24170f);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.muted { color: rgba(244,231,200,.62); font-size: 14px; line-height: 1.45; }
.grid { display:grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.stories { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card {
  background: linear-gradient(180deg, #312014, #22160f);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.story {
  cursor: pointer; transition: transform .15s ease, border-color .15s ease;
  min-height: 210px; display:flex; flex-direction:column; gap: 10px;
  background:
    linear-gradient(180deg, rgba(61,38,24,.95), rgba(32,21,14,.98));
}
.story:hover { transform: translateY(-3px); border-color: rgba(224,194,122,.55); }
.story h3 { margin: 0; font-size: 22px; }
.story p { margin: 0; color: rgba(244,231,200,.72); flex: 1; }
.pill {
  align-self: flex-start; display:inline-block; padding: 3px 10px;
  border: 1px solid var(--brass); border-radius: 999px; font-size: 12px; color: var(--brass-2);
}
button, .btn {
  font-family: inherit; cursor: pointer;
  border: 1px solid var(--brass);
  background: linear-gradient(#523524, #2f2118);
  color: var(--paper); padding: 11px 16px; border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
button.primary, .btn.primary {
  background: linear-gradient(#a44338, #6f2822);
  border-color: #d7a07a;
}
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px;
  border: 1px solid rgba(201,164,90,.35); background: #1d140e; color: var(--paper);
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
label { display:block; font-size: 13px; color: var(--brass); margin: 12px 0 6px; }
.paper {
  background: linear-gradient(180deg, #f6e9cb, #ead4a6);
  color: var(--ink); border-radius: 8px; padding: 14px 16px;
  box-shadow: inset 0 0 0 1px rgba(90,60,20,.18);
}
.paper h3 { margin-top: 0; }
.error { color: #ffb4a8; font-size: 14px; min-height: 1.2em; }
.row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.modal-back {
  position: fixed; inset: 0; background: rgba(8,5,3,.72);
  display:flex; align-items:center; justify-content:center; z-index: 30; padding: 20px;
}
.modal {
  width: min(680px, 100%); max-height: 85vh; overflow:auto;
  background: linear-gradient(180deg, #3a2618, #24170f);
  border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow);
}
.section-title { display:flex; justify-content:space-between; align-items:end; gap:12px; margin: 28px 0 14px; }
.section-title h2 { margin: 0; }
.char-card { display:flex; flex-direction:column; gap:10px; align-items:stretch; }
.steps { display:flex; gap:6px; flex-wrap:wrap; margin-bottom: 12px; }
.steps span {
  width: 28px; height: 28px; display:grid; place-items:center;
  border-radius: 50%; border: 1px solid rgba(244,231,200,.18); font-size: 12px;
}
.steps span.on { border-color: var(--brass); color: var(--brass-2); background: rgba(201,164,90,.12); }
.table-layout {
  display: grid; grid-template-columns: minmax(260px, var(--side-w, 380px)) 4px 1fr; gap: 0;
  height: calc(100vh - 74px); padding: 12px;
}
.table-resize-handle {
  cursor: col-resize;
  background: var(--line, #ccc);
  width: 4px;
  border-radius: 2px;
  transition: background .15s;
}
.table-resize-handle:hover, .table-resize-handle.dragging { background: var(--accent, #8a5); }
.party-col { min-height: 0; display: flex; flex-direction: column; padding-right: 8px; }
.map-panel {
  margin: 10px 0; padding: 10px; border: 1px solid rgba(201,164,90,.35); border-radius: 10px;
  background: linear-gradient(180deg, rgba(28,18,12,.9), rgba(10,7,5,.92)); flex-shrink: 0;
}
.map-ph-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.map-ph-title { font-weight: 600; }
.map-ph-meta { font-size: 11px; }
.map-hint { font-size: 11px; margin: 6px 0 0; text-align: center; }
.map-hint.hidden { display: none; }
.init-tracker {
  margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(155,34,38,.08);
}
.init-tracker h4 { margin: 0 0 8px; font-size: 13px; color: var(--brass-2); }
.init-order { list-style: none; margin: 0; padding: 0; }
.init-order-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px;
  border-radius: 6px; background: rgba(0,0,0,.3); font-size: 13px;
}
.init-order-item.init-active { border: 1px solid var(--brass); background: rgba(201,164,90,.15); }
.init-order-item.player { border-left: 3px solid #6fcf6f; }
.init-order-item.enemy { border-left: 3px solid #ff6b6b; }
.init-rank { width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.4); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.init-name { flex: 1; }
.init-val { font-family: Cinzel, serif; color: var(--brass-2); font-weight: 700; }
.init-log-card { text-align: left; padding: 10px 12px; }
.init-log-title { font-weight: 700; margin-bottom: 8px; color: var(--brass-2); }
.init-order-log .init-order-item { margin-bottom: 3px; }
.dice-card-appear { animation: diceCardIn .35s ease-out; }
@keyframes diceCardIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dice-face-wrap { margin-bottom: 8px; }
.dice-face {
  display: inline-grid; place-items: center;
  width: 72px; height: 72px; border-radius: 12px;
  background: linear-gradient(145deg, #3a2818, #1a100a);
  border: 2px solid var(--brass);
  font-family: Cinzel, serif; font-size: 36px; color: var(--brass-2);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.dice-face.nat20 { border-color: #ffd700; color: #ffd700; box-shadow: 0 0 20px rgba(255,215,0,.35); }
.dice-face.nat1 { border-color: #ff6b6b; color: #ff6b6b; }
.dice-overlay-name { font-family: Cinzel, serif; font-size: 18px; margin-top: 4px; }
.dice-overlay-kind { font-size: 13px; color: var(--muted); margin: 4px 0; }
.dice-overlay-detail { font-size: 12px; }
.dice-overlay-total { font-size: 22px; margin-top: 6px; }
.dice-overlay-explain { font-size: 12px; margin: 2px 0 6px; line-height: 1.35; }
.dice-card-context { font-size: 12px; margin: 2px 0 6px; line-height: 1.35; }
.map-panel { min-height: 120px; }
.die-face-inline {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(0,0,0,.4); border: 1px solid var(--brass);
  font-weight: 700; vertical-align: middle; margin-right: 4px;
}
.dice-card.dm-roll { border-left: 3px solid #c9a45a; }
.dm-pill { font-size: 10px; padding: 1px 6px; margin-left: 4px; }
.roll-heal { color: #6fcf6f; font-size: 12px; margin-top: 4px; }
.roll-init-note { font-size: 11px; margin-top: 4px; }
.chat-col { min-height: 0; display: flex; flex-direction: column; }
.party-head, .chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-shrink: 0; }
.phase-pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--brass-2); }
.host-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.admin-fold { margin-top: 10px; font-size: 13px; }
.admin-fold summary { cursor: pointer; color: var(--brass-2); }
.clock-pill { font-size: 12px; white-space: nowrap; }
.combat-banner {
  font-size: 13px; padding: 8px 10px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(143,47,42,.18); color: var(--brass-2);
}
.token-foot { font-size: 11px; margin-top: 6px; opacity: .65; }
.quest-box { margin: 10px 0; font-size: 13px; }
.quest-box h4 { margin: 0 0 6px; }
.quest-item { padding: 6px 8px; margin-bottom: 4px; border-left: 3px solid var(--brass); background: rgba(0,0,0,.15); }
.quest-item.done { opacity: .7; border-left-color: var(--moss); }
.quest-done { margin-top: 6px; }
.death-save-track { font-size: 12px; margin-top: 4px; }
.death-save-track.dead { color: var(--blood-2); font-weight: 600; }
.conditions-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cond-pill { font-size: 11px; padding: 2px 6px; border-radius: 8px; background: rgba(178,34,34,.25); color: #f0c0c0; border: 1px solid rgba(178,34,34,.4); }
.admin-line.kind-prompt_packet { border-left: 3px solid var(--brass); padding-left: 8px; margin: 8px 0; }
.prompt-msg { margin: 4px 0; }
.prompt-msg summary { cursor: pointer; color: var(--brass-2); font-size: 12px; }
.prompt-pre {
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
  font-size: 11px; background: rgba(0,0,0,.35); padding: 8px; border-radius: 6px; margin: 4px 0 8px;
}
.admin-log { max-height: 420px; overflow: auto; }
.map-placeholder { margin: 10px 0; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; font-size: 12px; }
.map-ph-title { font-weight: 600; margin-bottom: 4px; }
.sheet-card { position: relative; font-size: 13px; margin-bottom: 8px; padding: 10px; }
.sheet-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.sheet-details summary { cursor: pointer; color: var(--brass-2); font-size: 12px; margin-top: 6px; }
.sheet-full-btn { margin-top: 8px; width: 100%; }
.peer-roll-mini {
  position: absolute; top: -8px; right: -8px; z-index: 2;
  width: 42px; height: 42px; border-radius: 8px;
  background: linear-gradient(145deg, #3a2818, #1a100a);
  border: 2px solid var(--brass);
  display: grid; place-items: center;
  font-family: Cinzel, serif; font-size: 20px; color: var(--brass-2);
  box-shadow: 0 8px 20px rgba(0,0,0,.45);
}
.die-anim { animation: dicePop 0.55s ease-out; }
@keyframes dicePop {
  0% { transform: scale(0.2) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.dice-overlay-card { min-width: 300px; text-align: center; animation: overlayIn .25s ease; }
@keyframes overlayIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
.dnd-sheet { background: linear-gradient(180deg, rgba(36,23,15,.95), rgba(20,12,8,.98)); border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--paper); }
.dnd-sheet-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.dnd-logo { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.dnd-sheet-name { font-family: Cinzel, serif; font-size: 18px; }
.dnd-sheet-meta { font-size: 12px; color: rgba(244,231,200,.65); }
.dnd-sheet-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dnd-pill { background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 11px; }
.dnd-pill b { margin-left: 4px; color: var(--brass-2); }
.bardic-pill { border-color: rgba(201,164,90,.5); background: rgba(201,164,90,.12); }
.bardic-pill b { color: var(--brass); }
.dnd-hp { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.dnd-hp .hpbar { flex: 1; margin: 0; }
.dnd-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 8px; }
.dnd-stat { text-align: center; background: rgba(0,0,0,.3); border: 1px solid rgba(201,164,90,.2); border-radius: 6px; padding: 4px 2px; }
.dnd-stat-ab { font-size: 9px; color: var(--brass); }
.dnd-stat-val { font-size: 16px; font-weight: 700; }
.dnd-stat-mod { font-size: 11px; color: var(--brass-2); }
.dnd-saves { font-size: 11px; margin-bottom: 8px; }
.dnd-save { margin-right: 6px; }
.dnd-skills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.dnd-skill { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.25); }
.dnd-skill.prof { border: 1px solid var(--brass); color: var(--brass-2); }
.dnd-block { font-size: 12px; margin-top: 8px; }
.dnd-block p { margin: 4px 0; color: rgba(244,231,200,.75); white-space: pre-wrap; }
.dnd-feat { margin: 4px 0; }
.dnd-sheet.compact .dnd-stats { grid-template-columns: repeat(3, 1fr); }
.story-sections { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow: auto; }
.story-section { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: rgba(0,0,0,.2); }
.story-section-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.story-sec-title { flex: 1; font-weight: 600; }
.story-rm { padding: 2px 8px; line-height: 1.2; }
.lore-preview { max-height: 360px; overflow: auto; white-space: pre-wrap; font-size: 13px; }
.app-modal-sheet { max-width: 520px; width: 95vw; }
.live-slots { flex-shrink: 0; max-height: 28vh; overflow: auto; padding: 8px 0 4px; border-top: 1px solid var(--line); background: rgba(16,11,8,.94); }
.live-slots.hidden { display: none; }
.ws-banner { flex-shrink: 0; padding: 8px 12px; font-size: 13px; background: rgba(201,164,90,.15); border-bottom: 1px solid var(--line); }
.ws-banner.warn { background: rgba(143,47,42,.35); color: #ffd4cc; }
.ws-banner.hidden { display: none; }
.check-wait { flex-shrink: 0; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); background: rgba(60,40,28,.6); }
.check-wait.hidden { display: none; }
.live-slot { margin-bottom: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(201,164,90,.08); border: 1px solid rgba(201,164,90,.22); }
.live-slot .draft { margin-top: 4px; }
.log { overflow:auto; padding: 8px; display:flex; flex-direction:column; gap:10px; flex:1; word-break:break-word; overflow-wrap:break-word; }
.msg { padding: 10px 12px; border-radius: 8px; word-break:break-word; overflow-wrap:break-word; max-width:100%; }
.msg.ai { background: #2a1d14; border-left: 3px solid var(--brass); }
.msg.user { background: #1d241c; border-left: 3px solid var(--moss); }
.msg.system, .msg.dice { background: #24181c; border-left: 3px solid var(--blood); font-size: 14px; }
.sheet-mini { font-size: 13px; }
.hpbar { height: 8px; background: #3a2018; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.hpbar > span { display:block; height:100%; background: linear-gradient(90deg, #8f2f2a, #c45a4a); }
.draft { font-size: 13px; color: rgba(244,231,200,.55); font-style: italic; }
.paper .draft { color: var(--ink); opacity: .82; }
.lib-link, a.lib-link, button.lib-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid var(--brass);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.lib-link:hover, a.lib-link:hover { background: var(--paper-2); color: var(--ink); border-color: var(--brass-2); }
.paper .lib-link { color: var(--ink); }
.overlay {
  position: fixed; inset: 0; background: rgba(10,6,4,.72);
  display:flex; align-items:center; justify-content:center; z-index: 90;
}
.map-canvas-wrap {
  overflow: hidden; border-radius: 8px; background: #120c08; min-height: 240px;
  position: relative; box-shadow: inset 0 0 40px rgba(0,0,0,.45);
}
#battleMap {
  display: block; width: 100%; height: auto; min-height: 240px;
  border: 1px solid rgba(201,164,90,.45); border-radius: 8px;
  cursor: grab; touch-action: none; background: #120c08;
}
.map-tip {
  position: absolute; z-index: 3; pointer-events: none;
  background: rgba(12,8,6,.92); color: #f4e7c8;
  padding: 4px 8px; border-radius: 4px; font-size: 11px;
  border: 1px solid rgba(201,164,90,.45); white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0,0,0,.4);
}
.map-tip.hidden { display: none; }
.map-panel.expanded {
  position: fixed; inset: 20px; z-index: 55; margin: 0;
  background: #140e0a; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.map-expand-btn { font-size: 12px; padding: 2px 8px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 11px; }
.map-leg { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.map-leg.party { background: rgba(45,106,79,.35); }
.map-leg.enemy { background: rgba(155,34,38,.4); }
.map-leg.ally { background: rgba(40,90,160,.4); }
.combat-row.ally { border-left: 3px solid #3a7bd5; }
.map-move-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding: 8px; border: 1px solid var(--brass);
  border-radius: 6px; background: rgba(201,164,90,.12); font-size: 13px;
}
.map-move-bar.hidden { display: none; }
.map-leg.feat { background: rgba(0,0,0,.35); text-transform: none; }
.map-leg.feat.water { background: #15608a; color: #e8f4ff; }
.map-leg.feat.house { background: #6a3b28; }
.map-leg.feat.tree { background: #1b5c32; }
.map-leg.feat.road { background: #8a5a32; }
.map-leg.feat.grass { background: #335c30; }
.map-leg.feat.wall { background: #3a3a3e; }
.map-leg.feat.crate { background: #c4893a; color: #1a100a; }
.map-leg.feat.boat { background: #8a5a32; color: #f4e7c8; }
.map-leg.feat.wade { background: #1a6a86; color: #e8f4ff; }
.map-kit {
  margin-top: 8px; padding: 8px; border: 1px solid rgba(201,164,90,.28);
  border-radius: 8px; background: rgba(0,0,0,.22);
}
.map-kit.hidden { display: none; }
.map-kit-head { font-size: 11px; color: var(--brass-2); margin-bottom: 6px; letter-spacing: .04em; }
.map-kit-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.map-kit-btn {
  font: inherit; font-size: 11px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid rgba(201,164,90,.35); background: rgba(0,0,0,.25);
  color: var(--paper); cursor: pointer;
}
.map-kit-btn.on { background: rgba(201,164,90,.28); border-color: var(--brass-2); color: #f4e7c8; }
.map-panel.map-glow {
  box-shadow: 0 0 0 2px #e8c888, 0 0 28px rgba(232, 200, 136, 0.55);
  animation: mapGlow 1.1s ease-in-out 4;
}
@keyframes mapGlow {
  0%, 100% { box-shadow: 0 0 0 2px #e8c888, 0 0 16px rgba(232, 200, 136, 0.35); }
  50% { box-shadow: 0 0 0 3px #fff3c4, 0 0 36px rgba(255, 236, 180, 0.75); }
}
.dice-card { min-width: 280px; text-align: center; }
.die { font-size: 64px; font-family: Cinzel, serif; color: var(--brass); text-shadow: 0 8px 0 #1a100a; }
.hidden { display: none !important; }
.auth-grid { max-width: 820px; margin: 40px auto; }
.field-hint { font-size: 12px; color: rgba(244,231,200,.5); margin-top: 4px; }

.lib-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.lib-rules { grid-column: 1 / -1; }
.lib-item { margin: 8px 0; padding: 8px 10px; border: 1px solid rgba(201,164,90,.25); border-radius: 8px; background: rgba(0,0,0,.15); }
.lib-item summary { cursor: pointer; color: var(--brass-2); font-weight: 600; }
.lib-item[open] { background: rgba(201,164,90,.06); }

.warn-banner {
  background: rgba(196,90,74,.18); border: 1px solid rgba(196,90,74,.45);
  color: #ffd2c8; padding: 10px 12px; border-radius: 8px; margin: 0 0 12px;
}
.guide-steps { margin: 8px 0 12px 1.2em; color: rgba(244,231,200,.82); line-height: 1.5; }
.char-pick-list { display:flex; flex-direction:column; gap:8px; }
.char-pick {
  text-align:left; display:flex; flex-direction:column; gap:2px;
  border: 1px solid rgba(201,164,90,.35); background: rgba(0,0,0,.18);
  color: var(--paper); padding: 10px 12px; border-radius: 8px; cursor:pointer; font: inherit;
}
.char-pick.selected {
  border-color: var(--brass-2); background: rgba(201,164,90,.18);
  box-shadow: inset 0 0 0 1px rgba(224,194,122,.45);
}
.char-pick:hover { border-color: var(--brass); }
button[disabled] { opacity: .45; cursor: not-allowed; }

.admin-panel {
  margin-top: 8px; padding: 10px; border-radius: 8px;
  border: 1px dashed rgba(201,164,90,.45); background: rgba(0,0,0,.25);
}
.admin-log { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.admin-line { font-size: 12px; padding: 6px 8px; border-radius: 6px; background: rgba(201,164,90,.08); }
.admin-line b { color: var(--brass-2); display: block; margin-bottom: 2px; }
.admin-line pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  color: rgba(244,231,200,.78); font-family: ui-monospace, Consolas, monospace; font-size: 11px;
}
.admin-line.kind-tool_call { border-left: 3px solid var(--brass); }
.admin-line.kind-tool_result { border-left: 3px solid var(--moss); }
.admin-line.kind-turn_start, .admin-line.kind-turn_done { border-left: 3px solid #7aa2c8; }
.admin-line.kind-paused { border-left: 3px solid var(--blood); }

.msg.ai .desc { font-style: italic; color: rgba(244,231,200,.84); margin: 0.35em 0; line-height: 1.5; }
.msg.ai .desc em { font-style: italic; }
.msg.ai .speech, .msg.ai .said {
  display: block;
  font-style: normal;
  color: var(--paper);
  margin: 0.55em 0;
  padding-left: 10px;
  border-left: 2px solid var(--brass);
  line-height: 1.45;
}
.admin-line.kind-salvaged { border-left: 3px solid #c9a45a; opacity: .9; }

.admin-line.kind-info { border-left: 3px solid #888; opacity: .85; }


.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brass);
}
.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  font-size: 14px;
  margin: 14px 0 6px;
}
.check-line input { width: auto; margin: 0; accent-color: var(--brass); }
.sheet-extra { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.sheet-extra summary { cursor: pointer; color: var(--brass-2); font-weight: 600; }
button.danger, .danger { border-color: rgba(196,90,74,.7); color: #ffd2c8; }
button.ghost.danger:hover { background: rgba(143,47,42,.25); }
.table-open { min-height: 160px; }
.hero-copy .row { margin-top: 8px; }

.vote-bar {
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  padding:10px 12px; margin-bottom:8px;
  border:1px solid var(--brass); border-radius:8px;
  background: rgba(201,164,90,.12);
}
.msg-tools { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.msg-tools button { padding:6px 10px; font-size:12px; }
.die.ok { color:#8fce8f; }
.die.fail { color:#e08a80; }
.gear-line { font-size:12px; max-height:2.6em; overflow:hidden; }
.msg.vote { border-left-color: var(--brass); font-size:13px; }
.invite-box { margin: 12px 0; padding: 12px; border: 1px dashed var(--brass); border-radius: 10px; background: rgba(0,0,0,.2); }
.invite-code { font-family: Cinzel, serif; font-size: 28px; letter-spacing: .18em; color: var(--brass-2); margin: 4px 0 8px; }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.dot.on { background:#7dca7d; box-shadow:0 0 6px #7dca7d; }
.dot.off { background:#6a4a42; }
.combat-row { margin-bottom:8px; }
.combat-row.down { opacity:.55; }

/* Provider Selection Card */
.provider-box {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--brass);
  border-radius: 8px;
  background: rgba(30, 20, 15, 0.4);
}
.provider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.provider-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 12px;
  background: rgba(201, 164, 90, 0.25);
  color: var(--brass-2);
  border: 1px solid var(--brass);
}
.key-link {
  font-size: 12px;
  color: var(--brass-2);
  text-decoration: underline;
  cursor: pointer;
}

/* Range slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 10px;
}
.slider-wrap input[type=range] {
  flex: 1;
  accent-color: var(--brass);
  cursor: pointer;
}
.slider-val {
  font-size: 13px;
  color: var(--brass-2);
  font-weight: 600;
  min-width: 140px;
}

/* Fast Archetypes in Builder */
.archetype-section {
  margin: 12px 0 16px;
  padding: 12px;
  background: rgba(20, 15, 10, 0.45);
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.archetype-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--brass-2);
  margin-bottom: 8px;
}
.archetype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.archetype-card {
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(40, 28, 20, 0.5);
  color: var(--paper);
  cursor: pointer;
  transition: all 0.15s ease;
}
.archetype-card:hover {
  border-color: var(--brass);
  background: rgba(60, 42, 28, 0.7);
  transform: translateY(-1px);
}
.archetype-card b {
  display: block;
  font-size: 13px;
  color: var(--brass-2);
}
.archetype-card span {
  font-size: 11px;
  color: rgba(244, 231, 200, 0.7);
}

/* Member Ready Status in Lobby */
.ready-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.ready-pill.ready {
  background: rgba(60, 140, 60, 0.25);
  color: #8fce8f;
  border: 1px solid rgba(143, 206, 143, 0.4);
}
.ready-pill.waiting {
  background: rgba(200, 140, 40, 0.2);
  color: #f0c070;
  border: 1px solid rgba(240, 192, 112, 0.3);
}
.live-pill {
  background: rgba(60, 140, 60, 0.25);
  color: #8fce8f;
  border: 1px solid rgba(143, 206, 143, 0.4);
}
.card.muted-card {
  opacity: 0.72;
}

/* Generic Modal Overlay */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 3, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.app-modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  background: #1e1510;
  border: 1px solid var(--brass);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  padding: 20px;
}
.app-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.app-modal-close {
  background: none;
  border: none;
  color: var(--brass-2);
  font-size: 22px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}

/* Sheet inspection view */
.sheet-inspect-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 12px 0;
  text-align: center;
}
.sheet-inspect-stat {
  padding: 6px 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sheet-inspect-stat .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--brass-2);
}
.sheet-inspect-stat .mod {
  font-size: 11px;
  color: rgba(244, 231, 200, 0.7);
}

/* Interactive Dice Bar at Table */
.dice-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(30, 22, 16, 0.65);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.dice-btn {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--brass);
  border-radius: 5px;
  background: rgba(201, 164, 90, 0.12);
  color: var(--brass-2);
  cursor: pointer;
  transition: all 0.1s ease;
}
.dice-btn:hover {
  background: rgba(201, 164, 90, 0.3);
  transform: scale(1.05);
}
.adv-select {
  padding: 4px 6px;
  font-size: 11px;
  background: #19120c;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

/* Action Chips */
.action-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.chip-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(45, 32, 23, 0.6);
  color: rgba(244, 231, 200, 0.85);
  cursor: pointer;
  transition: background 0.12s;
}
.chip-btn:hover {
  background: rgba(75, 54, 38, 0.8);
  border-color: var(--brass);
  color: var(--brass-2);
}

/* Chat filters bar */
.chat-filters {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(25, 18, 13, 0.4);
}
.chat-tab {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: rgba(244, 231, 200, 0.65);
  cursor: pointer;
}
.chat-tab.active {
  background: rgba(201, 164, 90, 0.2);
  color: var(--brass-2);
  font-weight: 600;
}

/* Nat20 and Nat1 styles */
.msg.nat20 {
  border-left-color: #ffd700 !important;
  background: rgba(255, 215, 0, 0.08) !important;
  box-shadow: inset 0 0 12px rgba(255, 215, 0, 0.1);
}
.msg.nat1 {
  border-left-color: #ff4d4d !important;
  background: rgba(255, 77, 77, 0.08) !important;
}

.msg.streaming {
  opacity: 0.85;
  border-left-color: var(--brass) !important;
}

.dice-card {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}
.dice-card-head b { color: var(--brass-2); font-size: 15px; }
.dice-card-kind { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.dice-card-roll { font-size: 14px; }
.dice-card.roll-ok { border-left: 3px solid #6fcf6f; }
.dice-card.roll-fail { border-left: 3px solid #ff6b6b; }
.roll-outcome { font-size: 12px; font-weight: 600; margin-top: 4px; }
.roll-ok-text { color: #6fcf6f; }
.roll-fail-text { color: #ff6b6b; }
.roll-dmg { font-size: 12px; margin-top: 4px; color: var(--brass-2); }
.roll-dead { color: #ff4d4d; font-weight: 700; margin-top: 4px; }
.roll-nat { font-size: 11px; padding: 1px 5px; border-radius: 3px; margin-left: 4px; }
.roll-nat20 { background: rgba(255, 215, 0, 0.2); color: #ffd700; }
.roll-nat1 { background: rgba(255, 77, 77, 0.2); color: #ff6b6b; }

/* Initiative List */
.init-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 10px;
}
.init-item {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
}
.init-item.player {
  border-color: var(--brass);
  color: var(--brass-2);
}
.sound-toggle {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  color: var(--brass-2);
}

.ban-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.ban-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.ban-chip input { margin: 0; }
.lore-preview {
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
}

/* Create / lobby UI */
.form-section-title {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--brass-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.gate-card { max-width: 420px; margin: 48px auto; }
.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 16px 18px;
}
.lobby-header h2 { margin: 0 0 8px; }
.lobby-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.lobby-meta-item { color: var(--muted); }
.seats-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.25);
}
.seats-badge.full { border-color: #c45; color: #f88; }
.lobby-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.lobby-card-head h3 { margin: 0; }
.party-list { display: flex; flex-direction: column; gap: 8px; }
.party-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
}
.party-member-me { border-color: var(--brass); background: rgba(201,164,90,.08); }
.party-member-name { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.party-member-char { font-size: 12px; margin-top: 2px; }
.btn-sm { padding: 3px 8px !important; font-size: 11px !important; }
.lobby-actions { margin-top: 14px; flex-wrap: wrap; }
.sheet-gate { margin: 12px 0 0; font-size: 13px; }
.lobby-chat { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.lobby-chat-log {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
  font-size: 13px;
  word-break: break-word;
  overflow-wrap: break-word;
}
.lobby-chat-line { word-break: break-word; overflow-wrap: break-word; }
.lobby-chat-line b { color: var(--brass, #c9a45a); margin-right: 4px; }
.lobby-chat-form { gap: 8px; align-items: stretch; }
.lobby-chat-form input { flex: 1; min-width: 0; }

/* Character builder */
.builder-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.builder-head h3 { margin: 0; }
.builder-rules { font-size: 12px; margin-bottom: 10px; }
.builder-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.builder-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.builder-section-title { font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.builder-body { min-height: 120px; }
.builder-nav { margin-top: 14px; justify-content: flex-end; gap: 8px; }

.stepper {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.stepper-item {
  flex: 1;
  min-width: 64px;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid var(--line);
  opacity: .55;
  font-size: 10px;
}
.stepper-item.on {
  opacity: 1;
  border-color: var(--brass);
  background: rgba(201,164,90,.12);
}
.stepper-item.done { opacity: .85; }
.stepper-num {
  display: block;
  font-weight: 700;
  font-size: 12px;
  color: var(--brass-2);
}
.stepper-label { display: block; margin-top: 2px; line-height: 1.2; }

.ability-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0;
}
.ability-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
}
.ability-cell input { width: 100%; text-align: center; }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 10px;
  margin: 8px 0;
}
.skill-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line, #ccc);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.skill-check:hover { border-color: var(--accent, #8a5); }
.skill-check.on { border-color: var(--accent, #8a5); background: rgba(120, 140, 80, 0.10); }
.skill-check.locked { opacity: 0.45; cursor: not-allowed; }
.skill-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}
.skill-counts { margin: 8px 0; font-size: 14px; }
.skill-counts .ok { color: var(--ok, #2a7); font-weight: 600; }
.spell-counts { margin: 8px 0 12px; font-size: 14px; }
.spell-count.ok { color: var(--ok, #2a7); font-weight: 600; }
.spell-tier { margin: 12px 0; }
.spell-tier-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line, #ccc);
}
.spell-pick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.spell-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line, #ccc);
  border-radius: 6px;
  margin: 0;
  cursor: pointer;
}
.spell-check input {
  margin-top: 3px;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}
.spell-check-body { display: flex; flex-direction: column; gap: 2px; }
.spell-desc { font-size: 12px; color: var(--muted, #999); line-height: 1.3; }
.spell-check.on { border-color: var(--accent, #8a5); background: rgba(120, 140, 80, 0.08); }
.spell-check.locked { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 720px) {
  .ability-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-grid { grid-template-columns: 1fr; }
  .stepper-label { display: none; }
  .std-slots { grid-template-columns: repeat(2, 1fr); }
}

/* Master secrets spoiler */
.spoiler-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(180, 40, 40, 0.25);
  color: #f5a;
  border: 1px solid rgba(255, 100, 100, 0.35);
}
.spoiler-badge.inline { margin-left: 6px; vertical-align: middle; }
.spoiler-block { margin: 10px 0; }
.spoiler-cover {
  display: block;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  background: #0a0a0a;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.spoiler-cover-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  color: var(--muted);
  font-size: 13px;
  background: repeating-linear-gradient(
    45deg,
    #111 0,
    #111 8px,
    #0d0d0d 8px,
    #0d0d0d 16px
  );
  border-radius: 8px;
}
.spoiler-reveal {
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(120, 30, 30, 0.15);
  border: 1px solid rgba(255, 80, 80, 0.25);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
}

/* Lorebook entries */
.lorebook-panel {
  margin-top: 20px;
  border: 1px solid rgba(224, 194, 122, 0.45);
  background:
    linear-gradient(145deg, rgba(74, 47, 31, 0.55), rgba(28, 18, 12, 0.92)),
    radial-gradient(circle at 90% 0%, rgba(201, 164, 90, 0.12), transparent 45%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.42);
}
.lorebook-panel-head { margin-bottom: 14px; }
.lorebook-eyebrow {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 4px;
}
.lorebook-title { margin: 0 0 6px; font-size: 24px; }
.lorebook-actions { margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.lorebook-saved { margin-top: 16px; }
.lorebook-saved-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.lorebook-saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}
.lb-entries { display: flex; flex-direction: column; gap: 14px; margin: 14px 0; }
.lb-entry {
  padding: 14px 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(201, 164, 90, 0.35);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.lb-entry-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.lb-entry-head .lb-name { flex: 1; min-width: 140px; font-weight: 600; }
.lb-const {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 164, 90, 0.35);
  background: rgba(201, 164, 90, 0.1);
  cursor: pointer;
}
.lb-const input { width: auto; margin: 0; accent-color: var(--brass); }
.lb-keys { width: 100%; margin-bottom: 8px; font-size: 13px; }
.lb-content { width: 100%; font-size: 13px; min-height: 88px; line-height: 1.45; }
.lb-rm { flex-shrink: 0; min-width: 36px; padding: 6px 10px; }

input.secret-input {
  -webkit-text-security: disc;
  text-security: disc;
  font-family: ui-monospace, "Cascadia Code", monospace;
  letter-spacing: 0.06em;
}

.map-grid-demo {
  margin: 10px 0 12px;
  height: 120px;
  border-radius: 8px;
  border: 1px dashed rgba(201, 164, 90, 0.35);
  background:
    linear-gradient(rgba(201, 164, 90, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 164, 90, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: rgba(0, 0, 0, 0.25);
}

/* Standard array assigner */
.std-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(201,164,90,.08);
  border: 1px dashed var(--brass);
  min-height: 48px;
  align-items: center;
}
.pool-chip {
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--brass);
  background: rgba(201,164,90,.18);
  color: var(--brass-2);
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.pool-chip:hover { transform: scale(1.06); background: rgba(201,164,90,.32); }
.pool-done { font-size: 13px; }
.std-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: rgba(0,0,0,.25);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.stat-slot.pick {
  border-color: var(--brass);
  background: rgba(201,164,90,.15);
  box-shadow: 0 0 0 2px rgba(201,164,90,.25);
}
.stat-slot.filled .stat-val { color: var(--brass-2); font-size: 22px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-val { font-size: 20px; font-weight: 700; }

.card.form-section,
.builder-card,
.lobby-party-card {
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.builder-card {
  border-color: rgba(201,164,90,.25);
}

/* —— Design polish —— */
.hero-copy {
  position: relative;
  overflow: hidden;
}
.hero-copy::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(201,164,90,.12), transparent 70%);
  pointer-events: none;
}
.section-title h2 {
  font-size: clamp(22px, 3vw, 28px);
  background: linear-gradient(90deg, var(--paper), var(--brass-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.card.story {
  position: relative;
  overflow: hidden;
  border-color: rgba(201,164,90,.22);
  box-shadow: 0 14px 40px rgba(0,0,0,.38);
}
.card.story::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  opacity: .55;
}
.card.story:hover {
  box-shadow: 0 18px 48px rgba(0,0,0,.48), 0 0 0 1px rgba(224,194,122,.2);
}
.story-cta {
  margin-top: auto;
  font-size: 13px;
  letter-spacing: .04em;
  opacity: .85;
}
.story-secrets {
  margin-top: 4px;
}
.story-secrets .spoiler-cover {
  min-height: 44px;
}
.story-secrets .spoiler-cover-inner {
  min-height: 44px;
  font-size: 12px;
}
.story-secrets .spoiler-badge {
  font-size: 10px;
  margin-bottom: 4px;
}
.modal-back {
  backdrop-filter: blur(6px);
}
.modal-story {
  border-color: rgba(224,194,122,.35);
  box-shadow: 0 28px 80px rgba(0,0,0,.55);
}
.modal-secrets { margin: 12px 0 4px; }
button:focus-visible, .nav-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass-2);
  outline-offset: 2px;
}
button.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.card.table-open:hover {
  border-color: rgba(224,194,122,.5);
}
.auto-memory {
  margin: 8px 0 12px;
  font-size: 13px;
}
.auto-memory summary { cursor: pointer; }
.auto-memory-body {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
  max-height: 160px;
  overflow: auto;
}

.bestiary-grid { display: grid; gap: 10px; }
.beast-card summary { cursor: pointer; }
.beast-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.beast-table th, .beast-table td { border: 1px solid var(--line, #444); padding: 4px 8px; text-align: left; }
.beast-table tr.on { background: rgba(120, 140, 80, 0.15); }
.beast-ability { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--brass, #c9a45a); }
.beast-ability p { margin: 4px 0 0; }
.beast-variants, .beast-abilities { margin-top: 12px; }

/* ===== MOBILE ADAPTATION ===== */

/* Tablet and below */
@media (max-width: 768px) {
  /* Grid system */
  .table-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
    padding: 8px;
  }
  
  .party-col {
    order: 2;
    max-height: 40vh;
    overflow-y: auto;
  }
  
  .chat-col {
    order: 1;
    min-height: 50vh;
  }
  
  .map-panel {
    order: -1;
    min-height: 200px;
    margin: 8px 0;
  }
  
  .map-panel.expanded {
    inset: 10px;
  }
  
  /* Navigation */
  .top {
    padding: 10px 16px;
  }
  
  .brand {
    font-size: 16px;
  }
  
  .nav {
    gap: 6px;
  }
  
  .nav-link {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  /* Touch elements */
  button, .btn {
    padding: 14px 18px;
    font-size: 15px;
    min-height: 48px;
  }
  
  input, select, textarea {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  /* Cards and containers */
  .wrap {
    padding: 16px 14px 60px;
  }
  
  .card, .story {
    padding: 14px;
    border-radius: 8px;
  }
  
  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }
  
  .hero-copy {
    padding: 24px 20px;
  }
  
  .hero-copy h1 {
    font-size: 28px;
  }
  
  /* Chat interface */
  .log {
    padding: 6px;
    gap: 8px;
  }
  
  .msg {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .live-slots {
    max-height: 20vh;
    font-size: 12px;
    padding: 6px 0 4px;
  }
  
  .live-slot {
    padding: 6px 8px;
    margin-bottom: 4px;
  }
  
  /* Map interface */
  .map-canvas-wrap {
    min-height: 180px;
  }
  
  .map-legend {
    font-size: 10px;
  }
  
  /* Dice interface */
  .dice-face {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
  
  .dice-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }
  
  /* Character sheet */
  .dnd-sheet {
    padding: 10px;
    font-size: 12px;
  }
  
  .dnd-sheet.compact .dnd-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .dnd-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }
  
  .dnd-stat {
    padding: 3px 2px;
  }
  
  /* Hide less important elements */
  .admin-fold,
  .map-hint,
  .token-foot,
  .dice-overlay-detail {
    display: none;
  }
  
  /* Modal adjustments */
  .modal {
    width: 95vw;
    max-height: 90vh;
    padding: 16px;
    margin: 10px;
  }
  
  .app-modal-card {
    padding: 16px;
    max-height: 85vh;
  }
  
  /* Performance optimizations */
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }
  
  body::before {
    display: none;
  }
  
  .shell {
    background: linear-gradient(180deg, #17100c 0%, #100b08 100%);
  }
}

/* Small phones */
@media (max-width: 480px) {
  .table-layout {
    padding: 6px;
  }
  
  .top {
    padding: 8px 12px;
  }
  
  .brand {
    font-size: 14px;
  }
  
  .brand small {
    font-size: 8px;
  }
  
  .avatar {
    width: 36px;
    height: 36px;
  }
  
  button, .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .wrap {
    padding: 12px 10px 50px;
  }
  
  .hero-copy h1 {
    font-size: 24px;
  }
  
  .hero-copy p {
    font-size: 16px;
  }
  
  .card, .story {
    padding: 12px;
  }
  
  .log {
    padding: 4px;
  }
  
  .msg {
    padding: 6px 8px;
    font-size: 13px;
  }
  
  .live-slots {
    max-height: 18vh;
    font-size: 11px;
  }
  
  .map-panel {
    min-height: 160px;
    margin: 6px 0;
  }
  
  .map-canvas-wrap {
    min-height: 150px;
  }
  
  .dice-face {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
  
  .dnd-sheet {
    padding: 8px;
    font-size: 11px;
  }
  
  .dnd-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .nav-link {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .grid.two, .grid.stories {
    grid-template-columns: 1fr;
  }
  
  .modal {
    padding: 12px;
    margin: 8px;
  }
  
  .app-modal-card {
    padding: 12px;
  }

  /* Lobby 480 */
  .lobby-header h2 { font-size: 18px; }
  .lobby-actions { flex-direction: column; }
  .lobby-actions button { width: 100%; }
  .invite-code { font-size: 18px; }

  /* Builder 480 */
  .stepper-item { min-width: 36px; }
  .ability-grid { grid-template-columns: 1fr !important; }
  .std-slots { grid-template-columns: 1fr !important; }
  .builder-nav { flex-direction: column; }
  .builder-nav button { width: 100%; }

  /* Modal 480 */
  .modal { width: 96vw; margin: 0; padding: 10px; }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .table-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    height: calc(100vh - 60px);
  }
  
  .party-col {
    order: 1;
    max-height: none;
  }
  
  .chat-col {
    order: 2;
    min-height: auto;
  }
  
  .map-panel {
    order: 3;
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 200px;
    min-height: 150px;
    z-index: 50;
  }
}

/* ===== MOBILE BURGER MENU ===== */
.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 44px;
  height: 44px;
  background: rgba(201, 164, 90, 0.15);
  border: 1px solid var(--brass);
  border-radius: 8px;
  cursor: pointer;
  padding: 10px;
  z-index: 100;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.burger-btn span {
  width: 24px;
  height: 3px;
  background: var(--brass-2);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.burger-btn:active {
  background: rgba(201, 164, 90, 0.25);
  transform: scale(0.95);
}

.burger-btn.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.burger-btn.open span:nth-child(2) {
  opacity: 0;
}

.burger-btn.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -280px;
  width: min(280px, 85vw);
  height: 100vh;
  background: linear-gradient(180deg, #1a120d, #0d0906);
  border-left: 1px solid var(--line);
  z-index: 99;
  padding: 80px 20px 20px;
  transition: right 0.3s ease;
  overflow-y: auto;
  pointer-events: none;
}

.mobile-menu.open {
  right: 0;
  pointer-events: auto;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-menu-overlay.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-item {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(201, 164, 90, 0.08);
  color: var(--paper);
  text-align: left;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-item:hover {
  background: rgba(201, 164, 90, 0.15);
  border-color: var(--brass);
  transform: translateX(-4px);
}

.mobile-menu-item.primary {
  background: rgba(163, 67, 56, 0.15);
  border-color: rgba(196, 90, 74, 0.5);
}

.mobile-menu-item.primary:hover {
  background: rgba(163, 67, 56, 0.25);
}

@media (max-width: 768px) {
  .burger-btn {
    display: flex;
  }
  
  .mobile-menu {
    display: block;
  }
  
  .mobile-menu-overlay {
    display: block;
  }
  
  .nav {
    display: none;
  }
  
  /* Ensure burger button is clickable */
  .top {
    padding: 8px 12px;
    position: relative;
    z-index: 101;
  }
  
  .burger-btn {
    margin-right: 12px;
    position: relative;
    z-index: 102;
  }
  
  /* Ensure main content is clickable */
  .shell {
    position: relative;
    z-index: 1;
  }
  
  /* Ensure no overlays block clicks when closed */
  .mobile-menu:not(.open),
  .mobile-menu-overlay:not(.open) {
    pointer-events: none;
  }
}

/* ===== MOBILE PAGE OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* Reduce padding and margins */
  .wrap {
    padding: 12px 12px 50px;
    position: relative;
    z-index: 1;
  }
  
  .hero-copy {
    padding: 20px 16px;
  }
  
  .hero-side {
    padding: 16px;
  }
  
  .card, .story {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .section-title {
    margin: 20px 0 10px;
  }
  
  /* Compact hero text */
  .hero-copy h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }
  
  .hero-copy p {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 12px;
  }
  
  /* Reduce spacing in grids */
  .grid {
    gap: 12px;
  }
  
  .grid.two, .grid.stories {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* Compact cards */
  .story {
    min-height: auto;
    padding: 12px;
  }
  
  .story h3 {
    font-size: 18px;
    margin-bottom: 6px;
  }
  
  .story p {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .pill {
    font-size: 11px;
    padding: 2px 8px;
  }
  
  /* Reduce modal sizes */
  .modal {
    width: 95vw;
    max-height: 85vh;
    padding: 16px;
    margin: 8px;
  }
  
  .app-modal-card {
    padding: 16px;
    max-height: 80vh;
  }
  
  /* Compact forms */
  input, select, textarea {
    padding: 12px 14px;
    font-size: 15px;
  }
  
  label {
    margin: 8px 0 4px;
    font-size: 12px;
  }
  
  /* Reduce button sizes */
  button, .btn {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
  }
  
  /* Compact character sheet */
  .dnd-sheet {
    padding: 8px;
    font-size: 11px;
  }
  
  .dnd-stats {
    gap: 2px;
  }
  
  .dnd-stat {
    padding: 2px 1px;
  }
  
  .dnd-stat-val {
    font-size: 14px;
  }
  
  /* Reduce chat spacing */
  .log {
    padding: 4px;
    gap: 6px;
  }
  
  .msg {
    padding: 6px 8px;
    font-size: 13px;
  }
  
  /* Compact live slots */
  .live-slots {
    padding: 4px 0 2px;
    max-height: 16vh;
  }
  
  .live-slot {
    padding: 4px 6px;
    margin-bottom: 3px;
  }
  
  /* Compact map panel */
  .map-panel {
    padding: 8px;
    margin: 6px 0;
    min-height: 160px;
  }
  
  .map-canvas-wrap {
    min-height: 150px;
  }
  
  /* Reduce text in various components */
  .muted {
    font-size: 12px;
  }
  
  .field-hint {
    font-size: 11px;
  }
  
  /* Hide decorative elements on mobile */
  .hero-copy::after {
    display: none;
  }
  
  .card.story::before {
    display: none;
  }
  
  /* Scroll optimization */
  .log, .admin-log, .lore-preview, .story-sections {
    -webkit-overflow-scrolling: touch;
  }

  /* ===== Lobby mobile ===== */
  .lobby-header {
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }
  .lobby-header h2 { font-size: 20px; margin-bottom: 4px; }
  .lobby-meta { font-size: 12px; gap: 6px; }
  .lobby-header-actions { width: 100%; display: flex; gap: 8px; }
  .lobby-header-actions .btn,
  .lobby-header-actions button { flex: 1; text-align: center; }
  .lobby-grid { gap: 12px !important; }
  .lobby-party-card { padding: 12px; }
  .lobby-actions { gap: 6px; }
  .lobby-actions button { font-size: 13px; padding: 10px 12px; }
  .party-member { padding: 8px 10px; gap: 8px; }
  .party-member-name { font-size: 14px; }
  .lobby-chat-log { max-height: 140px; padding: 6px 8px; font-size: 12px; }
  .lobby-chat-form input { font-size: 14px; }

  /* ===== Builder mobile ===== */
  .builder-head { flex-direction: column; gap: 4px; }
  .builder-head h3 { font-size: 18px; }
  .stepper { gap: 2px; }
  .stepper-item { min-width: 42px; padding: 4px 2px; font-size: 9px; }
  .archetype-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .archetype-card { padding: 10px 12px; }
  .char-pick-list { gap: 6px; }
  .char-pick { padding: 8px 10px; }
  .builder-nav { gap: 6px; }
  .builder-nav button { flex: 1; }
  .ability-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .std-pool { gap: 6px; flex-wrap: wrap; }
  .std-slots { grid-template-columns: repeat(2, 1fr) !important; gap: 6px; }
  .stat-slot { padding: 8px 6px; }
  .skill-grid { grid-template-columns: 1fr !important; }
  .skill-check { padding: 6px 8px; font-size: 13px; }
  .spell-pick-grid { grid-template-columns: 1fr; }
  .spell-check { padding: 6px 8px; }

  /* ===== Invite box mobile ===== */
  .invite-code { font-size: 20px; letter-spacing: .1em; word-break: break-all; }
  .invite-box { padding: 10px; }

  /* ===== Library / Bestiary mobile ===== */
  .lib-grid { grid-template-columns: 1fr !important; }
  .lib-item { padding: 6px 8px; font-size: 13px; }
  .bestiary-grid { grid-template-columns: 1fr; }
  .beast-table { font-size: 12px; }
  .beast-table td, .beast-table th { padding: 4px 6px; }

  /* ===== Profile mobile ===== */
  .profile-wrap { padding: 0; }
  .profile-wrap details summary { font-size: 14px; padding: 8px 0; }

  /* ===== Dice overlay / cards mobile ===== */
  .dice-overlay-card { min-width: 0; width: 90vw; max-width: 340px; }
  .dice-card { min-width: 0; }

  /* ===== Avatar menu mobile ===== */
  .avatar-menu { min-width: 180px; right: -8px; }

  /* ===== Modal overflow fix ===== */
  .modal { width: 92vw; margin: 0; max-height: 88vh; }
  .modal-back { padding: 12px; }
}

/* AI error card in chat */
.ai-error-card {
  background: rgba(196, 90, 74, 0.10);
  border: 1px solid rgba(196, 90, 74, 0.4);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.ai-error-icon { font-size: 32px; margin-bottom: 6px; }
.ai-error-title { font-size: 16px; font-weight: 700; color: #c45a4a; margin-bottom: 6px; }
.ai-error-text { font-size: 13px; color: var(--ink); opacity: 0.8; word-break: break-word; margin-bottom: 8px; }
.ai-error-hint { font-size: 13px; color: var(--ink); opacity: 0.65; margin-bottom: 12px; }
.ai-error-settings { font-size: 14px; }

/* Redacted secrets blocks */
.secrets-redacted {
  margin: 12px 0;
  padding: 14px;
  background: var(--paper-2, #e8d4a8);
  border: 1px solid var(--line, #ccc);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}
.secrets-redacted:hover { border-color: var(--accent, #8a5); }
.redacted-blocks {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}
.redacted-blocks span {
  display: inline-block;
  width: 40px;
  height: 14px;
  background: #2a2016;
  border-radius: 3px;
  opacity: 0.7;
}
.redacted-blocks span:nth-child(2) { width: 60px; }
.redacted-blocks span:nth-child(3) { width: 35px; }
.redacted-blocks span:nth-child(4) { width: 50px; }
.redacted-blocks span:nth-child(5) { width: 28px; }
.secrets-hint { font-size: 12px; margin: 4px 0 0; }

/* Save toast — prominent success feedback */
.save-toast {
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  background: rgba(42, 119, 68, 0.12);
  color: #1a7a3a;
  border: 1px solid rgba(42, 119, 68, 0.3);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.save-toast.show {
  opacity: 1;
  transform: translateY(0);
}
