:root {
  --bg: #070707;
  --mobile-nav-height: 86px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --bg-deep: #000000;
  --wood: #121212;
  --wood-dark: #050505;
  --wood-light: #1f1f1f;
  --paper: #121212;
  --paper-dark: #070707;
  --ink: #d9effc;
  --accent: #73aacd;
  --accent-bright: #eef9ff;
  --olive: #6ca3c2;
  --red: #b3495d;
  --text: #f1eadb;
  --muted: #b9a98d;
  --shadow: rgba(0, 0, 0, 0.5);
}

.scene-dialogue-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.scene-dialogue-card {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  max-width: 92%;
  padding: 12px 14px 13px;
  border: 1px solid rgba(123, 154, 180, 0.24);
  background: linear-gradient(180deg, rgba(34, 46, 57, 0.92), rgba(18, 24, 31, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 18px rgba(0,0,0,0.18);
  position: relative;
}

.scene-dialogue-card.left {
  border-color: rgba(113, 166, 214, 0.38);
  background: linear-gradient(180deg, rgba(26, 42, 57, 0.96), rgba(13, 21, 28, 0.98));
  border-left-width: 2px;
  border-right-width: 1px;
  border-radius: 10px 14px 14px 10px;
  transform: translateX(-2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 20px rgba(0,0,0,0.2), 0 0 0 1px rgba(76, 133, 188, 0.12);
}

.scene-dialogue-card.left::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 7px solid rgba(26, 42, 57, 0.96);
}

.scene-dialogue-card.left.thread-continue::before {
  display: none;
}

.scene-dialogue-card.right {
  grid-template-columns: minmax(0, 1fr) 60px;
  border-color: rgba(215, 189, 115, 0.42);
  background: linear-gradient(180deg, rgba(52, 40, 18, 0.95), rgba(23, 18, 10, 0.98));
  border-right-width: 2px;
  border-left-width: 1px;
  border-radius: 14px 10px 10px 14px;
  transform: translateX(2px);
  justify-self: end;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 20px rgba(0,0,0,0.22), 0 0 0 1px rgba(215, 189, 115, 0.12);
}

.scene-dialogue-card.right::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid rgba(52, 40, 18, 0.95);
}

.scene-dialogue-card.right.thread-continue::after {
  display: none;
}

.scene-dialogue-card.thread-continue {
  margin-bottom: -4px;
}

.scene-dialogue-card.thread-continue .scene-dialogue-role {
  opacity: 0.78;
}

.scene-dialogue-card.right .scene-dialogue-avatar {
  order: 2;
}

.scene-dialogue-card.right .scene-dialogue-body {
  order: 1;
  text-align: left;
}

.scene-dialogue-avatar {
  width: 60px;
  height: 60px;
  border: 1px solid rgba(215, 189, 115, 0.45);
  border-radius: 12px;
  background-color: #050709;
  background-image: linear-gradient(180deg, rgba(215, 189, 115, 0.12), rgba(31, 38, 46, 0.9));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  margin-top: 2px;
  overflow: hidden;
}

.scene-dialogue-avatar.fellowship-portrait {
  background-size: var(--portrait-size, cover);
  background-position: var(--portrait-position, center top);
  border-radius: 14px;
}

.scene-dialogue-card.left .scene-dialogue-avatar {
  border-color: rgba(113, 166, 214, 0.48);
  background-color: #0f1a24;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 0 1px rgba(88, 142, 196, 0.12);
}

.scene-dialogue-card.right .scene-dialogue-avatar {
  border-color: rgba(215, 189, 115, 0.54);
  background-color: #24190c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 1px rgba(215, 189, 115, 0.14);
}

.scene-dialogue-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.scene-dialogue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scene-dialogue-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.scene-dialogue-card.left .scene-dialogue-role {
  color: #d7efff;
  background: rgba(80, 140, 198, 0.18);
  border: 1px solid rgba(106, 167, 225, 0.34);
}

.scene-dialogue-card.right .scene-dialogue-role {
  color: #fff1c9;
  background: rgba(207, 170, 84, 0.16);
  border: 1px solid rgba(227, 193, 117, 0.34);
}

.scene-dialogue-speaker {
  color: #f1d784;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.1;
}

.scene-dialogue-card.left .scene-dialogue-speaker {
  color: #8cc8ff;
}

.scene-dialogue-card.right .scene-dialogue-speaker {
  color: #f1d784;
}

.scene-dialogue-text {
  color: #ece7dc;
  font-size: 0.97rem;
  line-height: 1.5;
  white-space: normal;
}

@media (max-width: 640px) {
  .scene-dialogue-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 9px;
    padding: 10px 11px;
    max-width: 100%;
  }

  .scene-dialogue-card.right {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .scene-dialogue-card.left {
    transform: translateX(-1px);
  }

  .scene-dialogue-card.right {
    transform: translateX(1px);
  }

  .scene-dialogue-card.left::before {
    left: -6px;
    border-top-width: 5px;
    border-bottom-width: 5px;
    border-right-width: 6px;
  }

  .scene-dialogue-card.right::after {
    right: -6px;
    border-top-width: 5px;
    border-bottom-width: 5px;
    border-left-width: 6px;
  }

  .scene-dialogue-avatar {
    width: 48px;
    height: 48px;
  }

  .scene-dialogue-text {
    font-size: 0.88rem;
  }

  .scene-dialogue-meta {
    gap: 8px;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 146, 67, 0.12), transparent 26%),
    repeating-linear-gradient(90deg, rgba(255, 180, 120, 0.02) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, #0a0a0a 0%, var(--bg) 45%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: "Verdana", "Trebuchet MS", monospace;
  image-rendering: pixelated;
}

body {
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  min-height: var(--app-vh, 100vh);
}

.app-shell {
  width: 100%;
  max-width: 760px;
  min-height: var(--app-vh, 100vh);
  padding: calc(5px + var(--safe-top)) 10px calc(var(--mobile-nav-height) + var(--safe-bottom) + 16px);
}

.topbar,
.bottom-nav,
.pixel-card,
.pixel-button,
input {
  border: 3px solid #000;
  box-shadow:
    0 0 0 3px var(--wood-dark),
    6px 6px 0 0 var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(180deg, var(--wood-light), var(--wood));
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-pixel {
  color: var(--accent-bright);
  letter-spacing: 1px;
  font-size: 15px;
  text-transform: uppercase;
}

.brand-sub,
.eyebrow,
.hint,
.tiny-chip {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.table-lamps {
  display: none;
  gap: 8px;
  margin-left: auto;
}

.table-lamps span {
  width: 10px;
  height: 10px;
  background: var(--accent-bright);
  box-shadow: 0 0 0 2px #000, 0 0 12px rgba(244, 210, 138, 0.55);
}

.screen {
  padding: 6px 0 0;
}

.hero-banner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tavern-banner {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 32%),
    linear-gradient(180deg, #173f56, #102e40);
}

.hero-banner h1 {
  margin: 0 0 12px;
  font-size: clamp(18px, 6vw, 28px);
  line-height: 1.15;
  color: var(--accent-bright);
}

.lead {
  margin: 0;
  max-width: none;
  color: var(--muted);
  line-height: 1.55;
  font-size: 11px;
}

.banner-copy {
  display: grid;
  gap: 8px;
}

.gm-table {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 8px 10px;
  width: 100%;
  justify-content: center;
  background: rgba(6, 20, 31, 0.36);
  border: 2px solid #000;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}

.gm-dice {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 11px;
  font-weight: 700;
  color: #fff7e5;
  clip-path: polygon(50% 0%, 100% 22%, 100% 78%, 50% 100%, 0% 78%, 0% 22%);
  border: 2px solid rgba(0, 0, 0, 0.5);
}

.dice-red {
  background: linear-gradient(180deg, #b85f56, #7e362f);
}

.dice-gold {
  background: linear-gradient(180deg, #dbb66b, #9d6f2e);
  color: #2e2211;
}

.gm-mini,
.pixel-avatar {
  position: relative;
  width: 34px;
  height: 44px;
  border: 2px solid #000;
  image-rendering: pixelated;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-color: rgba(0, 0, 0, 0.16);
}

.gm-mini::before,
.pixel-avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%);
}

.mini-warrior {
  background-image: url("/assets/sprites/warrior.png");
}

.mini-mage {
  background-image: url("/assets/sprites/mage.png");
}

.gm-mini::after,
.pixel-avatar::after {
  content: none;
  position: absolute;
  left: 50%;
  top: 8px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  background: #f5ddba;
  box-shadow:
    -8px 16px 0 0 rgba(0, 0, 0, 0.16),
    8px 16px 0 0 rgba(0, 0, 0, 0.16);
}

.status-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.status-chip,
.tiny-chip,
.card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 2px solid #000;
}

.status-chip {
  color: var(--accent-bright);
}

.control-panel,
.pixel-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    linear-gradient(180deg, #14384a, #0f2a39);
  padding: 12px;
}

.panel-banner {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid #000;
  color: var(--accent-bright);
  font-size: 10px;
}

.input-label {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--accent-bright);
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input {
  flex: 1;
  min-width: 0;
  background: #0b2230;
  color: var(--text);
  padding: 14px 12px;
  outline: none;
  font: inherit;
}

.pixel-button {
  background: linear-gradient(180deg, #2a5871, #17394b);
  color: var(--text);
  min-height: 48px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
}

.pixel-button.accent {
  background: linear-gradient(180deg, #8fc4e1, #4f86aa);
  color: #08202f;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.card-tag {
  color: var(--accent-bright);
}

.parchment-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #15394c, #0f2b3a);
}

.wood-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 20%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0 8px, rgba(0, 0, 0, 0.02) 8px 16px),
    linear-gradient(180deg, #133548, #0d2937);
}

.quote-frame {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 16%),
    linear-gradient(180deg, #193b4c, #102b3b);
  border: 3px solid var(--paper-dark);
  color: var(--ink);
  line-height: 1.8;
  white-space: pre-wrap;
  font-size: 12px;
  box-shadow: inset 0 0 0 2px rgba(8, 26, 39, 0.28);
}

.quote-frame .summary-title {
  color: var(--accent-bright);
  margin-bottom: 8px;
}

.quote-frame .hero-stat,
.quote-frame .summary-entry {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(117, 167, 194, 0.16);
  color: var(--text);
}

.quote-frame .hero-stat strong {
  color: var(--accent-bright);
}

.quote-frame.empty-state,
.quote-frame.empty-state p {
  color: var(--muted);
}

.scene-card {
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.stack {
  display: grid;
  gap: 10px;
  font-size: 12px;
  line-height: 1.8;
}

.utility-card,
.chronicle-card {
  min-height: 0;
}

.utility-screen {
  display: grid;
  gap: 12px;
  min-height: 100%;
}

.empty-state {
  color: var(--muted);
}

.roster-entry,
.hero-stat,
.log-entry,
.summary-entry {
  padding: 10px 12px;
  border: 2px solid rgba(0, 0, 0, 0.38);
  background: rgba(255, 255, 255, 0.05);
}

.roster-entry {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
}

.avatar-wrap {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.avatar-label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.roster-text {
  display: grid;
  gap: 4px;
}

.hero-name {
  color: var(--accent-bright);
}

.summary-title {
  color: var(--accent-bright);
  margin-top: 4px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.log-entry[data-kind="reward"] {
  color: #d7f0a2;
}

.log-entry[data-kind="warning"] {
  color: #ffb3a7;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(8px + var(--safe-bottom));
  transform: translateX(-50%);
  width: calc(100% - 16px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 16%),
    rgba(8, 25, 36, 0.96);
  backdrop-filter: blur(4px);
}

.nav-button {
  position: relative;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid #5e512d;
  background: linear-gradient(180deg, rgba(214, 187, 111, 0.08), transparent 26%), #0c0c0c;
  color: #e8dcc0;
  cursor: pointer;
  font: inherit;
  text-transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-button.active {
  color: #1c1508;
  border-color: #d6bb6f;
  background: linear-gradient(180deg, #d9c071, #c8aa59);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 205, 0.24);
  animation: none;
}

.nav-icon {
  width: 24px;
  height: 24px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.nav-icon.world {
  background-image: url("/assets/ui/nav_world.png");
}

.nav-icon.party {
  background-image: url("/assets/ui/nav_party.png");
}

.nav-icon.chat {
  background-image: url("/assets/ui/nav_chat.png");
}

.nav-icon.character {
  background-image: url("/assets/ui/nav_character.png");
}

.nav-label {
  font-size: 11px;
  letter-spacing: 0.4px;
  line-height: 1;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  background: linear-gradient(180deg, #5cc7ff, #245e88);
  color: #fff3df;
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

.nav-badge.hidden {
  display: none;
}

.combat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.battlefield {
  display: grid;
  gap: 12px;
}

.battle-lane {
  display: grid;
  gap: 8px;
}

.lane-title {
  color: var(--accent-bright);
  text-transform: uppercase;
  font-size: 10px;
}

.miniatures {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(180deg, #214b61, #13384c);
  border: 3px solid #000;
}

.combatant {
  display: grid;
  gap: 4px;
  justify-items: center;
  width: 76px;
  position: relative;
}

.combatant.enemy.menu-open {
  z-index: 3;
}

.combatant.active-turn {
  animation: activePulse 1s steps(2, end) infinite;
}

.combatant.enemy .pixel-avatar {
  background-color: rgba(90, 34, 26, 0.28);
}

.combatant.hit-flash .pixel-avatar {
  animation: hitFlash 420ms steps(2, end) 1;
}

.combatant-name {
  font-size: 9px;
  text-align: center;
}

.combatant.enemy {
  appearance: none;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.combatant.enemy.selected-target {
  box-shadow:
    inset 0 0 0 2px var(--accent-bright),
    0 0 0 2px rgba(239, 209, 123, 0.18);
}

.combatant-hint {
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border: 1px solid #000;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-size: 8px;
  text-transform: uppercase;
}

.status-badge-icon {
  width: 10px;
  height: 10px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.status-badge.buff,
.status-badge.blessed {
  background: rgba(61, 132, 92, 0.85);
}

.status-badge.debuff,
.status-badge.weakened {
  background: rgba(138, 59, 84, 0.85);
}

.status-badge.poison,
.status-badge.poisoned {
  background: rgba(79, 127, 45, 0.88);
}

.status-badge.fire,
.status-badge.burning {
  background: rgba(182, 74, 30, 0.88);
}

.status-badge.magic,
.status-badge.arcane {
  background: rgba(87, 71, 180, 0.88);
}

.status-badge.cooldown {
  background: rgba(118, 96, 52, 0.9);
}

.status-badge.guard {
  background: rgba(77, 111, 142, 0.92);
}

.hp-bar {
  width: 100%;
  height: 10px;
  border: 2px solid #000;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #b74d42, #dfb66b);
}

.hp-text {
  font-size: 9px;
  color: var(--muted);
}

.initiative-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 2px solid #000;
}

.initiative-entry {
  padding: 8px 10px;
  border: 2px solid rgba(0, 0, 0, 0.38);
  background: rgba(255, 246, 224, 0.1);
  font-size: 11px;
}

.initiative-entry.active {
  color: var(--accent-bright);
  box-shadow: inset 0 0 0 2px var(--accent-bright);
  animation: activePulse 1s steps(2, end) infinite;
}

.chat-feed {
  display: grid;
  gap: 8px;
  max-height: 260px;
  min-height: 260px;
  padding-right: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  border: 2px solid rgba(131, 181, 209, 0.16);
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.chat-message {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
}

.hub-chat-message {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
}

.hub-chat-message.joinable {
  cursor: pointer;
}

.hub-chat-message.joinable .chat-bubble {
  border-color: rgba(214, 187, 111, 0.42);
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(131, 181, 209, 0.35);
  display: grid;
  place-items: center;
  color: var(--accent-bright);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
}

.chat-bubble {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.chat-author {
  color: var(--accent-bright);
  font-size: 10px;
  text-transform: uppercase;
}

.chat-text {
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.chat-compose input {
  flex: 1;
}

.scene-finish-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-feed::-webkit-scrollbar {
  width: 10px;
}

.chat-feed::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #000;
}

.chat-feed::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4f86aa, #245e88);
  border: 1px solid #000;
}

.hero-sheet {
  display: grid;
  gap: 14px;
}

.hero-top-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.hero-top-tab {
  min-height: 42px;
  padding: 8px 4px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  cursor: pointer;
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.hero-top-tab.active {
  color: var(--accent-bright);
  border-color: rgba(214, 187, 111, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(214, 187, 111, 0.25),
    0 0 12px rgba(130, 184, 216, 0.2);
  animation: activeTabPulse 1.6s ease-in-out infinite;
}

.hero-top-tab:hover {
  color: var(--accent-bright);
  border-color: rgba(131, 181, 209, 0.4);
}

.top-tab-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.sheet-header {
  text-align: center;
  color: var(--accent-bright);
  font-size: 18px;
  letter-spacing: 1px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(121, 174, 204, 0.18);
}

.pixel-separator {
  height: 10px;
  border-top: 2px solid rgba(131, 181, 209, 0.16);
  border-bottom: 2px solid rgba(0, 0, 0, 0.35);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.12));
}

.equipment-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

.equipment-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.equip-slot {
  min-height: 88px;
  padding: 10px 8px;
  border: 2px solid rgba(131, 181, 209, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  text-align: center;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.equip-slot.filled {
  border-color: rgba(214, 187, 111, 0.75);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.35);
}

.equip-icon {
  width: 34px;
  height: 34px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.equip-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--muted);
}

.equip-name {
  font-size: 10px;
  color: var(--text);
}

.hero-doll {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.hero-doll-name {
  color: var(--accent-bright);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-doll-frame {
  width: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
}

.hero-portrait {
  width: 126px;
  height: 164px;
  border-width: 0;
  background-color: transparent;
  box-shadow: none;
  background-position: center top;
  background-size: contain;
}

.hero-doll-sub {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.stats-panel {
  display: grid;
  gap: 12px;
}

.stat-meter-card {
  display: grid;
  gap: 6px;
}

.meter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.meter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.meter-icon,
.stat-tile-icon {
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.meter-icon {
  width: 22px;
  height: 22px;
}

.stat-meter {
  width: 100%;
  height: 24px;
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.55);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.meter-fill {
  height: 100%;
  border-radius: 8px;
}

.meter-fill.health {
  background: linear-gradient(90deg, #bb4b5e, #d9687a);
}

.meter-fill.mana {
  background: linear-gradient(90deg, #5c98c4, #84bfe1);
}

.hero-stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hero-stat-tile,
.hero-skill-card {
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
}

.hero-stat-tile {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.stat-tile-icon {
  width: 28px;
  height: 28px;
}

.stat-name {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.hero-stat-tile strong {
  font-size: 24px;
  color: var(--accent-bright);
}

.skill-title {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.skill-name {
  color: var(--accent-bright);
  font-size: 16px;
  margin-bottom: 4px;
}

.skill-copy {
  font-size: 11px;
  line-height: 1.6;
}

.inventory-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-block {
  display: grid;
  gap: 8px;
}

.inventory-chip {
  padding: 8px 10px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
}

.inventory-chip.muted {
  color: var(--muted);
}

.panel-screen {
  display: grid;
  gap: 10px;
}

.inventory-screen {
  display: grid;
  gap: 10px;
}

.chapter-list {
  display: grid;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
}

.chapter-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
}

.chapter-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chapter-title {
  color: var(--accent-bright);
  font-size: 14px;
}

.chapter-events {
  display: grid;
  gap: 6px;
}

.chapter-event {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  line-height: 1.6;
}

.chapter-event.muted {
  color: var(--muted);
}

.chapter-event[data-kind="reward"] {
  color: #d7f0a2;
}

.chapter-event[data-kind="warning"] {
  color: #ffb3a7;
}

.scene-shell,
.party-tile,
.chronicle-tile {
  border-radius: 12px;
}

.scene-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.scene-code-chip {
  padding: 6px 10px;
  border: 2px solid rgba(131, 181, 209, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-bright);
  font-size: 10px;
}

.scene-headline {
  font-size: 22px;
  color: var(--accent-bright);
}

.scene-subline {
  color: var(--muted);
  font-size: 12px;
}

.scene-ending-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid rgba(131, 181, 209, 0.22);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 12px;
  font-size: 11px;
}

.scene-ending-banner.victory {
  border-color: rgba(118, 141, 108, 0.55);
  background: rgba(118, 141, 108, 0.14);
}

.scene-ending-banner.defeat {
  border-color: rgba(160, 103, 98, 0.55);
  background: rgba(160, 103, 98, 0.14);
}

.scene-ending-icon {
  width: 20px;
  height: 20px;
}

.scene-copy {
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  line-height: 1.8;
}

.scene-options-block {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.22);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 12px;
}

.scene-gm-line {
  margin: 0;
  color: var(--accent-bright);
  font-size: 12px;
  line-height: 1.65;
}

.scene-turn-badge {
  display: grid;
  place-items: center;
  text-align: center;
  align-self: start;
  min-height: 42px;
  min-width: 138px;
  width: fit-content;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: 1px solid rgba(131, 181, 209, 0.3);
}

.scene-turn-badge.is-active {
  color: #f8e3a2;
  background: rgba(214, 187, 111, 0.14);
  border-color: rgba(214, 187, 111, 0.44);
}

.scene-turn-badge.is-waiting {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.scene-turn-line {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.story-turn-timer {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(131, 181, 209, 0.22);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.story-turn-timer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}

#storyTurnTimerLabel {
  font-weight: 700;
  justify-self: end;
}

.story-turn-timer-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 20, 29, 0.72);
  border: 1px solid rgba(131, 181, 209, 0.18);
}

.story-turn-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #d6bb6f 0%, #7bd8ff 100%);
  transition: width 0.8s linear;
}

.scene-options {
  display: grid;
  gap: 8px;
}

.scene-option-button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border: 2px solid rgba(131, 181, 209, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  border-radius: 10px;
}

.scene-option-button.active {
  border-color: rgba(214, 187, 111, 0.44);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.14);
}

.scene-option-button.locked {
  opacity: 0.78;
}

.scene-option-button:hover:not(:disabled) {
  border-color: rgba(214, 187, 111, 0.72);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.2);
}

.scene-option-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.scene-option-title {
  color: var(--accent-bright);
  font-size: 11px;
}

.scene-option-copy {
  color: var(--text);
  font-size: 10px;
  line-height: 1.5;
}

.scene-summary {
  display: grid;
  gap: 8px;
}

.scene-story-result {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 2px solid rgba(214, 187, 111, 0.28);
  background: rgba(255, 245, 214, 0.06);
  border-radius: 12px;
}

.scene-story-result-title {
  color: var(--accent-bright);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.scene-story-result-copy {
  color: var(--text);
  font-size: 11px;
  line-height: 1.7;
}

.inventory-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-bright);
  font-size: 12px;
  text-transform: uppercase;
}

.inventory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.inventory-bag-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.inventory-bag-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 1px solid rgba(214, 187, 111, 0.42);
  background: #090909;
  padding: 0;
  display: block;
  overflow: hidden;
}

.inventory-bag-cell.empty {
  opacity: 0.45;
  border-style: dashed;
  border-color: rgba(90, 90, 90, 0.7);
}

.inventory-bag-cell.filled:hover {
  border-color: rgba(214, 187, 111, 0.9);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.24);
}

.inventory-bag-icon {
  position: absolute;
  inset: 4px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.inventory-bag-qty {
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.86);
  color: var(--accent-bright);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  border: 1px solid rgba(214, 187, 111, 0.42);
}

.hero-sheet-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hero-sheet-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 8px;
  flex: 1;
}

.hero-meta-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hero-meta-label {
  color: #a8a8a8;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-edit-input {
  width: 100%;
  background: #090909;
  color: #fff;
  border: 1px solid rgba(214, 187, 111, 0.42);
  padding: 6px 8px;
  font: inherit;
  min-width: 0;
}

.hero-name-input {
  font-size: 13px;
  font-weight: 700;
}

.hero-status-input {
  font-size: 12px;
  color: #d6bb6f;
}

.hero-status-display {
  display: flex;
  align-items: center;
  min-height: 31px;
  color: #d6bb6f;
  cursor: default;
  user-select: none;
}

.hero-meta-save {
  align-self: end;
  height: 31px;
  padding-inline: 10px;
  white-space: nowrap;
  font-size: 10px !important;
}

.hero-sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
  align-items: start;
}

.hero-sheet-identity {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.hero-sheet-portrait-frame {
  border: 1px solid rgba(214, 187, 111, 0.42);
  background: #090909;
  padding: 8px;
  display: flex;
  justify-content: center;
}

.hero-sheet-portrait {
  width: 70px;
  height: 70px;
}

.hero-sheet-stats {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(214, 187, 111, 0.42);
  background: #090909;
  padding: 8px 10px;
}

.hero-sheet-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.hero-sheet-stat-row span {
  color: #a8a8a8;
}

.hero-sheet-stat-row strong {
  color: #fff;
  font-size: 12px;
}

.hero-sheet-stat-row.stat-up {
  animation: heroStatRise 2.8s ease-out 1;
}

.hero-sheet-stat-row.stat-up strong,
.hero-sheet-stat-row.stat-up span {
  color: #78e08f !important;
}

.hero-sheet-stat-row.stat-down {
  animation: heroStatDrop 2.8s ease-out 1;
}

.hero-sheet-stat-row.stat-down strong,
.hero-sheet-stat-row.stat-down span {
  color: #ff7675 !important;
}

.hero-equip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hero-equip-grid-slot {
  min-height: 84px;
  border: 1px solid rgba(214, 187, 111, 0.42);
  background: #090909;
  padding: 7px 5px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  text-align: center;
}

.hero-equip-grid-slot.ghost {
  opacity: 0.28;
  border-style: dashed;
}

.hero-equip-grid-icon {
  width: 28px;
  height: 28px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.hero-equip-grid-label {
  color: #a8a8a8;
  font-size: 9px;
  text-transform: uppercase;
}

.hero-equip-grid-name {
  color: #fff;
  font-size: 10px;
  line-height: 1.25;
}

.hero-talents-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.hero-talent-tile {
  min-height: 66px;
  border: 1px solid rgba(214, 187, 111, 0.42);
  background: #090909;
  color: #fff;
  padding: 8px;
  text-align: left;
  display: grid;
  align-content: space-between;
  gap: 6px;
}

.hero-talent-title {
  font-size: 11px;
  font-weight: 700;
  color: #d6bb6f;
}

.hero-talent-rank {
  font-size: 10px;
  color: #a8a8a8;
}

@keyframes heroStatRise {
  0% { background: rgba(120, 224, 143, 0.28); }
  100% { background: transparent; }
}

@keyframes heroStatDrop {
  0% { background: rgba(255, 118, 117, 0.24); }
  100% { background: transparent; }
}

@media (max-width: 720px) {
  .hero-sheet-topline {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-sheet-meta-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  }

  .hero-meta-save {
    width: 100%;
    height: 28px;
    font-size: 9px !important;
  }

  .hero-sheet-layout {
    grid-template-columns: 1fr;
  }

  .hero-sheet-identity {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .hero-sheet-portrait {
    width: 60px;
    height: 60px;
  }

  .hero-equip-grid-slot {
    min-height: 74px;
    padding: 6px 4px;
  }

  .hero-equip-grid-name,
  .hero-talent-title {
    font-size: 10px;
  }

  .hero-talents-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.inventory-panel-tile,
.inventory-item-card {
  position: relative;
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  display: grid;
  gap: 6px;
}

.inventory-action-tile {
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.inventory-action-tile:hover,
.equip-slot:hover {
  border-color: rgba(214, 187, 111, 0.72);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.18);
}

.inventory-item-card.muted {
  color: var(--muted);
}

.inventory-item-copy {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.inventory-item-hint {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.doubleclick-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  background: linear-gradient(180deg, #8fc4e1, #4f86aa);
  color: #09202e;
  font-size: 10px;
  line-height: 1;
}

.inventory-footer {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.party-tile {
  border-color: rgba(131, 181, 209, 0.2);
}

.party-name-row {
  color: var(--accent-bright);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chronicle-tile {
  border-color: rgba(131, 181, 209, 0.2);
}

.card-mini-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.class-badge-icon {
  width: 20px;
  height: 20px;
}

.inventory-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 15, 24, 0.72);
  backdrop-filter: blur(3px);
  z-index: 40;
  padding: 18px;
}

.inventory-modal {
  width: min(100%, 420px);
  max-height: min(80vh, 560px);
  overflow: hidden;
}

.inventory-overlay-list {
  display: grid;
  gap: 10px;
  max-height: calc(80vh - 120px);
  overflow-y: auto;
}

.inventory-picker-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 2px solid rgba(131, 181, 209, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.inventory-picker-item:hover {
  border-color: rgba(214, 187, 111, 0.72);
}

.inventory-picker-name {
  color: var(--accent-bright);
  font-size: 11px;
}

.inventory-picker-copy {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.flash-equip {
  animation: inventoryFlashEquip 520ms ease-out 1;
}

.flash-unequip {
  animation: inventoryFlashUnequip 520ms ease-out 1;
}

.flash-use {
  animation: inventoryFlashUse 520ms ease-out 1;
}

.tab-activated {
  animation: tabSlideFade 320ms ease-out 1;
}

.chapter-list::-webkit-scrollbar {
  width: 10px;
}

.chapter-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #000;
}

.chapter-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4f86aa, #245e88);
  border: 1px solid #000;
}

@keyframes activeTabPulse {
  0% {
    transform: translateY(0);
    box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.25), 0 0 0 rgba(130, 184, 216, 0);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.35), 0 0 10px rgba(130, 184, 216, 0.22);
  }
  100% {
    transform: translateY(0);
    box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.25), 0 0 0 rgba(130, 184, 216, 0);
  }
}

@keyframes inventoryFlashEquip {
  0% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(214, 187, 111, 0);
  }
  45% {
    transform: scale(1.03);
    box-shadow: inset 0 0 0 2px rgba(214, 187, 111, 0.45), 0 0 12px rgba(214, 187, 111, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 0 rgba(214, 187, 111, 0);
  }
}

@keyframes inventoryFlashUnequip {
  0% {
    transform: translateX(0);
    box-shadow: 0 0 0 rgba(181, 103, 103, 0);
  }
  35% {
    transform: translateX(-2px);
    box-shadow: 0 0 10px rgba(181, 103, 103, 0.26);
  }
  70% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
    box-shadow: 0 0 0 rgba(181, 103, 103, 0);
  }
}

@keyframes inventoryFlashUse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.04);
    filter: brightness(1.25);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes tabSlideFade {
  0% {
    opacity: 0.55;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.combat-hud {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: rgba(27, 16, 9, 0.34);
  border: 2px solid #000;
}

.hud-banner {
  color: var(--accent-bright);
  font-size: 10px;
  text-transform: uppercase;
}

.turn-timer {
  display: grid;
  gap: 6px;
}

.turn-timer-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--accent-bright);
  text-transform: uppercase;
}

.turn-timer-bar {
  width: 100%;
  height: 12px;
  border: 2px solid #000;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.turn-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, #7bc96f, #d9b46b 70%, #c6574a);
  transition: width 1s linear;
}

.hud-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-target-chip {
  padding: 8px 10px;
  border: 2px solid #000;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.hud-target-chip.selected {
  color: var(--text);
  background: rgba(239, 209, 123, 0.12);
  box-shadow: inset 0 0 0 2px rgba(239, 209, 123, 0.28);
}

.hud-mobile-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  border: 1px solid rgba(131, 181, 209, 0.16);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
}

.hud-actions,
.hud-items,
.hud-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-mobile-items {
  display: grid;
  gap: 8px;
}

.hud-button {
  min-height: 38px;
  padding: 8px 10px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #7b5738, #5b3a23);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hud-button-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.hud-button.primary {
  background: linear-gradient(180deg, #d9b46b, #b4813d);
  color: #2f2417;
}

.hud-button.selected {
  box-shadow: inset 0 0 0 2px var(--accent-bright);
  color: var(--accent-bright);
}

.hud-button:disabled {
  opacity: 0.45;
  cursor: default;
}


.hud-hit-hint {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.35;
  color: rgba(225, 238, 247, 0.82);
  text-align: left;
}

.hud-target-chip .hud-hit-hint {
  display: inline-block;
  margin-top: 4px;
  text-align: center;
  color: rgba(239, 209, 123, 0.9);
}

.hud-log {
  padding: 10px 12px;
  border: 2px solid rgba(0, 0, 0, 0.38);
  background: rgba(255, 246, 224, 0.08);
  font-size: 11px;
  line-height: 1.6;
}

.dice-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(25, 14, 8, 0.38);
  z-index: 3;
  pointer-events: none;
}

.combat-dice {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  font-size: 24px;
  font-weight: 700;
  color: #fff7e5;
  background: linear-gradient(180deg, #d9b46b, #9d6f2e);
  border: 3px solid #000;
  clip-path: polygon(50% 0%, 100% 22%, 100% 78%, 50% 100%, 0% 78%, 0% 22%);
  box-shadow:
    0 0 0 3px var(--wood-dark),
    8px 8px 0 rgba(0, 0, 0, 0.35);
}

.combat-dice.rolling {
  animation: diceRoll 700ms steps(6, end) 1;
}

.combat-dice.critical {
  background: linear-gradient(180deg, #ffef9e, #d97a2b);
  color: #3a1d00;
  animation: critDice 1100ms steps(4, end) 1;
}

.damage-popup {
  position: absolute;
  top: -12px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #c6574a, #7f2f29);
  color: #fff1e8;
  font-size: 11px;
  z-index: 4;
  pointer-events: none;
  animation: floatDamage 900ms ease-out 1 forwards;
}

.popup-icon {
  font-size: 10px;
  line-height: 1;
}

.popup-icon-image {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.damage-popup.heal {
  background: linear-gradient(180deg, #74c96d, #3a7e39);
  color: #f2fff1;
}

.damage-popup.miss,
.damage-popup.block {
  background: linear-gradient(180deg, #e6d7a1, #9d8252);
  color: #31240f;
}

.damage-popup.crit {
  background: linear-gradient(180deg, #ffcf6f, #b63b2f);
  color: #fff7e6;
}

.damage-popup.buff {
  background: linear-gradient(180deg, #88d9a2, #3b8a68);
  color: #f2fff7;
}

.damage-popup.debuff {
  background: linear-gradient(180deg, #d97878, #8a3b54);
  color: #fff2f6;
}

.damage-popup.poison {
  background: linear-gradient(180deg, #9fd76f, #4f7f2d);
  color: #f7ffec;
}

.damage-popup.fire {
  background: linear-gradient(180deg, #ffb068, #b64a1e);
  color: #fff4ea;
}

.damage-popup.magic {
  background: linear-gradient(180deg, #9f8dff, #5747b4);
  color: #f6f2ff;
}

@keyframes diceRoll {
  0% {
    transform: rotate(0deg) scale(0.8);
  }
  20% {
    transform: rotate(16deg) scale(1.08);
  }
  40% {
    transform: rotate(-14deg) scale(0.92);
  }
  60% {
    transform: rotate(10deg) scale(1.04);
  }
  80% {
    transform: rotate(-6deg) scale(0.97);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

@keyframes critDice {
  0% {
    transform: rotate(0deg) scale(0.8);
    filter: brightness(1);
  }
  20% {
    transform: rotate(14deg) scale(1.12);
    filter: brightness(1.3);
  }
  40% {
    transform: rotate(-12deg) scale(0.96);
    filter: brightness(1.8);
  }
  65% {
    transform: rotate(10deg) scale(1.08);
    filter: brightness(1.5);
  }
  100% {
    transform: rotate(0deg) scale(1);
    filter: brightness(1);
  }
}

@keyframes hitFlash {
  0%,
  100% {
    filter: brightness(1);
  }
  35% {
    filter: brightness(1.95) saturate(1.3);
  }
  60% {
    filter: brightness(0.82);
  }
}

@keyframes floatDamage {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateY(-2px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(1.05);
  }
}

@keyframes activePulse {
  0%,
  100% {
    filter: brightness(1);
    transform: translateY(0);
  }
  50% {
    filter: brightness(1.18);
    transform: translateY(-1px);
  }
}

@media (min-width: 769px) {
  .app-shell {
    max-width: 980px;
    padding: 16px 14px 96px;
  }

  .topbar {
    flex-wrap: nowrap;
    gap: 12px;
    padding: 14px;
  }

  .brand-pixel {
    font-size: 18px;
  }

  .table-lamps {
    display: flex;
  }

  .screen {
    padding: 18px 0 0;
  }

  .hero-banner {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
  }

  .lead {
    max-width: 620px;
    line-height: 1.7;
    font-size: 12px;
  }

  .gm-table {
    width: auto;
    justify-content: flex-start;
    padding: 10px 14px;
  }

  .status-cluster {
    display: grid;
    min-width: 150px;
  }

  .control-panel,
  .pixel-card {
    padding: 16px;
  }

  .input-row {
    flex-direction: row;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
  }

  .utility-card,
  .chronicle-card {
    min-height: 620px;
  }

  .bottom-nav {
    bottom: 16px;
    width: min(calc(100% - 28px), 952px);
    gap: 8px;
    padding: 10px;
  }

  .nav-button {
    min-height: 54px;
    padding: 6px 4px 8px;
  }

  .nav-icon {
    width: 28px;
    height: 28px;
  }

  .nav-label {
    font-size: 10px;
  }

  .combat-layout {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 14px;
  }

  .chat-feed {
    max-height: 340px;
    min-height: 340px;
  }

  .chat-compose {
    flex-direction: row;
    align-items: center;
  }

  .hero-top-tabs {
    gap: 6px;
  }

  .hero-top-tab {
    min-height: 0;
    padding: 8px 6px;
    gap: 6px;
  }

  .equipment-panel {
    grid-template-columns: 96px minmax(0, 1fr) 96px;
    gap: 14px;
  }

  .equipment-column {
    grid-template-columns: 1fr;
  }

  .hero-doll-frame {
    min-height: 252px;
  }

  .hero-portrait {
    width: 176px;
    height: 224px;
  }

  .hero-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chapter-list {
    max-height: 540px;
  }

  .inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .initiative-panel {
    display: none;
  }

  .combat-hud {
    position: sticky;
    bottom: 86px;
    z-index: 4;
    margin-top: 10px;
    padding: 10px;
  }

  .hud-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-button {
    min-height: 42px;
    width: 100%;
  }

  .miniatures {
    gap: 8px;
    padding: 10px;
  }

  .combatant {
    width: calc(50% - 4px);
    max-width: none;
  }

  .combatant.enemy {
    min-height: 176px;
  }
}


@media (max-width: 768px) {
  .app-shell {
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 14px);
  }

  .topbar,
  .pixel-card,
  .bottom-nav,
  .pixel-button,
  input {
    box-shadow:
      0 0 0 2px var(--wood-dark),
      3px 3px 0 0 var(--shadow);
  }

  .topbar {
    position: sticky;
    top: var(--safe-top);
    z-index: 6;
    padding: 10px;
    gap: 8px;
  }

  .brand-pixel {
    font-size: 13px;
  }

  .brand-sub,
  .eyebrow,
  .hint,
  .tiny-chip {
    font-size: 9px;
  }

  .screen {
    padding-top: 10px;
  }

  .hero-banner {
    gap: 10px;
    margin-bottom: 10px;
  }

  .control-panel,
  .pixel-card {
    padding: 10px;
  }

  .quote-frame,
  .scene-copy,
  .scene-options-block,
  .scene-story-result,
  .inventory-panel-tile,
  .inventory-item-card,
  .chapter-item,
  .chat-bubble,
  .hud-log {
    padding: 10px;
  }

  .scene-headline {
    font-size: clamp(18px, 5.8vw, 22px);
    line-height: 1.25;
  }

  .scene-subline {
    font-size: 11px;
  }

  .scene-copy {
    font-size: 11px;
    line-height: 1.7;
  }

  .scene-option-button {
    min-height: 44px;
    padding: 10px;
  }

  .input-row {
    gap: 8px;
  }

  input,
  .pixel-button,
  .hud-button,
  .hero-top-tab,
  .nav-button {
    min-height: 44px;
  }

  .hero-top-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 6px;
  }

  .hero-top-tab {
    padding: 8px 6px;
    font-size: 9px;
    line-height: 1.2;
  }

  .chat-feed {
    max-height: 44vh;
    min-height: min(260px, 44vh);
    padding: 8px;
  }

  .chat-compose {
    gap: 8px;
  }

  .chapter-list {
    max-height: 46vh;
  }

  .bottom-nav {
    width: calc(100% - 12px);
    gap: 4px;
    padding: 6px;
    border-width: 2px;
  }

  .nav-button {
    min-height: 52px;
    padding: 6px 4px;
    border-width: 1px;
    gap: 3px;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  .nav-label {
    font-size: 8px;
    letter-spacing: 0.2px;
  }

  .combat-hud {
    position: sticky;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) - 6px);
    z-index: 5;
    margin-top: 8px;
    padding: 8px;
    gap: 8px;
  }

  .hud-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .hud-button {
    min-height: 44px;
    font-size: 11px;
    padding: 8px;
  }

  .miniatures {
    gap: 8px;
    padding: 8px;
  }

  .combatant {
    width: calc(50% - 4px);
    gap: 3px;
  }

  .combatant.enemy {
    min-height: 156px;
  }

  .combatant-name {
    font-size: 8px;
    line-height: 1.3;
  }

  .inventory-overlay {
    padding: 8px;
    align-items: end;
  }

  .inventory-modal {
    width: 100%;
    max-height: min(84vh, 620px);
  }

  .inventory-overlay-list {
    max-height: calc(84vh - 112px);
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-left: 6px;
    padding-right: 6px;
  }

  .topbar,
  .control-panel,
  .pixel-card {
    padding: 8px;
  }

  .brand-pixel {
    font-size: 12px;
  }

  .panel-banner,
  .card-tag,
  .tiny-chip,
  .status-chip {
    font-size: 8px;
    padding: 6px 8px;
  }

  .hero-banner h1 {
    font-size: clamp(17px, 6vw, 20px);
  }

  .lead {
    font-size: 10px;
  }

  .grid {
    gap: 10px;
    margin-top: 10px;
  }

  .scene-title-row {
    align-items: flex-start;
  }

  .scene-code-chip {
    font-size: 9px;
    padding: 4px 8px;
  }

  .chat-feed {
    max-height: 40vh;
  }

  .combatant.enemy {
    min-height: 144px;
  }

  .pixel-avatar {
    width: 32px;
    height: 40px;
  }

  .hp-text {
    font-size: 8px;
  }

  .inventory-grid {
    gap: 8px;
  }

  .hud-log {
    font-size: 10px;
  }
}


@media (max-width: 768px) {
  .scene-options-block {
    gap: 10px;
    padding: 10px;
  }

  .scene-turn-badge {
    min-height: 40px;
    min-width: 128px;
    padding: 0 14px;
    font-size: 9px;
  }

  .story-turn-timer {
    padding: 8px 10px;
  }

  .story-turn-timer-head {
    font-size: 9px;
  }

  .scene-turn-line {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
}



/* compact-topbar-and-hud-refine */
.topbar {
  padding: 9px 10px;
  gap: 8px;
}

.brand {
  gap: 3px;
  min-width: 0;
}

.brand-pixel {
  font-size: 13px;
  letter-spacing: 0.6px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 8px;
  letter-spacing: 0.7px;
  line-height: 1.1;
}

#refreshButton.pixel-button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 0.6px;
  border-width: 2px;
  box-shadow:
    0 0 0 2px var(--wood-dark),
    2px 2px 0 0 var(--shadow);
}

.combat-hud {
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(20, 33, 43, 0.9), rgba(13, 24, 33, 0.9));
  border: 1px solid rgba(131, 181, 209, 0.35);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hud-banner {
  font-size: 9px;
  letter-spacing: 0.7px;
  color: rgba(184, 220, 243, 0.92);
}

.turn-timer {
  gap: 5px;
}

.turn-timer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 8px;
  font-size: 9px;
  letter-spacing: 0.6px;
}

.turn-timer-head span:nth-child(2) {
  color: rgba(145, 180, 199, 0.8);
}

.turn-timer-bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(92, 135, 160, 0.5);
  background: rgba(8, 20, 29, 0.82);
}

.hud-log {
  padding: 9px 10px;
  border: 1px solid rgba(131, 181, 209, 0.24);
  background: rgba(116, 161, 187, 0.08);
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.45;
}

.hud-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.hud-button {
  min-height: 40px;
  padding: 8px;
  border: 1px solid rgba(121, 163, 187, 0.45);
  border-radius: 10px;
  background: linear-gradient(180deg, #31586e, #214357);
  font-size: 10px;
  line-height: 1.2;
}

.hud-button.primary {
  background: linear-gradient(180deg, #d4b774, #ab8745);
}

.hud-button.selected {
  box-shadow: inset 0 0 0 1px var(--accent-bright), 0 0 0 1px rgba(131, 181, 209, 0.2);
}

.hud-mobile-hint {
  font-size: 9px;
  padding: 7px 9px;
  border-radius: 8px;
}

.hud-target-chip {
  padding: 7px 9px;
  border-width: 1px;
  border-radius: 8px;
  font-size: 9px;
}

.hud-button-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .topbar {
    padding: 7px 8px;
    gap: 6px;
    border-width: 2px;
  }

  .brand-pixel {
    font-size: 12px;
    letter-spacing: 0.45px;
  }

  .brand-sub {
    font-size: 7px;
    letter-spacing: 0.55px;
  }

  #refreshButton.pixel-button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 9px;
    line-height: 1;
  }

  .combat-hud {
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) - 8px);
    padding: 8px;
    gap: 7px;
  }

  .turn-timer-head {
    font-size: 8px;
    column-gap: 6px;
  }

  .hud-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .hud-button {
    min-height: 38px;
    padding: 7px 6px;
    font-size: 9px;
    gap: 5px;
  }

  .hud-log,
  .hud-target-chip,
  .hud-mobile-hint {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 6px 7px;
  }

  .brand-pixel {
    font-size: 11px;
  }

  #refreshButton.pixel-button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 8px;
  }

  .turn-timer-head {
    font-size: 7px;
  }

  .hud-button {
    min-height: 36px;
    font-size: 8px;
  }
}



/* scene-finish-actions-compact */
.scene-finish-actions {
  gap: 8px;
}

.scene-finish-actions .pixel-button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.1;
  letter-spacing: 0.35px;
  border-width: 2px;
  box-shadow:
    0 0 0 2px var(--wood-dark),
    2px 2px 0 0 var(--shadow);
}

@media (max-width: 768px) {
  .scene-finish-actions {
    gap: 6px;
  }

  .scene-finish-actions .pixel-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  .scene-finish-actions .pixel-button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 9px;
  }
}



/* scene-shell-polish */
.panel-screen.scene-shell {
  display: grid;
  gap: 12px;
}


.lobby-shell {
  gap: 14px;
}

.global-topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 2px solid rgba(131, 181, 209, 0.28);
  background: rgba(255, 255, 255, 0.03);
}

.global-topcell {
  display: grid;
  gap: 2px;
  text-align: center;
}

.global-topcell span {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.global-topcell strong {
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-topbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 2px solid rgba(131, 181, 209, 0.28);
  background: rgba(255, 255, 255, 0.03);
}

.lobby-topcell {
  display: grid;
  gap: 2px;
  text-align: center;
}

.lobby-topcell span {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.lobby-topcell strong {
  font-size: 12px;
  color: var(--text);
}

.lobby-members-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lobby-member-card {
  border: 2px solid rgba(131, 181, 209, 0.3);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 8px;
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 172px;
}

.lobby-member-card.empty {
  opacity: 0.7;
}

.lobby-member-avatar {
  width: 72px;
  height: 92px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.lobby-member-avatar.placeholder {
  background: linear-gradient(180deg, rgba(131, 181, 209, 0.18), rgba(131, 181, 209, 0.06));
  border: 2px dashed rgba(131, 181, 209, 0.35);
}

.lobby-member-name {
  font-size: 11px;
  text-align: center;
  color: var(--text);
}

.lobby-member-role {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.lobby-member-role.status-admin {
  color: #ff5a5a !important;
}

.lobby-member-role.status-moderator {
  color: #57a5ff !important;
}

.lobby-member-role.status-elite {
  color: #d7bd73 !important;
}

.lobby-member-role.status-honored {
  color: #6fdc77 !important;
}

.lobby-member-role.status-default {
  color: #a8a8a8 !important;
}

.lobby-member-state {
  font-size: 9px;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.lobby-member-state.online {
  color: #9ce0a8;
  border-color: rgba(156, 224, 168, 0.5);
}

.lobby-member-state.offline {
  color: #c7d0d6;
  border-color: rgba(199, 208, 214, 0.45);
}

.lobby-footnote {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

.scene-title-row {
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.scene-title-row .summary-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.25px;
  line-height: 1.25;
}

.scene-code-chip {
  padding: 5px 8px;
  font-size: 10px;
  border-width: 1px;
  border-color: rgba(131, 181, 209, 0.32);
  background: rgba(255, 255, 255, 0.04);
}

.scene-headline {
  margin: 0;
  font-size: clamp(32px, 5.4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #e7f3fb;
}

.scene-subline {
  margin-top: -2px;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(163, 195, 213, 0.9);
}

.scene-copy {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(131, 181, 209, 0.26);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
  font-size: 13px;
  line-height: 1.55;
  color: rgba(186, 212, 227, 0.96);
}

.scene-options-block {
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(131, 181, 209, 0.28);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(29, 62, 83, 0.55), rgba(19, 47, 63, 0.55));
}

.scene-gm-line {
  font-size: 13px;
  line-height: 1.45;
  color: #dbeffa;
}

.story-turn-timer {
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(131, 181, 209, 0.26);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.story-turn-timer-head {
  font-size: 9px;
  letter-spacing: 0.45px;
}

.story-turn-timer-bar {
  height: 10px;
  border-width: 1px;
}

.scene-turn-line {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.45px;
  color: rgba(145, 180, 199, 0.96);
}

@media (max-width: 768px) {
  .panel-screen.scene-shell {
    gap: 10px;
  }

  .scene-title-row .summary-title {
    font-size: 12px;
    line-height: 1.2;
  }

  .scene-code-chip {
    padding: 4px 7px;
    font-size: 8px;
  }

  .scene-headline {
    font-size: clamp(26px, 8.6vw, 44px);
    line-height: 1.06;
  }

  .scene-copy {
    padding: 10px;
    font-size: 11px;
    line-height: 1.5;
  }

  .scene-options-block {
    padding: 10px;
    gap: 9px;
  }

  .scene-gm-line {
    font-size: 11px;
  }

  .story-turn-timer {
    padding: 8px 9px;
  }
}

@media (max-width: 420px) {
  .scene-headline {
    font-size: clamp(22px, 9vw, 32px);
    letter-spacing: 0;
  }

  .scene-copy {
    font-size: 10px;
  }

  .scene-gm-line {
    font-size: 10px;
  }
}



/* scene-premium-refine */
.panel-screen.scene-shell {
  position: relative;
  padding-top: 2px;
}

.panel-screen.scene-shell > * {
  position: relative;
}

.panel-screen.scene-shell > * + * {
  padding-top: 10px;
}

.panel-screen.scene-shell > * + *::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(131, 181, 209, 0), rgba(131, 181, 209, 0.24) 16%, rgba(131, 181, 209, 0.24) 84%, rgba(131, 181, 209, 0));
}

.scene-title-row .summary-title {
  color: rgba(214, 236, 248, 0.95);
}

.scene-headline {
  text-wrap: balance;
  color: rgba(235, 246, 252, 0.97);
}

.scene-subline {
  color: rgba(161, 191, 208, 0.88);
}

.scene-copy {
  color: rgba(182, 208, 223, 0.9);
  border-color: rgba(131, 181, 209, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.scene-options-block,
.scene-story-result,
.scene-summary {
  border-color: rgba(131, 181, 209, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.scene-gm-line {
  color: rgba(218, 237, 248, 0.94);
}

.scene-turn-line,
.story-turn-timer-head,
.scene-option-copy,
.scene-story-result-copy,
.hud-log {
  color: rgba(161, 192, 208, 0.9);
}

.scene-option-title,
.scene-story-result-title,
.summary-title {
  color: rgba(220, 239, 250, 0.96);
}

.story-turn-timer {
  border-color: rgba(131, 181, 209, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.012));
}

.story-turn-timer-fill {
  box-shadow: 0 0 10px rgba(131, 181, 209, 0.14);
}

@media (max-width: 768px) {
  .panel-screen.scene-shell > * + * {
    padding-top: 8px;
  }
}

@media (max-width: 420px) {
  .panel-screen.scene-shell > * + * {
    padding-top: 7px;
  }

  .scene-copy {
    color: rgba(174, 201, 217, 0.9);
  }
}



/* scene-clean-v2 */
.panel-screen.scene-shell {
  gap: 10px;
}

.panel-screen.scene-shell > * + * {
  padding-top: 0;
}

.panel-screen.scene-shell > * + *::before {
  content: none;
}

.scene-title-row {
  margin: 0;
  align-items: center;
  gap: 10px;
}

.scene-title-row .summary-title {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: #d7ebf7;
}

.scene-code-chip {
  padding: 4px 8px;
  font-size: 9px;
  border: 1px solid rgba(127, 170, 194, 0.3);
  border-radius: 6px;
  background: rgba(24, 55, 73, 0.45);
  color: #cfe6f5;
}

.scene-headline {
  margin: 2px 0 0;
  font-size: clamp(26px, 7.2vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: #e4f2fb;
  text-wrap: pretty;
}

.scene-subline {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(150, 182, 201, 0.9);
}

.scene-copy {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid rgba(118, 164, 190, 0.24);
  border-radius: 8px;
  background: rgba(17, 44, 60, 0.42);
  color: rgba(179, 206, 222, 0.93);
  font-size: 12px;
  line-height: 1.58;
  box-shadow: none;
}

.scene-options-block {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid rgba(118, 164, 190, 0.22);
  border-radius: 12px;
  background: rgba(18, 48, 66, 0.46);
  gap: 10px;
  box-shadow: none;
}

.scene-gm-line {
  font-size: 12px;
  line-height: 1.45;
  color: #d8edf9;
}

.scene-turn-badge {
  min-height: 38px;
  min-width: 124px;
  padding: 0 14px;
  border-width: 1px;
  border-color: rgba(206, 180, 111, 0.55);
  background: rgba(206, 180, 111, 0.1);
  color: #f5e1a2;
  font-size: 9px;
  letter-spacing: 0.6px;
}

.story-turn-timer {
  padding: 8px 10px;
  border: 1px solid rgba(118, 164, 190, 0.24);
  border-radius: 10px;
  background: rgba(16, 42, 58, 0.45);
  gap: 6px;
}

.story-turn-timer-head {
  font-size: 9px;
  letter-spacing: 0.4px;
  color: rgba(149, 182, 201, 0.95);
}

.story-turn-timer-bar {
  height: 9px;
  border: 1px solid rgba(118, 164, 190, 0.28);
  background: rgba(8, 24, 36, 0.9);
}

.scene-turn-line {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.35px;
  color: rgba(147, 181, 200, 0.9);
}

@media (max-width: 768px) {
  .panel-screen.scene-shell {
    gap: 9px;
  }

  .scene-title-row .summary-title {
    font-size: 12px;
  }

  .scene-code-chip {
    font-size: 8px;
    padding: 3px 7px;
  }

  .scene-headline {
    font-size: clamp(22px, 8.1vw, 32px);
    line-height: 1.12;
  }

  .scene-copy {
    padding: 10px;
    font-size: 11px;
  }

  .scene-options-block {
    padding: 10px;
  }

  .scene-gm-line {
    font-size: 11px;
  }

  .scene-turn-badge {
    min-height: 34px;
    min-width: 112px;
    font-size: 8px;
  }

  .story-turn-timer-head,
  .scene-turn-line {
    font-size: 8px;
  }
}

@media (max-width: 420px) {
  .scene-headline {
    font-size: clamp(20px, 8.4vw, 28px);
  }

  .scene-copy {
    font-size: 10px;
    line-height: 1.52;
  }
}



/* strict-minimal-v1 */
.panel-screen.scene-shell {
  gap: 8px;
}

.scene-title-row {
  gap: 8px;
  margin: 0;
}

.scene-title-row .summary-title {
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.15px;
  color: #d3e6f2;
}

.scene-code-chip {
  padding: 3px 7px;
  font-size: 8px;
  line-height: 1;
  border-radius: 4px;
  border: 1px solid rgba(120, 158, 180, 0.28);
  background: rgba(20, 46, 62, 0.35);
  color: #c9dfed;
}

.scene-headline {
  margin: 0;
  font-size: clamp(20px, 6.6vw, 30px);
  line-height: 1.14;
  letter-spacing: 0;
  font-weight: 600;
  color: #e2eef6;
}

.scene-subline {
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(146, 175, 192, 0.9);
}

.scene-copy {
  margin: 0;
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(174, 200, 214, 0.9);
  border: 1px solid rgba(118, 157, 179, 0.2);
  border-radius: 6px;
  background: rgba(16, 40, 54, 0.34);
  box-shadow: none;
}

.scene-options-block {
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(118, 157, 179, 0.22);
  border-radius: 8px;
  background: rgba(16, 40, 54, 0.34);
  box-shadow: none;
}

.scene-gm-line {
  font-size: 11px;
  line-height: 1.45;
  color: #d7e8f2;
}

.scene-turn-badge {
  min-height: 30px;
  min-width: 98px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(186, 164, 104, 0.5);
  background: rgba(186, 164, 104, 0.1);
  color: #efdca6;
  font-size: 8px;
  letter-spacing: 0.4px;
}

.story-turn-timer {
  padding: 7px 8px;
  gap: 5px;
  border: 1px solid rgba(118, 157, 179, 0.22);
  border-radius: 8px;
  background: rgba(13, 33, 45, 0.42);
}

.story-turn-timer-head {
  font-size: 8px;
  letter-spacing: 0.3px;
  color: rgba(144, 174, 191, 0.92);
}

.story-turn-timer-bar {
  height: 8px;
  border: 1px solid rgba(118, 157, 179, 0.25);
  border-radius: 999px;
  background: rgba(8, 21, 31, 0.92);
}

.story-turn-timer-fill {
  box-shadow: none;
}

.scene-turn-line {
  margin-top: 1px;
  font-size: 8px;
  letter-spacing: 0.3px;
  color: rgba(141, 171, 188, 0.88);
}

@media (max-width: 768px) {
  .panel-screen.scene-shell {
    gap: 7px;
  }

  .scene-headline {
    font-size: clamp(18px, 7.6vw, 26px);
  }

  .scene-copy {
    font-size: 10px;
    padding: 9px;
  }

  .scene-options-block {
    padding: 9px;
  }

  .scene-gm-line {
    font-size: 10px;
  }

  .scene-turn-badge {
    min-height: 28px;
    min-width: 90px;
    font-size: 7px;
  }
}

@media (max-width: 420px) {
  .scene-title-row .summary-title {
    font-size: 11px;
  }

  .scene-headline {
    font-size: clamp(17px, 7.8vw, 22px);
  }

  .scene-copy,
  .scene-gm-line {
    font-size: 9px;
  }
}



/* strict-minimal-v2 */
.panel-screen.scene-shell {
  gap: 6px;
}

.scene-title-row,
.scene-headline,
.scene-subline,
.scene-copy,
.scene-options-block,
.story-turn-timer,
.scene-turn-line,
.scene-story-result,
.scene-summary {
  margin: 0;
}

.scene-title-row {
  align-items: baseline;
  gap: 8px;
}

.scene-title-row .summary-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12px;
  line-height: 1.2;
  color: #cfe1ed;
}

.scene-code-chip {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(140, 171, 188, 0.88);
  font-size: 9px;
  letter-spacing: 0.3px;
}

.scene-headline {
  font-size: clamp(20px, 6.6vw, 27px);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  color: #deebf4;
}

.scene-subline {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(136, 167, 184, 0.86);
}

.scene-copy,
.scene-options-block,
.scene-story-result,
.scene-summary {
  padding: 8px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.scene-copy {
  font-size: 11px;
  line-height: 1.55;
  color: rgba(170, 196, 211, 0.9);
}

.scene-options-block {
  display: grid;
  gap: 8px;
}

.scene-gm-line {
  font-size: 11px;
  line-height: 1.42;
  color: #d3e4ef;
}

.scene-turn-badge {
  min-height: 24px;
  min-width: 74px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(190, 170, 115, 0.12);
  color: #e7d398;
  font-size: 8px;
  letter-spacing: 0.35px;
}

.story-turn-timer {
  gap: 4px;
  padding: 6px 0 0;
}

.story-turn-timer-head {
  font-size: 8px;
  letter-spacing: 0.25px;
  color: rgba(138, 168, 184, 0.9);
}

.story-turn-timer-bar {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(9, 21, 31, 0.9);
}

.story-turn-timer-fill {
  border-radius: 999px;
  box-shadow: none;
}

.scene-turn-line {
  font-size: 8px;
  letter-spacing: 0.22px;
  color: rgba(134, 164, 180, 0.88);
}

.scene-option-button {
  border: 0;
  border-radius: 6px;
  background: rgba(24, 52, 67, 0.36);
  padding: 8px;
}

.scene-option-title {
  font-size: 11px;
  color: #d8e9f4;
}

.scene-option-copy {
  font-size: 11px;
  color: rgba(155, 186, 202, 0.9);
}

.scene-option-button.active {
  box-shadow: inset 0 0 0 1px rgba(133, 173, 195, 0.32);
}

@media (max-width: 768px) {
  .panel-screen.scene-shell {
    gap: 5px;
  }

  .scene-headline {
    font-size: clamp(18px, 7.2vw, 24px);
  }

  .scene-copy {
    font-size: 11px;
    line-height: 1.52;
  }

  .scene-gm-line,
  .scene-option-title {
    font-size: 11px;
  }

  .scene-option-copy {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .scene-title-row .summary-title {
    font-size: 11px;
  }

  .scene-headline {
    font-size: clamp(16px, 7.2vw, 21px);
  }
}



/* story-roll-confirm-ui */
.scene-option-button.selected {
  box-shadow: inset 0 0 0 1px rgba(143, 190, 215, 0.45);
  background: rgba(30, 66, 85, 0.48);
}

.story-roll-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(141, 188, 214, 0.42);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(40, 84, 109, 0.88), rgba(26, 58, 77, 0.88));
  color: #dff1fc;
  font: inherit;
  cursor: pointer;
}

.story-roll-button:hover {
  border-color: rgba(170, 213, 236, 0.62);
  background: linear-gradient(180deg, rgba(47, 98, 127, 0.92), rgba(30, 67, 89, 0.92));
}

.story-roll-button:active {
  transform: translateY(1px);
}

.story-roll-cube {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 1px solid rgba(215, 190, 123, 0.68);
  background: linear-gradient(180deg, #d9bf7e, #a7803d);
  color: #2f2413;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.story-roll-label {
  font-size: 10px;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .story-roll-button {
    min-height: 40px;
    padding: 7px 10px;
    gap: 8px;
    border-radius: 8px;
  }

  .story-roll-cube {
    width: 24px;
    height: 24px;
    font-size: 8px;
  }

  .story-roll-label {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .story-roll-button {
    min-height: 38px;
  }

  .story-roll-label {
    font-size: 8px;
  }
}


.back-button {
  margin-right: 8px;
  padding: 8px 10px;
  min-width: 92px;
}

.app-shell.entry-mode .hero-banner,
.app-shell.entry-mode .control-panel,
.app-shell.entry-mode:not(.utility-drawer-open) .utility-card,
.app-shell.entry-mode .chronicle-card {
  display: none;
}

.entry-shell {
  display: grid;
  gap: 12px;
}

.entry-home-screen {
  position: relative;
  min-height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height, 72px) - var(--safe-bottom, 0px) - var(--safe-top, 0px));
}

.entry-grid {
  display: grid;
  gap: 10px;
}

.language-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: block;
  padding: 0;
  background: rgba(5, 8, 12, 0.78);
  backdrop-filter: blur(4px);
}

.language-overlay-card {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top, 0px) + 42px);
  transform: translateX(-50%);
  z-index: 9801;
  width: min(calc(100vw - 28px), 520px);
  max-height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height, 72px) - var(--safe-bottom, 0px) - var(--safe-top, 0px) - 36px);
  display: grid;
  gap: 14px;
  padding: 18px;
  margin: 0;
  border: 2px solid rgba(214, 190, 119, 0.5);
  background:
    linear-gradient(180deg, rgba(248, 224, 158, 0.08), transparent 28%),
    linear-gradient(180deg, #132230, #0b151f);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  overflow-y: auto;
}

.language-overlay-copy,
.language-overlay-current {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.language-overlay-current strong {
  color: var(--accent-bright);
}

.language-overlay-grid {
  display: grid;
  gap: 10px;
}

.language-overlay-grid .pixel-button {
  min-height: 58px;
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
}

.language-option-title {
  font-size: 15px;
  font-weight: 700;
}

.language-option-note {
  font-size: 11px;
  color: inherit;
  opacity: 0.8;
}

.language-overlay-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .language-overlay-backdrop {
    padding: 0;
  }

  .language-overlay-card {
    top: calc(var(--safe-top, 0px) + 18px);
    width: min(calc(100vw - 24px), 360px);
    max-height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height, 72px) - var(--safe-bottom, 0px) - var(--safe-top, 0px) - 40px);
    gap: 10px;
    padding: 14px;
  }
}

.entry-action {
  width: 100%;
  padding: 14px 12px;
  border: 2px solid #000;
  background: linear-gradient(180deg, #25506a, #1a3b51);
  color: var(--accent-bright);
  font-size: 14px;
  text-align: left;
}

.entry-stack {
  display: grid;
  gap: 10px;
}

.entry-scenario {
  width: 100%;
  border: 2px solid #000;
  background: linear-gradient(180deg, #111111, #090909);
  color: var(--text);
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.entry-scenario.standard {
  border-color: #4f4f4f;
  background: linear-gradient(180deg, #111111, #0a0a0a);
}

.entry-scenario.premium {
  border-color: rgba(214, 187, 111, 0.5);
  background:
    linear-gradient(180deg, rgba(214, 187, 111, 0.08), rgba(214, 187, 111, 0.01) 42%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, #111111, #0a0a0a);
  box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.08);
}

.entry-scenario.premium.owned {
  border-color: rgba(164, 214, 111, 0.42);
  box-shadow: inset 0 0 0 1px rgba(164, 214, 111, 0.08);
}

.entry-scenario.premium.owned .entry-scenario-corner-mark {
  background: linear-gradient(135deg, rgba(164, 214, 111, 0.92), rgba(164, 214, 111, 0.18));
}

.entry-scenario > button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.entry-scenario-title {
  font-weight: 700;
}

.entry-scenario-copy {
  font-size: 12px;
  color: var(--muted);
}

.entry-scenario-corner-mark {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  background: linear-gradient(135deg, rgba(214, 187, 111, 0.95), rgba(214, 187, 111, 0.18));
  pointer-events: none;
}

.entry-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.entry-hub-messages {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 2px solid rgba(146, 187, 213, 0.28);
  background: rgba(8, 24, 34, 0.5);
}

.entry-hub-message {
  display: grid;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(146, 187, 213, 0.18);
}

.entry-hub-invites {
  display: grid;
  gap: 8px;
}

.entry-invite-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.entry-shop-item {
  border: 2px solid rgba(146, 187, 213, 0.28);
  background: rgba(8, 24, 34, 0.45);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.entry-shop-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.entry-shop-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.entry-shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.entry-shop-card {
  border: 1px solid rgba(146, 187, 213, 0.28);
  background: rgba(8, 24, 34, 0.45);
  padding: 8px 8px 7px;
  min-height: 188px;
  display: grid;
  gap: 6px;
  align-content: start;
  grid-template-rows: auto auto auto 1fr auto auto;
}

.entry-shop-card.disabled {
  opacity: 0.6;
}

.entry-shop-card.placeholder {
  min-height: 188px;
  background: rgba(8, 8, 8, 0.35);
  border: 1px dashed rgba(120, 120, 120, 0.22);
}

.entry-shop-thumb-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.entry-shop-thumb {
  width: 32px;
  height: 32px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  image-rendering: pixelated;
}

.entry-shop-title {
  font-size: 12px;
  line-height: 1.16;
  text-align: center;
  color: #f2f4f6;
  word-break: break-word;
}

.entry-shop-kind {
  font-size: 9px;
  color: #aeb8c6;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
}

.entry-shop-copy {
  font-size: 10px;
  line-height: 1.32;
  color: #9ea6b3;
  text-align: left;
  min-height: 38px;
}

.entry-shop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 9px;
  color: var(--muted);
  min-height: 12px;
}

.entry-shop-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.shop-price-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.entry-currency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}

.entry-currency-icon {
  font-size: 12px;
  line-height: 1;
}

.shop-submenu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 1px 0 3px;
  border-bottom: 1px solid rgba(120, 120, 120, 0.28);
  margin-bottom: 2px;
}

.shop-submenu-tab {
  min-height: 22px;
  border: 1px solid rgba(120, 120, 120, 0.36);
  background: #070707;
  color: #d9d9d9;
  font-size: 9px;
  letter-spacing: 0.22px;
  text-transform: uppercase;
  padding: 2px 4px;
}

.shop-submenu-tab.active {
  border-color: #d7bd73;
  color: #d7bd73;
}

.pixel-button.tiny {
  padding: 4px 6px;
  font-size: 10px;
}

@media (max-width: 768px) {
  .topbar {
    gap: 6px;
  }
  .back-button {
    min-width: 78px;
    padding: 7px 8px;
    font-size: 10px;
  }
  .entry-action {
    padding: 12px 10px;
    font-size: 13px;
  }
  .entry-shop-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .entry-shop-card {
    min-height: 170px;
    padding: 6px;
    gap: 5px;
  }
  .entry-shop-card.placeholder {
    min-height: 170px;
  }
  .entry-shop-thumb {
    width: 28px;
    height: 28px;
  }
  .entry-shop-title {
    font-size: 11px;
  }
  .entry-shop-copy {
    font-size: 9px;
    min-height: 32px;
  }
  .shop-submenu {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .shop-submenu-tab {
    font-size: 8px;
    min-height: 20px;
  }
  .global-topbar {
    gap: 6px;
    padding: 6px;
  }
  .global-topcell span {
    font-size: 8px;
  }
  .global-topcell strong {
    font-size: 10px;
  }
}


/* BLACK QUEST THEME */
.topbar,
.bottom-nav,
.pixel-card,
.control-panel,
.tavern-banner,
.parchment-card,
.wood-card,
.initiative-panel,
.battlefield,
.combat-hud {
  background:
    linear-gradient(180deg, rgba(255, 160, 80, 0.08), transparent 32%),
    linear-gradient(180deg, #131313, #070707) !important;
}

.pixel-button,
.entry-action,
.entry-scenario,
.hud-button {
  background: linear-gradient(180deg, #202020, #0c0c0c) !important;
  color: #f5e5c4 !important;
  border-color: #000 !important;
}

.pixel-button.accent,
.entry-action:hover,
.hud-button.selected {
  background: linear-gradient(180deg, #7c2f12, #421306) !important;
  color: #ffe0b2 !important;
}

.scene-code-chip,
.card-tag,
.tiny-chip,
.status-chip {
  background: rgba(0, 0, 0, 0.75) !important;
  border-color: #2c2c2c !important;
}

.entry-main-logo {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 10px;
  border: 2px solid #2e2e2e;
  background:
    radial-gradient(circle at center, rgba(255, 138, 61, 0.24), transparent 58%),
    linear-gradient(180deg, #1a1a1a, #070707);
}

.entry-main-logo-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.entry-mini-sprite {
  width: 44px;
  height: 44px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.7));
}

.entry-main-logo-title {
  font-size: clamp(18px, 5vw, 28px);
  letter-spacing: 1px;
  font-weight: 900;
  text-transform: uppercase;
  color: #ffcc5d;
  text-shadow:
    0 1px 0 #000,
    0 2px 0 #000,
    0 0 10px rgba(255, 97, 35, 0.35);
}


.entry-main-logo-image {
  display: block;
  width: min(100%, 520px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
}

.entry-main-logo-top,
.entry-main-logo-title,
.entry-mini-sprite {
  display: none !important;
}

/* hard-black-theme */
:root {
  --bg: #000000;
  --bg-deep: #000000;
  --wood: #000000;
  --wood-dark: #000000;
  --wood-light: #0a0a0a;
  --paper: #050505;
  --paper-dark: #000000;
  --ink: #ffffff;
  --text: #ffffff;
  --muted: #a0a0a0;
  --accent: #d6bb6f;
  --accent-bright: #f2d98a;
  --olive: #d6bb6f;
  --shadow: rgba(0, 0, 0, 0.75);
}

html,
body {
  background: #000000 !important;
  color: #ffffff !important;
}

.app-shell,
.topbar,
.bottom-nav,
.panel-screen,
.panel-screen.scene-shell,
.scene-shell,
.entry-shell,
.lobby-shell,
.utility-screen,
.inventory-screen,
.hero-sheet,
.pixel-card,
.quote-frame,
.chat-feed,
.chat-compose,
.hud-target-chip,
.hud-log,
.hud-mobile-hint,
.inventory-panel,
.inventory-grid,
.entry-hub-messages,
.entry-hub-invites,
.entry-shop-item,
.scene-summary,
.scene-story-result,
.scene-options-block {
  background: #050505 !important;
  color: #ffffff !important;
  border-color: #4b4b4b !important;
}

.pixel-separator,
.chapter-events,
.chapter-event,
.lobby-topbar,
.scene-title-row,
.scene-headline,
.scene-copy,
.inventory-footer {
  border-color: #5a5a5a !important;
}

.brand-sub,
.eyebrow,
.hint,
.tiny-chip,
.scene-subline,
.lobby-footnote,
.lobby-member-role,
.inventory-item-copy,
.chat-author {
  color: #a8a8a8 !important;
}

.pixel-button,
.hud-button,
.entry-action,
.entry-scenario,
.inventory-action-tile,
.scene-option-button {
  background: #0a0a0a !important;
  color: #ffffff !important;
  border-color: #5c5c5c !important;
}

.pixel-button.accent,
.hud-button.primary,
.hud-button.selected,
.nav-button.active,
.hero-top-tab.active,
.scene-option-button.selected,
.entry-action.active,
.entry-scenario.active,
.scene-code-chip,
.scene-turn-badge.is-active {
  background: #1a1509 !important;
  color: #f2d98a !important;
  border-color: #d6bb6f !important;
}

input,
textarea {
  background: #0a0a0a !important;
  color: #ffffff !important;
  border-color: #5c5c5c !important;
}

.lobby-member-card.empty.add-bot-slot {
  background: #080808 !important;
  border-color: #d6bb6f !important;
}

/* active-button-gold-black */
.pixel-button.accent,
.hud-button.primary,
.hud-button.selected,
.nav-button.active,
.hero-top-tab.active,
.scene-option-button.selected,
.entry-action.active,
.entry-scenario.active,
.scene-turn-badge.is-active,
.entry-action:active,
.pixel-button:active,
.hud-button:active {
  background: #d6bb6f !important;
  border-color: #d6bb6f !important;
  color: #000000 !important;
  text-shadow: none !important;
}

/* combat-ui-reference-style */
.combat-hud {
  background:
    linear-gradient(180deg, rgba(28, 18, 10, 0.95), rgba(16, 10, 6, 0.97)),
    repeating-linear-gradient(90deg, rgba(255, 205, 120, 0.04) 0 2px, transparent 2px 8px) !important;
  border: 2px solid #6f5631 !important;
  box-shadow: inset 0 0 0 2px #2f2112, 0 10px 22px rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  padding: 10px;
}

.hud-titlebar {
  text-align: center;
  color: #f2d9a0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  border: 2px solid #6f5631;
  background: linear-gradient(180deg, #3c2817, #27190f);
  margin-bottom: 8px;
}

.turn-timer {
  border: 2px solid #6f5631 !important;
  background: #18110b !important;
}

.turn-timer-head {
  color: #f5e6c3 !important;
}

.turn-timer-bar {
  background: #0d0a08 !important;
  border: 1px solid #3d2d1d !important;
}

.turn-timer-fill {
  background: linear-gradient(90deg, #d24b30, #e0af53) !important;
}

.hud-log,
.hud-target-chip,
.hud-mobile-hint {
  border: 1px solid #5e4a32 !important;
  background: #130e0a !important;
  color: #f4e9ce !important;
}

.hud-main-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.hud-tactics-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin-top: 8px;
}

.hud-main-actions .hud-button {
  min-height: 88px;
}

.hud-tactics-actions .hud-button {
  min-height: 56px;
  opacity: 0.95;
}

.hud-button {
  border: 2px solid #7a5b34 !important;
  border-radius: 6px !important;
  background:
    linear-gradient(180deg, rgba(255, 222, 160, 0.06), transparent 35%),
    linear-gradient(180deg, #2c1d12, #1b120b) !important;
  color: #f5e2b3 !important;
  box-shadow: inset 0 0 0 1px #3c2a17;
}

.hud-button .hud-button-icon {
  width: 34px;
  height: 34px;
}

.hud-button.selected,
.hud-button.primary,
.hud-button:focus-visible {
  border-color: #d6bb6f !important;
  color: #fff1c6 !important;
  background:
    linear-gradient(180deg, rgba(246, 213, 128, 0.18), transparent 36%),
    linear-gradient(180deg, #322113, #20150d) !important;
}

.hud-items,
.hud-mobile-items,
.hud-targets {
  border: 1px solid #5b4730;
  background: #120d09;
  border-radius: 6px;
  padding: 8px;
}

@media (max-width: 768px) {
  .hud-titlebar {
    font-size: 21px;
    padding: 7px 8px;
  }

  .hud-main-actions .hud-button {
    min-height: 82px;
  }
}

/* main-screen-only-lock */
html,
body {
  height: 100vh !important;
  overflow: hidden !important;
}

body,
.app-shell,
.screen {
  overflow: hidden !important;
}

.app-shell {
  max-height: 100vh !important;
  padding: calc(8px + var(--safe-top)) 8px 8px !important;
}

.brand,
#refreshButton,
.hero-banner,
.control-panel,
.utility-card,
.chronicle-card,
.bottom-nav,
#inventoryOverlay {
  display: none !important;
}

.topbar {
  display: none !important;
}

.back-button {
  display: none !important;
}

.grid {
  display: block !important;
}

.scene-card {
  margin: 0 !important;
}

.scene-card .card-head {
  display: none !important;
}

.entry-grid {
  gap: 10px !important;
}

.pixel-button,
.entry-action,
.entry-scenario,
.scene-option-button,
.hud-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.entry-action span,
.pixel-button span,
.hud-button span {
  text-align: center !important;
}

/* main-screen-logo-tight + no-gray-frames */
.entry-shell {
  padding-top: 0 !important;
}

.entry-main-logo {
  margin-top: -10px !important;
  margin-bottom: 2px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.entry-main-logo-image {
  width: min(100%, 500px) !important;
}

.entry-shell.panel-screen,
.panel-screen.scene-shell.entry-shell,
.scene-card.pixel-card,
.scene-card .quote-frame,
.scene-card .panel-screen {
  border: none !important;
  box-shadow: none !important;
}

.start-adventure-screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  height: calc(100vh - 24px);
  padding: 4px 4px calc(var(--safe-bottom, 0px) + 10px) !important;
  overflow: hidden !important;
  align-content: start;
}

.start-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.start-meta-item {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #bcbcbc;
  border: 1px solid #3f3f3f;
  background: #0a0a0a;
  font-size: 12px;
}

.start-adventure-screen .entry-stack {
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  align-self: start;
  gap: 8px;
  margin-top: 0 !important;
  padding-right: 4px;
  padding-bottom: 18px;
  min-height: 0;
}

.start-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-self: end;
  margin-bottom: 0 !important;
}

.start-actions .pixel-button {
  min-height: 46px;
}

.start-adventure-screen .entry-scenario.active {
  background: #0a0a0a !important;
  color: #ffffff !important;
  border-color: #d6bb6f !important;
}

@media (max-width: 768px) {
  .start-adventure-screen .entry-stack {
    max-height: 100%;
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 18px) !important;
  }

  .start-actions {
    position: static;
    z-index: auto;
    margin-top: 0;
    margin-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 10px);
    padding-top: 0;
    background: transparent;
  }
}

/* compact lobby action row */
.lobby-actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px !important;
  margin-top: 6px;
}

.lobby-actions .pixel-button {
  min-height: 28px !important;
  padding: 4px 6px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  border-width: 1px !important;
  box-shadow: none !important;
  letter-spacing: 0.01em !important;
  text-transform: uppercase !important;
}

/* combat-heroes-compact */
.miniatures {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 4px !important;
  padding: 4px !important;
}

.miniatures .combatant {
  width: 100% !important;
  min-height: 28px;
  height: 28px;
  justify-items: stretch !important;
  border: 1px solid #3f3f3f;
  background: #090909;
  padding: 1px 3px;
  gap: 2px !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  align-content: start !important;
}

.miniatures .combatant.hero.hero-compact {
  min-height: 28px;
  height: 28px;
}

.combatant-row-rect {
  display: grid;
  grid-template-columns: 14px 1fr;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  height: 100%;
}

.combatant-avatar-square {
  width: 14px !important;
  height: 14px !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid #5d5d5d !important;
  box-shadow: none !important;
  align-self: start;
}

.combatant-avatar-square::before {
  display: none !important;
}

.combatant-main .combatant-name {
  text-align: left !important;
  font-size: 7px !important;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
}

.combatant-main {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 3px;
  align-items: end;
}

.combatant-main .hp-bar {
  margin-top: 0;
  height: 3px !important;
  border-width: 1px !important;
  width: 100% !important;
  min-width: 0;
}

/* combat-balance-pass */
.miniatures .combatant {
  min-height: 44px !important;
  height: 44px !important;
  padding: 2px 5px !important;
}

.miniatures .combatant.hero.hero-compact {
  min-height: 44px !important;
  height: 44px !important;
}

.combatant-row-rect {
  grid-template-columns: 24px 1fr !important;
  gap: 6px !important;
}

.combatant-avatar-square {
  width: 24px !important;
  height: 24px !important;
}

.combatant-main .combatant-name {
  font-size: 8px !important;
}

.combatant-main {
  grid-template-rows: 1fr 4px !important;
}

.combatant-main .hp-bar {
  height: 4px !important;
}

.combat-hud {
  padding: 6px !important;
}

.hud-titlebar {
  font-size: 18px !important;
  padding: 5px 8px !important;
  margin-bottom: 6px !important;
}

.turn-timer {
  padding: 4px 6px !important;
  margin-bottom: 6px !important;
}

.turn-timer-head {
  font-size: 10px !important;
}

.turn-timer-bar {
  height: 6px !important;
}

.hud-log,
.hud-target-chip,
.hud-mobile-hint {
  font-size: 10px !important;
  padding: 4px 6px !important;
}

.hud-actions {
  gap: 6px !important;
}

.hud-main-actions .hud-button {
  min-height: 56px !important;
}

.hud-tactics-actions .hud-button {
  min-height: 40px !important;
}

/* combat-lane-up */
.combat-layout {
  margin-top: 2px !important;
  gap: 6px !important;
}

.battlefield,
.battle-lane {
  gap: 4px !important;
}

.miniatures .combatant .hp-text,
.miniatures .combatant .combatant-hint,
.miniatures .combatant .status-strip {
  display: none !important;
}

/* combat-hud-tight-pass */
.turn-timer-inline {
  margin-top: 2px !important;
  margin-bottom: 4px !important;
}

.combat-hud {
  padding: 4px !important;
  gap: 4px !important;
}

.hud-titlebar {
  font-size: 15px !important;
  padding: 3px 6px !important;
  margin-bottom: 4px !important;
}

.hud-main-actions .hud-button {
  min-height: 46px !important;
}

.hud-tactics-actions .hud-button {
  min-height: 34px !important;
}

.hud-button {
  padding: 4px 6px !important;
  font-size: 11px !important;
}

.hud-button .hud-button-icon {
  width: 20px !important;
  height: 20px !important;
}

/* combat-top-alignment */
.combat-scene-content {
  margin: 0 !important;
  padding: 0 !important;
}

.combat-scene-content .summary-title {
  margin: 0 0 2px 0 !important;
  line-height: 1.15 !important;
}

.combat-scene-content .turn-timer-inline {
  margin-top: 0 !important;
  margin-bottom: 2px !important;
}

.combat-scene-content .combat-layout {
  margin-top: 0 !important;
  gap: 4px !important;
}

.combat-scene-content .battlefield,
.combat-scene-content .battle-lane {
  gap: 2px !important;
}

/* combat-vertical-tight-final */
.combat-scene-content .summary-title {
  margin: 0 0 1px 0 !important;
}

.turn-timer-inline {
  margin: 0 0 2px 0 !important;
}

.combat-layout {
  margin-top: 0 !important;
  gap: 2px !important;
}

.battlefield,
.battle-lane {
  gap: 1px !important;
}

.hud-titlebar {
  font-size: 13px !important;
  padding: 2px 5px !important;
  margin-bottom: 2px !important;
}

.hud-main-actions .hud-button {
  min-height: 40px !important;
}

.hud-tactics-actions .hud-button {
  min-height: 30px !important;
}

.hud-tactics-actions {
  grid-template-columns: 1fr !important;
}

/* global-lift-up-pass */
.app-shell {
  padding-top: calc((var(--safe-top) / 2) + 1px) !important;
}

.screen {
  padding-top: 0 !important;
}

.grid,
.scene-card,
.panel-screen.scene-shell,
.panel-screen.scene-shell.entry-shell,
.lobby-shell,
.combat-scene-content {
  margin-top: 0 !important;
}

.panel-screen.scene-shell,
.panel-screen.scene-shell.entry-shell {
  padding-top: 2px !important;
  gap: 6px !important;
}

.combat-scene-content .summary-title,
.combat-scene-content .turn-timer-inline,
.combat-layout,
.battlefield,
.battle-lane,
.turn-timer-inline {
  margin-top: 0 !important;
}

.battlefield {
  margin-top: -2px !important;
}

.battle-lane .lane-title {
  margin: 0 !important;
  line-height: 1 !important;
}

@media (max-width: 768px) {
  .app-shell {
    padding-top: 0 !important;
  }

  .panel-screen.scene-shell,
  .panel-screen.scene-shell.entry-shell {
    padding-top: 1px !important;
    gap: 4px !important;
  }

  .battlefield {
    margin-top: -3px !important;
  }
}

/* mobile viewport unclip fix */
@media (max-width: 768px) {
  html,
  body {
    height: auto !important;
    min-height: var(--app-vh, 100vh) !important;
    overflow-y: auto !important;
  }

  body,
  .app-shell,
  .screen {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .app-shell {
    max-height: none !important;
    min-height: var(--app-vh, 100vh) !important;
    padding-top: 0 !important;
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 20px) !important;
  }

  .screen {
    min-height: 0 !important;
  }
}

/* combat single-screen mobile fit */
@media (max-width: 768px) {
  body.combat-mode,
  body.combat-mode .app-shell,
  body.combat-mode .screen {
    overflow: hidden !important;
  }

  body.combat-mode .app-shell {
    min-height: var(--app-vh, 100vh) !important;
    max-height: var(--app-vh, 100vh) !important;
    padding-top: 0 !important;
    padding-bottom: calc(58px + var(--safe-bottom)) !important;
  }

  body.combat-mode .topbar {
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  body.combat-mode .topbar-stat {
    min-width: 0 !important;
  }

  body.combat-mode .topbar-label {
    font-size: 9px !important;
  }

  body.combat-mode .topbar-value {
    font-size: 10px !important;
    line-height: 1.05 !important;
  }

  body.combat-mode .combat-scene-content {
    gap: 2px !important;
  }

  body.combat-mode .combat-scene-content .summary-title {
    font-size: 10px !important;
    line-height: 1.05 !important;
  }

  body.combat-mode .lane-title {
    font-size: 9px !important;
    padding: 0 !important;
  }

  body.combat-mode .miniatures {
    gap: 3px !important;
    padding: 3px !important;
    justify-content: start !important;
  }

  body.combat-mode .miniatures .combatant {
    min-height: 28px !important;
    height: 28px !important;
    padding: 2px 3px !important;
    width: min(100%, 170px) !important;
    justify-self: start !important;
  }

  body.combat-mode .combatant-row-rect {
    grid-template-columns: 20px 1fr !important;
    gap: 4px !important;
    align-items: center !important;
  }

  body.combat-mode .combatant-avatar-square {
    width: 20px !important;
    height: 20px !important;
  }

  body.combat-mode .combatant-main {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 1px !important;
    min-width: 0 !important;
  }

  body.combat-mode .combatant-main .combatant-name {
    font-size: 8px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.combat-mode .combatant-main .combatant-hptext {
    font-size: 7px !important;
    line-height: 1 !important;
  }

  body.combat-mode .combatant-main .hp-bar {
    display: none !important;
  }

  body.combat-mode .combat-text-hud {
    gap: 0 !important;
    margin-top: 4px !important;
  }

  body.combat-mode .combat-hud {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    margin: 4px 0 0 !important;
    padding: 0 !important;
    z-index: 1 !important;
  }

  body.combat-mode .combat-text-header,
  body.combat-mode .combat-text-section {
    padding: 5px 7px !important;
  }

  body.combat-mode .combat-text-headline {
    font-size: 10px !important;
    line-height: 1.1 !important;
  }

  body.combat-mode .combat-text-label {
    font-size: 10px !important;
    margin-bottom: 1px !important;
  }

  body.combat-mode .combat-text-actions {
    gap: 4px !important;
  }

  body.combat-mode .combat-text-action {
    min-height: 27px !important;
    padding: 4px 6px !important;
    font-size: 9px !important;
  }

  body.combat-mode .combat-text-inline,
  body.combat-mode .combat-text-empty,
  body.combat-mode .combat-text-line,
  body.combat-mode .combat-text-log-line {
    min-height: 20px !important;
    padding: 4px 6px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
  }

  body.combat-mode .combat-text-log {
    gap: 3px !important;
    max-height: 240px !important;
    overflow-y: auto !important;
  }

  body.combat-mode .combat-text-log-line {
    max-height: none !important;
    overflow: visible !important;
    min-height: 34px !important;
    white-space: pre-wrap !important;
  }

  body.combat-mode .combat-text-items-sheet {
    display: none !important;
  }

  body.combat-mode #combatHud.items-open .combat-text-items-sheet {
    display: grid !important;
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: calc(var(--safe-bottom) + 8px) !important;
    z-index: 9000 !important;
    max-height: 42vh !important;
    overflow: auto !important;
    border: 1px solid #8f6b32 !important;
    background: #0b0b0b !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55) !important;
  }

  body.combat-mode #combatHud.items-open::before {
    content: "" !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.45) !important;
    z-index: 8999 !important;
  }

  body.combat-mode .combat-text-sheet-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  body.combat-mode .combat-text-close {
    min-height: 24px !important;
    padding: 0 8px !important;
    border: 1px solid #4a4a4a !important;
    background: #101010 !important;
    color: #f0f0f0 !important;
    font-family: "Courier New", monospace !important;
    font-size: 9px !important;
    font-weight: 700 !important;
  }

  .screen,
  .panel-screen.scene-shell,
  .panel-screen.scene-shell.entry-shell,
  .combat-scene-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .global-topbar {
    margin-top: 0 !important;
  }

  .bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    position: fixed !important;
    width: min(100vw, 760px) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: 0 !important;
    z-index: 1600 !important;
    padding: 4px 6px calc(4px + var(--safe-bottom)) !important;
    gap: 4px !important;
    border-top: 1px solid #2f2f2f !important;
    background: rgba(8, 8, 8, 0.96) !important;
    box-shadow: none !important;
    pointer-events: auto !important;
  }

  .bottom-nav .pixel-button,
  .bottom-nav .bottom-nav-button,
  .bottom-nav button {
    min-height: 36px !important;
    padding: 4px 8px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    box-shadow: none !important;
    pointer-events: auto !important;
  }

  .bottom-nav .nav-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: linear-gradient(180deg, rgba(214, 187, 111, 0.08), transparent 26%), #0c0c0c !important;
    border: 1px solid #5e512d !important;
    color: #e8dcc0 !important;
  }

  .bottom-nav .nav-button.active {
    background: linear-gradient(180deg, #d9c071, #c8aa59) !important;
    border-color: #d6bb6f !important;
    color: #1c1508 !important;
  }

  .bottom-nav .nav-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .bottom-nav .nav-label {
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  #utilityBackdrop.utility-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.58) !important;
    z-index: 1500 !important;
  }

  .app-shell .utility-card {
    display: none !important;
  }

  .app-shell.utility-drawer-open .utility-card {
    display: grid !important;
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: calc(50px + var(--safe-bottom)) !important;
    width: min(calc(100vw - 16px), 760px) !important;
    max-height: calc(var(--app-vh, 100vh) - 110px) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    overflow: hidden !important;
    z-index: 1601 !important;
    border: 1px solid #4b4b4b !important;
    background: #050505 !important;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55) !important;
  }

  .app-shell.utility-drawer-open .utility-card .card-head {
    margin: 0 !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid #343434 !important;
    background: linear-gradient(180deg, rgba(214, 187, 111, 0.08), transparent 45%), #0b0b0b !important;
  }

  .app-shell.utility-drawer-open .card-tag {
    padding: 4px 8px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    color: #e0c57a !important;
    background: #101010 !important;
    border: 1px solid #4b4b4b !important;
  }

  .app-shell.utility-drawer-open .tiny-chip {
    padding: 4px 8px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    background: #111 !important;
    border: 1px solid #4b4b4b !important;
    color: #d7d7d7 !important;
  }

  .app-shell.utility-drawer-open .utility-head-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .app-shell.utility-drawer-open .utility-close-button {
    min-height: 30px !important;
    padding: 0 12px !important;
    border: 1px solid #5a5a5a !important;
    background: #101010 !important;
    color: #f3f3f3 !important;
    box-shadow: none !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  .app-shell.utility-drawer-open #utilityContent {
    min-height: 0 !important;
    overflow: auto !important;
    padding: 8px !important;
  }

  .app-shell.utility-drawer-open .utility-screen,
  .app-shell.utility-drawer-open .inventory-screen,
  .app-shell.utility-drawer-open .hero-sheet {
    min-height: 0 !important;
  }

  .app-shell.utility-drawer-open .hero-sheet {
    gap: 10px !important;
  }

  .app-shell.utility-drawer-open .hero-top-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .app-shell.utility-drawer-open .hero-top-tab {
    min-height: 40px !important;
    padding: 6px 8px !important;
    border: 1px solid #4b4b4b !important;
    background: #111 !important;
    color: #d0d0d0 !important;
    box-shadow: none !important;
  }

  .app-shell.utility-drawer-open .hero-top-tab.active {
    background: linear-gradient(180deg, #d8be72, #c9ab5f) !important;
    color: #16120a !important;
    border-color: #d8be72 !important;
    animation: none !important;
    box-shadow: none !important;
  }

  .app-shell.utility-drawer-open .sheet-header {
    padding: 0 0 6px !important;
    margin: 0 !important;
    border-bottom: 1px solid #2f2f2f !important;
    font-size: 13px !important;
    letter-spacing: 0.04em !important;
  }

  .app-shell.utility-drawer-open .pixel-separator {
    height: 1px !important;
    border: 0 !important;
    background: #262626 !important;
  }

  .app-shell.utility-drawer-open .equipment-panel {
    gap: 8px !important;
  }

  .app-shell.utility-drawer-open .equipment-column {
    gap: 8px !important;
  }

  .app-shell.utility-drawer-open .equip-slot {
    min-height: 74px !important;
    padding: 8px 6px !important;
    border-radius: 0 !important;
    border: 1px solid #7e6a37 !important;
    background: #111 !important;
    box-shadow: inset 0 0 0 1px rgba(214, 187, 111, 0.12) !important;
  }

  .app-shell.utility-drawer-open .equip-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .app-shell.utility-drawer-open .equip-label {
    font-size: 8px !important;
  }

  .app-shell.utility-drawer-open .equip-name {
    font-size: 9px !important;
    line-height: 1.15 !important;
  }

  .app-shell.utility-drawer-open .hero-doll {
    gap: 6px !important;
  }

  .app-shell.utility-drawer-open .hero-doll-name {
    font-size: 11px !important;
    color: #e0c57a !important;
  }

  .app-shell.utility-drawer-open .hero-doll-frame {
    min-height: 124px !important;
  }

  .app-shell.utility-drawer-open .hero-portrait {
    width: 82px !important;
    height: 108px !important;
  }

  .app-shell.utility-drawer-open .hero-doll-sub {
    font-size: 8px !important;
  }

  .app-shell.utility-drawer-open .inventory-block,
  .app-shell.utility-drawer-open .hero-skill-card,
  .app-shell.utility-drawer-open .stat-meter-card,
  .app-shell.utility-drawer-open .hero-stat-tile {
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

/* dice-overlay-front-and-higher */
.dice-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 120 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-top: 0 !important;
  background: transparent !important;
  pointer-events: none !important;
}

.combat-dice {
  transform: none;
}

@media (max-width: 768px) {
  .dice-overlay {
    padding-top: 0 !important;
  }

  .combat-dice {
    transform: none;
  }
}

/* mobile scrollbar hide */
@media (max-width: 768px) {
  html,
  body,
  .app-shell,
  .screen,
  #utilityContent,
  .party-chat-overlay-feed,
  .inventory-overlay-list {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  .app-shell::-webkit-scrollbar,
  .screen::-webkit-scrollbar,
  #utilityContent::-webkit-scrollbar,
  .party-chat-overlay-feed::-webkit-scrollbar,
  .inventory-overlay-list::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
    background: transparent !important;
  }
}

/* entry home click-safe */
.app-shell.entry-mode:not(.utility-drawer-open) .utility-card,
.app-shell.entry-mode .chronicle-card,
.app-shell.entry-mode:not(.utility-drawer-open) #utilityBackdrop,
.app-shell.entry-mode #inventoryOverlay {
  display: none !important;
  pointer-events: none !important;
}

.app-shell.entry-mode:not(.utility-drawer-open) .entry-action,
.app-shell.entry-mode:not(.utility-drawer-open) .entry-scenario,
.app-shell.entry-mode:not(.utility-drawer-open) [data-entry-action],
.app-shell.entry-mode:not(.utility-drawer-open) [data-start-scenario-pick],
.app-shell.entry-mode:not(.utility-drawer-open) [data-start-create],
.app-shell.entry-mode:not(.utility-drawer-open) [data-start-back] {
  position: relative !important;
  z-index: 1701 !important;
  pointer-events: auto !important;
}

/* combat-mobile-priority-fix */
@media (max-width: 768px) {
  .scene-card {
    margin-top: -8px !important;
  }

  .quote-frame {
    padding-top: 4px !important;
  }

  .combat-scene-content {
    margin-top: -14px !important;
  }

  .combat-scene-content .summary-title {
    margin-top: 0 !important;
    margin-bottom: 2px !important;
  }

  .turn-timer-inline {
    margin-bottom: 3px !important;
  }

  .combat-layout {
    gap: 1px !important;
  }

  .battlefield {
    gap: 1px !important;
    margin-top: -2px !important;
  }

  .battle-lane {
    gap: 1px !important;
  }

  .combat-hud {
    margin-top: 4px !important;
    padding-top: 4px !important;
    z-index: 30 !important;
  }

  .hud-target-chip {
    order: 1 !important;
    margin-bottom: 2px !important;
  }

  .hud-main-actions {
    order: 2 !important;
  }

  .hud-tactics-actions {
    order: 3 !important;
  }

  .hud-mobile-hint {
    order: 4 !important;
  }

  .hud-banner,
  .hud-targets,
  .hud-items,
  .hud-mobile-items {
    order: 5 !important;
  }

  .hud-log {
    order: 9 !important;
    max-height: 86px !important;
    overflow-y: auto !important;
    padding: 6px 8px !important;
    line-height: 1.35 !important;
    margin-top: 2px !important;
  }

  .hud-main-actions .hud-button {
    min-height: 36px !important;
  }

  .hud-tactics-actions .hud-button {
    min-height: 28px !important;
  }

  .hud-button {
    font-size: 10px !important;
    padding: 4px 6px !important;
  }

  .combat-dice {
    transform: none;
  }
}

/* story-screen-black-gold + quote-narration */
.story-scene-shell {
  background: #050505 !important;
  border-color: #3f3f3f !important;
  gap: 2px !important;
}

.story-scene-shell .scene-title-row,
.story-scene-shell .scene-options-block,
.story-scene-shell .story-turn-timer,
.story-scene-shell .scene-story-result,
.story-scene-shell .scene-option-button {
  background: #0a0a0a !important;
  border-color: #3f3f3f !important;
  box-shadow: none !important;
}

.story-scene-shell .scene-gm-line,
.story-scene-shell .scene-turn-line,
.story-scene-shell .scene-option-copy,
.story-scene-shell .scene-story-result-copy {
  color: #d3d3d3 !important;
}

.story-scene-shell .scene-option-title,
.story-scene-shell .scene-story-result-title,
.story-scene-shell .scene-headline,
.story-scene-shell .summary-title {
  color: #f2d98a !important;
}

.scene-copy-quote {
  position: relative;
  padding: 12px 14px 12px 18px !important;
  border: 1px solid #5a5a5a !important;
  border-left: 3px solid #d6bb6f !important;
  background: linear-gradient(180deg, #0a0a0a, #070707) !important;
  color: #f0f0f0 !important;
  font-size: 12px !important;
  font-style: italic;
  line-height: 1.55 !important;
}

.scene-copy-quote::before,
.scene-copy-quote::after {
  color: #d6bb6f;
  font-size: 20px;
  line-height: 1;
  position: absolute;
}

.scene-copy-quote::before {
  content: "\201C";
  left: 6px;
  top: 5px;
}

.scene-copy-quote::after {
  content: "\201D";
  right: 8px;
  bottom: 4px;
}

@media (max-width: 768px) {
  .scene-copy-quote {
    padding: 10px 12px 10px 16px !important;
    font-size: 11px !important;
  }

  .scene-copy-quote::before,
  .scene-copy-quote::after {
    font-size: 17px;
  }
}

/* story-active-player-avatar */
.scene-turn-avatar {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 18px;
  border: 1px solid #d6bb6f;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  vertical-align: middle;
  margin-right: 6px;
}

/* lobby class picker */
.lobby-member-card.is-self {
  cursor: pointer;
  border-color: #d6bb6f !important;
}

.lobby-class-picker {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #4a4a4a;
  background: #0a0a0a;
}

.lobby-class-picker-title {
  color: #f2d98a;
  font-size: 11px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.lobby-class-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.lobby-class-picker-grid .pixel-button {
  min-height: 32px !important;
  font-size: 10px !important;
  padding: 6px 8px !important;
}

@media (max-width: 768px) {
  .scene-turn-avatar {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
    margin-right: 5px;
  }

  .lobby-class-picker-grid {
    grid-template-columns: 1fr;
  }
}

/* lobby self-slot button reset + turn line avatar layout */
button.lobby-member-card {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  text-align: center;
  width: 100%;
}

.scene-turn-line {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* compact-icons-pass */
.lobby-members-grid {
  gap: 6px !important;
}

.lobby-member-card {
  min-height: 108px !important;
  padding: 5px 5px !important;
  gap: 2px !important;
}

.lobby-member-avatar {
  width: 40px !important;
  height: 52px !important;
}

.lobby-member-name {
  font-size: 9px !important;
}

.lobby-member-role,
.lobby-member-state {
  font-size: 7px !important;
}

.scene-turn-avatar {
  width: 14px !important;
  height: 14px !important;
  flex: 0 0 14px !important;
  margin-right: 4px !important;
}

@media (max-width: 768px) {
  .lobby-member-card {
    min-height: 96px !important;
    padding: 4px !important;
  }

  .lobby-member-avatar {
    width: 34px !important;
    height: 44px !important;
  }

  .scene-turn-avatar {
    width: 12px !important;
    height: 12px !important;
    flex-basis: 12px !important;
    margin-right: 3px !important;
  }
}

.scene-title-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.difficulty-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d6bb6f !important;
  border-color: rgba(214, 187, 111, 0.48) !important;
}

.difficulty-chip-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  image-rendering: pixelated;
  object-fit: contain;
}

.entry-scenario.locked {
  opacity: 0.96;
}

.entry-start-root {
  position: relative;
}

.difficulty-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top, 0px) + 8px) 12px calc(var(--mobile-nav-height) + var(--safe-bottom) + 8px);
  z-index: 9800;
  overflow: hidden;
}

.difficulty-overlay-card {
  width: min(calc(100vw - 28px), 320px);
  max-width: 100%;
  max-height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height) - var(--safe-bottom) - var(--safe-top) - 24px);
  border: 1px solid rgba(214, 187, 111, 0.55);
  background:
    linear-gradient(180deg, rgba(214, 187, 111, 0.12), rgba(214, 187, 111, 0.02) 18%, transparent 32%),
    #050505;
  box-shadow: 0 0 0 1px rgba(214, 187, 111, 0.10), 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 8px;
  display: grid;
  gap: 6px;
  margin: 0 auto;
  overflow: hidden;
}

.difficulty-overlay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.difficulty-overlay-grid .pixel-button {
  min-height: 44px !important;
  padding: 6px 8px !important;
  font-size: 9px !important;
  line-height: 1.05 !important;
  border-width: 1px !important;
  box-shadow: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  text-align: center !important;
}

.difficulty-option-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.difficulty-option-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  image-rendering: pixelated;
  object-fit: contain;
}

.difficulty-option-label {
  display: inline-block;
  line-height: 1.05;
}

.chat-recruitment-meta {
  display: grid;
  gap: 4px;
  margin: 4px 0 6px;
}

.chat-recruitment-scenario {
  color: #f0d57d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.chat-recruitment-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d7d7d7;
  font-size: 10px;
  text-transform: uppercase;
}

.chat-recruitment-difficulty-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  image-rendering: pixelated;
  object-fit: contain;
}

.difficulty-overlay-copy {
  color: #a8a8a8;
  font-size: 9px;
  line-height: 1.25;
  padding: 6px 7px;
  border: 1px solid rgba(75, 75, 75, 0.85);
  background: rgba(10, 10, 10, 0.92);
  overflow-wrap: anywhere;
}

.difficulty-overlay-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.difficulty-overlay-actions .pixel-button {
  min-height: 30px !important;
  font-size: 9px !important;
  border-width: 1px !important;
  box-shadow: none !important;
  padding: 5px 8px !important;
}

.difficulty-overlay-card .sheet-header {
  margin: 0;
  padding: 1px 1px 6px;
  border-bottom: 1px solid rgba(214, 187, 111, 0.22);
  color: #f0d57d;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
}

.difficulty-overlay-grid .pixel-button:not(.accent) {
  background: #090909 !important;
  border-color: #4b4b4b !important;
  color: #f3f3f3 !important;
}

.difficulty-overlay-grid .pixel-button.accent {
  background: linear-gradient(180deg, #dcc574, #cfb15f) !important;
  border-color: #d6bb6f !important;
  color: #171208 !important;
}

@media (max-width: 768px) {
  .app-shell.entry-mode {
    height: var(--app-vh, 100vh) !important;
    max-height: var(--app-vh, 100vh) !important;
    overflow: hidden !important;
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 8px) !important;
  }

  .app-shell.entry-mode .screen,
  .app-shell.entry-mode .panel-screen.scene-shell.entry-shell,
  .app-shell.entry-mode .start-adventure-screen,
  .app-shell.entry-mode .entry-shell {
    overflow: hidden !important;
  }

  .app-shell.entry-mode .start-adventure-screen {
    height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height) - var(--safe-bottom) - 8px) !important;
  }

  .difficulty-overlay-backdrop {
    align-items: center;
    justify-content: center;
    padding: calc(var(--safe-top, 0px) + 6px) 8px calc(var(--mobile-nav-height) + var(--safe-bottom, 0px) + 6px);
  }

  .difficulty-overlay-card {
    width: min(calc(100vw - 16px), 300px);
    max-height: calc(var(--app-vh, 100vh) - var(--mobile-nav-height) - var(--safe-bottom) - var(--safe-top) - 16px);
    padding: 7px;
    gap: 4px;
  }

  .difficulty-overlay-grid .pixel-button {
    min-height: 40px !important;
    font-size: 8px !important;
  }

  .difficulty-option-content {
    gap: 6px;
  }

  .difficulty-option-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .difficulty-overlay-actions .pixel-button {
    min-height: 28px !important;
    font-size: 8px !important;
  }

  .difficulty-overlay-copy {
    font-size: 8px;
    line-height: 1.2;
  }

  .difficulty-overlay-card .sheet-header {
    font-size: 10px;
  }
}

.app-shell.entry-mode.difficulty-modal-open .entry-scenario,
.app-shell.entry-mode.difficulty-modal-open .entry-action,
.app-shell.entry-mode.difficulty-modal-open [data-entry-action],
.app-shell.entry-mode.difficulty-modal-open [data-start-scenario-pick],
.app-shell.entry-mode.difficulty-modal-open [data-start-create],
.app-shell.entry-mode.difficulty-modal-open [data-start-back],
.app-shell.entry-mode.difficulty-modal-open .start-actions {
  z-index: auto !important;
  pointer-events: none !important;
}

.app-shell.entry-mode.difficulty-modal-open .start-actions {
  opacity: 0.08;
}

.app-shell.entry-mode.language-modal-open .entry-action,
.app-shell.entry-mode.language-modal-open [data-entry-action],
.app-shell.entry-mode.language-modal-open [data-entry-language-open] {
  z-index: auto !important;
  pointer-events: none !important;
}

.app-shell.entry-mode.language-modal-open .entry-grid,
.app-shell.entry-mode.language-modal-open .scene-title-row,
.app-shell.entry-mode.language-modal-open .entry-main-logo {
  opacity: 0.16;
}

/* class-picker-grid-fix */
.lobby-class-picker {
  max-height: 170px;
  overflow-y: auto;
}

.lobby-class-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.lobby-class-picker-grid .pixel-button {
  min-height: 28px !important;
  font-size: 9px !important;
  padding: 4px 6px !important;
  line-height: 1.1 !important;
}

@media (max-width: 768px) {
  .lobby-class-picker {
    max-height: 152px;
    padding: 6px;
  }

  .lobby-class-picker-title {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .lobby-class-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }

.lobby-class-picker-grid .pixel-button {
  min-height: 24px !important;
  font-size: 8px !important;
  padding: 3px 5px !important;
  }
}

/* dice-overlay-visibility-fix */
.dice-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
}

/* class-picker-tight-rows + lobby-actions-up */
.lobby-actions {
  margin-top: 4px !important;
  margin-bottom: 4px !important;
}

.lobby-class-picker {
  margin-top: 2px !important;
  padding: 6px !important;
  max-height: 132px !important;
  overflow-y: auto !important;
}

.lobby-class-picker-title {
  margin: 0 0 4px 0 !important;
  font-size: 10px !important;
  line-height: 1.1 !important;
}

.lobby-class-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 4px !important;
  align-content: start !important;
}

.lobby-class-picker-grid .pixel-button {
  min-height: 22px !important;
  padding: 3px 4px !important;
  font-size: 8px !important;
  line-height: 1.05 !important;
}

@media (max-width: 768px) {
  .lobby-class-picker {
    max-height: 118px !important;
    padding: 5px !important;
  }

  .lobby-class-picker-title {
    margin-bottom: 3px !important;
    font-size: 9px !important;
  }

  .lobby-class-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 3px !important;
  }

  .lobby-class-picker-grid .pixel-button {
    min-height: 20px !important;
    padding: 2px 4px !important;
    font-size: 7px !important;
  }
}

/* class-picker-modal-fix */
.lobby-shell {
  position: relative;
}

.lobby-class-picker {
  position: fixed !important;
  left: 10px !important;
  right: 10px !important;
  bottom: calc(var(--safe-bottom) + 14px) !important;
  z-index: 120 !important;
  margin: 0 !important;
  padding: 8px !important;
  max-height: min(44vh, 280px) !important;
  overflow-y: auto !important;
  border: 1px solid #666 !important;
  background: #060606 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65);
}

.lobby-class-picker-title {
  position: sticky;
  top: 0;
  background: #060606;
  padding-bottom: 6px;
  z-index: 1;
}

.lobby-class-picker-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
}

.lobby-class-picker-grid .pixel-button {
  min-height: 28px !important;
  font-size: 9px !important;
  padding: 4px 6px !important;
}

@media (max-width: 768px) {
  .lobby-class-picker {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(var(--safe-bottom) + 10px) !important;
    max-height: min(42vh, 240px) !important;
    padding: 7px !important;
  }

  .lobby-class-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px !important;
  }

  .lobby-class-picker-grid .pixel-button {
    min-height: 24px !important;
    font-size: 8px !important;
    padding: 3px 5px !important;
  }
}

/* class-picker-center-tight-pass */
.lobby-class-picker {
  padding: 4px 6px !important;
  max-height: min(36vh, 220px) !important;
}

.lobby-class-picker-title {
  text-align: center !important;
  justify-content: center !important;
  margin: 0 0 4px 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.lobby-class-picker-grid {
  margin: 0 !important;
}

.lobby-class-picker-grid .pixel-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 4px !important;
  padding: 2px 4px !important;
}

@media (max-width: 768px) {
  .lobby-class-picker {
    padding: 3px 5px !important;
    max-height: min(34vh, 190px) !important;
  }

  .lobby-class-picker-title {
    margin-bottom: 3px !important;
  }

  .lobby-class-picker-grid .pixel-button {
    padding: 2px 3px !important;
  }
}

/* class-picker-4-in-row */
.lobby-class-picker-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 3px !important;
}

.lobby-class-picker-grid .pixel-button {
  min-height: 20px !important;
  font-size: 7px !important;
  line-height: 1 !important;
  padding: 2px 3px !important;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .lobby-class-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 2px !important;
  }

  .lobby-class-picker-grid .pixel-button {
    min-height: 18px !important;
    font-size: 6px !important;
    padding: 1px 2px !important;
  }
}

/* lobby-kickable-slot */
.lobby-member-card.is-kickable {
  cursor: pointer;
}

.lobby-member-card.is-kickable:hover {
  border-color: #d39a9a !important;
}

/* combat-mobile-lift-hard */
@media (max-width: 768px) {
  .combat-scene-content {
    display: grid !important;
    gap: 2px !important;
    margin-top: -16px !important;
    padding-top: 0 !important;
  }

  .combat-scene-content .summary-title {
    margin: 0 0 1px 0 !important;
    line-height: 1.05 !important;
  }

  .turn-timer-inline {
    margin: 0 0 2px 0 !important;
    padding: 4px 6px !important;
  }

  .combat-layout {
    margin: 0 !important;
    padding: 0 !important;
    gap: 2px !important;
  }

  .battlefield {
    margin: 0 !important;
    padding: 0 !important;
    gap: 2px !important;
    max-height: 38vh !important;
    overflow-y: auto !important;
  }

  .battle-lane {
    margin: 0 !important;
    gap: 1px !important;
  }

  .lane-title {
    margin: 0 !important;
    font-size: 8px !important;
    line-height: 1 !important;
    padding: 0 !important;
  }

  .miniatures {
    margin: 0 !important;
    padding: 3px !important;
  }

  .combat-hud {
    margin-top: 3px !important;
  }
}

/* combat-mobile-lift-balance */
@media (max-width: 768px) {
  .combat-scene-content {
    margin-top: -4px !important;
    gap: 4px !important;
  }

  .combat-scene-content .summary-title {
    margin: 0 0 3px 0 !important;
    line-height: 1.1 !important;
  }

  .turn-timer-inline {
    margin: 0 0 4px 0 !important;
    padding: 5px 7px !important;
  }

  .battlefield {
    max-height: 44vh !important;
    gap: 3px !important;
  }

  .battle-lane {
    gap: 2px !important;
  }

  .miniatures {
    padding: 4px !important;
  }

  .combat-hud {
    margin-top: 8px !important;
  }
}

/* scenario-finish-emoji-icons */
.scene-emoji-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  filter: saturate(1.1);
}

.scene-ending-emoji {
  font-size: 18px;
}

.scene-ending-banner .scene-emoji-icon {
  margin-right: 6px;
}

@media (max-width: 768px) {
  .scene-emoji-icon {
    width: 16px;
    min-width: 16px;
    height: 16px;
    font-size: 14px;
  }

  .scene-ending-emoji {
    font-size: 16px;
  }
}

/* story-screen-refine-request */
.scene-prev-summary {
  margin: 7px 0 9px;
  padding: 0;
  border: 0;
  background: transparent;
}

.scene-prev-summary-quote {
  padding: 12px 14px 12px 18px !important;
  border: 1px solid #4e535a !important;
  border-left: 3px solid #858b94 !important;
  background: linear-gradient(180deg, #0a0a0a, #070707) !important;
  color: #dde1e6;
  line-height: 1.55 !important;
  font-style: italic;
}

.scene-prev-summary-quote::after {
  right: 8px;
  bottom: 4px;
  color: #858b94 !important;
}

.scene-prev-summary-quote::before {
  color: #858b94 !important;
}

.scene-gm-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
}

.scene-gm-target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #f2f2f2;
}

.scene-gm-avatar {
  width: 18px;
  height: 18px;
  border: 1px solid #7b7150;
  background-color: #0d0d0d;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  flex: 0 0 18px;
}

.story-turn-timer {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #5a4c2b;
  background: #0d0a07;
  border-radius: 10px;
}

.story-turn-header {
  margin-bottom: 6px;
}

.story-turn-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid #7e6938;
  border-radius: 999px;
  background: #111111;
  color: #e9cf88;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.story-turn-label {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.story-turn-timer-bar {
  height: 8px;
  border: 1px solid #363636;
  border-radius: 999px;
  overflow: hidden;
  background: #050505;
}

