:root {
  --bg: #0d0b14;
  --panel: #171321;
  --panel-2: #211a2f;
  --panel-3: #2b233b;
  --text: #f6edf9;
  --muted: #c3b7cc;
  --accent: #d9a441;
  --accent-2: #8bd3ff;
  --danger: #ff6b6b;
  --good: #72df9f;
  --mana: #73a7ff;
  --stamina: #f0c36a;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --radius: 18px;
  --gap: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(217,164,65,.22), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(139,211,255,.16), transparent 28rem),
    var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #f0c96a, #c58c2d);
  color: #1b1208;
  font-weight: 800;
  padding: 11px 14px;
  min-height: 44px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
button.secondary { background: #302741; color: var(--text); }
button.ghost { background: transparent; border: 1px solid #4a3d61; color: var(--text); box-shadow: none; }
button.danger { background: linear-gradient(180deg, #ff8b8b, #c94b4b); color: #240404; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select {
  width: 100%;
  color: var(--text);
  background: #100d18;
  border: 1px solid #403650;
  border-radius: 14px;
  padding: 12px 14px;
}
ul { margin: 0; padding-left: 1.3rem; color: var(--muted); line-height: 1.55; }

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  min-height: 100svh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}
.screen { display: grid; gap: var(--gap); }
.hero {
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(33,26,47,.94), rgba(18,14,27,.96));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.title { font-size: clamp(2rem, 8vw, 4rem); line-height: .95; margin: 0 0 8px; letter-spacing: -.05em; }
.subtitle { color: var(--muted); max-width: 70ch; line-height: 1.55; }
.version { color: var(--accent); font-weight: 800; }
.grid { display: grid; gap: var(--gap); }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: rgba(23,19,33,.94);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.card.selected { outline: 2px solid var(--accent); background: rgba(57,43,71,.96); }
.locked-card { opacity: .78; filter: saturate(.75); }
.card h2, .card h3, .card h4 { margin: 0 0 8px; }
.card p { color: var(--muted); line-height: 1.45; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions button { flex: 1 1 150px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 999px;
  background: #2d253d; color: var(--muted); font-size: .86rem;
}
.pill.synergy { color: #ffe29c; background: rgba(217,164,65,.18); border: 1px solid rgba(217,164,65,.25); }
.kpi { font-weight: 900; color: var(--accent-2); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.stat { display: flex; justify-content: space-between; gap: 8px; background: #100d18; border-radius: 12px; padding: 8px 10px; }
.bar { position: relative; height: 16px; overflow: hidden; background: #100d18; border-radius: 999px; border: 1px solid rgba(255,255,255,.08); }
.bar span { display:block; height:100%; border-radius: inherit; transition: width .2s ease; }
.bar.hp span { background: linear-gradient(90deg, #d94848, #ff8b8b); }
.bar.mp span { background: linear-gradient(90deg, #4378de, #91c1ff); }
.bar.stamina span { background: linear-gradient(90deg, #c7902f, #ffd271); }
.bar.xp span { background: linear-gradient(90deg, #7b62ff, #d5c5ff); }
.small { font-size: .88rem; color: var(--muted); }
.log {
  max-height: 230px;
  overflow: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  background: #0b0911;
}
.log-line { color: var(--muted); border-bottom: 1px dashed rgba(255,255,255,.07); padding: 5px 0; }
.log-line strong { color: var(--text); }
.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 10px;
  background: rgba(13,11,20,.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  overflow-x: auto;
}
.navbar button { flex: 0 0 auto; min-height: 38px; padding: 8px 10px; }
.combat-layout { display: grid; gap: var(--gap); grid-template-columns: 1.1fr .9fr; }
.enemy-name { color: #ffb3b3; }
.player-name { color: #bde4ff; }
.status { color: #ffdc8a; }
.item-row, .skill-row, .class-row { display: grid; gap: 8px; grid-template-columns: 1fr auto; align-items: center; }
.footer-note { color: var(--muted); text-align: center; padding: 12px; }
.preview-card { border-color: rgba(139,211,255,.24); }
.save-slot.filled { border-color: rgba(114,223,159,.25); }
.mini-card {
  background: #100d18;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 11px;
  margin: 8px 0;
}
.intent-card {
  background: rgba(217,164,65,.12);
  border: 1px solid rgba(217,164,65,.22);
  border-radius: 14px;
  padding: 11px;
  margin: 10px 0;
}
.tree-list { display: grid; gap: 10px; }
.tree-node {
  background: #100d18;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px;
}
.tree-node.known, .tree-child.known { border-color: rgba(114,223,159,.35); }
.tree-children { margin-top: 8px; display: grid; gap: 6px; }
.tree-child {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
.tree-child.locked { opacity: .68; }
.active-bonus { color: var(--good); }

@media (max-width: 760px) {
  .app-shell { padding-inline: 10px; }
  .grid.two, .grid.three, .combat-layout { grid-template-columns: 1fr; }
  .hero { padding: 18px; border-radius: 22px; }
  .actions { flex-direction: column; }
  .actions button { width: 100%; flex-basis: auto; }
  .stat-grid { grid-template-columns: 1fr; }
  .item-row, .skill-row, .class-row { grid-template-columns: 1fr; }
}

/* Error fallback panel: keeps the game from becoming a blank page when a JS error happens. */
.danger-card {
  border-color: rgba(255, 90, 90, 0.45);
  background: rgba(90, 20, 30, 0.28);
}
.warn {
  color: #ffd18a;
}
pre {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
}


.filter-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
}
.filter-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.registry-card {
  min-height: 260px;
}
.registry-card h3 {
  margin: 0;
}
.locked-card {
  opacity: .72;
}
.mini-card {
  background: #100d18;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px;
}
.tree-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}
.tree-node, .tree-child {
  border-left: 3px solid rgba(255,255,255,.12);
  padding: 8px 10px;
  background: rgba(16,13,24,.72);
  border-radius: 12px;
}
.tree-node.known, .tree-child.known {
  border-left-color: var(--good);
}
.tree-child.locked {
  opacity: .8;
}
.tree-children {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

/* v0.3.1 creation filters */
.filter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}
.creation-filter-grid label {
  display: grid;
  gap: 6px;
}
.filter-count {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 14px;
  padding: 10px 12px;
  background: #100d18;
  border: 1px solid rgba(255,255,255,.08);
}
.filter-count strong {
  color: var(--accent-2);
  font-size: 1.35rem;
}
.selected-choice-warning {
  border-color: rgba(217,164,65,.55);
  background: rgba(217,164,65,.12);
}

/* v0.3.2 main menu new game filters */
.new-game-quick-builder {
  display: grid;
  gap: var(--gap);
  border-color: rgba(139, 211, 255, 0.18);
  background: linear-gradient(180deg, rgba(23,19,33,.96), rgba(17,14,26,.96));
}
.quick-filter-card {
  background: rgba(16, 13, 24, 0.82);
}
.compact-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.compact-choice {
  display: grid;
  gap: 10px;
  align-content: space-between;
  min-height: 210px;
}
.compact-choice h3 {
  margin: 0 0 6px;
}
.compact-choice p {
  margin: 6px 0;
}
.preview-card .stat-grid {
  margin: 8px 0;
}
@media (max-width: 760px) {
  .compact-choice {
    min-height: auto;
  }
  .new-game-quick-builder .filter-grid {
    grid-template-columns: 1fr;
  }
}

/* v0.4.0 Unlock System */
.unlock-card {
  border-color: rgba(114, 223, 159, 0.28);
}
.requirement-list {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}
.requirement-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.requirement-row.met { color: var(--good); }
.requirement-row.missing { color: var(--danger); }
.tree-child.unlockable {
  border-left: 3px solid var(--good);
  padding-left: 8px;
}
.tree-child.secret {
  opacity: .75;
  letter-spacing: .02em;
}
.current-tree .tree-node {
  margin-bottom: 12px;
}


/* v0.5.0 testing and ability-shop UI */
.dev-fab {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 50;
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  box-shadow: 0 12px 28px rgba(0,0,0,.38);
}
.dev-panel {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 56px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 49;
  width: min(360px, calc(100vw - 24px));
  max-height: min(680px, calc(100svh - 90px));
  overflow: auto;
  border-color: rgba(217,164,65,.35);
}
.dev-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.dev-actions button {
  min-height: 38px;
  padding: 8px;
  font-size: .82rem;
}
.mini-button {
  min-height: 34px;
  padding: 6px 10px;
  flex: 0 0 auto !important;
}
.ability-shop {
  border-color: rgba(139,211,255,.22);
}
.skill-shop-card {
  min-height: 285px;
}
.skill-shop-card.selected {
  border-color: rgba(114,223,159,.35);
}
@media (max-width: 760px) {
  .dev-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }
  .dev-actions {
    grid-template-columns: 1fr;
  }
}


.balance-note, .active-bonus { color: var(--good); }
.locked-card { opacity: .72; }


.shop-tabs {
  align-items: stretch;
}
.shop-tabs button {
  min-width: 145px;
}
.ability-shop .filter-grid {
  margin-top: 10px;
}

/* v0.6.2 Basic Ability status display */
.ability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.ability-card {
  background: #100d18;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px;
}
.ability-card p { margin: 7px 0 0; }
.ability-rank {
  color: var(--accent);
  letter-spacing: .02em;
}
.ability-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.06);
  margin-top: 8px;
}
.ability-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5d7dff, #f0c96a);
}
.rank-key {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
  background: rgba(16,13,24,.75);
  border: 1px dashed rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 9px 10px;
  margin: 8px 0 12px;
}
.derived-grid { margin-top: 8px; }


/* v0.6.3 Race / Job text layout */
.class-profile-card {
  display: grid;
  gap: 10px;
}
.class-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.class-profile-header h3 {
  margin: 2px 0 0;
}
.layout-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 900;
}
.class-profile-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.class-profile-section {
  background: rgba(16, 13, 24, .78);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
  padding: 9px 10px;
}
.class-profile-section strong,
.class-profile-traits strong {
  color: var(--text);
}
.class-profile-section p {
  margin: 5px 0 0;
}
.class-profile-traits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.class-profile-traits > div {
  background: rgba(16, 13, 24, .78);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
  padding: 9px 10px;
}
.class-profile-traits ul {
  margin-top: 6px;
}
.class-row-stack {
  display: grid;
  gap: 12px;
}
.linked-abilities-note {
  margin: -6px 0 6px;
  padding: 0 4px;
}
.registry-card > .class-profile-card {
  margin-top: 8px;
  background: rgba(16,13,24,.45);
}
@media (max-width: 760px) {
  .class-profile-traits {
    grid-template-columns: 1fr;
  }
  .class-profile-meta {
    justify-content: flex-start;
  }
}

/* v0.7.0 Quest, identity, battle modifier, and boss mechanic UI */
.identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.modifier-card,
.boss-mechanics-card {
  background: rgba(139,211,255,.10);
  border: 1px solid rgba(139,211,255,.22);
  border-radius: 14px;
  padding: 10px;
  margin: 10px 0;
}
.boss-mechanics-card {
  background: rgba(255,107,107,.10);
  border-color: rgba(255,107,107,.25);
}
.quest-list {
  display: grid;
  gap: 10px;
}
.quest-card.complete {
  border-color: rgba(114,223,159,.35);
  background: rgba(114,223,159,.08);
}
.quest-meter {
  margin: 8px 0;
}
.quest-meter span {
  background: linear-gradient(90deg, #72df9f, #d9a441);
}


/* v0.8.0 Ability Expansion */
.ability-evolution-lab {
  border-color: rgba(217, 164, 65, .28);
}
.evolution-card {
  min-height: 260px;
}
.evolution-card.selected {
  border-color: rgba(114, 223, 159, .35);
  box-shadow: 0 0 0 1px rgba(114, 223, 159, .14), 0 10px 24px rgba(0,0,0,.18);
}
.missing-input {
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, .35);
}
.ability-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}
.skill-shop-card .pill,
.evolution-card .pill {
  margin: 2px 2px 2px 0;
}

/* v0.9.0 Crafting / Loot / Build Planning */
.crafting-station, .forge-actions {
  border-color: rgba(217,164,65,.24);
}
.crafting-recipe.locked-card button,
.unlock-tracker-card button { opacity: .78; }
.loot-card {
  border-color: rgba(139,211,255,.22);
}
.loot-card h3 {
  color: var(--accent-2);
}
.unlock-tracker-card.complete,
.quest-card.complete {
  border-color: rgba(114,223,159,.35);
}
.modifier-card, .boss-mechanics-card {
  background: rgba(16,13,24,.78);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px;
  margin: 10px 0;
}
.forge-actions .actions button,
.crafting-station .actions button {
  min-width: 160px;
}

/* v0.9.1 Main Menu Cleanup */
.main-menu-screen {
  gap: 14px;
}
.main-menu-hero {
  min-height: 360px;
  display: grid;
  align-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 12%, rgba(139,211,255,.23), transparent 22rem),
    radial-gradient(circle at 8% 90%, rgba(217,164,65,.2), transparent 20rem),
    linear-gradient(135deg, rgba(35, 27, 45, .97), rgba(12, 10, 18, .98));
}
.main-menu-hero::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(217,164,65,.22);
  border-radius: 22px;
  pointer-events: none;
}
.main-menu-hero .title {
  max-width: 860px;
}
.main-menu-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
  max-width: 860px;
}
.main-menu-save-line {
  margin-top: 12px;
  max-width: 860px;
  background: rgba(16,13,24,.62);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 10px 12px;
}
.main-menu-card-grid {
  align-items: stretch;
}
.main-menu-card {
  display: grid;
  gap: 10px;
  align-content: space-between;
  min-height: 210px;
}
.primary-menu-card {
  border-color: rgba(217,164,65,.33);
  background: linear-gradient(180deg, rgba(39,31,52,.96), rgba(23,19,33,.94));
}
.feature-card {
  background: rgba(16,13,24,.78);
  min-height: 130px;
}
.main-menu-news {
  border-color: rgba(139,211,255,.16);
}
@media (max-width: 900px) {
  .main-menu-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .main-menu-hero {
    min-height: 300px;
  }
  .main-menu-actions {
    grid-template-columns: 1fr;
  }
}

/* v0.9.3 — Dark Guild Interface UI Update */
:root {
  --bg: #08070b;
  --bg-2: #111018;
  --panel: rgba(20, 18, 25, 0.94);
  --panel-2: rgba(30, 26, 36, 0.96);
  --panel-3: rgba(42, 36, 45, 0.96);
  --stone: #1b1a20;
  --parchment: #e8d9b8;
  --parchment-dim: #cdbb92;
  --text: #fbf3dd;
  --muted: #c6bda7;
  --accent: #d8a84b;
  --accent-2: #77d7d0;
  --bronze: #8f6230;
  --danger: #ff6f5e;
  --ember: #e9833c;
  --good: #79d28b;
  --mana: #7c9cff;
  --stamina: #eec36d;
  --shadow: 0 22px 64px rgba(0,0,0,.48);
  --radius: 18px;
  --gap: 12px;
}

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(216,168,75,.20), transparent 34rem),
    radial-gradient(circle at 80% 15%, rgba(119,215,208,.13), transparent 30rem),
    radial-gradient(circle at 50% 100%, rgba(233,131,60,.12), transparent 32rem),
    linear-gradient(180deg, #09080d 0%, #0f0d14 45%, #070609 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

button {
  background: linear-gradient(180deg, #f2cd76, #be7f29);
  border: 1px solid rgba(255, 224, 154, .32);
  border-bottom-color: rgba(60, 34, 9, .65);
  box-shadow: 0 10px 22px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.25);
  letter-spacing: .01em;
}
button.secondary {
  background: linear-gradient(180deg, #292631, #17141e);
  border-color: rgba(216,168,75,.22);
  color: var(--text);
}
button.ghost {
  border-color: rgba(119,215,208,.25);
  color: #dff9f6;
  background: rgba(119,215,208,.055);
}
button.danger {
  background: linear-gradient(180deg, #ff8a69, #a83226);
  color: #230806;
}
input, select {
  background: rgba(8, 7, 11, .72);
  border-color: rgba(216,168,75,.20);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}

.app-shell { width: min(1240px, 100%); }
.screen { gap: 14px; }
.hero {
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(36,31,40,.96), rgba(12,10,16,.98)),
    radial-gradient(circle at top right, rgba(119,215,208,.10), transparent 20rem);
  border: 1px solid rgba(216,168,75,.22);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
.card {
  background:
    linear-gradient(180deg, rgba(29,26,33,.96), rgba(17,15,22,.98));
  border: 1px solid rgba(216,168,75,.16);
  box-shadow: 0 14px 34px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.035);
}
.card h2, .card h3, .card h4 { color: #fff2cf; }
.card p, .small, ul { color: var(--muted); }
.card.selected {
  outline: 1px solid rgba(119,215,208,.55);
  background: linear-gradient(180deg, rgba(37,34,45,.98), rgba(19,17,25,.98));
}
.pill {
  background: rgba(216,168,75,.11);
  border: 1px solid rgba(216,168,75,.18);
  color: #e7d6ad;
}
.kpi { color: var(--accent-2); text-shadow: 0 0 14px rgba(119,215,208,.25); }
.layout-label {
  display: inline-flex;
  color: var(--accent);
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  margin-bottom: 5px;
}

/* Title screen */
.dark-guild-title-screen .main-menu-hero,
.title-guildhall {
  min-height: 430px;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at center 16%, rgba(216,168,75,.25), transparent 17rem),
    radial-gradient(circle at 78% 22%, rgba(119,215,208,.14), transparent 19rem),
    linear-gradient(180deg, rgba(31,27,33,.98), rgba(8,7,11,.98));
}
.title-guildhall::before {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(216,168,75,.17);
  border-radius: 22px;
  pointer-events: none;
}
.title-guildhall::after {
  content: "";
  position: absolute;
  inset: auto 8% 0;
  height: 150px;
  background: radial-gradient(ellipse at center, rgba(216,168,75,.18), transparent 70%);
  pointer-events: none;
}
.title-crest {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #332a33, #111018);
  border: 1px solid rgba(216,168,75,.42);
  color: var(--accent);
  font-size: 1.9rem;
  box-shadow: 0 0 34px rgba(216,168,75,.16);
}
.title-crest::first-letter { transform: rotate(-45deg); }
.main-menu-hero .title {
  font-size: clamp(2.8rem, 8vw, 5.9rem);
  color: #fff3ce;
  text-shadow: 0 0 30px rgba(216,168,75,.18), 0 5px 26px rgba(0,0,0,.52);
}
.title-actions {
  width: min(680px, 100%);
  justify-content: center;
}
.title-actions button { flex: 1 1 150px; }
.main-menu-save-line {
  max-width: 70ch;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(216,168,75,.12);
}
.primary-menu-card,
.guild-feature,
.guild-notice {
  position: relative;
  overflow: hidden;
}
.primary-menu-card::before,
.guild-feature::before,
.guild-notice::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
}
.guild-feature span {
  color: var(--accent-2);
  font-size: .72rem;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .12em;
}

/* Grouped navigation */
.dark-guild-nav {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border-color: rgba(216,168,75,.18);
  background: rgba(8,7,11,.82);
}
.nav-group {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.05);
}
.nav-group > span {
  color: var(--accent);
  font-size: .68rem;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .13em;
}
.nav-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nav-group button,
.dark-guild-nav > button {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 7px 9px;
  font-size: .86rem;
}
.nav-home {
  min-width: 82px;
  align-self: stretch;
  background: linear-gradient(180deg, #f2cd76, #b97828);
}

/* Guild dashboard cards */
.bar { height: 14px; background: rgba(255,255,255,.06); }
.bar span { box-shadow: 0 0 18px rgba(255,255,255,.12); }
.bar.hp span { background: linear-gradient(90deg, #b9292e, #ff7866); }
.bar.mp span { background: linear-gradient(90deg, #3f67d7, #8eb4ff); }
.bar.stamina span { background: linear-gradient(90deg, #b98225, #f3ce71); }
.bar.xp span { background: linear-gradient(90deg, #60c4bd, #d7b25b); }
.stat, .mini-card, .tree-node, .tree-child, .filter-count {
  background: rgba(8, 7, 11, .55);
  border-color: rgba(216,168,75,.11);
}
.intent-card, .modifier-card, .boss-mechanics-card {
  background: linear-gradient(180deg, rgba(92,38,31,.28), rgba(20,16,22,.86));
  border: 1px solid rgba(233,131,60,.25);
  border-radius: 16px;
  padding: 12px;
}
.boss-mechanics-card { border-color: rgba(255,111,94,.34); }

/* Ability cards */
.ability-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.ability-card,
.skill-shop-card.ability-card {
  position: relative;
  display: grid;
  gap: 10px;
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(24,22,30,.98), rgba(11,10,15,.98));
  border: 1px solid rgba(119,215,208,.14);
}
.ability-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #858585, transparent);
}
.ability-card-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}
.ability-card-head h3 { margin: 0; line-height: 1.15; }
.ability-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(216,168,75,.12);
  border: 1px solid rgba(216,168,75,.22);
  box-shadow: inset 0 0 20px rgba(216,168,75,.055);
  font-size: 1.4rem;
}
.ability-description { margin: 0; line-height: 1.45; }
.ability-stat-row,
.ability-shop-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
}
.ability-stat-row strong,
.ability-shop-meta strong { color: var(--text); }
.ability-shop-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ability-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ability-tag { font-size: .78rem; }
.passive-pill { justify-self: start; }
.rank-intrinsic::before { background: linear-gradient(90deg, #5ee2d0, transparent); }
.rank-common::before { background: linear-gradient(90deg, #a0a0a0, transparent); }
.rank-extra::before { background: linear-gradient(90deg, #5e91ff, transparent); }
.rank-unique::before { background: linear-gradient(90deg, #b56dff, transparent); }
.rank-ultimate::before { background: linear-gradient(90deg, #ffe08a, #ff854c, transparent); }
.rank-resist::before { background: linear-gradient(90deg, #72df9f, transparent); }
.rank-ultimate .ability-icon { border-color: rgba(255,224,138,.5); box-shadow: 0 0 28px rgba(255,224,138,.13); }
.rank-unique .ability-icon { border-color: rgba(181,109,255,.42); }

/* Shop / crafting / quest boards */
.shop-tabs button { border-color: rgba(216,168,75,.22); }
.ability-shop, .ability-evolution-lab { border-color: rgba(119,215,208,.20); }
.quest-card, .unlock-tracker-card, .evolution-card {
  border-color: rgba(216,168,75,.16);
}
.quest-meter, .ability-meter { background: rgba(255,255,255,.07); }
.ability-meter span { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* Class profile cards */
.class-profile-card {
  border-color: rgba(216,168,75,.14);
}
.class-profile-header {
  border-bottom: 1px solid rgba(216,168,75,.10);
  padding-bottom: 9px;
  margin-bottom: 8px;
}
.class-profile-section {
  background: rgba(255,255,255,.024);
  border: 1px solid rgba(255,255,255,.045);
  border-radius: 12px;
  padding: 9px;
  margin: 8px 0;
}
.class-profile-section strong { color: #f1d58f; }
.identity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.class-profile-traits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.class-profile-traits > div {
  background: rgba(8,7,11,.40);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.04);
}

/* Mobile: clean stacked guild cards */
@media (max-width: 900px) {
  .dark-guild-nav {
    grid-template-columns: 1fr;
    position: sticky;
    top: 0;
    max-height: 48svh;
    overflow: auto;
  }
  .nav-group > div { flex-wrap: nowrap; overflow-x: auto; }
  .nav-group button { flex: 0 0 auto; }
  .title-guildhall { min-height: 360px; }
  .grid.three, .grid.two, .combat-layout { grid-template-columns: 1fr; }
  .ability-shop-meta, .class-profile-traits { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .app-shell { padding: 10px; }
  .main-menu-hero .title { font-size: 2.55rem; }
  .title-actions { display: grid; grid-template-columns: 1fr; }
  .ability-card-grid { grid-template-columns: 1fr; }
  .ability-card-head { grid-template-columns: 42px 1fr; }
  .ability-icon { width: 42px; height: 42px; }
}

/* v0.9.4.2 — Item card layout + overflow fix */
.card,
.item-card,
.ability-card,
.skill-shop-card,
.class-profile-card,
.quest-card,
.unlock-tracker-card,
.evolution-card,
.mini-card,
.stat,
.item-row,
.skill-row,
.class-row,
.shop-tabs,
.navbar,
.nav-group,
.nav-group > div {
  min-width: 0;
}

.card *,
.item-card *,
.ability-card *,
.skill-shop-card *,
.class-profile-card *,
.quest-card *,
.unlock-tracker-card *,
.evolution-card * {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.pill,
.item-tag,
.ability-tag {
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
}

.item-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.item-card {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(24,22,30,.98), rgba(11,10,15,.98));
  border: 1px solid rgba(216,168,75,.14);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}

.item-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #858585, transparent);
}

.item-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.item-title-block,
.ability-card-head > div:last-child {
  min-width: 0;
}

.item-card h3,
.ability-card-head h3,
.skill-shop-card h3 {
  margin: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.item-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(216,168,75,.12);
  border: 1px solid rgba(216,168,75,.22);
  box-shadow: inset 0 0 20px rgba(216,168,75,.055);
  font-size: 1.35rem;
}

.item-description,
.ability-description {
  margin: 0;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-shop-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.item-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  min-width: 0;
}

.item-stat-row span,
.ability-stat-row span,
.ability-shop-meta span {
  flex: 0 0 auto;
  color: var(--muted);
}

.item-stat-row strong,
.ability-stat-row strong,
.ability-shop-meta strong {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.item-rarity-label {
  color: var(--accent);
  font-weight: 800;
}

.item-card.rarity-uncommon::before { background: linear-gradient(90deg, #72df9f, transparent); }
.item-card.rarity-rare::before { background: linear-gradient(90deg, #5e91ff, transparent); }
.item-card.rarity-epic::before { background: linear-gradient(90deg, #b56dff, transparent); }
.item-card.rarity-legendary::before { background: linear-gradient(90deg, #ffb24f, transparent); }
.item-card.rarity-mythic::before { background: linear-gradient(90deg, #ff6b6b, #b56dff, transparent); }
.item-card.rarity-world-class::before { background: linear-gradient(90deg, #fff1a8, #8bd3ff, transparent); }
.item-card.rarity-material::before { background: linear-gradient(90deg, #9aa3ad, transparent); }
.item-card.rarity-consumable::before { background: linear-gradient(90deg, #8bd3ff, transparent); }

.ability-stat-row,
.ability-shop-meta > div {
  min-width: 0;
}

.ability-shop-meta {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 760px) {
  .item-card-grid { grid-template-columns: 1fr; }
  .item-shop-meta { grid-template-columns: 1fr; }
  .item-card-head { grid-template-columns: 42px minmax(0, 1fr); }
  .item-icon { width: 42px; height: 42px; }
  .item-stat-row, .ability-stat-row, .ability-shop-meta > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .item-stat-row strong,
  .ability-stat-row strong,
  .ability-shop-meta strong {
    text-align: left;
  }
}

/* v0.9.6 Leveling Passives */
.passive-scaling-block {
  border-color: rgba(217, 164, 65, 0.24);
  background: rgba(217, 164, 65, 0.055);
}
.passive-scaling-block .pill,
.passive-bonus-card .pill {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.passive-bonus-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.passive-bonus-card {
  border-left: 3px solid rgba(217, 164, 65, 0.55);
}
.passive-bonus-card p,
.passive-scaling-block p {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* v0.9.8 Description Cleanup + Prescriptions + Mastery Gates */
.prescription-grid {
  margin-top: .75rem;
}
.prescription-card p,
.ability-card p,
.skill-shop-card p,
.class-profile-card p,
.item-card p {
  overflow-wrap: anywhere;
  word-break: normal;
}
.requirement-row strong,
.missing-requirement {
  color: var(--warning, #f6c177);
}
.missing-requirement {
  border-left: 3px solid var(--warning, #f6c177);
  padding-left: .6rem;
}
.ability-stat-row.requirement-row {
  border-color: rgba(246, 193, 119, .35);
  background: rgba(246, 193, 119, .06);
}
.prescription-card {
  background: linear-gradient(180deg, rgba(246, 193, 119, .07), rgba(120, 90, 45, .04));
}
.prescription-card strong:first-child {
  color: var(--accent, #f6c177);
}

/* v0.9.9 Legend Engine */
.legend-engine-hero {
  border-color: rgba(196, 159, 91, 0.45);
  background:
    radial-gradient(circle at top left, rgba(112, 83, 255, 0.18), transparent 32%),
    linear-gradient(135deg, rgba(40, 30, 19, 0.96), rgba(17, 20, 31, 0.96));
}
.legend-profile-card,
.legend-card,
.legend-achievement-card {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}
.legend-list {
  gap: 1rem;
}
.legend-card h3,
.legend-achievement-card h3 {
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.legend-achievement-card.selected {
  border-color: rgba(244, 205, 116, 0.75);
  box-shadow: 0 0 0 1px rgba(244, 205, 116, 0.28), 0 18px 42px rgba(0, 0, 0, 0.35);
}
.legend-card.complete {
  border-color: rgba(87, 224, 162, 0.65);
}
.legend-engine-hero .actions,
.legend-card .actions {
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .legend-engine-hero .actions button { width: 100%; }
  .legend-profile-card p,
  .legend-card p,
  .legend-achievement-card p { font-size: 0.92rem; }
}

/* v1.0.0 Roguelike Dungeon Map Update */
.dungeon-map-screen .dungeon-hero,
.dungeon-event-screen .dungeon-hero {
  border-color: rgba(197, 141, 62, 0.45);
  background:
    radial-gradient(circle at top left, rgba(197, 141, 62, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(15, 14, 18, 0.96), rgba(35, 25, 22, 0.94));
}

.dungeon-status-grid,
.dungeon-route-board,
.dungeon-supplies-card,
.dungeon-goals-card,
.run-summary-card {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dungeon-node-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.dungeon-node-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(197, 141, 62, 0.28);
  background:
    linear-gradient(180deg, rgba(22, 22, 28, 0.97), rgba(13, 13, 17, 0.98));
}

.dungeon-node-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: rgba(197, 141, 62, 0.55);
}

.dungeon-node-card.node-battle::before { background: rgba(206, 84, 62, 0.85); }
.dungeon-node-card.node-elite::before,
.dungeon-node-card.node-boss::before { background: rgba(220, 54, 54, 0.95); }
.dungeon-node-card.node-treasure::before { background: rgba(232, 183, 76, 0.95); }
.dungeon-node-card.node-shrine::before,
.dungeon-node-card.node-secret::before { background: rgba(147, 102, 255, 0.85); }
.dungeon-node-card.node-rest::before { background: rgba(75, 183, 124, 0.9); }
.dungeon-node-card.node-merchant::before { background: rgba(72, 191, 190, 0.9); }
.dungeon-node-card.node-cursed_altar::before { background: rgba(125, 25, 25, 1); }
.dungeon-node-card.node-forge::before { background: rgba(166, 121, 72, 0.95); }
.dungeon-node-card.node-alchemy::before { background: rgba(84, 184, 104, 0.9); }

.dungeon-node-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.node-icon {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.35rem;
  flex: 0 0 auto;
}

.node-meta-grid,
.supply-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.7rem 0;
}

.supply-pill,
.danger-pill {
  white-space: normal;
}

.danger-meter span,
.quest-meter span {
  display: block;
  height: 100%;
}

.dungeon-danger-card.danger-low { border-color: rgba(78, 181, 123, 0.45); }
.dungeon-danger-card.danger-medium { border-color: rgba(230, 180, 75, 0.55); }
.dungeon-danger-card.danger-high { border-color: rgba(224, 116, 65, 0.65); }
.dungeon-danger-card.danger-extreme { border-color: rgba(224, 55, 55, 0.8); box-shadow: 0 0 24px rgba(224, 55, 55, 0.12); }

.run-goal-card.complete {
  border-color: rgba(91, 205, 140, 0.65);
  background: rgba(42, 90, 62, 0.16);
}

.dungeon-choice-grid {
  align-items: stretch;
}

.dungeon-choice-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

.summary-kpis .mini-card {
  display: grid;
  gap: 0.3rem;
}

@media (max-width: 720px) {
  .dungeon-node-lanes,
  .dungeon-status-grid,
  .summary-kpis {
    grid-template-columns: 1fr;
  }
  .dungeon-node-top {
    align-items: flex-start;
  }
}


/* v1.1.1 Class Registry & Progression Rules */
.registry-full-grid {
  align-items: stretch;
}
.compact-registry-card h3,
.ability-registry-card h3 {
  overflow-wrap: anywhere;
  word-break: normal;
}
.registry-tags,
.ability-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}
.registry-requirements {
  margin-top: 0.65rem;
}
.current-stage {
  border-color: rgba(245, 197, 106, 0.55);
}
.previous-stage {
  opacity: 0.86;
}
.basic-class-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  max-height: 34rem;
  overflow: auto;
  padding-right: 0.25rem;
}
.basic-class-add-card p {
  overflow-wrap: anywhere;
}
.ability-registry-card .ability-stat-row strong {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* v1.1.2 Tactical Battle UI Cleanup + Boss Combat Polish */
.tactical-battle-screen {
  --battle-red: #ff7272;
  --battle-gold: #f0c36a;
  --battle-blue: #8bd3ff;
  --battle-purple: #b795ff;
}
.tactical-battle-hero {
  border-color: rgba(240, 195, 106, .38);
  background:
    radial-gradient(circle at top left, rgba(240, 195, 106, .15), transparent 34%),
    radial-gradient(circle at bottom right, rgba(139, 211, 255, .10), transparent 35%),
    linear-gradient(135deg, rgba(18, 16, 24, .98), rgba(36, 26, 23, .96));
}
.battle-turn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}
.battle-turn-strip span {
  background: rgba(255,255,255,.065);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: .45rem .7rem;
  color: var(--muted);
  font-size: .9rem;
}
.battle-turn-strip strong { color: var(--text); }
.battle-board.two-column-battle {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr);
  gap: var(--gap);
  align-items: start;
}
.battle-left-column,
.battle-right-column {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}
.enemy-combat-card,
.player-combat-card,
.ally-combat-card,
.enemy-intent-card,
.battle-action-panel,
.battlefield-modifier-card,
.boss-phase-card,
.battle-result-card {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.battle-card-head,
.ability-card-head {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  min-width: 0;
}
.battle-title-block,
.item-title-block,
.ability-card-head > div:last-child {
  min-width: 0;
}
.battle-title-block h2,
.battle-ability-card h3,
.battle-result-card h2,
.enemy-combat-card h2,
.player-combat-card h2 {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}
.battle-avatar,
.ability-icon {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .9rem;
  flex: 0 0 auto;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 1.25rem;
}
.enemy-avatar { background: rgba(255, 114, 114, .12); }
.player-avatar { background: rgba(139, 211, 255, .12); }
.boss-enemy-card {
  border-color: rgba(255, 114, 114, .46);
  box-shadow: 0 18px 38px rgba(109, 24, 24, .16);
}
.battle-matchup-row,
.battle-status-row,
.battle-tab-row,
.ally-tactics-row,
.ability-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: .65rem 0;
}
.weakness-pill { color: #bff4ff; border: 1px solid rgba(139, 211, 255, .25); }
.resist-pill { color: #ffc4c4; border: 1px solid rgba(255, 114, 114, .22); }
.battle-details-panel {
  margin-top: .65rem;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: .55rem;
}
.battle-details-panel summary,
.battle-log-panel summary,
.status-help-panel summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}
.enemy-intent-card {
  position: relative;
  overflow: hidden;
}
.enemy-intent-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--battle-gold);
}
.enemy-intent-card.intent-danger::before { background: var(--danger); }
.enemy-intent-card.intent-curse::before { background: var(--battle-purple); }
.enemy-intent-card.intent-spell::before { background: var(--battle-blue); }
.enemy-intent-card.intent-heal::before { background: var(--good); }
.enemy-intent-card.intent-guard::before { background: var(--battle-gold); }
.recommendation-strip,
.weakness-window-card {
  margin-top: .75rem;
  border: 1px solid rgba(240, 195, 106, .22);
  background: rgba(240, 195, 106, .08);
  border-radius: 14px;
  padding: .7rem;
  color: var(--muted);
  line-height: 1.4;
}
.battlefield-modifier-card {
  border-color: rgba(139, 211, 255, .24);
}
.ally-card-grid {
  display: grid;
  gap: .55rem;
}
.ally-mini-card {
  background: rgba(16, 13, 24, .88);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: .7rem;
}
.recommended-action-list {
  display: grid;
  gap: .5rem;
}
.recommendation-row {
  display: grid;
  gap: .15rem;
  background: rgba(16, 13, 24, .86);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: .65rem .75rem;
}
.recommendation-row strong { color: var(--text); }
.recommendation-row span { color: var(--muted); font-size: .9rem; }
.battle-tab-button {
  flex: 1 1 105px;
  min-height: 38px;
  padding: .55rem .7rem;
}
.battle-tab-button.active {
  background: linear-gradient(180deg, #f0c96a, #c58c2d);
  color: #1b1208;
}
.compact-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: .75rem;
  align-items: stretch;
}
.battle-ability-card {
  display: grid;
  gap: .58rem;
  min-width: 0;
  overflow: hidden;
  background: rgba(16, 13, 24, .92);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: .85rem;
}
.battle-ability-card.selected {
  border-color: rgba(240, 195, 106, .55);
  box-shadow: 0 0 0 1px rgba(240, 195, 106, .18);
}
.battle-ability-card p,
.battle-ability-card strong,
.battle-ability-card span,
.battle-ability-card h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.battle-ability-card .ability-stat-row,
.battle-result-card .ability-stat-row {
  display: grid;
  grid-template-columns: minmax(70px, .7fr) minmax(0, 1.3fr);
  gap: .5rem;
  align-items: start;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: .48rem .6rem;
}
.battle-ability-card .ability-stat-row span { color: var(--muted); }
.battle-ability-card .ability-stat-row strong { color: var(--text); text-align: right; }
.missing-requirement { color: #ffc2c2 !important; }
.battle-log-panel {
  max-height: none;
  overflow: visible;
}
.battle-log-panel summary {
  display: grid;
  gap: .25rem;
}
.battle-log-panel summary small {
  color: var(--muted);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.battle-log-lines {
  max-height: 260px;
  overflow: auto;
  margin-top: .6rem;
  display: flex;
  flex-direction: column-reverse;
}
.boss-phase-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  margin: .75rem 0;
}
.boss-phase-track span {
  text-align: center;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: .42rem .5rem;
  color: var(--muted);
  background: rgba(255,255,255,.04);
}
.boss-phase-track span.active {
  color: #ffe2e2;
  background: rgba(255, 114, 114, .13);
  border-color: rgba(255, 114, 114, .35);
}
.status-tooltip {
  cursor: help;
}
.status-help-panel {
  margin-top: .5rem;
}
.battle-result-hero.victory {
  border-color: rgba(114, 223, 159, .55);
  background: linear-gradient(135deg, rgba(19, 52, 38, .94), rgba(14, 13, 20, .96));
}
.battle-result-hero.defeat {
  border-color: rgba(255, 114, 114, .55);
  background: linear-gradient(135deg, rgba(62, 20, 20, .94), rgba(14, 13, 20, .96));
}
.battle-result-log {
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column-reverse;
}
.result-actions button {
  flex: 1 1 180px;
}
@media (min-width: 920px) {
  .battle-action-panel {
    position: sticky;
    top: 92px;
  }
}
@media (max-width: 900px) {
  .battle-board.two-column-battle,
  .grid.two {
    grid-template-columns: 1fr;
  }
  .battle-left-column { order: 1; }
  .battle-right-column { order: 2; }
}
@media (max-width: 720px) {
  .tactical-battle-screen { padding-bottom: 74px; }
  .battle-action-panel {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 8;
    box-shadow: 0 -12px 36px rgba(0,0,0,.35);
    border-color: rgba(240, 195, 106, .28);
  }
  .battle-tab-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; }
  .battle-tab-button { flex: 0 0 auto; }
  .compact-action-grid { grid-template-columns: 1fr; }
  .battle-ability-card .ability-stat-row { grid-template-columns: 1fr; }
  .battle-ability-card .ability-stat-row strong { text-align: left; }
  .battle-turn-strip span { width: 100%; }
  .boss-phase-track { grid-template-columns: 1fr; }
}