.story-turn-timer-fill {
  background: linear-gradient(90deg, #c3a053 0%, #f2d58e 100%);
}

.scene-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.scene-option-button {
  text-align: left;
  border: 1px solid #51452a;
  border-radius: 0;
  background: #0f0f0f;
  padding: 8px 9px;
  box-shadow: inset 0 0 0 1px #252525;
}

.scene-option-button.active {
  border-color: #92763a;
}

.scene-option-button.selected {
  border-color: #c09a4f;
  box-shadow: inset 0 0 0 1px #5e4c26;
}

.scene-option-title {
  display: block;
  color: #e4c57c;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
}

.scene-option-copy {
  display: block;
  margin-top: 3px;
  color: #cfcfcf;
  font-size: 13px;
  line-height: 1.3;
}

.scene-option-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scene-option-title-main {
  min-width: 0;
  flex: 1 1 auto;
}

.scene-option-check {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex: 0 0 auto;
  color: #e4c57c;
  font-size: 12px;
  white-space: nowrap;
  margin-top: 3px;
}

.scene-option-check-dice {
  filter: grayscale(0.05);
}

@media (max-width: 768px) {
  .scene-prev-summary {
    margin: 5px 0 7px;
    padding: 0;
  }

  .scene-prev-summary-quote {
    padding: 10px 12px 10px 16px !important;
    font-size: 11px !important;
  }

  .scene-gm-line {
    margin-bottom: 7px;
    font-size: 16px;
  }

  .scene-gm-avatar {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .story-turn-timer {
    padding: 7px 9px;
    margin-bottom: 7px;
  }

  .story-turn-status {
    min-height: 22px;
    font-size: 10px;
  }

  .story-turn-label {
    font-size: 14px;
  }

  .scene-option-button {
    padding: 7px 8px;
  }

  .scene-option-title {
    font-size: 13px;
    gap: 8px;
  }

  .scene-option-copy {
    font-size: 12px;
  }

  .scene-option-check {
    font-size: 11px;
    gap: 3px;
  }
}

/* story-tight-gap-between-prev-and-current-quote */
.story-scene-shell .scene-prev-summary {
  margin: 0 !important;
}

.story-scene-shell .scene-prev-summary-quote {
  margin: 0 !important;
}

.story-scene-shell .scene-copy.scene-copy-quote {
  margin: 0 !important;
  padding-top: 8px !important;
}

@media (max-width: 768px) {
  .story-scene-shell {
    gap: 1px !important;
  }

  .story-scene-shell .scene-prev-summary {
    margin: 0 !important;
  }

  .story-scene-shell .scene-copy.scene-copy-quote {
    padding-top: 7px !important;
  }
}

/* story-mobile-gap-and-gm-size-hard-fix */
.story-scene-shell {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
}

.story-scene-shell .scene-prev-summary {
  margin: 0 !important;
  padding: 0 !important;
}

.story-scene-shell .scene-prev-summary + .scene-copy.scene-copy-quote {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.story-scene-shell .scene-gm-line {
  font-size: 13px !important;
  line-height: 1.2 !important;
  margin-top: 2px !important;
  margin-bottom: 6px !important;
}

.story-scene-shell .scene-gm-target {
  font-size: 13px !important;
}

.story-scene-shell .scene-headline {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.06 !important;
}

.story-scene-shell .scene-headline + * {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.scene-merged-quote .scene-merged-label {
  color: #aab2bc;
  font-style: normal;
  font-weight: 700;
}

.scene-story-stack {
  display: grid;
  gap: 4px;
}

.loot-popup-open {
  margin-top: 6px;
  min-height: 28px !important;
  border-color: #5c5c5c !important;
  color: #d6d6d6 !important;
  background: #0e0e0e !important;
}

.loot-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.66);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.loot-popup-overlay.is-open {
  display: flex;
}

.loot-popup-card {
  width: min(560px, 100%);
  max-height: 80vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid #585858;
  background: #070707;
}

.loot-popup-title {
  color: #f0f0f0;
  font-weight: 700;
  margin-bottom: 8px;
}

.loot-popup-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.loot-popup-item {
  border: 1px solid #3f3f3f;
  padding: 8px;
  color: #d2d2d2;
  line-height: 1.35;
  background: #0e0e0e;
}

@media (max-width: 768px) {
  .scene-story-stack {
    gap: 3px;
  }

  .loot-popup-open {
    min-height: 24px !important;
    font-size: 10px !important;
    margin-top: 4px;
  }
}

.story-scene-shell .scene-story-stack {
  display: grid !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.story-scene-shell .scene-story-stack .scene-prev-summary {
  margin: 0 !important;
  padding: 0 !important;
}

.story-scene-shell .scene-story-stack .scene-copy.scene-copy-quote {
  margin: 0 !important;
  padding-top: 0 !important;
}

.story-scene-shell .scene-headline + .scene-prev-summary {
  margin-top: -6px !important;
}

.story-scene-shell .scene-prev-summary + .scene-copy.scene-copy-quote {
  margin-top: -10px !important;
  padding-top: 0 !important;
}

@media (max-width: 768px) {
  .story-scene-shell .scene-prev-summary + .scene-copy.scene-copy-quote {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .story-scene-shell .scene-gm-line {
    font-size: 10px !important;
    line-height: 1.18 !important;
    margin-bottom: 3px !important;
  }

  .story-scene-shell .scene-gm-target {
    font-size: 10px !important;
  }

  .story-scene-shell .scene-headline + * {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .story-scene-shell .scene-story-stack {
    gap: 0 !important;
  }

  .story-scene-shell .scene-headline + .scene-prev-summary {
    margin-top: -5px !important;
  }

  .story-scene-shell .scene-prev-summary + .scene-copy.scene-copy-quote {
    margin-top: -9px !important;
    padding-top: 0 !important;
  }
}

/* story-block-spacing-final-fix */
.story-scene-shell .scene-story-stack,
.story-scene-shell .scene-prev-summary {
  gap: 0 !important;
}

.story-scene-shell .scene-prev-summary-quote {
  margin: 0 !important;
}

.story-scene-shell .summary-inline-toggle {
  margin-top: 2px !important;
  min-height: 22px !important;
  font-size: 10px !important;
  border-color: #5a5a5a !important;
  color: #d8d8d8 !important;
  background: #0b0b0b !important;
}

.story-scene-shell .scene-story-stack .scene-copy.scene-copy-quote {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.scene-prev-summary-extra {
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #3a3f46;
  background: #08090b;
  display: grid;
  gap: 4px;
}

.scene-prev-summary-item {
  font-size: 11px;
  line-height: 1.3;
}

.scene-prev-summary-item.rarity-common {
  color: #b3b8bf;
}

.scene-round-chat-line.rarity-common {
  color: #b3b8bf;
}

.scene-prev-summary-item.rarity-uncommon {
  color: #6fdc77;
}

.scene-round-chat-line.rarity-uncommon {
  color: #6fdc77;
}

.scene-prev-summary-item.rarity-rare {
  color: #68a7ff;
}

.scene-round-chat-line.rarity-rare {
  color: #68a7ff;
}

.scene-prev-summary-item.rarity-epic {
  color: #b98aff;
}

.scene-round-chat-line.rarity-epic {
  color: #b98aff;
}

.scene-prev-summary-item.rarity-mythic {
  color: #ffd94d;
}

.scene-round-chat-line.rarity-mythic {
  color: #ffd94d;
}

.scene-prev-summary-item.rarity-legendary {
  color: #ff8a2b;
}

.scene-round-chat-line.rarity-legendary {
  color: #ff8a2b;
}

.scene-prev-summary-item.rarity-xp {
  color: #7fd6ff;
}

.scene-round-chat-line.rarity-xp {
  color: #7fd6ff;
}

.scene-round-chat {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 6px 0 0;
}

.scene-round-chat-title {
  color: #9ea7b2;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scene-round-chat-feed {
  display: grid;
  gap: 4px;
}

.scene-round-chat-line {
  border: 1px solid #353b42;
  background: #090a0c;
  color: #d6dce4;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.28;
}

.scene-turn-call {
  display: grid;
  gap: 5px;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .scene-prev-summary-extra {
    margin-top: 3px;
    padding: 5px 7px;
    gap: 3px;
  }

  .scene-prev-summary-item {
    font-size: 10px;
    line-height: 1.25;
  }

  .scene-round-chat {
    gap: 4px;
    padding-top: 4px;
  }

  .scene-round-chat-title {
    font-size: 9px;
  }

  .scene-round-chat-feed {
    gap: 3px;
  }

  .scene-round-chat-line {
    padding: 5px 7px;
    font-size: 10px;
    line-height: 1.24;
  }

  .scene-turn-call {
    gap: 4px;
    padding-top: 3px;
  }
}

/* combat-hud-drop-down-fix */
.combat-hud {
  margin-top: 12px !important;
}

@media (max-width: 768px) {
  .combat-hud {
    margin-top: 14px !important;
  }
}

/* user-status-colors-in-chat */
.chat-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-author-badge {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.35;
}

.chat-author.status-admin {
  color: #ff5a5a !important;
}

.chat-author.status-moderator {
  color: #57a5ff !important;
}

.chat-author.status-elite {
  color: #d7bd73 !important;
}

.chat-author.status-honored {
  color: #6fdc77 !important;
}

.chat-author.status-default {
  color: #a8a8a8 !important;
}

.entry-hub-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entry-hub-author-badge {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.35;
}

.entry-hub-author.status-admin {
  color: #ff5a5a !important;
}

.entry-hub-author.status-moderator {
  color: #57a5ff !important;
}

.entry-hub-author.status-elite {
  color: #d7bd73 !important;
}

.entry-hub-author.status-honored {
  color: #6fdc77 !important;
}

.entry-hub-author.status-default {
  color: #e6e6e6 !important;
}

/* story-mobile-gap-final-hotfix */
@media (max-width: 768px) {
  .panel-screen.scene-shell.story-scene-shell {
    gap: 4px !important;
    padding-top: 0 !important;
  }

  .story-scene-shell .scene-title-row,
  .story-scene-shell .scene-headline,
  .story-scene-shell .scene-subline {
    margin: 0 !important;
    padding: 0 !important;
  }

  .story-scene-shell .scene-headline {
    line-height: 1.06 !important;
  }

  .story-scene-shell .scene-headline + .scene-story-result,
  .story-scene-shell .scene-headline + .scene-story-stack,
  .story-scene-shell .scene-story-result + .scene-story-stack,
  .story-scene-shell .scene-story-stack + .scene-options-block {
    margin-top: 4px !important;
    padding-top: 0 !important;
  }

  .story-scene-shell .scene-story-result,
  .story-scene-shell .scene-story-stack,
  .story-scene-shell .scene-prev-summary,
  .story-scene-shell .scene-options-block {
    margin: 0 !important;
    min-height: 0 !important;
  }

  .story-scene-shell .scene-story-result {
    padding: 4px 0 0 !important;
  }

  .story-scene-shell .scene-story-result-copy {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    max-height: 7.8em;
    overflow: auto;
  }

  .story-scene-shell .scene-story-stack {
    display: grid !important;
    gap: 4px !important;
    padding: 0 !important;
  }

  .story-scene-shell .scene-prev-summary {
    padding: 0 !important;
  }

  .story-scene-shell .scene-prev-summary-quote,
  .story-scene-shell .scene-copy.scene-copy-quote {
    margin: 0 !important;
    padding: 8px 10px 8px 13px !important;
  }

  .story-scene-shell .scene-options-block {
    padding: 6px 0 0 !important;
    gap: 6px !important;
  }

  .story-scene-shell .scene-gm-line {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
  }
}

/* party-chat-overlay */
.party-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.party-chat-overlay-card {
  width: min(720px, 100%);
  max-height: 88vh;
  border: 1px solid #565656;
  background: #080808;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.party-chat-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #2d2d2d;
}

.party-chat-overlay-title {
  color: #f2f2f2;
  font-weight: 700;
}

#partyChatOverlayBody {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}

.party-chat-overlay-feed {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.party-chat-overlay-message {
  border: 1px solid #343434;
  background: #0b0b0b;
  padding: 6px;
  display: grid;
  gap: 3px;
}

.party-chat-overlay-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.party-chat-overlay-badge {
  border: 1px solid currentColor;
  padding: 0 4px;
  font-size: 9px;
  line-height: 1.3;
}

.party-chat-overlay-text {
  color: #d3d3d3;
  font-size: 12px;
  line-height: 1.35;
}

.party-chat-overlay-empty {
  color: #9e9e9e;
  font-size: 12px;
}

.party-chat-overlay-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid #2d2d2d;
  background: #070707;
}

@media (max-width: 768px) {
  .party-chat-overlay {
    padding: 6px;
  }

  .party-chat-overlay-card {
    max-height: 92vh;
  }

  .party-chat-overlay-text {
    font-size: 11px;
  }
}

/* hub-v2: compact feed + fixed bottom compose */
.entry-hub-shell {
  display: grid !important;
  grid-template-rows: auto 1fr auto !important;
  gap: 8px !important;
  height: calc(var(--app-vh, 100vh) - 92px) !important;
  min-height: 520px;
  overflow: hidden !important;
}

.entry-hub-feed-v2 {
  max-height: none !important;
  min-height: 0;
  overflow: auto !important;
  gap: 6px;
  padding: 8px !important;
  border: 1px solid #3a3a3a !important;
  background: #080808 !important;
}

.entry-hub-message-v2 {
  display: grid;
  gap: 4px;
  padding: 6px 6px 7px;
  border: 1px solid #2f2f2f;
  background: #0b0b0b;
  max-width: 92%;
  width: fit-content;
  min-width: 62%;
}

.entry-hub-message-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.entry-hub-text {
  color: #d6d6d6;
  line-height: 1.35;
  font-size: 12px;
}

.entry-hub-bottom {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid #3b3b3b;
  background: #070707;
}

.entry-hub-compose-row {
  grid-template-columns: 1fr auto !important;
}

.entry-hub-compose-row .pixel-button {
  min-width: 108px;
}

.entry-hub-invites-v2 {
  gap: 6px;
  max-height: 98px;
  overflow: auto;
  border-top: 1px solid #262626;
  padding-top: 6px;
}

.hub-channel-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.hub-channel-tab {
  min-height: 34px !important;
  height: 34px !important;
  max-height: 34px !important;
  font-size: 11px !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .entry-hub-shell {
    height: calc(var(--app-vh, 100vh) - 84px) !important;
    min-height: 460px;
    gap: 6px !important;
  }

  .entry-hub-feed-v2 {
    padding: 7px !important;
    gap: 5px;
  }

  .entry-hub-message-v2 {
    padding: 5px 6px 6px;
    max-width: 96%;
    min-width: 72%;
  }

  .entry-hub-text {
    font-size: 11px;
    line-height: 1.3;
  }

  .entry-hub-bottom {
    padding: 6px;
    gap: 5px;
  }

  .entry-hub-invites-v2 {
    max-height: 86px;
  }

  .hub-channel-tabs {
    gap: 5px;
  }

  .hub-channel-tab {
    min-height: 30px !important;
    height: 30px !important;
    max-height: 30px !important;
    font-size: 10px !important;
    padding: 0 6px !important;
  }
}

/* combat-layout-clean-v3 */
.combat-scene-content {
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  gap: 4px !important;
}

.combat-scene-content .summary-title {
  margin: 0 !important;
  line-height: 1.1 !important;
}

.turn-timer-inline {
  margin: 0 !important;
}

.combat-layout {
  margin: 0 !important;
  padding: 0 !important;
  gap: 4px !important;
}

.battlefield {
  margin: 0 !important;
  padding: 0 !important;
  gap: 4px !important;
  max-height: none !important;
  overflow: visible !important;
}

.battle-lane {
  margin: 0 !important;
  gap: 5px !important;
}

.lane-title {
  margin: 0 !important;
  padding: 0 1px !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
}

.miniatures {
  gap: 6px !important;
  padding: 5px !important;
  margin: 0 !important;
  background: #08131a !important;
  border: 1px solid #1c3546 !important;
}

.miniatures .combatant {
  min-height: 54px !important;
  height: 54px !important;
  padding: 5px 6px !important;
  border: 1px solid #284353 !important;
}

.miniatures .combatant.hero.hero-compact,
.miniatures .combatant.enemy {
  min-height: 54px !important;
  height: 54px !important;
}

.combatant-row-rect {
  grid-template-columns: 28px 1fr !important;
  gap: 7px !important;
}

.combatant-avatar-square {
  width: 28px !important;
  height: 28px !important;
}

.combatant-main .combatant-name {
  color: #ececec !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
}

.combatant-main .combatant-hptext {
  color: #d2c29a !important;
  font-size: 9px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.combatant-main {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 4px !important;
  height: 100% !important;
}

.combatant-main .hp-bar {
  height: 5px !important;
}

.combat-hud {
  position: relative !important;
  z-index: 1 !important;
  margin: 4px 0 0 !important;
  padding: 8px !important;
  gap: 8px !important;
}

.hud-titlebar {
  margin-bottom: 6px !important;
  font-size: 17px !important;
  padding: 4px 8px !important;
}

.hud-main-actions {
  gap: 7px !important;
}

.hud-main-actions .hud-button {
  min-height: 48px !important;
}

.hud-tactics-actions .hud-button {
  min-height: 38px !important;
}

@media (max-width: 768px) {
  .combat-scene-content {
    gap: 3px !important;
  }

  .combat-scene-content .summary-title {
    font-size: 13px !important;
    margin-bottom: 0 !important;
  }

  .combat-layout,
  .battlefield {
    gap: 3px !important;
  }

  .battle-lane {
    gap: 4px !important;
  }

  .miniatures {
    gap: 5px !important;
    padding: 5px !important;
  }

  .miniatures .combatant {
    min-height: 50px !important;
    height: 50px !important;
    padding: 4px 5px !important;
    border-color: #243d4c !important;
  }

  .miniatures .combatant.hero.hero-compact,
  .miniatures .combatant.enemy {
    min-height: 50px !important;
    height: 50px !important;
  }

  .combatant-row-rect {
    grid-template-columns: 24px 1fr !important;
    gap: 6px !important;
  }

  .combatant-avatar-square {
    width: 24px !important;
    height: 24px !important;
  }

  .combatant-main .combatant-name {
    font-size: 9px !important;
    line-height: 1.15 !important;
  }

  .combatant-main .combatant-hptext {
    font-size: 8px !important;
    line-height: 1.05 !important;
  }

  .combatant-main .hp-bar {
    height: 4px !important;
  }

  .combat-hud {
    margin-top: 8px !important;
    padding: 7px !important;
    gap: 6px !important;
  }

  .hud-titlebar {
    font-size: 15px !important;
    padding: 3px 7px !important;
    margin-bottom: 5px !important;
  }

  .hud-main-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .hud-main-actions .hud-button {
    min-height: 44px !important;
  }

  .hud-tactics-actions {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    margin-top: 0 !important;
  }

  .hud-tactics-actions .hud-button {
    min-height: 34px !important;
  }
}

/* story-header-summary-and-readable-timer */
.scene-chapter-summary {
  display: grid;
  gap: 4px;
  margin: 4px 0 8px;
}

.scene-chapter-summary-title {
  color: #d8c07a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.scene-chapter-summary-quote {
  margin: 0 !important;
  padding: 8px 10px 8px 14px !important;
  border-left-color: #8e95a2 !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}

@media (max-width: 768px) {
  .story-scene-shell .scene-chapter-summary {
    margin: 3px 0 6px !important;
    gap: 3px !important;
  }

  .story-scene-shell .scene-chapter-summary-title {
    font-size: 9px !important;
  }

  .story-scene-shell .scene-chapter-summary-quote,
  .story-scene-shell .scene-copy.scene-copy-quote {
    font-size: 11px !important;
    line-height: 1.32 !important;
    padding: 7px 9px 7px 12px !important;
  }

  .story-scene-shell .scene-gm-line {
    font-size: 11px !important;
    line-height: 1.2 !important;
  }

  .story-scene-shell .story-turn-timer {
    margin: 0 !important;
    padding: 6px 8px !important;
    border-width: 1px !important;
    border-radius: 8px !important;
    gap: 4px !important;
  }

  .story-scene-shell .story-turn-header {
    margin-bottom: 3px !important;
  }

  .story-scene-shell .story-turn-status {
    min-height: 18px !important;
    font-size: 9px !important;
    padding: 0 7px !important;
    letter-spacing: 0.04em !important;
  }

  .story-scene-shell .story-turn-label {
    font-size: 11px !important;
  }

  .story-scene-shell .story-turn-timer-bar {
    height: 6px !important;
  }

  .story-scene-shell .scene-option-title {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .story-scene-shell .scene-option-copy {
    font-size: 10px !important;
    line-height: 1.25 !important;
    color: #d6d6d6 !important;
  }
}

/* mobile-font-downscale-final */
@media (max-width: 768px) {
  .story-scene-shell .summary-title {
    font-size: 9px !important;
    letter-spacing: 0.04em !important;
  }

  .story-scene-shell .scene-code-chip {
    font-size: 8px !important;
    padding: 2px 5px !important;
  }

  .story-scene-shell .scene-headline {
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  .story-scene-shell .scene-subline {
    font-size: 9px !important;
    line-height: 1.2 !important;
  }

  .story-scene-shell .scene-ending-banner {
    font-size: 10px !important;
    line-height: 1.2 !important;
    padding: 6px 8px !important;
  }

  .story-scene-shell .scene-copy.scene-copy-quote {
    font-size: 10px !important;
    line-height: 1.24 !important;
  }

  .story-scene-shell .scene-story-result-title {
    font-size: 9px !important;
  }

  .story-scene-shell .scene-story-result-copy {
    font-size: 10px !important;
    line-height: 1.22 !important;
  }

  .scene-finish-actions {
    gap: 6px !important;
  }

  .scene-finish-actions .pixel-button {
    min-height: 34px !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
  }
}

/* dice-overlay-black-70 + true-3d-cube */
.dice-overlay {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.7) !important;
  z-index: 5000 !important;
  pointer-events: none !important;
}

.dice-scene {
  perspective: 1100px;
}

.combat-dice {
  position: relative;
  width: 90px !important;
  height: 90px !important;
  display: block !important;
  clip-path: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  transform-style: preserve-3d;
  transform: rotateX(-22deg) rotateY(32deg);
  transition: transform 280ms ease-out;
  counter-reset: steps 0;
}

.combat-dice .dice-face {
  display: none !important;
}

.face {
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -24px;
  width: 0;
  height: 0;
  border-left: 24px solid transparent;
  border-right: 24px solid transparent;
  border-bottom: 41px solid rgba(255, 255, 255, 0.88);
  transform-origin: 50% 100%;
  backface-visibility: hidden;
}

.face::before {
  counter-increment: steps 1;
  content: counter(steps);
  position: absolute;
  left: -23px;
  top: 8px;
  width: 46px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
  color: #171717;
  font-weight: 700;
}

.face:nth-child(odd) {
  border-bottom-color: rgba(255, 247, 227, 0.95);
}

.dice-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(39, 39, 39, 0.95);
  background: radial-gradient(circle at 34% 30%, #f8de9f 0%, #d2a454 46%, #7f5524 100%);
  box-shadow: inset 0 1px 10px rgba(255, 246, 222, 0.2);
  backface-visibility: hidden;
}

.dice-face.front { background: radial-gradient(circle at 34% 30%, #f8de9f 0%, #d2a454 46%, #7f5524 100%); }
.dice-face.back { background: radial-gradient(circle at 34% 30%, #e4c27f 0%, #b7853a 50%, #6c471d 100%); }
.dice-face.right { background: linear-gradient(145deg, #cf9c4d 0%, #7a4f20 100%); }
.dice-face.left { background: linear-gradient(145deg, #b98741 0%, #65401a 100%); }
.dice-face.top { background: linear-gradient(145deg, #f3cf86 0%, #a36f2f 100%); }
.dice-face.bottom { background: linear-gradient(145deg, #9a6a2e 0%, #4b2f12 100%); }

.dice-face.front { transform: translateZ(45px); }
.dice-face.back { transform: rotateY(180deg) translateZ(45px); }
.dice-face.right { transform: rotateY(90deg) translateZ(45px); }
.dice-face.left { transform: rotateY(-90deg) translateZ(45px); }
.dice-face.top { transform: rotateX(90deg) translateZ(45px); }
.dice-face.bottom { transform: rotateX(-90deg) translateZ(45px); }

.face:nth-child(1) { transform: rotateY(0deg) translateZ(16px) translateY(-6px) rotateX(53deg); }
.face:nth-child(2) { transform: rotateY(-72deg) translateZ(16px) translateY(-6px) rotateX(53deg); }
.face:nth-child(3) { transform: rotateY(-144deg) translateZ(16px) translateY(-6px) rotateX(53deg); }
.face:nth-child(4) { transform: rotateY(-216deg) translateZ(16px) translateY(-6px) rotateX(53deg); }
.face:nth-child(5) { transform: rotateY(-288deg) translateZ(16px) translateY(-6px) rotateX(53deg); }

.face:nth-child(6) { transform: rotateY(360deg) translateZ(36px) translateY(26px) rotateZ(180deg) rotateX(-11deg); }
.face:nth-child(7) { transform: rotateY(288deg) translateZ(36px) translateY(26px) rotateZ(180deg) rotateX(-11deg); }
.face:nth-child(8) { transform: rotateY(216deg) translateZ(36px) translateY(26px) rotateZ(180deg) rotateX(-11deg); }
.face:nth-child(9) { transform: rotateY(144deg) translateZ(36px) translateY(26px) rotateZ(180deg) rotateX(-11deg); }
.face:nth-child(10) { transform: rotateY(72deg) translateZ(36px) translateY(26px) rotateZ(180deg) rotateX(-11deg); }

.face:nth-child(11) { transform: rotateY(252deg) translateZ(36px) translateY(26px) rotateX(-11deg); }
.face:nth-child(12) { transform: rotateY(324deg) translateZ(36px) translateY(26px) rotateX(-11deg); }
.face:nth-child(13) { transform: rotateY(396deg) translateZ(36px) translateY(26px) rotateX(-11deg); }
.face:nth-child(14) { transform: rotateY(468deg) translateZ(36px) translateY(26px) rotateX(-11deg); }
.face:nth-child(15) { transform: rotateY(540deg) translateZ(36px) translateY(26px) rotateX(-11deg); }

.face:nth-child(16) { transform: rotateY(-108deg) translateZ(16px) translateY(56px) rotateZ(180deg) rotateX(53deg); }
.face:nth-child(17) { transform: rotateY(-36deg) translateZ(16px) translateY(56px) rotateZ(180deg) rotateX(53deg); }
.face:nth-child(18) { transform: rotateY(36deg) translateZ(16px) translateY(56px) rotateZ(180deg) rotateX(53deg); }
.face:nth-child(19) { transform: rotateY(108deg) translateZ(16px) translateY(56px) rotateZ(180deg) rotateX(53deg); }
.face:nth-child(20) { transform: rotateY(180deg) translateZ(16px) translateY(56px) rotateZ(180deg) rotateX(53deg); }

.combat-dice[data-face="1"] { transform: rotateX(308deg) rotateY(0deg) !important; }
.combat-dice[data-face="2"] { transform: rotateX(308deg) rotateY(72deg) !important; }
.combat-dice[data-face="3"] { transform: rotateX(308deg) rotateY(144deg) !important; }
.combat-dice[data-face="4"] { transform: rotateX(308deg) rotateY(216deg) !important; }
.combat-dice[data-face="5"] { transform: rotateX(308deg) rotateY(288deg) !important; }
.combat-dice[data-face="6"] { transform: rotateX(248deg) rotateY(0deg) !important; }
.combat-dice[data-face="7"] { transform: rotateX(248deg) rotateY(72deg) !important; }
.combat-dice[data-face="8"] { transform: rotateX(248deg) rotateY(144deg) !important; }
.combat-dice[data-face="9"] { transform: rotateX(248deg) rotateY(216deg) !important; }
.combat-dice[data-face="10"] { transform: rotateX(248deg) rotateY(288deg) !important; }
.combat-dice[data-face="11"] { transform: rotateX(188deg) rotateY(324deg) !important; }
.combat-dice[data-face="12"] { transform: rotateX(188deg) rotateY(36deg) !important; }
.combat-dice[data-face="13"] { transform: rotateX(188deg) rotateY(108deg) !important; }
.combat-dice[data-face="14"] { transform: rotateX(188deg) rotateY(180deg) !important; }
.combat-dice[data-face="15"] { transform: rotateX(188deg) rotateY(252deg) !important; }
.combat-dice[data-face="16"] { transform: rotateX(128deg) rotateY(324deg) !important; }
.combat-dice[data-face="17"] { transform: rotateX(128deg) rotateY(36deg) !important; }
.combat-dice[data-face="18"] { transform: rotateX(128deg) rotateY(108deg) !important; }
.combat-dice[data-face="19"] { transform: rotateX(128deg) rotateY(180deg) !important; }
.combat-dice[data-face="20"] { transform: rotateX(128deg) rotateY(252deg) !important; }

.dice-number {
  color: #fff8e8;
  font-size: 31px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

.dice-side-mark {
  color: rgba(255, 245, 220, 0.72);
  font-size: 20px;
  line-height: 1;
}

.combat-dice::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%) translateZ(-6px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 68%);
  filter: blur(2px);
  z-index: -1;
}

.combat-dice.rolling {
  animation: trueDiceRoll3d 2.25s cubic-bezier(0.2, 0.7, 0.2, 1) 1 !important;
}

.combat-dice.critical {
  animation: trueDiceCrit3d 2.45s cubic-bezier(0.2, 0.68, 0.2, 1) 1 !important;
}

.combat-dice.critical .dice-face {
  background: radial-gradient(circle at 34% 30%, #fff4bf 0%, #f2ba56 44%, #b44b1c 100%);
}

@keyframes trueDiceRoll3d {
  0% { transform: rotateX(-22deg) rotateY(32deg) rotateZ(0deg); }
  18% { transform: rotateX(180deg) rotateY(200deg) rotateZ(65deg); }
  40% { transform: rotateX(420deg) rotateY(460deg) rotateZ(140deg); }
  62% { transform: rotateX(640deg) rotateY(700deg) rotateZ(220deg); }
  84% { transform: rotateX(820deg) rotateY(900deg) rotateZ(300deg); }
  100% { transform: rotateX(900deg) rotateY(1080deg) rotateZ(360deg); }
}

@keyframes trueDiceCrit3d {
  0% { transform: scale(1) rotateX(-22deg) rotateY(32deg); filter: brightness(1); }
  28% { transform: scale(1.08) rotateX(250deg) rotateY(300deg); filter: brightness(1.2); }
  58% { transform: scale(1.04) rotateX(520deg) rotateY(620deg); filter: brightness(1.12); }
  100% { transform: scale(1) rotateX(760deg) rotateY(900deg); filter: brightness(1); }
}

@media (max-width: 768px) {
  .combat-dice {
    width: 78px !important;
    height: 78px !important;
  }

  .dice-face.front { transform: translateZ(39px); }
  .dice-face.back { transform: rotateY(180deg) translateZ(39px); }
  .dice-face.right { transform: rotateY(90deg) translateZ(39px); }
  .dice-face.left { transform: rotateY(-90deg) translateZ(39px); }
  .dice-face.top { transform: rotateX(90deg) translateZ(39px); }
  .dice-face.bottom { transform: rotateX(-90deg) translateZ(39px); }

  .dice-number {
    font-size: 26px;
  }

  .combat-dice::after {
    width: 88px;
    height: 88px;
  }
}

/* dice-whittle-overlay */
#diceOverlay {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.7) !important;
  z-index: 7000 !important;
  pointer-events: none !important;
}

#diceOverlay.hidden {
  display: none !important;
}

#diceOverlay .dice-scene {
  position: relative !important;
  width: min(94vw, 980px) !important;
  height: min(52vh, 320px) !important;
  display: grid !important;
  place-items: center !important;
}

#diceCube.dice-whittle-root,
#diceCube.dice-whittle-root.rolling,
#diceCube.dice-whittle-root.critical {
  --dice-transition: cubic-bezier(0.75, 0, 0.25, 1);
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform: none !important;
  animation: none !important;
  filter:
    drop-shadow(0 18px 36px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 18px rgba(248, 220, 126, 0.06)) !important;
}

#diceCube.dice-whittle-root::before,
#diceCube.dice-whittle-root::after,
#diceCube.dice-whittle-root > .face,
#diceCube.dice-whittle-root > .face::before {
  display: none !important;
  content: none !important;
}

#diceCube.dice-whittle-root .dice-whittle-outline {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 136px !important;
  height: 157px !important;
  opacity: 0 !important;
  transform: translate(-50%, -50%) scale(0.985) !important;
  transition: opacity 160ms var(--dice-transition), transform 160ms var(--dice-transition) !important;
  stroke-dasharray: 480;
  stroke-dashoffset: 480;
}

#diceCube.dice-whittle-root.resolved .dice-whittle-outline {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) !important;
  animation: diceDraw 1s var(--dice-transition) forwards !important;
}

#diceCube.dice-whittle-root .dice-whittle-outline path {
  fill: rgba(143, 107, 50, 0.12) !important;
  stroke: rgba(242, 212, 121, 0.98) !important;
  stroke-width: 3.5px !important;
}

#diceCube.dice-whittle-root.is-critical .dice-whittle-outline path,
#diceCube.dice-whittle-root.critical .dice-whittle-outline path {
  stroke: #fff1b8 !important;
}

#diceCube.dice-whittle-root .dice-whittle-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  width: min(90vw, 1280px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: clamp(10px, 1.8vw, 30px) !important;
  flex-wrap: nowrap !important;
  pointer-events: none !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.mid {
  gap: clamp(8px, 1.3vw, 18px) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.dense {
  gap: clamp(4px, 0.9vw, 12px) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list li {
  display: block !important;
  position: relative !important;
  font-size: clamp(30px, 4vw, 60px) !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  letter-spacing: -0.02em !important;
  color: rgba(255, 255, 255, 0.96) !important;
  opacity: 0.96 !important;
  transition: all 0.5s var(--dice-transition) !important;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.26) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.whittling li.leaving-active {
  position: absolute !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.whittling li.leaving {
  opacity: 0 !important;
  transform: translate(var(--burst-x, 0px), var(--burst-y, 0px)) scale(5) !important;
  margin-top: 0 !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.whittling li {
  transform: none !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.mid li {
  font-size: clamp(22px, 2.8vw, 42px) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.dense li {
  font-size: clamp(14px, 2vw, 30px) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.single li {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  font-size: clamp(38px, 7vw, 68px) !important;
  font-weight: 600 !important;
  letter-spacing: -0.05em !important;
  color: #fffaf0 !important;
  text-shadow:
    0 0 30px rgba(255, 244, 213, 0.2),
    0 5px 16px rgba(0, 0, 0, 0.38) !important;
  transform-origin: center !important;
}

#diceCube.dice-whittle-root .dice-whittle-list li:only-child {
  transform: translate(-50%, -50%) scale(1.75) !important;
}

#diceCube.dice-whittle-root .dice-whittle-outcome {
  position: absolute !important;
  left: 50% !important;
  top: calc(50% + 54px) !important;
  transform: translateX(-50%) !important;
  min-width: 180px !important;
  text-align: center !important;
  font-size: clamp(12px, 2.1vw, 18px) !important;
  line-height: 1.1 !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  color: #ff6c6c !important;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.45) !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.whittling li.shaking {
  animation: diceWhittleShake 0.1s var(--dice-transition) infinite !important;
}

#diceCube.dice-whittle-root .dice-whittle-list.whittling li.shaking-alt {
  animation-delay: 0.05s !important;
}

@keyframes diceDraw {
  from { stroke-dashoffset: 480; }
  to { stroke-dashoffset: 20; }
}

@keyframes diceWhittleShake {
  from {
    margin-top: -0.05em;
  }
  to {
    margin-top: 0.05em;
  }
}

@media (max-width: 768px) {
  #diceOverlay .dice-scene {
    width: min(96vw, 420px) !important;
    height: min(42vh, 220px) !important;
  }

  #diceCube.dice-whittle-root,
  #diceCube.dice-whittle-root.rolling,
  #diceCube.dice-whittle-root.critical {
    width: 100% !important;
    height: 100% !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-outline {
    width: 112px !important;
    height: 130px !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-list li {
    font-size: clamp(24px, 7vw, 44px) !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-list.mid li {
    font-size: clamp(18px, 5.2vw, 28px) !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-list.dense li {
    font-size: clamp(10px, 3.6vw, 18px) !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-list.single li {
    font-size: 40px !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-outcome {
    top: calc(50% + 46px) !important;
    min-width: 150px !important;
    font-size: clamp(10px, 3vw, 14px) !important;
  }

  #diceCube.dice-whittle-root .dice-whittle-list.whittling li.shaking {
    font-size: clamp(42px, 14vw, 82px) !important;
  }
}

/* combat-text-hud */
.combat-text-hud {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 0;
  border: 1px solid #3b2c1c;
  background: #0b0b0b;
  color: #f5f5f5;
  font-family: "Courier New", monospace;
}

.combat-text-header {
  display: grid;
  gap: 0;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #3b2c1c;
  background: #111;
}

.combat-text-header-bar {
  padding: 5px 8px;
  background: #2a2016;
  color: #f3e5bf;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.combat-text-headline {
  color: #d8d8d8;
  font-size: 13px;
  line-height: 1.3;
}

.combat-text-section {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid #3b2c1c;
  background: #0f0f0f;
}

.combat-text-label {
  color: #e0c57a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.combat-text-lines,
.combat-text-log {
  display: grid;
  gap: 4px;
}

.combat-text-log {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.combat-text-emergency {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.combat-text-emergency .pixel-button {
  min-width: 190px;
}

.combat-text-line,
.combat-text-log-line,
.combat-text-inline,
.combat-text-empty {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #2f2f2f;
  background: #090909;
  color: #e8e8e8;
  font-size: 12px;
  line-height: 1.3;
}

.combat-text-line {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
}

button.combat-text-line,
.combat-text-action {
  cursor: pointer;
}

.combat-text-enemy {
  border-color: #364b5b;
}

.combat-text-enemy.selected {
  border-color: #8f6b32;
  background: #18120d;
  box-shadow: inset 0 0 0 1px rgba(224, 197, 122, 0.22);
}

.combat-text-item {
  border-color: #3f3f3f;
}

.combat-text-index {
  color: #e0c57a;
  font-weight: 700;
}

.combat-text-main {
  color: #f5f5f5;
}

.combat-text-meta {
  color: #b8b8b8;
  font-size: 11px;
  text-transform: uppercase;
}

.combat-text-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.combat-text-action {
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid #4a4a4a;
  background: #101010;
  color: #f0f0f0;
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.combat-text-action.selected,
.combat-text-action:focus-visible,
.combat-text-action:hover {
  border-color: #8f6b32;
  background: #1f1710;
  color: #f3e5bf;
}

.combat-text-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.combat-text-log-line {
  white-space: pre-wrap;
}

.combat-text-hint-line {
  color: #c8c8c8;
}

@media (max-width: 768px) {
  .combat-text-hud {
    gap: 6px;
    margin-top: 6px;
    padding: 0;
  }

  .combat-text-header,
  .combat-text-section {
    padding: 8px 10px;
  }

  .combat-text-header-bar,
  .combat-text-label {
    font-size: 11px;
  }

  .combat-text-headline,
  .combat-text-line,
  .combat-text-log-line,
  .combat-text-inline,
  .combat-text-empty,
  .combat-text-action {
    font-size: 10px;
  }

  .combat-text-line,
  .combat-text-log-line,
  .combat-text-inline,
  .combat-text-empty {
    min-height: 30px;
    padding: 6px 8px;
  }

  .combat-text-log {
    max-height: 180px;
  }

  .combat-text-action {
    min-height: 34px;
    padding: 6px 8px;
  }

  .combat-text-line {
    grid-template-columns: 18px 1fr auto;
    gap: 6px;
  }

  .combat-text-meta {
    font-size: 9px;
  }
}

/* story mobile timer + option cleanup */
@media (max-width: 768px) {
  .story-scene-shell .story-turn-timer {
    border-radius: 0 !important;
    padding: 7px 8px !important;
  }

  .story-scene-shell .story-turn-status {
    border-radius: 0 !important;
    min-height: 20px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
  }

  .story-scene-shell .story-turn-timer-bar {
    border-radius: 0 !important;
    height: 6px !important;
  }

  .story-scene-shell .story-turn-timer-fill {
    border-radius: 0 !important;
  }

  .story-scene-shell .scene-option-button {
    padding: 8px 9px !important;
  }

  .story-scene-shell .scene-option-title {
    display: block !important;
  }

  .story-scene-shell .scene-option-title-main {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.08 !important;
  }

  .story-scene-shell .scene-option-check {
    margin-top: 4px !important;
    font-size: 9px !important;
    color: #d9bf79 !important;
  }

  .story-scene-shell .scene-option-copy {
    margin-top: 5px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
  }
}
