/* AI-GM Mobile-First Frontend - T28.5 */
/* Based on Figma design v18-20 */

/* #668 — FAB raportu bugów (tester): wyżej nad kompozerem + paskiem statusu (SF4),
   safe-area na mobile, by nie był przycięty/nachodzący. Klasowy `[hidden]` działa
   (inline display:flex wcześniej go ignorował). */
.bug-fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(200px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1a1a2e;
  border: 1px solid #c0392b;
  color: #e74c3c;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: background 0.15s;
  touch-action: none; /* #668: pozwól na pionowy drag bez przewijania strony */
}
.bug-fab[hidden] { display: none; }
.bug-fab:hover { background: #24243e; }
@media (min-width: 768px) {
  /* desktop: kompozer niżej, FAB może siedzieć nieco bliżej dołu */
  .bug-fab { bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
}

:root {
  /* Colors */
  --bg-primary: #0a0908;
  --bg-secondary: #12100e;
  --bg-card: #1a1612;
  --bg-card-hover: #221e19;
  --bg-input: #0f0d0b;

  --accent: #c9a54a;
  --accent-light: #d4b65e;
  --accent-dark: #a8893d;
  --accent-glow: rgba(201, 165, 74, 0.15);

  --text-primary: #e8e4dc;
  --text-secondary: #9a958c;
  --text-muted: #6b665e;

  --border: #2a2622;
  --border-accent: rgba(201, 165, 74, 0.4);

  --gm-bubble: #2d4a2d;
  --gm-bubble-border: #3d6a3d;
  --user-bubble: #1e3a5f;
  --user-bubble-border: #2e5a8f;
  --system-bubble: #252220;

  --success: #22a746;
  --danger: #c94a4a;
  --warning: #c9944a;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Screen backgrounds — overridden at runtime by /api/ui/backgrounds */
  /* #896: default is none so browser never paints stale image before JS runs */
  --bg-screen-login: none;
  --bg-screen-campaigns: url('../img/bg-campaigns.jpg');
  --bg-screen-new-campaign: url('https://wallpapercave.com/wp/wp5534522.jpg');
  --bg-screen-wizard: url('../img/bg-hero.jpg');
  --bg-screen-game: url('../img/bg-dungeon.jpg');
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


/* Screens */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-top);
}

.screen--active {
  display: flex;
}

/* Hide fixed panels when game screen is not active */
#game-screen:not(.screen--active) .sheet-panel,
#game-screen:not(.screen--active) .settings-panel,
#game-screen:not(.screen--active) .journal-panel,
#game-screen:not(.screen--active) .panel-overlay {
  display: none !important;
}

#game-screen.screen {
  padding-bottom: 0;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.header__left,
.header__right {
  width: 40px;
  flex-shrink: 0;
}

.header__center {
  flex: 1;
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
}

.header__icon {
  font-size: 20px;
}

/* #952 — wiersz tożsamości: imię (truncate) + chip czasu / klaster lochu inline */
.header__id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header__title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header__subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}
.header__subtitle[hidden] { display: none; }

/* Game clock chip (#952) — kompaktowy "☀ D1·Rano" zamiast osobnego wiersza */
.header__clock-chip {
  flex-shrink: 0;
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(201, 165, 74, 0.28);
  background: rgba(201, 165, 74, 0.08);
  color: rgba(201, 165, 74, 0.85);
  white-space: nowrap;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.header__clock-chip[hidden] { display: none; }
.header__clock-chip[data-period="Rano"]       { color: rgba(255, 215, 130, 0.9);  border-color: rgba(255, 215, 130, 0.3); }
.header__clock-chip[data-period="Popołudnie"] { color: rgba(201, 165, 74, 0.9);   border-color: rgba(201, 165, 74, 0.3); }
.header__clock-chip[data-period="Wieczór"]    { color: rgba(220, 130, 80, 0.9);   border-color: rgba(220, 130, 80, 0.32); }
.header__clock-chip[data-period="Noc"]        { color: rgba(140, 160, 220, 0.85); border-color: rgba(120, 140, 200, 0.32); }

/* #952 — kontekstowy klaster lochu, inline w pasku (zastępuje chip czasu) */
.header__dungeon {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  font-size: 0.7rem;
}
.header__dungeon[hidden] { display: none; }
.header__dungeon-label {
  font-family: Cinzel, serif;
  font-size: 0.72rem;
  color: #e09030;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(201,117,26,0.4);
  flex-shrink: 0;
}
.header__dungeon-progress { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.header__dungeon-room {
  font-size: 0.64rem; color: #a08060; text-transform: uppercase;
  letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header__dungeon-btn {
  background: none; border: 1px solid #3a2510; border-radius: 6px;
  color: #c9a060; font-size: 0.78rem; padding: 2px 7px; cursor: pointer; flex-shrink: 0;
  line-height: 1;
}
.header__dungeon-btn:hover { border-color: #c9751a; color: #e8951a; }
.header__dungeon-btn[hidden] { display: none; }

/* #952 — HP/mana jako cienkie włoski pod imieniem */
.header__hairlines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
}

.header-hp-bar {
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  width: 100%;
  max-width: 220px;
  overflow: hidden;
}

.header-hp-bar__fill {
  height: 100%;
  background: var(--success);
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background-color 0.4s ease;
}

.header-hp-bar__fill--low {
  background: #e8572a;
}

.header-hp-bar__fill--critical {
  background: #c0392b;
}

.header-mana-bar {
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  width: 100%;
  max-width: 220px;
  overflow: hidden;
}

.header-mana-bar__fill {
  height: 100%;
  background: #3b82f6;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.quest-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
  max-width: 200px;
}
.quest-bar[hidden] { display: none; }
.quest-chip {
  font-size: 0.62rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(201,165,74,0.15);
  border: 1px solid rgba(201,165,74,0.35);
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  cursor: default;
}

.quest-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.quest-card {
  background: rgba(201,165,74,0.08);
  border: 1px solid rgba(201,165,74,0.25);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.quest-card__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.quest-card__objective {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 3px;
}
.quest-card__reward {
  font-size: 0.68rem;
  color: var(--text-tertiary);
}

.header__back,
.header__action,
.header__avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.header__back:hover,
.header__action:hover,
.header__avatar:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}

.header__avatar {
  border-color: var(--accent);
  color: var(--accent);
}

.header--game {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 50px;
  padding: 6px 12px;
  gap: 8px;
  transition: transform 0.25s ease;
}

/* #952 — auto-hide: pasek chowa się przy czytaniu (scroll w dół), wraca przy scrollu w górę */
.header--game.header--hidden {
  transform: translateY(-100%);
}
/* #967: w walce pasek NIGDY nie ucieka — body.combat-active overriduje translateY */
body.combat-active .header--game {
  transform: none !important;
}

/* #952 — kompaktowe ikony akcji w pasku gry */
.header--game .header__avatar,
.header--game .header__action {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

/* #952 — dropdown menu ☰ (position:fixed, kotwiczone przez JS pod ☰ — poza <header> żeby nie rozciągać belki) */
.game-menu {
  position: fixed;
  z-index: 200;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 2px;
  background: var(--bg-secondary, #1a1206);
  border: 1px solid var(--border, #3a2510);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
}
.game-menu[hidden] { display: none; }
.game-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 7px);
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.game-menu__item:hover { background: var(--bg-card, rgba(255,255,255,0.06)); }
.game-menu__item svg { flex-shrink: 0; color: var(--accent, #c9a54a); }
.game-menu__item--exit { color: #c06040; }
.game-menu__item--exit:hover { background: rgba(192,96,64,0.12); }
.game-menu__item[hidden] { display: none; }
#game-menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* Login Screen - Mystical Portal */
#login-screen {
  background:
    /* Magical glow from center */
    radial-gradient(ellipse at center, rgba(201, 165, 74, 0.08) 0%, transparent 40%),
    /* Dark edges */
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%),
    /* Background image - mystical */
    var(--bg-screen-login) center/cover no-repeat,
    /* Fallback gradient */
    linear-gradient(180deg, #12100e 0%, #0a0908 50%, #050404 100%);
}

/* Campaigns Screen - Adventure Map */
#campaigns-screen {
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.85) 0%, rgba(10, 9, 8, 0.7) 50%, rgba(10, 9, 8, 0.9) 100%),
    var(--bg-screen-campaigns) center/cover no-repeat,
    linear-gradient(180deg, #0f0d0b 0%, #0a0908 100%);
}

/* New Campaign Screen - Forge/Creation */
#new-campaign-screen {
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.82) 0%, rgba(10, 9, 8, 0.6) 50%, rgba(10, 9, 8, 0.88) 100%),
    var(--bg-screen-new-campaign) center/cover no-repeat,
    #0a0908;
}

/* Character Wizard - Hero's Journey */
#character-wizard-screen {
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.85) 0%, rgba(10, 9, 8, 0.7) 50%, rgba(10, 9, 8, 0.85) 100%),
    var(--bg-screen-wizard) center/cover no-repeat,
    #0a0908;
}

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-xl);
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.login__logo {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.login__icons {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.login__icon {
  font-size: 28px;
  opacity: 0.7;
}

.login__icon--main {
  font-size: 48px;
  opacity: 1;
  color: var(--accent);
}

.login__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.login__subtitle {
  font-size: var(--font-size-sm);
  color: var(--accent);
  font-style: italic;
  margin-top: var(--space-sm);
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.login__footer {
  text-align: center;
  margin-top: var(--space-2xl);
}

.login__quote {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

.login__version {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* Form Fields */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-field label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-field textarea {
  min-height: 100px;
  resize: vertical;
}

.form-field__counter {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: right;
}

.form-field input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  padding: 0;
}

.form-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  min-height: 44px; /* iOS HIG touch target minimum */
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--bg-primary);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201, 165, 74, 0.3);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn--secondary:hover {
  border-color: var(--accent);
}

.btn--danger {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: var(--text-primary);
}

.btn--danger:hover {
  background: #a83a3a;
}

.btn--full {
  width: 100%;
  min-height: 52px;
}

.btn__icon {
  font-size: 16px;
}

/* Campaigns */
.campaigns {
  flex: 1;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

#campaigns-list:empty {
  display: none;
}

.campaign-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  position: relative;
}

.campaign-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.campaign-card--new {
  background: linear-gradient(135deg, rgba(201, 165, 74, 0.15) 0%, rgba(201, 165, 74, 0.05) 100%);
  border-color: var(--accent);
}

.campaign-card__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.campaign-card__content {
  flex: 1;
  min-width: 0;
}

.campaign-card__content h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.campaign-card__content p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campaign-card__arrow {
  font-size: 24px;
  color: var(--accent);
}

/* Campaign Delete - Swipe wrapper */
.campaign-swipe-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

/* ────────────────────────────────────────────────────────────────────────
   Stage 6 H3–H5 — Hero hub: enriched cards, status chips, history modal.
   ──────────────────────────────────────────────────────────────────────── */
.hero-card-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.2s, transform 0.15s;
}
.hero-card-wrapper:hover {
  border-color: rgba(201,165,74,0.45);
}
.hero-card {
  flex: 1;
  padding: 14px 14px 12px;
  cursor: pointer;
  position: relative;
}
.hero-card__main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.hero-card__icon {
  flex: 0 0 36px;
  font-size: 26px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(201,165,74,0.35));
  line-height: 1;
  padding-top: 2px;
}
.hero-card__body {
  flex: 1;
  min-width: 0;
}
.hero-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.hero-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-card__sub {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero-card__lastseen {
  color: rgba(201,165,74,0.65);
  font-style: italic;
}
.hero-card__campaign {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: rgba(201,165,74,0.75);
}
.hero-card__trophy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.06);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.hero-card__trophy span { white-space: nowrap; }

.hero-card__history-btn,
.hero-card__awansuj-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(201,165,74,0.35);
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hero-card__history-btn:hover {
  background: rgba(201,165,74,0.12);
  border-color: var(--accent);
}
.hero-card__awansuj-btn {
  border-color: rgba(74,222,128,0.55);
  color: #4ade80;
  margin-left: 0;
}
.hero-card__awansuj-btn:hover {
  background: rgba(74,222,128,0.10);
  border-color: #4ade80;
}

.hero-card__delete {
  background: #3a1212;
  border: none;
  border-left: 1px solid var(--border);
  color: #c94a4a;
  padding: 0 14px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.15s, color 0.15s;
}
.hero-card__delete:hover {
  background: #4a1a1a;
  color: #f87171;
}

/* Status chips */
.hero-status-chip {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.hero-status--idle {
  background: rgba(74,222,128,0.12);
  border: 1px solid rgba(74,222,128,0.45);
  color: #86efac;
}
.hero-status--campaign {
  background: rgba(201,165,74,0.12);
  border: 1px solid rgba(201,165,74,0.45);
  color: var(--accent);
}
.hero-status--dungeon {
  background: rgba(220,38,38,0.12);
  border: 1px solid rgba(220,38,38,0.45);
  color: #fca5a5;
}

/* ── H4 Hero history modal ───────────────────────────────────────────── */
.hero-history-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9100;
}
.hero-history-modal--open { display: block; }
.hero-history-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
}
.hero-history-modal__card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 64px);
  background: linear-gradient(180deg, rgba(28,24,32,0.98) 0%, rgba(20,18,26,0.98) 100%);
  border: 1px solid rgba(201,165,74,0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: hero-history-pop 0.22s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes hero-history-pop {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.hero-history-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(201,165,74,0.18);
}
.hero-history-modal__header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.hero-history-modal__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.hero-history-modal__close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.hero-history-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px 18px;
}
.hero-history-modal__loading,
.hero-history-modal__empty {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 18px 0;
}

.hero-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-history-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: rgba(28,24,32,0.6);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
}
.hero-history-row--victory   { border-left-color: #4ade80; }
.hero-history-row--death     { border-left-color: #f87171; }
.hero-history-row--abandoned { border-left-color: rgba(201,165,74,0.55); }
.hero-history-row__icon {
  font-size: 20px;
  line-height: 1;
  padding-top: 2px;
}
.hero-history-row__main { flex: 1; min-width: 0; }
.hero-history-row__title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-history-row__meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.hero-history-row__summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.campaign-swipe-wrapper .campaign-card {
  position: relative;
  z-index: 1;
  transition: transform 0.2s ease-out;
  border-radius: var(--radius-lg);
}

.campaign-delete-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 24px;
  z-index: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* Desktop: subtle X on hover */
.campaign-card__delete {
  position: absolute;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  z-index: 2;
  line-height: 1;
  padding: 0;
}

.campaign-card__delete:hover {
  color: var(--danger);
}

/* Desktop hover behavior */
@media (hover: hover) and (pointer: fine) {
  .campaign-swipe-wrapper:hover .campaign-card__delete {
    opacity: 1;
  }

  .campaign-swipe-wrapper .campaign-delete-action {
    display: none;
  }
}

/* Mobile: swipe reveal */
@media (hover: none) and (pointer: coarse) {
  .campaign-card__delete {
    display: none;
  }

  .campaign-swipe-wrapper.swiped .campaign-card {
    transform: translateX(-80px);
  }
}

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl);
}

.empty-state__icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: var(--space-lg);
}

.empty-state h3 {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Wizard */
.wizard-content {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
}

.wizard-hero {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.wizard-hero__icon {
  display: inline-block;
  font-size: 48px;
  margin-bottom: var(--space-lg);
}

.wizard-hero h2 {
  font-size: var(--font-size-xl);
  color: var(--accent);
  margin-bottom: var(--space-md);
}

.wizard-hero p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
}

.wizard-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.wizard-footer {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Suggestions */
.suggestions {
  margin-top: var(--space-lg);
}

.suggestions__label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.suggestions__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.chip {
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Archetype Cards */
.archetype-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.archetype-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.2s;
}

.archetype-card:hover {
  border-color: var(--accent);
}

.archetype-card--selected {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.archetype-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 24px;
  flex-shrink: 0;
}

.archetype-card__content {
  flex: 1;
}

.archetype-card__content h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: 4px;
}

.archetype-card__content p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.archetype-card__check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 50%;
  color: var(--bg-primary);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.archetype-card--selected .archetype-card__check {
  opacity: 1;
}

/* Stat Rows */
.stat-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-row__label {
  flex: 1;
  font-weight: 600;
}

.stat-row__modifier {
  font-size: var(--font-size-sm);
  color: var(--accent);
  min-width: 32px;
}

.stat-row__value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.stat-row__btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.stat-row__btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.stat-row__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Game Screen Layout - Fixed composer at bottom */
#game-screen {
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.95) 0%, rgba(10, 9, 8, 0.8) 30%, rgba(10, 9, 8, 0.85) 100%),
    var(--bg-screen-game) center/cover no-repeat,
    #0a0908;
}

/* Torch glow effect on sides */
#game-screen::before,
#game-screen::after {
  content: '';
  position: absolute;
  top: 80px;
  width: 120px;
  height: 500px;
  pointer-events: none;
  z-index: 0;
  animation: torchFlicker 4s ease-in-out infinite;
}

#game-screen::before {
  left: -60px;
  background: radial-gradient(ellipse at left center, rgba(201, 165, 74, 0.12) 0%, transparent 70%);
}

#game-screen::after {
  right: -60px;
  background: radial-gradient(ellipse at right center, rgba(201, 165, 74, 0.12) 0%, transparent 70%);
  animation-delay: 2s;
}

@keyframes torchFlicker {
  0%, 100% { opacity: 0.4; }
  25% { opacity: 0.6; }
  50% { opacity: 0.45; }
  75% { opacity: 0.55; }
}

#game-screen .header {
  flex-shrink: 0;
}

/* Chat */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

/* ── Time-of-day overlay (continuous luminous frame) ─────────────────────
   Treats the entire game viewport as one room with ambient lighting from
   four corners. Header owns the top corners + bottom-edge bleed; composer
   owns the bottom corners + top-edge bleed; chat fills the middle with
   side edges and an optional bg wash. Together they form a single
   atmospheric frame instead of three boxed-in halos.

   Driven by CSS variables set in JS by applyTimeOfDayOverlay():
     --tod-color        — primary tint (period color, applied to corners
                          near the chat and to side edges)
     --tod-accent       — light edge highlight (applied to far corners
                          farthest from the chat — like sunlight on a
                          window ledge)
     --tod-intensity    — 0..1 opacity multiplier
   And data attrs on <html>:
     data-tod-mode      — "frame" | "bg" | "both" | "off"
     data-tod-period    — "Rano" | "Popołudnie" | "Wieczór" | "Noc"
   Scoping: ONLY inside #game-screen — login/wizard headers stay clean.
*/

#game-screen .header,
#game-screen .composer {
  position: relative;
}

/* Top half of the frame — header owns the top corners and faintly bleeds
   downward along its bottom edge (toward the chat). */
#game-screen .header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(circle 90px at 0%   0%,  var(--tod-accent, transparent) 0%, transparent 65%),
    radial-gradient(circle 90px at 100% 0%,  var(--tod-accent, transparent) 0%, transparent 65%),
    linear-gradient(0deg, var(--tod-color, transparent) 0%, transparent 35%);
  mix-blend-mode: screen;
}
/* Keep clickable controls (buttons, name, clock) above the wash */
#game-screen .header > * { position: relative; z-index: 1; }

/* Middle — chat keeps the side bleeds and an optional bg wash */
.chat::before,
.chat::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transition: opacity 1.2s ease;
}
/* Side edges only — no corner glows (those live on header/composer now) */
.chat::before {
  background:
    linear-gradient(90deg,  var(--tod-color, transparent) 0%, transparent 6%),
    linear-gradient(270deg, var(--tod-color, transparent) 0%, transparent 6%);
  mix-blend-mode: screen;
}
.chat::after {
  background:
    radial-gradient(ellipse 120% 50% at 50% -10%, var(--tod-color, transparent) 0%, transparent 60%);
  mix-blend-mode: soft-light;
}

/* Bottom half of the frame — composer owns the bottom corners and faintly
   bleeds upward along its top edge (toward the chat). */
#game-screen .composer::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(circle 110px at 0%   100%, var(--tod-color, transparent) 0%, transparent 70%),
    radial-gradient(circle 110px at 100% 100%, var(--tod-color, transparent) 0%, transparent 70%),
    linear-gradient(180deg, var(--tod-color, transparent) 0%, transparent 30%);
  mix-blend-mode: screen;
}
#game-screen .composer > * { position: relative; z-index: 1; }

/* Mode + intensity gates — apply opacity in lockstep across all three regions */
:root[data-tod-mode="frame"] #game-screen .header::after,
:root[data-tod-mode="both"]  #game-screen .header::after,
:root[data-tod-mode="frame"] #game-screen .composer::after,
:root[data-tod-mode="both"]  #game-screen .composer::after {
  opacity: calc(var(--tod-intensity, 0.6) * 0.55);
}
:root[data-tod-mode="frame"] .chat::before,
:root[data-tod-mode="both"]  .chat::before {
  opacity: calc(var(--tod-intensity, 0.6) * 0.40);  /* side bleeds slightly subtler */
}
:root[data-tod-mode="bg"]    .chat::after,
:root[data-tod-mode="both"]  .chat::after {
  opacity: calc(var(--tod-intensity, 0.6) * 0.35);
}

/* Period-specific atmospheric tweaks — Noc gets a darker, deeper feel */
:root[data-tod-period="Noc"] #game-screen .header::after,
:root[data-tod-period="Noc"] #game-screen .composer::after,
:root[data-tod-period="Noc"] .chat::before { mix-blend-mode: overlay; }
:root[data-tod-period="Noc"] .chat::after  {
  mix-blend-mode: multiply;
  opacity: calc(var(--tod-intensity, 0.6) * 0.22);
}

/* Respect reduced-motion — drop the slow fade transition */
@media (prefers-reduced-motion: reduce) {
  #game-screen .header::after,
  #game-screen .composer::after,
  .chat::before,
  .chat::after { transition: none; }
}

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  padding-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.message,
.chat-bubble {
  max-width: 85%;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  animation: messageIn 0.2s ease-out;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message--gm,
.chat-bubble--gm {
  align-self: flex-start;
  background: var(--gm-bubble);
  border: 1px solid var(--gm-bubble-border);
  border-bottom-left-radius: var(--radius-sm);
}

.message--user,
.chat-bubble--user {
  align-self: flex-end;
  background: var(--user-bubble);
  border: 1px solid var(--user-bubble-border);
  border-bottom-right-radius: var(--radius-sm);
}

.message--system,
.chat-bubble--system {
  align-self: center;
  background: var(--system-bubble);
  border: 1px solid var(--border);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.message__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.message__icon {
  font-size: 14px;
  opacity: 0.7;
}

.message__time,
.chat-bubble__time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

.chat-bubble__content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  font-size: var(--chat-font-size, inherit);
  font-family: var(--chat-font-family, inherit);
  transition: font-size 0.2s ease;
}

/* ── Streaming GM bubble ─────────────────────────────────────────────────── */
.chat-bubble--streaming {
  min-width: min(480px, 80vw);   /* holds fixed width while tokens arrive */
}

.chat-bubble--streaming .chat-bubble__content {
  white-space: pre-wrap;
}

@keyframes stream-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── GM Narrative paragraph formatting ──────────────────────────────────── */
.chat-bubble--gm .gm-p {
  margin: 0 0 0.55em 0;
  line-height: 1.72;
}
.chat-bubble--gm .gm-p:last-child { margin-bottom: 0; }

/* Em-dash dialog paragraph: — "Czego chcesz od nas?" */
.chat-bubble--gm .gm-p--speech {
  font-style: italic;
  color: #d4a565;
  padding-left: 10px;
  border-left: 2px solid rgba(212, 165, 101, 0.4);
  margin-left: 2px;
}

/* Inline quoted speech „..." */
.chat-bubble--gm .gm-speech {
  font-style: italic;
  color: #d4a565;
}

/* Bubble metadata row */
.chat-bubble__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  gap: 6px;
  flex-wrap: wrap;
}

.bubble-meta__left,
.bubble-meta__right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.bubble-meta__name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.75;
}

.bubble-meta__turn {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  opacity: 0.7;
  background: rgba(201, 165, 74, 0.1);
  border-radius: 3px;
  padding: 1px 4px;
}

.bubble-meta__route {
  display: none;
}

.bubble-meta__datetime {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

/* Visibility toggles via body classes */
body.hide-bubble-name .bubble-meta__name { display: none; }
body.hide-bubble-turn .bubble-meta__turn { display: none; }
body.hide-bubble-datetime .bubble-meta__datetime { display: none; }

/* Slash command autocomplete popup */
.slash-popup {
  display: none;
  position: fixed;
  z-index: 9100;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
  max-height: 240px;
  overflow-y: auto;
}

.slash-popup--open {
  display: block;
}

.slash-popup-item {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.slash-popup-item:last-child {
  border-bottom: none;
}

.slash-popup-item:hover,
.slash-popup-item--active {
  background: rgba(201, 165, 74, 0.12);
}

.slash-popup-cmd {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'Courier New', monospace;
}

.slash-popup-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Composer */
.composer {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.composer__input-wrap {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  position: relative;
}

.composer__tts-reading {
  position: absolute;
  left: 52px;
  right: 58px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 18px;
  background: var(--bg-input);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-full);
  cursor: pointer;
  overflow: hidden;
}
.composer__tts-reading[hidden] { display: none; }

.composer__tts-reading span {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: var(--accent);
  height: 60%;
  animation: tts-eq 0.7s ease-in-out infinite;
  transform-origin: center;
}
.composer__tts-reading span:nth-child(1)  { animation-delay: 0.00s; }
.composer__tts-reading span:nth-child(2)  { animation-delay: 0.08s; }
.composer__tts-reading span:nth-child(3)  { animation-delay: 0.16s; }
.composer__tts-reading span:nth-child(4)  { animation-delay: 0.24s; }
.composer__tts-reading span:nth-child(5)  { animation-delay: 0.32s; }
.composer__tts-reading span:nth-child(6)  { animation-delay: 0.40s; }
.composer__tts-reading span:nth-child(7)  { animation-delay: 0.32s; }
.composer__tts-reading span:nth-child(8)  { animation-delay: 0.24s; }
.composer__tts-reading span:nth-child(9)  { animation-delay: 0.16s; }
.composer__tts-reading span:nth-child(10) { animation-delay: 0.08s; }
.composer__tts-reading span:nth-child(11) { animation-delay: 0.00s; }
.composer__tts-reading span:nth-child(12) { animation-delay: 0.08s; }
.composer__tts-reading span:nth-child(13) { animation-delay: 0.16s; }
.composer__tts-reading span:nth-child(14) { animation-delay: 0.24s; }
.composer__tts-reading span:nth-child(15) { animation-delay: 0.32s; }

@keyframes tts-eq {
  0%, 100% { transform: scaleY(0.2); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.composer__input {
  flex: 1;
  min-width: 0;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
}

.composer__input:focus {
  outline: none;
  border-color: var(--accent);
}

.composer__mic {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.composer__mic:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.composer__mic.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.composer__mic.is-recording {
  border-color: #e74c3c;
  color: #e74c3c;
  animation: pulse-mic 1s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

.composer__voice-status {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px var(--space-md) 0;
  text-align: center;
}

.bubble-reread-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.6;
  vertical-align: middle;
  transition: opacity 0.15s, color 0.15s;
  border-radius: var(--radius-sm);
}

.bubble-reread-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.settings-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
  font-style: italic;
}

.composer__send {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.composer__send:hover {
  transform: scale(1.05);
}

.composer__send:active {
  transform: scale(0.95);
}

.composer__dice {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 20px;
}

.composer__dice:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.composer__dice:active {
  transform: scale(0.95);
}

/* Dice Modal */
.dice-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.dice-modal[hidden] {
  display: none;
}

.dice-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.dice-modal__content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.dice-modal__content h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
}

.dice-modal__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.dice-btn {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dice-btn:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.dice-btn:active {
  transform: scale(0.95);
}

.dice-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.dice-btn--primary:hover {
  background: var(--accent-light);
}

.dice-modal__custom {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.dice-modal__custom input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-size-sm);
}

.dice-modal__custom input:focus {
  outline: none;
  border-color: var(--accent);
}

.dice-modal__custom .btn {
  padding: var(--space-sm) var(--space-md);
  min-height: auto;
}

.dice-modal__close {
  width: 100%;
  padding: var(--space-md);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.dice-modal__close:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Sheet Panel */
.sheet-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sheet-panel--open {
  transform: translateY(0);
}

.sheet-panel__handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: var(--space-md) auto;
}

.sheet-panel__header {
  padding: 0 var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.sheet-panel__header h2 {
  font-size: var(--font-size-xl);
  margin: 0;
}

.sheet-header-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.sheet-location-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 100%;
}

.sheet-location-badge__pin {
  font-size: 0.95em;
  line-height: 1;
}

.sheet-location-badge__label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.sheet-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  padding: var(--space-xs);
}

.sheet-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.sheet-tab:hover {
  color: var(--text-primary);
}

.sheet-tab--active {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.sheet-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

.sheet-tab-content {
  display: none;
}

.sheet-tab-content--active {
  display: block;
}

.sheet-section-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.sheet-panel__hint {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
}

/* Stat Cards */
.stat-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.stat-card--hp {
  border-color: var(--success);
}

.stat-card__label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.stat-card__value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.stat-card__bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  margin-top: var(--space-md);
  overflow: hidden;
}

.stat-card__bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: var(--radius-full);
  transition: width 0.3s;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.stats-grid .stat-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-md);
}

.stats-grid .stat-row__value {
  display: flex;
  gap: var(--space-sm);
}

.stats-grid .stat-row__modifier {
  color: var(--accent);
}

/* Skills List */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.skill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.skill-row__info h4 {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.skill-row__info p {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.skill-row__dots {
  display: flex;
  gap: 4px;
}

.skill-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.skill-row__dot--filled {
  background: var(--accent);
}

/* ============================================================
   Inventory Tab — Adventurer's Pack
   ============================================================ */

/* Gold tally — small ingot card with warm radial wash */
.inv-gold {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
  background: linear-gradient(135deg, rgba(201,165,74,0.08), rgba(201,165,74,0.02));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.inv-gold::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 0% 50%, rgba(201,165,74,0.14), transparent 60%);
  pointer-events: none;
}
.inv-gold > * { position: relative; }
.inv-gold__icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-dark) 100%);
  color: #2a1f00;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.04em;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 1px 2px rgba(0,0,0,0.5);
}
.inv-gold__label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.inv-gold__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.inv-gold__unit {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* Section dividers — hairline gold rule with small-caps label */
.inv-section-label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0 var(--space-md);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  font-weight: 600;
}
.inv-section-label::before,
.inv-section-label::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(to right, transparent, var(--border) 50%, transparent);
}
.inv-section-label > span:first-child { flex-shrink: 0; }
.inv-section-label__count {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  text-align: center;
}
.inv-section-label--lore { color: rgba(201,165,74,0.55); }

/* Equipment triptych */
.inv-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
.inv-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) var(--space-sm) var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 118px;
  text-align: center;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.inv-slot--empty {
  border-style: dashed;
  border-color: rgba(201,165,74,0.18);
  background: transparent;
}
.inv-slot--filled {
  border-color: var(--border-accent);
  background:
    linear-gradient(180deg, rgba(201,165,74,0.07) 0%, var(--bg-card) 70%);
  box-shadow:
    inset 0 1px 0 rgba(201,165,74,0.08),
    0 4px 14px rgba(0,0,0,0.28);
}
.inv-slot__icon {
  width: 30px; height: 30px;
  margin-bottom: 6px;
  color: var(--text-muted);
  transition: color 0.25s ease;
}
.inv-slot--filled .inv-slot__icon { color: var(--accent); }
.inv-slot__type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1;
}
.inv-slot__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-xs);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  padding: 0 2px;
}
.inv-slot__name--empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}
.inv-slot__unequip {
  margin-top: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  font-weight: 600;
  font-family: inherit;
}
.inv-slot__unequip:hover {
  color: #e88a8a;
  background: rgba(201,74,74,0.1);
}

/* Equip pulse — fires once after successful equip */
@keyframes inv-equip-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(201,165,74,0.55), inset 0 1px 0 rgba(201,165,74,0.08); }
  100% { box-shadow: 0 0 0 14px rgba(201,165,74,0),  inset 0 1px 0 rgba(201,165,74,0.08); }
}
.inv-slot--just-equipped { animation: inv-equip-pulse 0.7s ease-out; }

/* ──────────────────────────────────────────────────────────────────────────
   Stage 5 E5/E6/E7 — Anatomical 8-slot equipment diagram.
   Heraldic medieval aesthetic: 8 ornate cartouches arranged around a
   golden warrior silhouette. Empty slots = parchment-dim. Filled = gold-lit.
   Locked-by-full-armor = chain icon. Wounded = blood overlay + red gradient.
   ────────────────────────────────────────────────────────────────────────── */

.anatomy {
  margin: 4px 0 var(--space-md);
}

.anatomy__frame {
  position: relative;
  padding: 18px 8px 10px;
  border: 1px solid rgba(201,165,74,0.18);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at center, rgba(201,165,74,0.04) 0%, transparent 60%),
    linear-gradient(180deg, rgba(20,18,26,0.45) 0%, rgba(10,9,8,0.0) 100%);
  /* Ornamental corner brackets (gold leaf, etched-in look) */
  box-shadow:
    inset 0 0 0 1px rgba(201,165,74,0.04),
    inset 0 1px 0 rgba(201,165,74,0.12);
}
.anatomy__frame::before,
.anatomy__frame::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid rgba(201,165,74,0.45);
  pointer-events: none;
}
.anatomy__frame::before {
  top: -2px; left: -2px;
  border-right: none; border-bottom: none;
  border-top-left-radius: 12px;
}
.anatomy__frame::after {
  bottom: -2px; right: -2px;
  border-left: none; border-top: none;
  border-bottom-right-radius: 12px;
}

/* Background warrior silhouette — golden line art behind the slot grid */
.anatomy__silhouette {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(100px, 32%, 180px);
  height: auto;
  pointer-events: none;
  opacity: 0.10;
  z-index: 0;
}
.anatomy__silhouette > * {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.anatomy__silhouette circle {
  fill: rgba(201,165,74,0.10);
}
.anatomy__silhouette path {
  fill: rgba(201,165,74,0.03);
}
.anatomy__silhouette .anatomy__crest {
  fill: rgba(201,165,74,0.18);
  stroke-width: 0.8;
}

/* Slot grid — 3 columns, anatomically-placed areas */
.anatomy__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ". head ."
    "larm torso rarm"
    ". hands ."
    "lleg . rleg"
    "mainh . offh";
  gap: 8px;
}

.anatomy-slot--head  { grid-area: head; }
.anatomy-slot--larm  { grid-area: larm; }
.anatomy-slot--torso { grid-area: torso; }
.anatomy-slot--rarm  { grid-area: rarm; }
.anatomy-slot--hands { grid-area: hands; }
.anatomy-slot--lleg  { grid-area: lleg; }
.anatomy-slot--rleg  { grid-area: rleg; }
.anatomy-slot--mainh { grid-area: mainh; }
.anatomy-slot--offh  { grid-area: offh; }

/* Base cartouche styling — small ornate shield-shape via clip-path on a corner cut */
.anatomy-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 6px 6px 8px;
  min-height: 76px;
  border: 1px solid rgba(201,165,74,0.18);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(28,24,32,0.85) 0%, rgba(20,18,26,0.92) 100%);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.15s, box-shadow 0.25s;
  outline: none;
  user-select: none;
}
.anatomy-slot::before {
  /* Inner gold-leaf rim, hairline */
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  pointer-events: none;
  transition: border-color 0.25s;
}
.anatomy-slot:hover {
  border-color: rgba(201,165,74,0.45);
  transform: translateY(-1px);
}
.anatomy-slot:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(201,165,74,0.35);
}

.anatomy-slot__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin-bottom: 4px;
}
.anatomy-slot__icon {
  display: inline-flex;
  width: 16px; height: 16px;
  color: rgba(201,165,74,0.55);
  flex-shrink: 0;
}
.anatomy-slot__icon svg { width: 100%; height: 100%; }
.anatomy-slot__type {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(201,165,74,0.75);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.anatomy-slot__name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  padding: 0 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.anatomy-slot__name--empty {
  color: rgba(201,165,74,0.32);
  font-weight: 400;
  font-style: italic;
  font-size: 16px;
}
.anatomy-slot__name--locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: rgba(201,165,74,0.55);
  font-size: 9.5px;
  font-style: italic;
  letter-spacing: 0.04em;
}
.anatomy-slot__chain {
  display: inline-flex;
  width: 14px; height: 14px;
  color: rgba(201,165,74,0.7);
}
.anatomy-slot__chain svg { width: 100%; height: 100%; }

.anatomy-slot__unequip {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(201,74,74,0.25);
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.anatomy-slot__unequip:hover {
  background: rgba(201,74,74,0.18);
  border-color: rgba(201,74,74,0.6);
  color: #fca5a5;
}

/* States: filled / locked / wounded / filtering */
.anatomy-slot--filled {
  border-color: var(--accent, #c9a54a);
  background:
    linear-gradient(180deg, rgba(201,165,74,0.10) 0%, rgba(28,24,32,0.92) 70%);
  box-shadow:
    inset 0 1px 0 rgba(201,165,74,0.18),
    0 4px 12px rgba(0,0,0,0.32);
}
.anatomy-slot--filled::before {
  border-color: rgba(201,165,74,0.32);
}
.anatomy-slot--filled .anatomy-slot__icon {
  color: var(--accent);
  filter: drop-shadow(0 0 4px rgba(201,165,74,0.45));
}

.anatomy-slot--empty {
  border-style: dashed;
}
.anatomy-slot--empty .anatomy-slot__icon {
  opacity: 0.5;
}

.anatomy-slot--locked {
  border-style: solid;
  border-color: rgba(201,165,74,0.25);
  background:
    repeating-linear-gradient(
      135deg,
      rgba(20,18,26,0.92) 0px,
      rgba(20,18,26,0.92) 6px,
      rgba(201,165,74,0.03) 6px,
      rgba(201,165,74,0.03) 12px
    );
  cursor: default;
}
.anatomy-slot--locked:hover {
  transform: none;
  border-color: rgba(201,165,74,0.35);
}
.anatomy-slot--locked .anatomy-slot__icon {
  opacity: 0.3;
}

/* E7 — wound state: blood-red overlay with a drop icon at top-right */
.anatomy-slot--wounded {
  border-color: rgba(220,38,38,0.55) !important;
  background:
    linear-gradient(180deg, rgba(127,29,29,0.35) 0%, rgba(28,24,32,0.92) 65%) !important;
  box-shadow: inset 0 0 14px rgba(220,38,38,0.18);
  animation: wound-pulse 2.8s ease-in-out infinite;
}
.anatomy-slot--wounded .anatomy-slot__type {
  color: #fca5a5;
}
.anatomy-slot__blood {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  color: #ef4444;
  filter: drop-shadow(0 0 4px rgba(239,68,68,0.6));
  z-index: 2;
}
@keyframes wound-pulse {
  0%, 100% { box-shadow: inset 0 0 14px rgba(220,38,38,0.18); }
  50%      { box-shadow: inset 0 0 22px rgba(220,38,38,0.35); }
}

/* E6 — actively-filtering slot (the empty slot the player tapped) */
.anatomy-slot--filtering {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(201,165,74,0.18) 0%, rgba(28,24,32,0.92) 70%);
  animation: anatomy-filter-pulse 1.6s ease-in-out infinite;
}
@keyframes anatomy-filter-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,165,74,0.0); }
  50%      { box-shadow: 0 0 0 3px rgba(201,165,74,0.35); }
}

/* Filter pill above backpack */
.anatomy-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 4px 6px 4px 12px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(201,165,74,0.08);
  border: 1px solid rgba(201,165,74,0.35);
  border-radius: 999px;
}
.anatomy-filter-pill strong {
  font-weight: 700;
  color: var(--text-primary);
}
.anatomy-filter-pill__clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}
.anatomy-filter-pill__clear:hover {
  background: rgba(201,165,74,0.18);
  color: var(--accent);
}

/* Mobile compact — keep grid but tighten gaps + shrink silhouette */
@media (max-width: 480px) {
  .anatomy__grid { gap: 5px; }
  .anatomy-slot { min-height: 64px; padding: 5px 4px 6px; }
  .anatomy-slot__type { font-size: 7.5px; letter-spacing: 0.10em; }
  .anatomy-slot__name { font-size: 10.5px; }
  .anatomy__silhouette { opacity: 0.07; }
}

/* Backpack rows */
.inv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.inv-row:hover {
  border-color: rgba(201,165,74,0.28);
}
.inv-row__icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.inv-row__icon svg { width: 18px; height: 18px; }
.inv-row__info { min-width: 0; }
.inv-row__name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  line-height: 1.25;
}
.inv-row__qty {
  font-size: 10px;
  color: var(--accent);
  background: rgba(201,165,74,0.08);
  border: 1px solid rgba(201,165,74,0.2);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Compact gold-pill equip button */
.inv-equip-btn {
  background: transparent;
  border: 1px solid rgba(201,165,74,0.45);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}
.inv-equip-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #1a1300;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(201,165,74,0.3);
}
.inv-equip-btn:active:not(:disabled) { transform: translateY(1px); }
.inv-equip-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Lore variant — preserved/untouchable look */
.inv-list--lore .inv-row {
  background: transparent;
  border-color: rgba(201,165,74,0.13);
  border-style: dashed;
}
.inv-list--lore .inv-row__icon {
  background: transparent;
  border-color: rgba(201,165,74,0.18);
  color: rgba(201,165,74,0.65);
}
.inv-list--lore .inv-row__name { color: var(--text-secondary); font-style: italic; }
.inv-row__desc { font-size: 0.7rem; color: var(--text-muted); line-height: 1.3; margin-top: 2px; }
.inv-row__drop-btn { margin-left: auto; flex-shrink: 0; background: none; border: none;
  color: var(--text-muted); font-size: 0.8rem; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; opacity: 0.5; }
.inv-row__drop-btn:hover { color: #f87171; opacity: 1; background: rgba(248,113,113,0.1); }

/* Empty states */
.inv-empty {
  padding: var(--space-lg);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.18);
}

/* Settings Panel - Ancient Grimoire Theme */
.settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: linear-gradient(180deg, #12100e 0%, #0a0908 100%);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 -4px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(201, 165, 74, 0.2);
}

.settings-panel--open {
  transform: translateY(0);
}

.settings-panel__handle {
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 2px;
  margin: 12px auto 8px;
  opacity: 0.6;
}

.settings-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 32px;
  padding-bottom: calc(32px + var(--safe-bottom));
}

/* Settings Header */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 20px 20px;
  position: relative;
}

.settings-close-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  z-index: 10;
}

.settings-close-btn:hover {
  background: rgba(201, 165, 74, 0.15);
  color: var(--text-primary);
}

.settings-header__ornament {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 165, 74, 0.4), transparent);
  max-width: 80px;
}

.settings-header__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Settings Dividers */
.settings-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.settings-divider::before,
.settings-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.settings-divider__ornament {
  color: var(--accent);
  font-size: 10px;
  opacity: 0.7;
}

.settings-divider--danger .settings-divider__ornament {
  color: var(--danger);
}

.settings-divider--danger::before,
.settings-divider--danger::after {
  background: linear-gradient(90deg, transparent, rgba(201, 74, 74, 0.4), transparent);
}

/* Settings Groups */
.settings-group {
  margin-bottom: 8px;
}

.settings-group__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-group__icon {
  color: var(--accent);
  font-size: 14px;
}

.settings-group__icon--danger {
  color: var(--danger);
}

.settings-group__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-group__title--danger {
  color: var(--danger);
}

/* Navigation Button */
.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: rgba(201, 165, 74, 0.08);
  border: 1px solid rgba(201, 165, 74, 0.25);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-nav-btn:hover {
  background: rgba(201, 165, 74, 0.15);
  border-color: rgba(201, 165, 74, 0.4);
}

.settings-nav-btn:active {
  transform: scale(0.98);
}

.settings-nav-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(201, 165, 74, 0.15);
  border-radius: 10px;
  color: var(--accent);
}

.settings-nav-btn__text {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

.settings-nav-btn__arrow {
  font-size: 20px;
  color: var(--accent);
  opacity: 0.7;
}

/* Settings Controls */
.settings-control {
  margin-bottom: 20px;
}

.settings-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.settings-value {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Custom Select */
.settings-select-wrap {
  position: relative;
}

.settings-select {
  width: 100%;
  padding: 14px 44px 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 165, 74, 0.15);
}

.settings-select__arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
  font-size: 12px;
}

/* Toggle control row */
.settings-control--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.settings-label--toggle {
  margin-bottom: 0;
  font-size: 14px;
  color: var(--text-primary);
}

/* Toggle switch */
.settings-toggle {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
}

.settings-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle__track {
  display: block;
  width: 44px;
  height: 26px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: background 0.2s, border-color 0.2s;
}

.settings-toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.settings-toggle input:checked + .settings-toggle__track {
  background: rgba(201, 165, 74, 0.25);
  border-color: var(--accent);
}

.settings-toggle input:checked + .settings-toggle__track::after {
  transform: translateX(18px);
  background: var(--accent);
}

/* Custom Slider */
.settings-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-slider__min,
.settings-slider__max {
  color: var(--text-muted);
  font-weight: 500;
}

.settings-slider__min {
  font-size: 12px;
}

.settings-slider__max {
  font-size: 18px;
}

.settings-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.settings-slider::-webkit-slider-thumb:active {
  transform: scale(0.95);
}

.settings-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Preview Parchment */
.settings-preview {
  position: relative;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(201, 165, 74, 0.05) 0%, transparent 50%),
    linear-gradient(225deg, rgba(201, 165, 74, 0.05) 0%, transparent 50%),
    var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 8px;
}

.settings-preview__corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.4;
}

.settings-preview__corner--tl {
  top: 8px;
  left: 8px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}

.settings-preview__corner--tr {
  top: 8px;
  right: 8px;
  border-width: 2px 2px 0 0;
  border-radius: 0 4px 0 0;
}

.settings-preview__corner--bl {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 4px;
}

.settings-preview__corner--br {
  bottom: 8px;
  right: 8px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

.settings-preview__text {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
  font-style: italic;
}

/* Foldable settings sections */
.settings-group__header--toggle {
  cursor: pointer;
  user-select: none;
  justify-content: space-between;
}

.settings-group__header--toggle:hover .settings-group__title {
  color: var(--accent);
}

.settings-group__chevron {
  font-size: 18px;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.2s ease;
  display: inline-block;
  transform: rotate(0deg);
}

.settings-group__chevron--open {
  transform: rotate(90deg);
}

.settings-fold {
  padding-top: var(--space-sm);
}

/* Service Status Dots (in Admin section) */
.service-status-row {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md) 0 var(--space-lg);
}

.service-status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.service-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.3s;
}

.service-dot.ok     { background: #27ae60; box-shadow: 0 0 4px #27ae60; }
.service-dot.warn   { background: #f39c12; box-shadow: 0 0 4px #f39c12; }
.service-dot.error  { background: #e74c3c; box-shadow: 0 0 4px #e74c3c; }
.service-dot.unknown { background: var(--text-muted); }

.service-dot-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Lore text blocks (Appearance / History tabs) */
.sheet-lore-block {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.sheet-lore-block:last-child {
  border-bottom: none;
}

.sheet-section-title {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.sheet-lore-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.sheet-lore-text--accent {
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

/* ============================================
   DEATH SCREEN - The Passing
   ============================================ */

.death-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center bottom, #1a0a0a 0%, #0a0908 50%, #000 100%);
  animation: deathFadeIn 1.5s ease-out forwards;
  overflow: hidden;
}

.death-screen[hidden] {
  display: none;
}

@keyframes deathFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.death-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.8) 100%);
  pointer-events: none;
}

.death-embers {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ember {
  position: absolute;
  bottom: -20px;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, #c9a54a 0%, #c94a4a 50%, transparent 100%);
  border-radius: 50%;
  animation: emberRise linear infinite;
  opacity: 0;
}

.ember:nth-child(1) { left: 10%; animation-duration: 4s; animation-delay: 0s; }
.ember:nth-child(2) { left: 20%; animation-duration: 5s; animation-delay: 0.5s; }
.ember:nth-child(3) { left: 30%; animation-duration: 4.5s; animation-delay: 1s; }
.ember:nth-child(4) { left: 40%; animation-duration: 5.5s; animation-delay: 0.3s; }
.ember:nth-child(5) { left: 50%; animation-duration: 4s; animation-delay: 0.8s; }
.ember:nth-child(6) { left: 60%; animation-duration: 5s; animation-delay: 1.2s; }
.ember:nth-child(7) { left: 70%; animation-duration: 4.2s; animation-delay: 0.2s; }
.ember:nth-child(8) { left: 80%; animation-duration: 5.2s; animation-delay: 0.7s; }
.ember:nth-child(9) { left: 15%; animation-duration: 4.8s; animation-delay: 1.5s; }
.ember:nth-child(10) { left: 45%; animation-duration: 4.3s; animation-delay: 0.4s; }
.ember:nth-child(11) { left: 75%; animation-duration: 5.1s; animation-delay: 1.1s; }
.ember:nth-child(12) { left: 90%; animation-duration: 4.6s; animation-delay: 0.6s; }

@keyframes emberRise {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 1; }
  90% { opacity: 0.6; }
  100% {
    transform: translateY(-100vh) scale(0.3);
    opacity: 0;
  }
}

.death-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  max-width: 360px;
}

.death-skull {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 32px;
  animation: skullReveal 2s ease-out forwards;
  opacity: 0;
}

@keyframes skullReveal {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

.death-skull svg {
  width: 100%;
  height: 100%;
  color: #c94a4a;
  filter: drop-shadow(0 0 20px rgba(201, 74, 74, 0.5));
  animation: skullPulse 3s ease-in-out infinite;
}

@keyframes skullPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(201, 74, 74, 0.5)); }
  50% { filter: drop-shadow(0 0 40px rgba(201, 74, 74, 0.8)); }
}

.death-skull__glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, rgba(201, 74, 74, 0.3) 0%, transparent 70%);
  animation: glowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.death-text {
  margin-bottom: 24px;
}

.death-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: #6b665e;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  margin-bottom: 8px;
  animation: textFadeUp 1s ease-out 0.5s forwards;
  opacity: 0;
}

.death-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 42px;
  font-weight: 700;
  color: #c94a4a;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  text-shadow: 0 0 40px rgba(201, 74, 74, 0.5), 0 4px 8px rgba(0, 0, 0, 0.5);
  animation: textFadeUp 1s ease-out 0.8s forwards;
  opacity: 0;
}

.death-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #c9a54a;
  animation: textFadeUp 1s ease-out 1.1s forwards;
  opacity: 0;
}

@keyframes textFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.death-epitaph {
  font-size: 14px;
  font-style: italic;
  color: #6b665e;
  margin-bottom: 40px;
  animation: textFadeUp 1s ease-out 1.4s forwards;
  opacity: 0;
  max-width: 540px;
  line-height: 1.55;
  padding: 0 24px;
  letter-spacing: 0;
  transition: opacity 1.6s ease, letter-spacing 1.6s cubic-bezier(.2,.8,.3,1);
}
/* Stage 9 P5 — fade-in animation triggered once the LLM epitaph lands.
   Letter-spacing collapses from 0.3em to 0 while opacity ramps to 1. */
.death-epitaph:not(.death-epitaph--lit) {
  opacity: 0;
  letter-spacing: 0.3em;
}
.death-epitaph--lit {
  opacity: 1 !important;
  letter-spacing: 0;
  animation: none;  /* override the static textFadeUp once we drive the state */
}

.death-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  animation: textFadeUp 1s ease-out 1.7s forwards;
  opacity: 0;
}

/* E3/E4 (#418/#419) — campaign run stats row on death/victory screens. */
.run-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin: 4px 0 18px;
  animation: textFadeUp 1s ease-out 1.4s forwards;
  opacity: 0;
}
.run-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 72px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.run-stat__icon { font-size: 1.1rem; opacity: 0.85; }
.run-stat__val { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.run-stat__label { font-size: 0.66rem; color: var(--text-muted); text-align: center; }

.death-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.death-btn--resurrect {
  background: linear-gradient(135deg, #c9a54a 0%, #a8893d 100%);
  border: 1px solid #c9a54a;
  color: #0a0908;
  box-shadow: 0 4px 20px rgba(201, 165, 74, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.death-btn--resurrect:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(201, 165, 74, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.death-btn--resurrect:active {
  transform: translateY(0);
}

.death-btn__icon {
  font-size: 14px;
  animation: iconSparkle 2s ease-in-out infinite;
}

@keyframes iconSparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.death-btn--return {
  background: transparent;
  border: 1px solid #2a2622;
  color: #6b665e;
}

.death-btn--return:hover {
  border-color: #3a3632;
  color: #9a958c;
}

@media (min-width: 768px) {
  .death-skull {
    width: 140px;
    height: 140px;
  }

  .death-title {
    font-size: 52px;
  }

  .death-name {
    font-size: 24px;
  }

  .death-content {
    max-width: 420px;
  }
}

/* Panel Overlay */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 99;
}

.panel-overlay--visible,
.panel-overlay--active {
  opacity: 1;
  pointer-events: auto;
}

/* Info Card */
.info-card {
  padding: var(--space-lg);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
}

.info-card p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Muted text */
.muted {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Desktop Styles */
@media (min-width: 768px) {
  .screen {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .login {
    padding: var(--space-2xl);
  }

  .header {
    padding: var(--space-lg) var(--space-xl);
  }

  .settings-panel {
    max-width: 420px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }

  .settings-panel--open {
    transform: translateX(-50%) translateY(0);
  }
}

@media (min-width: 1024px) {
  body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(135deg, #0a0908 0%, #1a1612 100%);
  }

  .screen {
    max-width: 420px;
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
  }

  #game-screen.screen {
    max-width: 600px;
    height: 100vh;
    height: 100dvh;
  }

  #game-screen.screen--active {
    display: flex;
  }
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000;
  max-width: 90%;
  text-align: center;
  border: 1px solid var(--border);
}

.toast--visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast--error {
  background: #3d1c1c;
  border-color: #7c2d2d;
  color: #f87171;
}

.toast--success {
  background: #1c3d1c;
  border-color: #2d7c2d;
  color: #71f871;
}

/* Typing Indicator */
.chat-bubble--typing .chat-bubble__content {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 24px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Wizard Options */
.wizard-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
}

.option-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-card:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.option-card--selected {
  border-color: var(--accent);
  background: rgba(201, 165, 74, 0.1);
}

.option-card__icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.option-card__title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.option-card__desc {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Sheet Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  padding: var(--space-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.stat-item__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
}

.stat-item__value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--accent);
}
.stat-item__mod { font-size: 0.7rem; font-weight: 700; margin-top: 1px; }
.stat-item__mod.mod--pos { color: #4ade80; }
.stat-item__mod.mod--neg { color: #f87171; }
.stat-item__mod.mod--zero { color: var(--text-muted); }

/* Vitals row (HP + Mana) */
.sheet-vitals-row { display: flex; gap: 10px; }
.sheet-vitals-row .stat-card { flex: 1; }
.stat-card__bar--mana { background: rgba(99,102,241,0.15); }
.stat-card__bar-fill--mana { background: linear-gradient(90deg,#6366f1,#8b5cf6); }

/* Meta row (Level, XP, Arcane) */
.sheet-meta-row { display: flex; gap: 8px; margin-top: 10px; margin-bottom: 10px; }
.sheet-meta-row .stat-card--small { flex: 1; padding: 8px; }
.sheet-meta-row .stat-card--small .stat-card__value { font-size: 1.1rem; }

/* Conditions */
.conditions-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.condition-chip { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5; border-radius: 12px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600;
  cursor: help; transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s; }
.condition-chip:hover, .condition-chip:focus-visible {
  outline: none; transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
/* S6: auto-expand visual hook — when section has the class, conditions get a soft glow border */
.sheet-conditions--expanded {
  display: block !important;
  animation: conditions-flash 0.55s ease-out;
}
@keyframes conditions-flash {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.0); }
  35% { box-shadow: 0 0 0 2px rgba(239,68,68,0.55); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.0); }
}
/* S11: condition fade in/out */
.condition-chip--entering {
  animation: condition-enter 0.42s cubic-bezier(.4,1.4,.6,1) both;
}
.condition-chip--leaving {
  animation: condition-leave 0.22s ease-in both;
}
@keyframes condition-enter {
  0%   { opacity: 0; transform: translateY(-6px) scale(0.85); background: rgba(251,146,60,0.45); border-color: rgba(251,146,60,0.85); }
  60%  { opacity: 1; transform: translateY(0) scale(1.05); background: rgba(251,146,60,0.35); border-color: rgba(251,146,60,0.7); }
  100% { opacity: 1; transform: none; }
}
@keyframes condition-leave {
  to { opacity: 0; transform: scale(0.7); }
}

/* S8: HP damage flash + number tick */
.stat-card--damaged {
  animation: hp-damage-flash 0.6s ease-out;
}
@keyframes hp-damage-flash {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0); background-color: var(--bg-secondary); }
  20%  { box-shadow: 0 0 22px 4px rgba(239,68,68,0.55); background-color: rgba(239,68,68,0.18); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); background-color: var(--bg-secondary); }
}
.stat-card__value--ticked {
  animation: hp-number-tick 0.48s ease-out;
}
@keyframes hp-number-tick {
  0%   { transform: scale(1); color: var(--accent); }
  40%  { transform: scale(1.18); color: #f87171; }
  100% { transform: scale(1); color: var(--accent); }
}

/* S9: gold pulse on change */
.inv-gold--pulsing {
  animation: gold-pulse 0.7s ease-out;
}
@keyframes gold-pulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,215,0,0); }
  35%  { transform: scale(1.04); box-shadow: 0 0 18px 4px rgba(255,215,0,0.45); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,215,0,0); }
}

/* S10: XP bar fill animation on gain */
.xp-bar-card--gained {
  animation: xp-card-glow 1.1s ease-out;
}
@keyframes xp-card-glow {
  0%   { box-shadow: 0 0 0 0 rgba(132,204,22,0); }
  40%  { box-shadow: 0 0 16px 3px rgba(132,204,22,0.55); }
  100% { box-shadow: 0 0 0 0 rgba(132,204,22,0); }
}
.xp-bar__fill--filling {
  animation: xp-bar-shimmer 1.0s ease-out;
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.45) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
}
@keyframes xp-bar-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* S12 + follow-up: bottom tab bar — shown on the game screen at ALL viewport widths
   (gated by body.bottom-bar-visible, which is added only on currentScreen === 'game').
   #game-screen height is shortened by the bar's full height so the composer footer
   is never covered, and the slide-up sheet panel sits above the bar.
*/
.mobile-bottom-bar { display: none; }

/* Show the bar via body-class (set by showScreen) AND via a `:has()` fallback that
   detects #game-screen.screen--active directly, so the bar also surfaces on hard
   reloads or any code path that mounts the game screen without going through
   showScreen(). Both selectors apply identical declarations. */
body.bottom-bar-visible .mobile-bottom-bar,
body:has(#game-screen.screen--active) .mobile-bottom-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary, #14121a);
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  z-index: 150;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 14px rgba(0,0,0,0.35);
  height: calc(56px + env(safe-area-inset-bottom));
}
/* Shrink the game screen so the composer footer doesn't slide under the bar.
   Override height/min-height/max-height — .screen.min-height: 100dvh was winning. */
body.bottom-bar-visible #game-screen,
body:has(#game-screen.screen--active) #game-screen {
  height: calc(100dvh - 56px - env(safe-area-inset-bottom));
  min-height: calc(100dvh - 56px - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 56px - env(safe-area-inset-bottom));
}
/* Lift the sheet panel above the bar */
body.bottom-bar-visible .sheet-panel,
body:has(#game-screen.screen--active) .sheet-panel {
  bottom: calc(56px + env(safe-area-inset-bottom));
}
.mbb-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
  transition: color 0.15s;
}
.mbb-btn__icon { display: flex; align-items: center; justify-content: center; line-height: 1; }
.mbb-btn__label { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; }
.mbb-btn:active { transform: scale(0.96); }
.mbb-btn--active { color: var(--accent); }
.mbb-btn--active .mbb-btn__icon { filter: drop-shadow(0 0 6px rgba(201,165,74,0.55)); }

/* On wider viewports the bar can grow a bit, with a centered cap so it doesn't stretch awkwardly */
@media (min-width: 769px) {
  body.bottom-bar-visible .mobile-bottom-bar {
    justify-content: center;
    gap: 8px;
  }
  body.bottom-bar-visible .mobile-bottom-bar .mbb-btn {
    flex: 0 0 auto;
    min-width: 120px;
    padding: 4px 18px;
  }
}

/* Stage 4 S2+S3 — merged stat→skill list */
.stat-skill-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-md) var(--space-md) 4px;
}
.stat-skill-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px 6px;
}
.stat-skill-group__header {
  display: grid;
  grid-template-columns: 36px 28px 30px 1fr 22px;
  align-items: center;
  gap: 8px;
}
.stat-skill-group__code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.stat-skill-group__val {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stat-skill-group__mod {
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  padding: 1px 0;
  border-radius: var(--radius-sm);
}
.stat-skill-group__mod.mod--pos { color: #4ade80; background: rgba(74,222,128,0.10); }
.stat-skill-group__mod.mod--neg { color: #f87171; background: rgba(248,113,113,0.10); }
.stat-skill-group__mod.mod--zero { color: var(--text-muted); }

.stat-skill-group__bar {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}
.stat-skill-group__bar-base {
  height: 100%;
  background: linear-gradient(90deg, rgba(201,165,74,0.55), rgba(201,165,74,0.85));
  transition: width 0.4s ease;
}
.stat-skill-group__bar-bonus {
  height: 100%;
  background: linear-gradient(90deg, rgba(74,222,128,0.7), rgba(74,222,128,1));
  border-left: 1px solid rgba(0,0,0,0.4);
  transition: width 0.4s ease;
}
.stat-skill-group__cap {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-align: right;
}

/* Skills nested inside each stat block */
.stat-skill-group__skills {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.05);
  padding-top: 4px;
}
.stat-skill-group__empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0 0 36px;
  opacity: 0.6;
}
.stat-skill-row {
  display: grid;
  grid-template-columns: 1fr auto auto 44px;
  align-items: center;
  gap: 10px;
  padding: 5px 4px 5px 36px;
  cursor: help;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.stat-skill-row:hover { background: rgba(255,255,255,0.025); }
.stat-skill-row__name {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-skill-row__dots-wrap {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.stat-skill-row__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  box-sizing: border-box;
}
.stat-skill-row__dot--filled {
  background: var(--accent);
  border-color: var(--accent);
}
.stat-skill-row__prof {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: rgba(74,222,128,0.14);
  border: 1px solid rgba(74,222,128,0.45);
  color: #86efac;
}
.stat-skill-row__roll {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1;
}

/* Spells Tab */
.sheet-mana-summary { display: flex; gap: 12px; padding: 10px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.spell-resource { display: flex; flex-direction: column; align-items: center; flex: 1; }
.spell-resource__label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.spell-resource__val { font-size: 1.1rem; font-weight: 700; color: #818cf8; }
.spells-list { display: flex; flex-direction: column; gap: 8px; }
.spell-card { background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 12px; }
.spell-card__header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.spell-card__icon { font-size: 1rem; }
.spell-card__name { flex: 1; font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.spell-card__mana { font-size: 0.78rem; color: #818cf8; font-weight: 600; }
.spell-card__meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.spell-card__die { font-size: 0.75rem; color: #f87171; font-weight: 600; }
.spell-card__die.heal { color: #4ade80; }
.spell-card__ranks { display: flex; gap: 3px; }
.spell-rank-pip { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.spell-rank-pip.active { background: #818cf8; }
.spell-card__desc { font-size: 0.75rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.spell-card__actions { margin-top: 6px; }
.spell-card__cast-btn { padding: 4px 10px; font-size: 0.75rem; font-weight: 600; border-radius: 6px;
  border: 1px solid #818cf8; background: rgba(129,140,248,0.12); color: #a5b4fc; cursor: pointer;
  transition: background 0.15s, color 0.15s; }
.spell-card__cast-btn:hover:not(:disabled) { background: rgba(129,140,248,0.25); color: #c7d2fe; }
.spell-card__cast-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.spell-card__cast-btn--nomana { border-color: #6b7280; color: #6b7280; background: transparent; }
.spell-card__cast-btn--combat-only { border-color: #4b5563; color: #4b5563; background: transparent; }

/* Skills & Inventory Items */
.skill-item,
.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.skill-item:last-child,
.inventory-item:last-child {
  border-bottom: none;
}

.skill-item__name,
.inventory-item__name {
  color: var(--text-primary);
}

.skill-item__level,
.inventory-item__qty {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Untrained skills (rank 0) — dim, italic to distinguish from trained */
.skill-item--dim .skill-item__name { color: var(--text-muted); font-style: italic; }
.skill-item--dim .skill-row__dot { opacity: 0.4; }
.skill-item .skill-row__dot {
  width: 9px; height: 9px;
}

/* Trained-skill row with rank/ceiling and tap-for-description */
.skill-item--clickable {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) var(--space-lg);
  transition: background 0.15s ease;
}
.skill-item--clickable:hover { background: var(--bg-card-hover); }
.skill-item--clickable:last-child { border-bottom: none; }
.skill-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.skill-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.skill-item__stat {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(201,165,74,0.06);
  border: 1px solid rgba(201,165,74,0.2);
  color: rgba(201,165,74,0.85);
}
.skill-item__rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}
.skill-item__desc {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.skill-item--open { background: var(--bg-card-hover); }

/* ================================================
   JOURNAL PANEL — Dziennik podróżnika
   ================================================ */

.journal-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: linear-gradient(180deg, #1e1b14 0%, #16130e 100%);
  border-top: 2px solid var(--gold);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.7), inset 0 1px 0 rgba(201,165,74,0.2);
}

.journal-panel--open {
  transform: translateY(0);
}

.journal-panel__handle {
  width: 40px;
  height: 4px;
  background: var(--gold);
  border-radius: 2px;
  margin: 12px auto 0;
  opacity: 0.5;
  flex-shrink: 0;
}

.journal-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Parchment body */
/* U18 (#570): Dziennik gracza — structured sections (Zadania / Wątki / Kronika) */
.journal-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.journal-section {
  background: rgba(201,165,74,0.05);
  border: 1px solid rgba(201,165,74,0.2);
  border-radius: 8px;
  padding: var(--space-md) var(--space-lg);
}
.journal-section__title {
  margin: 0 0 var(--space-sm);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: #c9a54a;
}
.journal-list { list-style: none; margin: 0; padding: 0; }
.journal-list li { padding: 6px 0; border-top: 1px solid rgba(201,165,74,0.12); }
.journal-list li:first-child { border-top: none; }
.journal-quest { display: flex; gap: 8px; align-items: flex-start; }
.journal-quest__mark { color: #c9a54a; flex: 0 0 auto; }
.journal-quest__title { font-weight: 600; color: var(--text-primary); }
.journal-quest__narr { font-size: 0.85rem; color: var(--text-secondary); opacity: 0.85; }
.journal-quest--done .journal-quest__title { text-decoration: line-through; opacity: 0.6; }
.journal-quest--done .journal-quest__mark { color: #6fae6f; }
.journal-thread, .journal-chron { display: flex; gap: 8px; align-items: baseline; }
.journal-thread__hint, .journal-chron__text { flex: 1; color: var(--text-secondary); }
.journal-thread__turn, .journal-chron__turn {
  flex: 0 0 auto; font-size: 0.72rem; opacity: 0.55; color: #c9a54a;
}
.journal-chron__icon { flex: 0 0 auto; color: #c9a54a; }

.journal-body {
  background: rgba(201,165,74,0.05);
  border: 1px solid rgba(201,165,74,0.2);
  border-radius: 8px;
  padding: var(--space-lg);
  font-family: var(--chat-font-family, 'Lora', Georgia, serif);
  font-size: var(--chat-font-size, 1rem);
  line-height: 1.75;
  color: var(--text-secondary);
  position: relative;
}

.journal-body::before {
  content: '✦';
  display: block;
  color: var(--gold);
  opacity: 0.5;
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.journal-body::after {
  content: '✦';
  display: block;
  color: var(--gold);
  opacity: 0.5;
  text-align: center;
  font-size: 1.2rem;
  margin-top: var(--space-md);
}

.journal-body p {
  margin: 0 0 var(--space-md) 0;
}

.journal-body p:last-child {
  margin-bottom: 0;
}

.journal-body .journal-h {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: var(--space-lg) 0 var(--space-sm);
  font-weight: 600;
  line-height: 1.3;
}

.journal-body .journal-h:first-child {
  margin-top: 0;
}

.journal-body .journal-h--1 {
  font-size: 1.4em;
  text-align: center;
  border-bottom: 1px solid rgba(201,165,74,0.25);
  padding-bottom: var(--space-sm);
  text-transform: uppercase;
}

.journal-body .journal-h--2 {
  font-size: 1.2em;
  border-left: 2px solid var(--gold);
  padding-left: var(--space-sm);
}

.journal-body .journal-h--3 {
  font-size: 1.05em;
  font-style: italic;
  opacity: 0.92;
}

.journal-body .journal-h--4 {
  font-size: 1em;
  opacity: 0.85;
}

.journal-body .journal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
}

.journal-body .journal-list li {
  position: relative;
  padding-left: 1.4em;
  margin-bottom: var(--space-xs);
}

.journal-body .journal-list li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--gold);
  opacity: 0.55;
  font-size: 0.7em;
  line-height: 1.9;
}

.journal-body strong {
  color: var(--gold);
  font-weight: 600;
}

.journal-body em {
  color: var(--text-primary);
  font-style: italic;
}

.journal-body code {
  background: rgba(201,165,74,0.1);
  border: 1px solid rgba(201,165,74,0.2);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
  color: var(--gold);
}

/* Empty state */
.journal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl) 0;
  color: var(--text-muted);
  text-align: center;
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* Loading dots */
.journal-loading {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: var(--space-2xl) 0;
}

.journal-loading__dot {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0.4;
  animation: journalDotPulse 1.2s ease-in-out infinite;
}

.journal-loading__dot:nth-child(2) { animation-delay: 0.2s; }
.journal-loading__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes journalDotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* Banner (errors/warnings) */
.journal-banner {
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--gold);
  background: rgba(201,165,74,0.06);
  border-radius: 4px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Action buttons */
.journal-actions {
  display: flex;
  justify-content: center;
  padding-bottom: var(--space-md);
}

.journal-regen-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  border: 1px solid rgba(201,165,74,0.35);
  color: var(--gold);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 20px;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.journal-regen-btn:hover {
  background: rgba(201,165,74,0.1);
  border-color: var(--gold);
}

.journal-regen-btn:active {
  background: rgba(201,165,74,0.15);
}

.journal-regen-btn svg {
  flex-shrink: 0;
}

/* Desktop centering */
@media (min-width: 768px) {
  .journal-panel {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
  }

  .journal-panel--open {
    transform: translateX(-50%) translateY(0);
  }
}

/* ================================================
   COMBAT — Banner + composer override
   ================================================ */

.combat-banner {
  position: relative;
  background: linear-gradient(180deg, rgba(60, 20, 25, 0.95) 0%, rgba(35, 12, 18, 0.95) 100%);
  border-bottom: 1px solid rgba(220, 80, 80, 0.4);
  border-top: 1px solid rgba(220, 80, 80, 0.5);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(220, 80, 80, 0.15);
  z-index: 10;
  animation: combatBannerSlide 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes combatBannerSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.combat-banner__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cinzel', Georgia, serif;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 200, 200, 0.85);
  margin-bottom: var(--space-xs);
}

.combat-banner__round {
  color: rgba(220, 160, 80, 0.9);
}

.combat-banner__turn {
  font-weight: 600;
}

.combat-banner__turn--enemy {
  color: #ff8888;
  animation: turnPulse 1.4s ease-in-out infinite;
}

.combat-banner__turn--player {
  color: #ffd76a;
}

@keyframes turnPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.combat-banner__enemies {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Unified combatant row (player + enemy) */
.combat-combatant {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* #660 — aktywna tura: podświetlenie wiersza (zastępuje chip init-chip--active) */
.combat-combatant--active {
  border-radius: 8px;
  padding: 4px 6px;
  margin: 0 -6px;
  border: 2px solid rgba(220, 180, 100, 0.7);
  background: rgba(220, 180, 100, 0.08);
  box-shadow: 0 0 12px rgba(220, 180, 100, 0.25);
  animation: combat-active-pulse 1.8s ease-in-out infinite;
}
@keyframes combat-active-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(220, 180, 100, 0.18); }
  50%      { box-shadow: 0 0 16px rgba(220, 180, 100, 0.38); }
}
.combat-combatant__active-arrow {
  color: rgba(220, 180, 100, 0.9);
  font-size: 0.7rem;
  flex: 0 0 auto;
  margin-right: -2px;
}
.combat-combatant__cond-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.combat-combatant--player {
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.combat-combatant__icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.combat-combatant--player .combat-combatant__icon {
  background: linear-gradient(135deg, #1a3a2a 0%, #0d2018 100%);
  border: 1px solid rgba(80, 200, 120, 0.4);
}

.combat-combatant--enemy .combat-combatant__icon {
  background: linear-gradient(135deg, #4a1a1a 0%, #2a0e10 100%);
  border: 1px solid rgba(220, 80, 80, 0.5);
}

/* #595 — wybór celu ataku: klikalny wiersz wroga + podświetlenie wybranego */
.combat-combatant--targetable {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.combat-combatant--targetable:hover {
  background: rgba(220, 80, 80, 0.10);
}
.combat-combatant--targetable:focus-visible {
  outline: 2px solid rgba(255, 180, 80, 0.7);
  outline-offset: 1px;
}
.combat-combatant--target-selected {
  background: rgba(255, 140, 60, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 160, 70, 0.65);
}
.combat-combatant__target-badge {
  margin-left: 4px;
  font-size: 13px;
  line-height: 1;
}

.combat-combatant__body {
  flex: 1;
  min-width: 0;
}

.combat-combatant__name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  margin-bottom: 1px;
}

.combat-combatant__name-text {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combat-combatant--player .combat-combatant__name-text {
  color: rgba(160, 230, 160, 0.95);
}

.combat-combatant__meta {
  color: rgba(255, 200, 80, 0.7);
  font-size: 0.72rem;
  white-space: nowrap;
  margin-left: var(--space-sm);
}

.combat-combatant__hp-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(255, 200, 200, 0.75);
  margin-bottom: 2px;
}

.combat-combatant--player .combat-combatant__hp-row {
  color: rgba(160, 230, 160, 0.75);
}

/* Player HP bar — green tiers */
.combat-player__bar-fill--high {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2a8a50, #3aa060);
  transition: width 0.4s ease;
}

.combat-player__bar-fill--mid {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7a9030, #90a840);
  transition: width 0.4s ease;
}

.combat-player__bar-fill--low {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #8a4020, #a05030);
  transition: width 0.4s ease;
}

/* Legacy enemy icon / dead classes (keep for compat) */
.combat-enemy {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.combat-enemy__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a1a1a 0%, #2a0e10 100%);
  border: 1px solid rgba(220, 80, 80, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.combat-enemy--dead .combat-enemy__icon {
  opacity: 0.4;
  filter: grayscale(1);
}

.combat-enemy__body {
  flex: 1;
  min-width: 0;
}

.combat-enemy__name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-sm);
  margin-bottom: 2px;
  gap: var(--space-sm);
}

.combat-enemy__name-text {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combat-enemy__hp {
  font-variant-numeric: tabular-nums;
  color: rgba(255, 200, 200, 0.85);
  font-size: 0.85em;
}

.combat-enemy--dead .combat-enemy__name-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.combat-enemy__bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.combat-enemy__bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s;
}

.combat-enemy__bar-fill--high {
  background: linear-gradient(90deg, #d04848, #e06060);
}

.combat-enemy__bar-fill--mid {
  background: linear-gradient(90deg, #d4a040, #e0b050);
}

.combat-enemy__bar-fill--low {
  background: linear-gradient(90deg, #8a3030, #a04040);
}

/* ── Wound Label (T24 / W1+W2) ───────────────────────────────────────────
   Atmospheric dark-fantasy severity stamp under HP bars. Italic IM Fell
   English with flanking ornament. Pulses on the most severe tier. */
.wound-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;     /* IM Fell has elegant lowercase glyphs */
  line-height: 1;
  opacity: 0;
  animation: woundFade 380ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
  user-select: none;
}
.wound-label__text {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 8px currentColor;
  letter-spacing: 0.14em;
}
.wound-label__orn {
  font-size: 0.72rem;
  opacity: 0.65;
  letter-spacing: 0;
  transform: translateY(-1px);
}

/* Severity tiers — colour ladder matches backend WOUND_LABELS */
.wound-label--minor     { color: #ffc107; }
.wound-label--impaired  { color: #ff9800; }
.wound-label--desperate { color: #f44336; }
.wound-label--near_death {
  color: #b71c1c;
  font-weight: 600;
  font-style: italic;
  animation: woundFade 380ms cubic-bezier(0.32, 0.72, 0, 1) forwards,
             woundPulse 1.4s ease-in-out 600ms infinite;
}
.wound-label--near_death .wound-label__text {
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.8),
    0 0 10px rgba(220, 40, 40, 0.55),
    0 0 22px rgba(220, 40, 40, 0.25);
}

@keyframes woundFade {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes woundPulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

/* Compact variant — combat banner has less vertical room */
.combat-combatant .wound-label {
  margin-top: 4px;
  font-size: 0.7rem;
  gap: 6px;
}
.combat-combatant .wound-label__orn { font-size: 0.62rem; }

/* Honor reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .wound-label { animation: none; opacity: 1; }
  .wound-label--near_death { animation: none; }
}

/* ── Crit Flash (T34) ─────────────────────────────────────────────────────
   Theatrical overlay for Nat 20 / Nat 1 moments. Pointer-events: none so
   combat input stays live. CSS-only animation. Triggered by JS adding
   .crit-flash--active + variant class (--crit / --fumble) for 700ms.
*/
.crit-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease-out, visibility 600ms;
}
.crit-flash--active {
  opacity: 1;
  visibility: visible;
  transition: opacity 100ms ease-out, visibility 100ms;
}

.crit-flash__veil {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.crit-flash--active .crit-flash__veil {
  animation: critVeil 700ms cubic-bezier(0.22, 0.65, 0.32, 1) forwards;
}

/* Four directional "beams" radiating from each viewport edge inward.
   For crits they're warm gold; for fumbles deep blood-red. */
.crit-flash__beam {
  position: absolute;
  opacity: 0;
}
.crit-flash--active .crit-flash__beam {
  animation: critBeam 700ms cubic-bezier(0.22, 0.65, 0.32, 1) forwards;
}
.crit-flash__beam--top    { top: 0;    left: 0;  right: 0;  height: 38vh;
  background: linear-gradient(180deg, currentColor 0%, transparent 100%); }
.crit-flash__beam--bottom { bottom: 0; left: 0;  right: 0;  height: 38vh;
  background: linear-gradient(0deg,   currentColor 0%, transparent 100%); }
.crit-flash__beam--left   { top: 0;    bottom: 0; left: 0;  width: 28vw;
  background: linear-gradient(90deg,  currentColor 0%, transparent 100%); }
.crit-flash__beam--right  { top: 0;    bottom: 0; right: 0; width: 28vw;
  background: linear-gradient(270deg, currentColor 0%, transparent 100%); }

.crit-flash__title {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.6rem, 5.4vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  opacity: 0;
  white-space: nowrap;
}
.crit-flash--active .crit-flash__title {
  animation: critTitle 700ms cubic-bezier(0.22, 0.65, 0.32, 1) forwards;
}

.crit-flash__sub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: clamp(0.85rem, 1.8vw, 1.05rem);
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0;
  white-space: nowrap;
}
.crit-flash--active .crit-flash__sub {
  animation: critSub 700ms cubic-bezier(0.22, 0.65, 0.32, 1) forwards;
}

/* ── CRIT variant: warm gold, ceremonial ── */
.crit-flash--crit { color: #ffd76a; }
.crit-flash--crit .crit-flash__veil {
  background: radial-gradient(
    ellipse at center,
    rgba(20, 12, 4, 0.45) 0%,
    rgba(60, 35, 8, 0.25) 35%,
    rgba(255, 215, 106, 0.18) 80%,
    rgba(255, 243, 214, 0.32) 100%
  );
}
.crit-flash--crit .crit-flash__title {
  color: #fff3d6;
  text-shadow:
    0 0 12px rgba(255, 215, 106, 0.85),
    0 0 32px rgba(255, 180, 50, 0.55),
    0 2px 0 rgba(80, 40, 0, 0.7);
}
.crit-flash--crit .crit-flash__sub { color: rgba(255, 215, 106, 0.85); }

/* ── FUMBLE variant: blood-red closing-in vignette ── */
.crit-flash--fumble { color: #8a1818; }
.crit-flash--fumble .crit-flash__veil {
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 0%,
    rgba(40, 4, 4, 0.45) 60%,
    rgba(120, 10, 10, 0.6) 100%
  );
}
.crit-flash--fumble .crit-flash__title {
  color: #ff5050;
  letter-spacing: 0.22em;
  text-shadow:
    0 0 14px rgba(180, 30, 30, 0.95),
    0 2px 0 rgba(0, 0, 0, 0.85),
    -1px 0 0 rgba(120, 10, 10, 0.7),
    1px 0 0 rgba(60, 0, 0, 0.7);
}
.crit-flash--fumble .crit-flash__sub { color: rgba(255, 80, 80, 0.75); }

/* Fumble adds a brief viewport shake. The body listens for the class. */
body.crit-shake { animation: critShake 180ms ease-out 1; }

@keyframes critVeil {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes critBeam {
  0%   { opacity: 0; transform: scale(1.05); }
  18%  { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes critTitle {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); letter-spacing: 0.04em; }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02); letter-spacing: 0.16em; }
  35%  { transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
@keyframes critSub {
  0%   { opacity: 0; transform: translate(-50%, -50%) translateY(8px); }
  25%  { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(0); }
}
@keyframes critShake {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(3px, -2px); }
  40%  { transform: translate(-3px, 2px); }
  60%  { transform: translate(2px, 2px); }
  80%  { transform: translate(-2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* Honor reduced-motion preference — keep the static color flash, cut motion. */
@media (prefers-reduced-motion: reduce) {
  body.crit-shake { animation: none; }
  .crit-flash--active .crit-flash__veil,
  .crit-flash--active .crit-flash__beam,
  .crit-flash--active .crit-flash__title,
  .crit-flash--active .crit-flash__sub { animation-duration: 400ms; }
}

/* ── Combat Zones (T34) ─────────────────────────────────────────────────── */
/* #667 — gracz jako stały punkt odniesienia nad kolumnami stref */
.combat-arena {
  margin-top: 6px;
}
.combat-you {
  margin-bottom: 4px;
}
.combat-you:empty { display: none; }
.combat-you__tag {
  display: inline-block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #0c1320;
  background: linear-gradient(180deg, #d8b15a 0%, #b8902f 100%);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: middle;
}
.combat-you__zone {
  font-size: 0.66rem;
  color: rgba(220, 180, 100, 0.75);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.combat-axis-hint {
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(180, 150, 110, 0.45);
  padding: 2px 0 4px;
}
/* #667 — znacznik strefy na żetonie wroga */
.combat-combatant__zone {
  font-size: 0.78rem;
  margin-right: 3px;
  flex: 0 0 auto;
}

.combat-zones {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  position: relative;
}
.combat-zones::before {
  /* central divider */
  content: '';
  grid-column: 2;
  grid-row: 1;
  background: linear-gradient(180deg,
    rgba(220, 80, 80, 0.05) 0%,
    rgba(220, 80, 80, 0.35) 50%,
    rgba(220, 80, 80, 0.05) 100%);
}

.combat-zone {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 4px 8px;
}

.combat-zone__label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(220, 180, 100, 0.55);
  padding: 2px 0 4px;
  border-bottom: 1px solid rgba(120, 90, 60, 0.25);
  margin-bottom: 4px;
}

.combat-zone--ranged .combat-zone__label::before { content: '🏹  '; }
.combat-zone--engaged .combat-zone__label::before { content: '⚔️  '; }

.combat-zone__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 30px;
}
.combat-zone__list:empty::after {
  content: '— pusto —';
  display: block;
  text-align: center;
  font-size: 0.68rem;
  color: rgba(150, 145, 135, 0.35);
  font-style: italic;
  padding: 6px 0;
}

/* Mobile: stack zones vertically */
@media (max-width: 540px) {
  .combat-zones { grid-template-columns: 1fr; }
  .combat-zones::before { display: none; }
  .combat-zone { padding: 4px 0; }
  .combat-zone + .combat-zone { border-top: 1px solid rgba(120, 90, 60, 0.2); margin-top: 4px; padding-top: 6px; }
}

/* ════ #967 — kompaktowy banner walki (Wariant D) ════
   Każdy uczestnik = JEDNA linia (.cline) z inline HP barem. Strefy = lekkie nagłówki.
   Nic nie ukryte: HP liczby+pasek, DEF, INI, strefa, warunki, cel, absorb, ostrzeżenie broni. */
.combat-banner--compact .combat-banner__top { margin-bottom: 4px; }
.combat-banner--compact .combat-you { margin: 0 0 2px; }
.combat-banner--compact .combat-you:empty { display: none; }

.combat-zones--compact { display: block; }     /* nadpisuje stary grid 1fr/1px/1fr */
.combat-zones--compact::before { display: none; }
.czone { margin-top: 4px; }
.czone__head {
  font-family: 'Cinzel', Georgia, serif; font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(220, 180, 100, 0.55);
  margin: 0 0 1px;
}
.czone__head--rng { color: rgba(111, 182, 224, 0.5); }
.czone__list { display: flex; flex-direction: column; gap: 2px; }
.czone__list:empty::after {
  content: '— pusto —'; display: block; font-size: 0.66rem; font-style: italic;
  color: rgba(150, 145, 135, 0.4); padding: 1px 4px;
}

.cline {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  font-size: 0.8rem; line-height: 1.25; padding: 2px 5px; border-radius: 6px;
}
.cline--you { border: 1px solid rgba(220, 180, 100, 0.3); background: rgba(220, 180, 100, 0.05); }
.cline--active {
  border: 1px solid rgba(220, 180, 100, 0.7); background: rgba(220, 180, 100, 0.1);
  box-shadow: 0 0 9px rgba(220, 180, 100, 0.22); animation: combat-active-pulse 1.8s ease-in-out infinite;
}
.cline--targetable { cursor: pointer; }
.cline--targetable:hover { background: rgba(220, 180, 100, 0.08); }
.cline--targetable:focus-visible { outline: 2px solid rgba(220, 180, 100, 0.7); outline-offset: 1px; }
.cline--target { box-shadow: inset 0 0 0 1px rgba(220, 180, 100, 0.6); }
.cline--dead { opacity: 0.5; }
.cline__name--dead { text-decoration: line-through; }
.cline__tag {
  font-family: 'Cinzel', Georgia, serif; font-size: 0.56rem; font-weight: 700; letter-spacing: 0.12em;
  color: #0c1320; background: linear-gradient(180deg, #d8b15a 0%, #b8902f 100%);
  border-radius: 3px; padding: 1px 5px; flex: 0 0 auto;
}
.cline__name { font-weight: 600; color: var(--text-primary); }
.cline__hp { color: #ffb3b3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cline__hpbar {
  display: inline-block; width: 46px; height: 5px; border-radius: 3px;
  background: rgba(0, 0, 0, 0.45); overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.3); flex: 0 0 auto;
}
.cline__hpbar > i { display: block; height: 100%; }
.cline__hpbar--hi > i  { background: linear-gradient(90deg, #3f9f5a, #5fbf6a); }
.cline__hpbar--mid > i { background: linear-gradient(90deg, #b8902f, #e0c06a); }
.cline__hpbar--lo > i  { background: linear-gradient(90deg, #a83838, #d05a5a); }
.cline__def, .cline__ini { color: rgba(220, 200, 170, 0.5); font-size: 0.7rem; white-space: nowrap; }
.cline__zone, .cline__surprise, .cline__target { font-size: 0.82rem; flex: 0 0 auto; }
.cline__absorb { color: #9fd0ff; font-size: 0.7rem; flex: 0 0 auto; }
.cline__conds { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.cline .wound-label { font-size: 0.66rem; margin: 0; }
.cline .wound-label__orn { font-size: 0.58rem; }
.cline__dura {
  width: 100%; font-size: 0.66rem; color: #d8a05a; padding: 1px 5px 0;
}
.cline__dura--broken { color: #ff8888; }

/* Move (zone-change) button styling — sits between attack and flee */
.combat-btn--move {
  background: linear-gradient(180deg, #2a3e5a 0%, #18243a 100%);
  border-color: #4a6f96;
  color: #c5d8f0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(150, 200, 255, 0.15);
}
.combat-btn--move:hover:not(:disabled) {
  background: linear-gradient(180deg, #324a6f 0%, #1c2c46 100%);
  box-shadow: 0 4px 12px rgba(80, 130, 200, 0.35);
}
.combat-btn--move[data-direction="retreat"] svg { transform: scaleX(-1); }

/* Initiative chip zone glyph */
.init-chip__zone {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  line-height: 1;
  opacity: 0.7;
}

/* Stage 3 Z5 — surprise (zaskoczony) badge */
.init-chip__surprise {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 12px;
  line-height: 1;
  color: #ffd84a;
  text-shadow: 0 0 4px rgba(255, 216, 74, 0.7);
  animation: zaskoczony-pulse 1.4s ease-in-out infinite;
  pointer-events: auto;
  cursor: help;
}
.combat-combatant__surprise {
  display: inline-block;
  margin-left: 6px;
  font-size: 14px;
  color: #ffd84a;
  text-shadow: 0 0 4px rgba(255, 216, 74, 0.6);
  animation: zaskoczony-pulse 1.4s ease-in-out infinite;
  cursor: help;
}
@keyframes zaskoczony-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.18); }
}

/* Stage 7 C1 — condition badge row on initiative chip.
   Stacks badges horizontally along the top of the chip.
   Each badge has a tone-matching pulse animation. */
.init-chip__cond-row {
  position: absolute;
  top: 2px;
  right: 4px;
  display: inline-flex;
  gap: 3px;
  z-index: 2;
  pointer-events: auto;
}
.init-chip__cond-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  line-height: 1;
  cursor: help;
  user-select: none;
  filter: drop-shadow(0 0 3px currentColor);
  transition: transform 0.15s;
}
.init-chip__cond-badge:hover { transform: scale(1.2); }

/* Per-condition tints + pulse keyframes (color = drop-shadow accent) */
.init-chip__cond-badge--surprise { color: #ffd84a; animation: cond-pulse-warm 1.4s ease-in-out infinite; }
.init-chip__cond-badge--poison   { color: #4ade80; animation: cond-pulse-poison 1.8s ease-in-out infinite; }
.init-chip__cond-badge--bleed    { color: #ef4444; animation: cond-pulse-bleed 1.2s ease-in-out infinite; }
.init-chip__cond-badge--burn     { color: #fb923c; animation: cond-pulse-warm 0.9s ease-in-out infinite; }
.init-chip__cond-badge--fear     { color: #818cf8; animation: cond-pulse-cool 1.6s ease-in-out infinite; }
.init-chip__cond-badge--panic    { color: #a78bfa; animation: cond-pulse-cool 0.7s ease-in-out infinite; }
.init-chip__cond-badge--stun     { color: #c084fc; animation: cond-pulse-cool 1.4s ease-in-out infinite; }
.init-chip__cond-badge--blind    { color: #9ca3af; opacity: 0.7; }
.init-chip__cond-badge--curse    { color: #f472b6; animation: cond-pulse-cool 2.0s ease-in-out infinite; }
.init-chip__cond-badge--break    { color: #f87171; animation: cond-pulse-bleed 1.6s ease-in-out infinite; }
.init-chip__cond-badge--generic  { color: var(--text-muted); }

@keyframes cond-pulse-warm   { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.15); } }
@keyframes cond-pulse-poison { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes cond-pulse-bleed  { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.1); } }
@keyframes cond-pulse-cool   { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Stage 7 C2 — "Tura wroga…" overlay during enemy auto-turns.
   Lives inside the combat banner; absolutely positioned, fades in.
   Doesn't block clicks (pointer-events:none) because we still want chips clickable.
*/
.combat-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(20,18,26,0.55) 60%, rgba(20,18,26,0.0) 100%);
}
.combat-status-overlay--visible { opacity: 1; }

.combat-status-overlay__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 22px;
  background: linear-gradient(180deg, rgba(127,29,29,0.22) 0%, rgba(20,18,26,0.85) 100%);
  border: 1px solid rgba(220,38,38,0.45);
  border-radius: 10px;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.45),
    inset 0 0 14px rgba(220,38,38,0.18);
  animation: enemy-turn-card-pulse 1.8s ease-in-out infinite;
}
.combat-status-overlay__icon {
  font-size: 18px;
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239,68,68,0.6));
  line-height: 1;
}
.combat-status-overlay__title {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #fca5a5;
  text-transform: uppercase;
}
.combat-status-overlay__dots { display: inline-flex; gap: 2px; margin-left: 4px; }
.combat-status-overlay__dots i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #fca5a5;
  opacity: 0.3;
  animation: enemy-turn-dot 1.4s ease-in-out infinite;
}
.combat-status-overlay__dots i:nth-child(2) { animation-delay: 0.18s; }
.combat-status-overlay__dots i:nth-child(3) { animation-delay: 0.36s; }
.combat-status-overlay__sub {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: rgba(252,165,165,0.75);
  min-height: 14px;
}
@keyframes enemy-turn-card-pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,0.45), inset 0 0 14px rgba(220,38,38,0.18); }
  50%     { box-shadow: 0 4px 22px rgba(0,0,0,0.55), inset 0 0 22px rgba(220,38,38,0.32); }
}
@keyframes enemy-turn-dot {
  0%,100% { opacity: 0.25; transform: translateY(0); }
  50%     { opacity: 1;    transform: translateY(-2px); }
}
@media (min-width: 769px) {
  .combat-status-overlay { backdrop-filter: blur(2px); }
}

/* The init-chip already needs position:relative for the surprise badge.
   Re-assert here so the badge row pins correctly even if cascade order shifts. */
.init-chip { position: relative; }

/* ── Initiative Track (T34) ─────────────────────────────────────────────── */
.initiative-track {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 8px 4px 10px;
  margin: -4px 0 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 165, 74, 0.3) transparent;
  position: relative;
}
.initiative-track:empty { display: none; }
.initiative-track::-webkit-scrollbar { height: 4px; }
.initiative-track::-webkit-scrollbar-thumb { background: rgba(201, 165, 74, 0.3); border-radius: 2px; }

.init-chip {
  flex: 0 0 auto;
  min-width: 64px;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 8px 7px;
  border: 1px solid rgba(120, 90, 60, 0.4);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(35, 25, 22, 0.7) 0%, rgba(22, 16, 14, 0.7) 100%);
  position: relative;
  cursor: default;
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 220ms ease,
              border-color 220ms ease,
              opacity 320ms ease,
              filter 600ms ease;
}

.init-chip__portrait {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.5));
}

.init-chip__name {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 0.72rem;
  line-height: 1.1;
  color: rgba(232, 228, 220, 0.85);
  margin-top: 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.02em;
}

.init-chip__ini {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(201, 165, 74, 0.75);
  margin-top: 2px;
  text-transform: uppercase;
}

.init-chip__hp {
  width: 100%;
  height: 3px;
  margin-top: 5px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}
.init-chip__hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #6da64a, #9bc965);
  transition: width 320ms ease, background 320ms ease;
}
.init-chip__hp-fill--mid { background: linear-gradient(90deg, #d49b30, #e8c155); }
.init-chip__hp-fill--low { background: linear-gradient(90deg, #b03030, #d45050); }

/* U15 — wound tier on chip: colour dot + short label */
.init-chip__wound {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 3px;
  max-width: 100%;
}
.init-chip__wound-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
.init-chip__wound-label {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 0.62rem;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.init-chip__wound--near_death .init-chip__wound-dot {
  animation: cond-pulse-bleed 1.1s ease-in-out infinite;
}

/* Player vs enemy border tint */
.init-chip--player { border-color: rgba(120, 180, 100, 0.45); }
.init-chip--enemy  { border-color: rgba(200, 80, 80, 0.45); }

/* Active chip — gold glow, lift, caret */
.init-chip--active {
  transform: translateY(-3px) scale(1.06);
  border-color: rgba(255, 215, 106, 0.85);
  box-shadow:
    0 0 0 1px rgba(255, 215, 106, 0.35),
    0 6px 18px rgba(255, 180, 50, 0.25),
    inset 0 1px 0 rgba(255, 215, 106, 0.25);
  background: linear-gradient(180deg, rgba(60, 42, 24, 0.85) 0%, rgba(35, 25, 14, 0.85) 100%);
}
.init-chip--active .init-chip__name { color: #fff3d6; }
.init-chip--active .init-chip__ini  { color: #ffd76a; }
.init-chip--active::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #ffd76a;
  filter: drop-shadow(0 0 4px rgba(255, 180, 50, 0.6));
}

/* Acted this round — dim */
.init-chip--acted:not(.init-chip--active) {
  opacity: 0.45;
  filter: saturate(0.6);
}
.init-chip--acted:not(.init-chip--active) .init-chip__name { color: rgba(180, 175, 165, 0.65); }

/* Downed — greyscale + diagonal slash */
.init-chip--downed {
  opacity: 0.55;
  filter: grayscale(1) brightness(0.7);
}
.init-chip--downed .init-chip__name {
  text-decoration: line-through;
  text-decoration-color: rgba(220, 80, 80, 0.6);
  color: rgba(160, 155, 145, 0.6);
}
.init-chip--downed::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    transparent 47%,
    rgba(220, 80, 80, 0.45) 49%,
    rgba(220, 80, 80, 0.45) 51%,
    transparent 53%,
    transparent 100%
  );
  border-radius: 7px;
  pointer-events: none;
}

/* New-round sweep */
.initiative-track--new-round::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 215, 106, 0.18) 50%,
    transparent 100%
  );
  pointer-events: none;
  animation: initRoundSweep 600ms cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes initRoundSweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* Mobile: tighter chips */
@media (max-width: 480px) {
  .initiative-track { gap: 4px; padding: 6px 2px 8px; }
  .init-chip { min-width: 54px; max-width: 84px; padding: 4px 6px 6px; }
  .init-chip__portrait { font-size: 15px; }
  .init-chip__name { font-size: 0.66rem; }
  .init-chip__ini  { font-size: 0.56rem; }
}

.combat-banner__msg {
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--gold);
  border-radius: 3px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.combat-banner__msg--error {
  border-left-color: #d04848;
  color: #ffaaaa;
}

/* Combat composer */
/* SF4 (#632): pasek statusu gracza — trwała warstwa aktywnych kondycji nad kompozerem.
   Tokeny dark-fantasy, bez nowej palety. Informacyjny (nieklikalny) → niższy niż przyciski akcji. */
.combat-player-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg) 0;
  flex-shrink: 0;
}

.combat-player-status[hidden] {
  display: none;
}

.combat-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(201, 165, 74, 0.35);
  background: rgba(201, 165, 74, 0.08);
  color: var(--text-secondary, #cfc6b5);
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.combat-status-chip__glyph {
  font-size: 0.95rem;
}

.combat-status-chip__label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.combat-status-chip__level {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--accent-glow);
  color: var(--accent);
}

@media (max-width: 480px) {
  .combat-player-status {
    padding: var(--space-sm) var(--space-sm) 0;
    gap: 5px;
  }
  .combat-status-chip {
    font-size: 0.72rem;
    min-height: 26px;
    padding: 2px 7px;
  }
}

.combat-composer {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(20, 14, 18, 0.98) 0%, rgba(15, 10, 14, 0.98) 100%);
  border-top: 1px solid rgba(220, 80, 80, 0.3);
  flex-shrink: 0;
}

.combat-composer[hidden] {
  display: none;
}

.combat-btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;
  border: 1px solid;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  white-space: nowrap;
}

.combat-btn svg {
  flex-shrink: 0;
}

.combat-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Mobile: compress padding/typography so all 3 buttons fit on narrow screens */
@media (max-width: 480px) {
  .combat-composer {
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-sm);
    padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  }
  .combat-btn {
    padding: 10px 6px;
    gap: 6px;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    border-radius: 10px;
  }
  .combat-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Very narrow phones (<360px): hide labels, keep icons only */
@media (max-width: 359px) {
  .combat-btn span {
    display: none;
  }
  .combat-btn {
    padding: 12px 4px;
  }
  .combat-btn svg {
    width: 22px;
    height: 22px;
  }
}

.combat-btn:active {
  transform: scale(0.97);
}

.combat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.combat-btn--attack {
  background: linear-gradient(180deg, #8b2828 0%, #5e1818 100%);
  border-color: #c04040;
  color: #ffe0c0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 200, 100, 0.2);
}

.combat-btn--attack:hover:not(:disabled) {
  background: linear-gradient(180deg, #a03030 0%, #701c1c 100%);
  box-shadow: 0 4px 12px rgba(192, 64, 64, 0.4);
}

.combat-btn--flee {
  background: linear-gradient(180deg, #2c2c3a 0%, #1a1a25 100%);
  border-color: #4a4a5c;
  color: #c0c0d0;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.combat-btn--flee:hover:not(:disabled) {
  background: linear-gradient(180deg, #3a3a4a 0%, #22222e 100%);
  border-color: var(--gold);
  color: var(--gold);
}

/* SF1 (#619): „Akcja ▾" — neutralny rdzeń (złoto), filar otwierający bottom sheet */
.combat-btn--action {
  background: linear-gradient(180deg, #2a2230 0%, #1a1420 100%);
  border-color: var(--gold, #c9a54a);
  color: var(--gold, #c9a54a);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(201, 165, 74, 0.18);
}
.combat-btn--action:hover:not(:disabled) {
  background: linear-gradient(180deg, #362b3e 0%, #221a2a 100%);
  box-shadow: 0 4px 12px rgba(201, 165, 74, 0.3);
}

/* SF1 (#619): bottom sheet z pozostałymi akcjami walki (wysuw od dołu, kciukowy) */
.combat-action-sheet[hidden] { display: none; }
.combat-action-sheet {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.combat-action-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  animation: combatSheetFade 0.2s ease-out;
}
.combat-action-sheet__panel {
  position: relative;
  background: linear-gradient(180deg, rgba(28, 20, 26, 0.99) 0%, rgba(18, 12, 16, 0.99) 100%);
  border-top: 1px solid rgba(201, 165, 74, 0.4);
  border-radius: 18px 18px 0 0;
  padding: var(--space-sm) var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  animation: combatSheetSlideUp 0.22s ease-out;  /* SF1 wartość startowa */
}
@keyframes combatSheetSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes combatSheetFade { from { opacity: 0; } to { opacity: 1; } }
.combat-action-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(201, 165, 74, 0.4);
  margin: 6px auto var(--space-sm);
}
.combat-action-sheet__title {
  font-family: 'Cinzel', Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--gold, #c9a54a);
  text-align: center;
  margin-bottom: var(--space-sm);
}
.combat-action-sheet__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
/* Pozycje arkusza = pełna szerokość, wyrównane do lewej, min. 48px (kciuk) */
.combat-action-sheet__list .combat-btn {
  flex: none;
  width: 100%;
  justify-content: flex-start;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 1rem;
  min-height: 48px;
}
.combat-action-sheet__list .combat-btn span {
  text-overflow: clip;
  display: inline;
}
/* W arkuszu atrybut hidden faktycznie chowa pozycję (override .combat-btn{display:flex}) */
.combat-action-sheet__list .combat-btn[hidden] { display: none; }

/* ── SF2 (#620): zawartość pozycji arkusza — koszt, opis, powód wyszarzenia ── */
.combat-action-sheet__list .combat-btn {
  align-items: flex-start;
}
.combat-action-sheet__list .combat-btn .combat-btn__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  align-items: stretch;
  text-align: left;
}
.combat-action-sheet__list .combat-btn .combat-btn__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 100%;
}
.combat-action-sheet__list .combat-btn .combat-btn__label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Znacznik kosztu: ⏳ akcja zużywa turę (złoto) vs ↺ reakcja za darmo (zieleń) */
.combat-action-sheet__list .combat-btn .combat-btn__cost {
  flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.4;
}
.combat-btn__cost--action {
  color: var(--gold, #c9a54a);
  border-color: rgba(201, 165, 74, 0.5);
  background: rgba(201, 165, 74, 0.12);
}
.combat-btn__cost--reaction {
  color: var(--success, #5fae6a);
  border-color: rgba(95, 174, 106, 0.5);
  background: rgba(95, 174, 106, 0.12);
}
.combat-action-sheet__list .combat-btn .combat-btn__desc {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted, #9a8f80);
  opacity: 0.9;
  white-space: normal;
}
/* Powód wyszarzenia — popielaty, pojawia się tylko gdy pozycja niedostępna (JS zdejmuje [hidden]) */
.combat-action-sheet__list .combat-btn .combat-btn__reason {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted, #9a8f80);
  white-space: normal;
}
.combat-action-sheet__list .combat-btn .combat-btn__reason[hidden] { display: none; }
.combat-action-sheet__list .combat-btn .combat-btn__reason::before { content: "⚠ "; }
/* Niedostępna pozycja = wyszarzona (disabled daje opacity:0.5 + cursor not-allowed); powód czytelny */
.combat-action-sheet__list .combat-btn.is-unavailable .combat-btn__reason { color: #c98a6a; }

/* ── SF3 (#631): reakcja „uzbrojona" — toggle wizualnie różny od akcji zużywającej turę ── */
/* Poświata + ramka akcentowa (złoto): gracz widzi, że unik/blok czeka na cios wroga. */
.combat-action-sheet__list .combat-btn.is-armed {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 0 12px var(--accent-glow);
  background: var(--accent-glow);
}
/* Uzbrojony znacznik kosztu mocniej świeci (z neutralnej zieleni → akcent). */
.combat-action-sheet__list .combat-btn.is-armed .combat-btn__cost--reaction {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(201, 165, 74, 0.18);
}
/* Linijka „⚡ uzbrojony do następnego ataku" — odsłaniana przez JS gdy reaction_declared. */
.combat-action-sheet__list .combat-btn .combat-btn__armed {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  white-space: normal;
}
.combat-action-sheet__list .combat-btn .combat-btn__armed[hidden] { display: none; }
/* Sheet zawsze pokazuje tekst, nawet na bardzo wąskich ekranach (override globalnego @media span{display:none}) */
@media (max-width: 359px) {
  .combat-action-sheet__list .combat-btn .combat-btn__body { display: flex; }
  .combat-action-sheet__list .combat-btn .combat-btn__head,
  .combat-action-sheet__list .combat-btn .combat-btn__label,
  .combat-action-sheet__list .combat-btn .combat-btn__cost,
  .combat-action-sheet__list .combat-btn .combat-btn__desc { display: block; }
  .combat-action-sheet__list .combat-btn .combat-btn__head { display: flex; }
  .combat-action-sheet__list .combat-btn .combat-btn__reason:not([hidden]) { display: block; }
  .combat-action-sheet__list .combat-btn .combat-btn__armed:not([hidden]) { display: block; }
}

/* Hide normal composer when combat composer shown */
.composer.composer--hidden {
  display: none;
}

/* Combat End Overlay */
.combat-end-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.combat-end-overlay[hidden] {
  display: none;
}

.combat-end-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.combat-end-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

/* U19 (#571) — Recap "Poprzednio…" card */
.recap-inner {
  max-width: 480px;
  text-align: left;
}
.recap-gap {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-style: italic;
  margin-bottom: var(--space-lg);
}
.recap-body {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: var(--space-lg);
}
.recap-section { margin-bottom: var(--space-lg); }
.recap-section__title {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #c9a14a);
  margin-bottom: var(--space-sm);
}
.recap-summary {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}
.recap-turn {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}
.recap-turn:last-child { border-bottom: none; }
.recap-turn__num {
  display: inline-block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.recap-turn__player {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin: 2px 0;
}
.recap-turn__gm {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  margin: 2px 0;
}
.recap-quests { list-style: none; padding: 0; margin: 0; }
.recap-quest {
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  padding: 4px 0;
}
.recap-empty {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

.combat-end-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

.combat-end-loot {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-align: left;
}

.combat-end-loot-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.combat-end-loot-list li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border);
}

.combat-loot-list ul {
  list-style: none;
  margin: var(--space-md) 0;
  padding: 0;
  text-align: left;
}

.combat-loot-list li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.combat-loot-list label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.combat-loot-empty {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* U17 (#565): Drop celebration — highlighted card for affixed/rare drops + diff vs equipped */
.drop-celebration-inner { max-width: 460px; }

.drop-celebration-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  max-height: 60vh;
  overflow-y: auto;
}

.drop-card {
  border: 2px solid var(--rarity-color, #9aa);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 14px -4px var(--rarity-color, #9aa);
  text-align: left;
}
/* rarity color map (starting palette — Numbers Policy) */
.drop-card--common { --rarity-color: #9aa3ad; }
.drop-card--rare   { --rarity-color: #4a90d9; }
.drop-card--epic   { --rarity-color: #b061d6; }

.drop-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.drop-card__icon { font-size: 1.3em; }
.drop-card__name { font-weight: 700; flex: 1; }

.drop-rarity {
  font-size: var(--font-size-xs, 0.72rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 8px;
  border-radius: 10px;
  color: #fff;
  background: var(--rarity-color, #9aa);
}

.drop-affix-list {
  list-style: none;
  margin: 0 0 var(--space-sm);
  padding: 0;
}
.drop-affix {
  font-size: var(--font-size-sm);
  color: #d8c98a;
  padding: 2px 0;
}

.drop-diff-block { display: flex; flex-direction: column; gap: 3px; margin-bottom: var(--space-sm); }
.drop-diff {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}
.drop-diff--up   { color: #5cc46a; }
.drop-diff--down { color: #d9584a; }
.drop-diff--same { color: var(--text-muted); }
.drop-diff--none { color: var(--text-muted); font-style: italic; }

.drop-equip-btn { width: 100%; margin-top: 2px; }

.combat-end-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--space-sm);
  transition: all 0.2s;
}

.combat-end-btn:hover {
  background: var(--accent-light);
}

.combat-end-btn--secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.combat-end-btn--secondary:hover {
  border-color: var(--text-secondary);
  background: transparent;
}

/* Combat turn cards in chat */
.chat-bubble--cturn-player,
.chat-bubble--cturn-enemy,
.chat-bubble--cturn-death {
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  max-width: 88%;
  margin: 2px 0;
}

/* Player attack — right side, light blue */
.chat-bubble--cturn-player {
  align-self: flex-end;
  background: rgba(40, 80, 160, 0.18);
  border: 1px solid rgba(80, 130, 220, 0.3);
  border-bottom-right-radius: var(--radius-sm);
}

/* Enemy attack — left side, light red */
.chat-bubble--cturn-enemy {
  align-self: flex-start;
  background: rgba(160, 40, 40, 0.18);
  border: 1px solid rgba(220, 80, 80, 0.3);
  border-bottom-left-radius: var(--radius-sm);
}

/* Death event — centered, subtle purple */
.chat-bubble--cturn-death {
  align-self: center;
  background: rgba(80, 40, 120, 0.15);
  border: 1px solid rgba(140, 80, 200, 0.25);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cturn {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cturn__head {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  font-family: 'Cinzel', Georgia, serif;
}

.chat-bubble--cturn-player .cturn__head {
  color: rgba(160, 200, 255, 0.95);
}

.chat-bubble--cturn-enemy .cturn__head {
  color: rgba(255, 170, 160, 0.95);
}

.cturn__detail {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.cturn--death {
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

.cturn__icon {
  font-size: 1rem;
}

.cturn__hit {
  color: #6dcc88;
  font-weight: 600;
}

.cturn__miss {
  color: rgba(255, 150, 80, 0.9);
}

/* #861 — dual-wield: drugi cios off-hand wyróżniony lewym akcentem. */
.cturn--offhand {
  border-left: 2px solid rgba(120, 180, 255, 0.55);
  padding-left: var(--space-xs, 6px);
  opacity: 0.95;
}

/* #861 — parowanie (#598): badge przy ataku wroga + delikatny akcent karty. */
.cturn--parried {
  border-left: 2px solid rgba(120, 200, 160, 0.55);
}
.cturn__parry {
  margin-top: var(--space-xs, 4px);
  font-size: 0.72rem;
  font-weight: 600;
  color: #6dccaa;
}

/* SF8 (#637) — rozbicie rzutu po nazwanym źródle (atak + test umiejętności). */
.cturn__breakdown {
  margin-top: var(--space-xs, 4px);
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.sf8-part {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sf8-part i {
  font-style: normal;
  opacity: 0.85;
}
.sf8-part--pos { color: var(--success, #6dcc88); }
.sf8-part--neg { color: var(--danger, #d9534f); }

/* ── SF5 (#634): ulotne komunikaty zdarzeń — przygaszony wpis, zanika po ekspozycji ── */
.chat-bubble--cturn-ephemeral {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 0 !important;
  margin: 2px 0 !important;
}
.cturn--ephemeral-row {
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.74rem;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  /* widoczne 5.4 s, potem 0.6 s fade-out (łącznie 6 s = setTimeout w JS) */
  animation: sf5EphemeralFade 6s ease forwards;
}
.cturn--ephemeral-row .cturn__icon { font-size: 0.95rem; opacity: 0.85; }
.cturn--ephemeral-curse  { color: rgba(190, 150, 220, 0.9); }
.cturn--ephemeral-haste  { color: var(--accent); }
.cturn--ephemeral-confuse { color: rgba(230, 190, 120, 0.92); }

@keyframes sf5EphemeralFade {
  0%   { opacity: 0; transform: translateY(4px); }
  6%   { opacity: 1; transform: translateY(0); }
  90%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .cturn--ephemeral-row { animation: none; }
}

/* ── Wizard stat/skill adjustment steps ── */
.wizard-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}
.wizard-points, .wizard-swaps {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.wizard-class-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}
.wizard-stat-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}
.wizard-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
}
.wizard-stat-label {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 34px;
  color: var(--text-primary);
}
.wizard-stat-mod {
  font-size: 0.78rem;
  color: var(--accent);
  min-width: 24px;
}
.wizard-stat-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wizard-stat-btn:active { background: rgba(255,255,255,0.15); }
.wizard-stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  flex: 1;
  color: var(--text-primary);
}
.wizard-reset-btn {
  margin-top: var(--space-sm);
  font-size: 0.85rem;
}

/* Skill slot rows */
.wizard-skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
  gap: 8px;
}
.wizard-skill-row--changed {
  border-left: 3px solid var(--accent);
}
.wizard-skill-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.wizard-skill-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.wizard-skill-rank {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wizard-skill-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 4px 6px;
  max-width: 140px;
}
.wizard-skill-select:disabled { opacity: 0.4; }

/* Archetype cards (new simpler style) */
.archetype-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}
.archetype-card {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
  display: grid;
  grid-template-columns: 2rem 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: start;
}
.archetype-card:hover { background: rgba(255,255,255,0.07); }
.archetype-card--selected {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 212,160,89), 0.10);
}
.archetype-icon { font-size: 1.4rem; grid-row: 1 / 3; align-self: center; }
.archetype-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 2px;
}
.archetype-bonus {
  grid-column: 2;
  display: block;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 4px;
}
.archetype-desc {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Skill row — swap select + level +/- side by side */
.wizard-skill-swap {
  flex: 1;
  min-width: 0;
}
.wizard-skill-level {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.wizard-skill-level .wizard-stat-val {
  font-size: 0.75rem;
  min-width: 52px;
  text-align: center;
}

/* ── Wizard loading dots animation ── */
@keyframes wiz-dots {
  0%   { content: "Ładowanie."; }
  33%  { content: "Ładowanie.."; }
  66%  { content: "Ładowanie..."; }
  100% { content: "Ładowanie."; }
}
.wiz-loading-dots::after {
  content: "Ładowanie.";
  animation: wiz-dots 1.2s steps(1, end) infinite;
  display: inline-block;
}

/* ── Stat controls: tighter [−] 15 [+] ── */
.wizard-stat-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.wizard-stat-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
}
.wizard-skill-row {
  flex-wrap: wrap;
}
.wizard-stat-label-wrap { display: flex; align-items: center; gap: 4px; min-width: 42px; }
.wizard-stat-label {
  font-weight: 700;
  font-size: 0.9rem;
}
.wizard-stat-hint {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08); color: var(--text-muted);
  font-size: 0.62rem; font-weight: 700; cursor: help;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* E2 (#417) — inline stat/skill descriptions replace tooltip duplicates */
.wizard-stat-desc,
.wizard-skill-desc {
  flex-basis: 100%;
  width: 100%;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.48);
  margin-top: 2px;
  padding: 4px 0 2px;
  border-top: 1px solid rgba(255,255,255,0.08);
  line-height: 1.4;
}

/* ── Wizard roll-in animations (stat/skill step reveal) ─────────────────── */
@keyframes wiz-row-enter {
  0% {
    opacity: 0;
    transform: translateX(18px) scale(0.97);
  }
  60% {
    opacity: 1;
    transform: translateX(-2px) scale(1.005);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes wiz-val-rolling {
  0%, 100% { opacity: 0.5; transform: scale(0.92); }
  50%       { opacity: 1;   transform: scale(1.05); }
}

@keyframes wiz-val-land {
  0%   { transform: scale(1.3);  color: var(--accent,#c9a54a); text-shadow: 0 0 12px rgba(201,165,74,.7); }
  55%  { transform: scale(0.92); }
  80%  { transform: scale(1.04); }
  100% { transform: scale(1);    color: inherit; text-shadow: none; }
}

@keyframes wiz-rank-land {
  0%   { transform: scale(1.2);  color: var(--accent,#c9a54a); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1);    color: inherit; }
}

.wizard-stat-row.wiz-entering,
.wizard-skill-row.wiz-entering {
  opacity: 0;
  animation: wiz-row-enter 0.38s cubic-bezier(0.22, 0.85, 0.42, 1) forwards;
  animation-delay: calc(var(--wiz-i, 0) * 52ms);
}

.wizard-stat-val.wiz-val-rolling {
  animation: wiz-val-rolling 0.07s ease-in-out infinite;
  color: rgba(201,165,74,0.6);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.wizard-stat-val.wiz-val-landed {
  animation: wiz-val-land 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wizard-skill-rank.wiz-rank-rolling {
  color: rgba(201,165,74,0.75);
  letter-spacing: 0.04em;
}

.wizard-skill-rank.wiz-rank-landed {
  animation: wiz-rank-land 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

/* E2 (#417) — Creator tooltips. The `?` hints and archetype cards carry a
   data-tooltip; this renders it as a floating bubble on hover/focus so the
   player sees the mechanical explanation. Without this rule the attribute did
   nothing. pointer-events:none keeps the bubble from blocking the click. */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after,
[data-tooltip]:focus::after,
[data-tooltip]:focus-within::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: 260px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(18, 16, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
  pointer-events: none;
}
.wizard-stat-mod {
  font-size: 0.82rem;
  color: var(--accent);
  min-width: 28px;
}
.wizard-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
}
.wizard-stat-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1.1rem;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wizard-stat-btn:disabled { opacity: 0.3; cursor: default; }
.wizard-stat-btn:active:not(:disabled) { background: rgba(255,255,255,0.18); }

/* ── Skill list ── */
.wizard-skill-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}
.wizard-skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
}
.wizard-skill-row--changed { border-left: 3px solid var(--accent); }
.wizard-skill-row--swapping { background: rgba(255,255,255,0.07); }
.wizard-skill-name {
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.wizard-skill-stat { color: var(--text-muted); font-weight: 400; }
.wizard-skill-rank { font-size: 0.82rem; min-width: 72px; text-align: center; }
.wizard-skill-controls { flex-shrink: 0; }
.wizard-skill-swap-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 5px;
  line-height: 1.2;
}
.wizard-skill-swap-btn--revert { color: var(--accent); border-color: var(--accent); }
.wizard-skill-swap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.wizard-skill-swap-sel {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 6px 8px;
}

/* ── Debug block ─────────────────────────────────────────────── */
.debug-block {
  margin-top: 4px;
  border-radius: 6px;
}
.debug-block__pre {
  margin: 0 0 2px 0;
  padding: 6px 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,160,0,0.35);
  border-radius: 6px;
  color: rgba(255,220,100,0.9);
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.debug-block__loc {
  display: block;
  padding: 4px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,160,0,0.2);
  border-radius: 6px;
  color: rgba(180,220,255,0.85);
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* ── Skill Test Roll Popup v3 ─────────────────────────────────────────────── */
.skill-roll-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,4,3,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
.srp-card {
  background: #fef6e4;
  border: 1px solid #c9a050;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,160,80,0.3);
  width: 280px;
  display: flex;
  flex-direction: column;
  font-family: Cinzel,"Palatino Linotype",serif;
  overflow: hidden;
  border-radius: 10px;
}
.srp-head {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(74,53,16,0.4);
}
.srp-eyebrow {
  font-size: 0.47rem;
  letter-spacing: 0.3em;
  color: #4a3510;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.srp-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #c9961a;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.15;
}
.srp-mods-line {
  font-size: 0.6rem;
  color: #6a5228;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.srp-mods-line span { color: #8a6a30; font-weight: 700; }
.srp-die-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 10px;
  gap: 10px;
}
.srp-die-wrap {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}
.srp-die-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 10px rgba(160,100,10,0.2));
}
.srp-d20-outer { transition: stroke 0.25s; }
.srp-d20-num   { transition: fill 0.25s; }
.srp-die-wrap.srp-rolling {
  animation: srpTumble 0.1s linear infinite;
}
@keyframes srpTumble {
  0%  { transform: rotate(-4deg) scale(1.02); }
  50% { transform: rotate(4deg) scale(0.98); }
  100%{ transform: rotate(-4deg) scale(1.02); }
}
.srp-die-wrap.srp-landed {
  animation: srpLand 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes srpLand {
  from { transform: scale(1.15); }
  to   { transform: scale(1); }
}
.srp-die-wrap.srp-nat20 .srp-die-svg {
  filter: drop-shadow(0 0 10px rgba(240,192,64,0.8));
}
.srp-die-wrap.srp-nat1 {
  animation: srpShake 0.4s ease;
}
@keyframes srpShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.srp-result {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  opacity: 0;
  transition: opacity 0.3s;
}
.srp-result.visible { opacity: 1; }
.srp-res-val {
  font-size: 1.6rem;
  font-weight: 700;
  color: #3a2510;
  font-family: Cinzel,serif;
  line-height: 1;
}
.srp-res-sep { font-size: 0.75rem; color: #7a5520; }
.srp-res-total {
  font-size: 1.6rem;
  font-weight: 700;
  color: #8a6010;
  font-family: Cinzel,serif;
  line-height: 1;
}
.srp-res-total.nat20 { color: #b07800; }
.srp-res-total.nat1  { color: #a02020; }
.srp-res-label { font-size: 0.9rem; color: #8a6010; align-self: flex-end; padding-bottom: 2px; }
.srp-nat {
  font-size: 0.52rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
  min-height: 12px;
}
.srp-nat.nat20 { color: #f0c040; }
.srp-nat.nat1  { color: #b03030; }
.srp-foot {
  border-top: 1px solid rgba(74,53,16,0.3);
  display: flex;
  flex-direction: column;
}
.srp-btn {
  background: transparent;
  border: none;
  font-family: Cinzel,serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}
.srp-btn-roll { color: #7a5010; border-bottom: 1px solid rgba(74,53,16,0.2); }
.srp-btn-roll:hover:not(:disabled) { background: rgba(201,150,26,0.12); color: #5a3a08; }
.srp-btn-roll:disabled { opacity: 0.35; cursor: not-allowed; }
.srp-btn-confirm { color: #3a2510; background: rgba(201,150,26,0.15); }
.srp-btn-confirm:hover:not(:disabled) { background: rgba(201,150,26,0.25); color: #1a1008; }
.srp-btn-confirm:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── dice.js 3D roll overlay — issue #65 ────────────────────────────────── */

#dice-overlay {
  position: absolute;   /* scoped to #game-screen so die stays within the chat area */
  inset: 0;
  z-index: 9000;
  background: rgba(5, 3, 1, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;     /* clip physics edges that reach the border */
}
#dice-overlay[hidden] { display: none !important; }
#dice-result-card[hidden] { display: none !important; }

#dice-skip-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 10;
  width: 36px;
  height: 36px;
  background: rgba(40, 20, 10, 0.8);
  border: 1px solid rgba(160, 100, 30, 0.4);
  border-radius: 50%;
  color: rgba(200, 160, 80, 0.7);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
#dice-skip-btn:hover { background: rgba(80, 40, 10, 0.9); color: #d4a040; }

/* SF6 (#635) — baner stawki hazardu: widoczny u góry przez cały rzut, nad kością */
#dice-stake-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  padding: 6px 16px;
  background: rgba(20, 14, 4, 0.92);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent-light);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#dice-stake-banner[hidden] { display: none !important; }

#dice-container {
  position: absolute;
  inset: 0;
}

/* #829 — modern 3D dice (dice-box-threejs) mount. Same footprint as #dice-container,
   below the result/skill cards (which sit at z-index 1+). */
#dice3d-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#dice3d-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#dice-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* #829 — reliable 2D damage dice (Stage 2). The 3D second-throw was invisible on
   player devices; this pure-DOM roll always renders the damage dice. */
.dice2d-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 2;
  pointer-events: none;
}
.dice2d-die {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: #f3e0b0;
  background: linear-gradient(145deg, #3a2410, #1b1107);
  border: 2px solid var(--accent, #c08020);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), inset 0 0 14px rgba(200, 150, 60, 0.25);
  transform: rotate(-7deg);
}
.dice2d-die--heal {
  color: #bfe9b6;
  border-color: #5fae57;
  background: linear-gradient(145deg, #16300f, #0a1c08);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), inset 0 0 14px rgba(95, 174, 87, 0.3);
}
.dice2d-die--land {
  color: #ffd76a;
  animation: dice2dLand 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.dice2d-die--heal.dice2d-die--land { color: #9fe88f; }
@keyframes dice2dLand {
  0%   { transform: scale(1.45) rotate(9deg); }
  100% { transform: scale(1) rotate(0deg); }
}

#dice-skill-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin-bottom: 32px;
  padding: 20px 28px;
  background: rgba(14, 9, 4, 0.92);
  border: 1px solid rgba(160, 100, 30, 0.35);
  border-radius: 10px;
  text-align: center;
  backdrop-filter: blur(6px);
}

#dice-skill-name {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: #c9961a;
  margin-bottom: 4px;
}

#dice-skill-meta {
  font-size: 0.85rem;
  color: rgba(200, 170, 110, 0.65);
  margin-bottom: 16px;
}

#dice-roll-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  padding: 9px 28px;
  background: rgba(100, 60, 10, 0.5);
  color: #d4a040;
  border: 1px solid rgba(160, 100, 30, 0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

#dice-roll-btn:hover:not(:disabled) {
  background: rgba(160, 100, 20, 0.6);
  color: #f0c050;
}

#dice-roll-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#dice-result-card {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  animation: dice-result-fade 0.3s ease;
}

@keyframes dice-result-fade {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

#dice-result-num {
  font-family: 'Cinzel', serif;
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1;
  color: #c9961a;
  text-shadow: 0 0 40px rgba(201, 150, 26, 0.5);
}

#dice-result-num.nat20 { color: #ffd700; text-shadow: 0 0 60px rgba(255, 215, 0, 0.8); }
#dice-result-num.nat1  { color: #9b2020; text-shadow: 0 0 40px rgba(155, 32, 32, 0.6); }
#dice-result-num.heal  { color: #34d399; text-shadow: 0 0 40px rgba(52, 211, 153, 0.5); }

#dice-result-total {
  margin-top: 8px;
  font-size: 1.1rem;
  color: rgba(200, 170, 110, 0.8);
  letter-spacing: 0.05em;
}

#dice-result-verdict {
  margin-top: 12px;
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  letter-spacing: 0.1em;
  font-weight: 600;
}

#dice-result-verdict.success { color: #4caf78; text-shadow: 0 0 20px rgba(76, 175, 120, 0.4); }
#dice-result-verdict.failure { color: #9b2020; text-shadow: 0 0 20px rgba(155, 32, 32, 0.3); }
#dice-result-verdict.nat20   { color: #ffd700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
#dice-result-verdict.nat1    { color: #9b2020; }
/* Opozycyjny test trafienia — werdykt + linia z rzutem wroga na unik. */
#dice-result-verdict.dice-verdict-hit  { color: #4caf78; font-size: 1.35rem; }
#dice-result-verdict.dice-verdict-miss { color: #c9712a; font-size: 1.35rem; }
.dice-dodge-line {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #d9a441;
  letter-spacing: 0.03em;
}

#dice-result-skill {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  color: #c9961a;
  margin-bottom: 4px;
}

#dice-result-intent {
  font-size: 0.82rem;
  font-style: italic;
  color: rgba(200, 170, 110, 0.65);
  margin-bottom: 10px;
  max-width: 280px;
  text-align: center;
}

#dice-result-intent[hidden] { display: none !important; }

/* ── World Map Panel — Task 43 ───────────────────────────────────────────── */
.wmap-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 96vw);
  height: 100%;
  background: #0a0806;
  border-left: 1px solid #2a2218;
  box-shadow: -4px 0 32px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  z-index: 800;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.wmap-panel:not([hidden]) { transform: translateX(0); display: flex; }
.wmap-panel[hidden] { display: flex; } /* keep flex, use transform for animation */

.wmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #2a2218;
  flex-shrink: 0;
}
.wmap-title { font-family: Cinzel,serif; font-size: 0.88rem; font-weight: 700; color: #c9961a; letter-spacing: 0.1em; }
.wmap-close { background: none; border: none; color: var(--text-muted, #666); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
.wmap-close:hover { color: var(--text-primary, #eee); }

.wmap-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.wmap-svg { width: 100%; height: 100%; background: #060406; display: block; }

/* Travel confirmation */
.wmap-confirm {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(10,8,6,0.95);
  border-top: 1px solid #4a3510;
  padding: 14px 16px;
}
.wmap-confirm-title { font-family: Cinzel,serif; font-size: 0.9rem; font-weight: 700; color: #c9961a; margin-bottom: 6px; }
.wmap-confirm-info { font-size: 0.78rem; color: #9a8a6a; margin-bottom: 12px; line-height: 1.5; }
.wmap-confirm-btns { display: flex; gap: 8px; }
.wmap-btn-go {
  flex: 1; background: #c9961a; color: #0a0806; border: none;
  font-family: Cinzel,serif; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; padding: 10px;
  cursor: pointer; transition: background 0.15s;
}
.wmap-btn-go:hover { background: #e8b830; }
.wmap-btn-cancel {
  flex: 1; background: transparent; color: #7a6030;
  border: 1px solid #4a3510; font-family: Cinzel,serif;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px; cursor: pointer; transition: border-color 0.15s;
}
.wmap-btn-cancel:hover { border-color: #7a5018; }

/* ── Local Map Panel — #998 FAZA ML ──────────────────────────────────────── */
.lmap-panel { background: #06090a; border-left-color: #1a2a2a; }
.lmap-panel .wmap-canvas-wrap { overflow: visible; }
.lmap-svg { background: #040a0c; overflow: visible; }

.lmap-back-btn {
  background: none; border: 1px solid #2a3a3a;
  color: #6a9aaa; font-size: 0.72rem; letter-spacing: 0.06em;
  padding: 4px 10px; cursor: pointer; transition: color 0.15s, border-color 0.15s;
  font-family: Cinzel, serif;
}
.lmap-back-btn:hover { color: #9acada; border-color: #4a7a8a; }

.lmap-legend {
  display: flex; gap: 16px;
  padding: 8px 16px;
  font-size: 0.7rem;
  border-top: 1px solid #1a2a2a;
  flex-shrink: 0;
}
.lmap-leg--safe { color: #5aaa7a; }
.lmap-leg--risky { color: #cc6a3a; }

/* ── Adventure type selector (campaigns screen) ──────────────────────────── */
.adv-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 4px;
}
.adv-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}
.adv-card--primary { border-color: var(--accent-dark); }
.adv-card--primary:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.adv-card--disabled { opacity: 0.45; cursor: not-allowed; }
.adv-card__icon { font-size: 1.6rem; flex-shrink: 0; width: 36px; text-align: center; }
.adv-card__body { flex: 1; }
.adv-card__body h3 { font-size: var(--font-size-base); font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.adv-card__body p  { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.4; }
.adv-card__arrow { color: var(--accent); font-size: 1.3rem; flex-shrink: 0; }
.adv-card__tag { font-size: 0.65rem; color: var(--text-muted); background: rgba(255,255,255,0.06); padding: 2px 7px; border-radius: 99px; flex-shrink: 0; }
.campaigns-section-label { font-size: var(--font-size-xs); font-weight: 600; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; padding: 16px 16px 6px; }

/* ── Desktop: wider game chat ─────────────────────────────────────────────── */
@media (min-width: 900px) {
  #game-screen {
    max-width: 860px;
    margin: 0 auto;
  }
  .wmap-panel {
    position: absolute;
    right: 0; top: 0;
    height: 100%;
    width: min(400px, 45%);
    box-shadow: none;
    border-left: 1px solid #2a2218;
    transform: none !important;
  }
  .wmap-panel[hidden] { display: none !important; }
  .wmap-panel:not([hidden]) { display: flex !important; transform: none !important; }
}

/* Map close button — bigger touch target ─────────────────────────────────── */
.wmap-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

/* ── Travel event bubble — centered, amber tint ──────────────────────────── */
.chat-bubble--travel {
  align-self: center;
  max-width: 80%;
  background: rgba(180, 140, 30, 0.12);
  border: 1px solid rgba(201, 165, 74, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: #d4b870;
  margin: 4px auto;
}
.chat-bubble--travel strong { color: #e8c860; }
.chat-bubble--travel em { color: #b89a50; font-style: italic; }

/* ── Full-screen Travel Cinematic Overlay ───────────────────────────────────── */
.travel-cinematic {
  position: fixed; inset: 0; z-index: 9800;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.65s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.travel-cinematic[hidden] {
  display: flex !important;
  pointer-events: none;
}
.travel-cin--visible { opacity: 1; }

.travel-cin__bg {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(160deg, #0A0810 0%, #16141E 100%);
  transition: background 0s;
}
.travel-cin__bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 20%, rgba(0,0,0,0.6) 100%);
}
.travel-cin__bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  z-index: 1;
}

.travel-cin__content {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  gap: 16px;
  padding: 40px 28px 100px;
  text-align: center; width: 100%; max-width: 380px;
}

.travel-cin__icon {
  font-size: 5.5rem; line-height: 1;
  filter: drop-shadow(0 6px 28px rgba(0,0,0,0.7));
  animation: cin-float 3.5s ease-in-out infinite;
}
@keyframes cin-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.travel-cin__title {
  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  font-size: 2rem; font-weight: 700; margin: 0;
  color: #D4A94A;
  letter-spacing: 0.06em; line-height: 1.2;
  text-shadow: 0 2px 24px rgba(212,169,74,0.45), 0 0 80px rgba(212,169,74,0.12);
}

.travel-cin__atmo {
  font-family: Georgia, serif;
  font-style: italic; font-size: 0.9rem;
  color: #C8B090; max-width: 270px; line-height: 1.65;
  margin: 0; opacity: 0.9;
}

.travel-cin__tip {
  background: rgba(8,5,2,0.72);
  border: 1px solid rgba(212,169,74,0.22);
  border-radius: 8px; padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
  text-align: left; width: 100%; max-width: 320px;
  backdrop-filter: blur(6px);
  margin-top: 6px;
  animation: cin-tip-in 0.5s 0.4s both;
}
@keyframes cin-tip-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.travel-cin__tip[hidden] { display: none !important; }

.travel-cin-tip__icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 1px; }
.travel-cin-tip__body { display: flex; flex-direction: column; gap: 3px; }
.travel-cin-tip__label {
  font-size: 0.6rem; letter-spacing: 0.14em;
  color: #D4A94A; font-weight: 700; text-transform: uppercase;
}
.travel-cin-tip__title-text {
  font-size: 0.84rem; color: #E8D4A8; font-weight: 600; margin-bottom: 2px;
}
.travel-cin-tip__text { font-size: 0.8rem; color: #B8A880; line-height: 1.5; }

.travel-cin__footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding-bottom: 22px;
}
.travel-cin__progress {
  width: 100%; height: 3px;
  background: rgba(255,255,255,0.06);
}
.travel-cin__bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, rgba(212,169,74,0.5), #D4A94A);
  border-radius: 0 2px 2px 0;
}
.travel-cin__hint {
  font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin: 0;
  animation: cin-hint-pulse 2s ease-in-out infinite;
}
@keyframes cin-hint-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ── Custom DELETE confirmation modal ───────────────────────────────────────── */
.delete-modal-overlay {
  position: fixed; inset: 0; background: rgba(4,2,1,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 9500; backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.delete-modal {
  background: #0e0a07;
  border: 1px solid #4a2010;
  box-shadow: 0 0 0 3px #0e0a07, 0 0 0 4px #2a1008, 0 8px 40px rgba(0,0,0,0.8);
  width: min(320px, 88vw);
  padding: 0;
  font-family: Cinzel, serif;
  overflow: hidden;
}
.delete-modal__header {
  background: rgba(80,20,10,0.3);
  border-bottom: 1px solid rgba(180,50,30,0.3);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
}
.delete-modal__icon { font-size: 1.3rem; }
.delete-modal__title { font-size: 0.85rem; font-weight: 700; color: #c05030; letter-spacing: 0.1em; text-transform: uppercase; }
.delete-modal__body { padding: 16px 18px; }
.delete-modal__desc { font-family: var(--font-family); font-size: 0.82rem; color: #9a8878; line-height: 1.55; margin-bottom: 12px; }
.delete-modal__hero-name { color: #e8d0b0; font-family: Cinzel, serif; font-size: 0.88rem; font-weight: 700; margin-bottom: 12px; text-align: center; }
.delete-modal__label { font-size: 0.62rem; letter-spacing: 0.2em; color: #7a5040; text-transform: uppercase; margin-bottom: 6px; }
.delete-modal__input {
  width: 100%; background: #060402; border: 1px solid #3a1808;
  color: #e8d0b0; padding: 10px 12px; font-family: Cinzel, serif;
  font-size: 0.82rem; letter-spacing: 0.1em; outline: none;
  transition: border-color 0.2s;
}
.delete-modal__input:focus { border-color: #c04030; }
.delete-modal__input.valid { border-color: #c04030; color: #ff6040; }
.delete-modal__footer {
  display: flex; border-top: 1px solid rgba(74,32,16,0.4);
}
.delete-modal__btn {
  flex: 1; padding: 12px; border: none; font-family: Cinzel, serif;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; cursor: pointer; transition: background 0.15s;
}
.delete-modal__btn--cancel { background: transparent; color: #6a5040; }
.delete-modal__btn--cancel:hover { background: rgba(255,255,255,0.04); }
.delete-modal__btn--confirm {
  background: rgba(180,40,20,0.15); color: #c04030;
  border-left: 1px solid rgba(74,32,16,0.4);
}
.delete-modal__btn--confirm:hover:not(:disabled) { background: rgba(180,40,20,0.3); color: #ff6040; }
.delete-modal__btn--confirm:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Settings panel nav buttons ─────────────────────────────────────────────── */
.settings-nav-mini {
  display: flex; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.settings-nav-mini-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 10px; background: rgba(201,165,74,0.06);
  border: 1px solid rgba(201,165,74,0.2); border-radius: var(--radius-sm);
  color: var(--accent); font-size: 0.7rem; font-family: Cinzel, serif;
  letter-spacing: 0.06em; cursor: pointer; transition: all 0.15s;
}
.settings-nav-mini-btn:hover { background: rgba(201,165,74,0.12); border-color: var(--accent); }
.settings-nav-mini-btn svg { opacity: 0.7; }

/* ── Wizard Step 4 — Identity ───────────────────────────────────────────────── */
.wiz-identity-grid { display: flex; flex-direction: column; gap: 0; }
.wiz-identity-card {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 14px 0 10px;
}
.wiz-identity-card:last-child { border-bottom: none; }
.wiz-identity-label {
  font-family: Cinzel, serif; font-size: 0.56rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--accent-dark); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.wiz-identity-label::after { content:''; flex:1; height:1px; background: rgba(168,137,61,0.2); }
.wiz-identity-textarea {
  width: 100%; background: rgba(0,0,0,0.25); border: 1px solid rgba(168,137,61,0.12);
  border-radius: 6px; color: var(--text-primary); padding: 10px 12px;
  font-size: var(--font-size-sm); line-height: 1.6; resize: none; outline: none;
  font-family: var(--font-family); transition: border-color 0.2s;
}
.wiz-identity-textarea:focus { border-color: rgba(201,165,74,0.4); }
.wiz-identity-pair { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wiz-identity-pair:last-child { margin-bottom: 0; }
.wiz-identity-pair-header { display: flex; align-items: center; gap: 8px; }
.wiz-identity-type {
  background: rgba(201,165,74,0.08); border: 1px solid rgba(201,165,74,0.15);
  border-radius: 4px; padding: 4px 10px; color: var(--accent);
  font-family: Cinzel, serif; font-size: 0.62rem; letter-spacing: 0.1em;
  cursor: pointer; appearance: none; outline: none; transition: border-color 0.15s;
  min-width: 110px;
}
.wiz-identity-type:focus { border-color: var(--accent); }
.wiz-identity-hint {
  font-size: var(--font-size-xs); color: var(--text-muted);
  padding: 10px 0 2px; display: flex; align-items: center; gap: 6px;
}
.wiz-identity-hint::before { content: '🔒'; font-size: 0.75rem; }

/* ── Dungeon System ──────────────────────────────────────────────────────── */

/* Dungeon picker button */
.adv-card--dungeon { border-color: rgba(201,100,30,0.4); }
.adv-card--dungeon:hover { border-color: rgba(201,100,30,0.8); background: rgba(201,100,30,0.06); }

/* Picker overlay */
.dungeon-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: flex;
  align-items: center; justify-content: center; z-index: 1200; padding: 20px; }
.dungeon-overlay[hidden] { display: none; }

.dungeon-picker-box { background: #0d0b08; border: 1px solid #3a2510;
  border-radius: 12px; width: 100%; max-width: 480px; max-height: 80vh;
  display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,0.8); }

.dungeon-picker-header { display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #2a1a0a; }
.dungeon-picker-title { font-family: Cinzel, serif; font-size: 0.95rem; color: #c9751a; letter-spacing: 0.08em; }
.dungeon-picker-close { background: none; border: none; color: #666; cursor: pointer; font-size: 1rem; padding: 4px 8px; }
.dungeon-picker-close:hover { color: #eee; }

.dungeon-picker-list { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.dungeon-picker-loading, .dungeon-picker-empty { padding: 20px; text-align: center; color: #666; font-size: 0.85rem; }

.dungeon-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: #12100c; border: 1px solid #2a1a0a; border-radius: 8px;
  cursor: pointer; width: 100%; text-align: left; transition: border-color 0.15s; }
.dungeon-card:hover:not(:disabled) { border-color: #c9751a; background: #1a1208; }
.dungeon-card--cooldown { opacity: 0.5; cursor: not-allowed; }
.dungeon-card--locked { opacity: 0.45; cursor: not-allowed; }
.dungeon-card--locked .dungeon-card__cooldown { color: #b06a4a; }
.dungeon-card__icon { font-size: 1.5rem; flex-shrink: 0; }
.dungeon-card__body { flex: 1; min-width: 0; }
.dungeon-card__name { font-weight: 600; color: #d4b07a; font-size: 0.9rem; margin-bottom: 2px; }
.dungeon-card__meta { font-size: 0.75rem; color: #8a7a5a; }
.dungeon-card__atm { font-size: 0.73rem; color: #6a6050; margin-top: 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dungeon-card__arrow { color: #c9751a; font-size: 1.2rem; }
.dungeon-card__cooldown { font-size: 0.78rem; color: #8a7050; white-space: nowrap; }

/* #952 — pasek lochu scalony z górną belką (header.header__dungeon). Pipy postępu nadal używane. */
.dungeon-pip { font-size: 0.8rem; opacity: 0.35; transition: opacity 0.2s, transform 0.15s; }
.dungeon-pip.cleared { opacity: 0.55; }
.dungeon-pip.current { opacity: 1; transform: scale(1.25); filter: drop-shadow(0 0 4px #c9751a); }

/* L12 (#681): dungeon movement nav — floating D-pad cluster above the composer.
   Was unstyled (#681 follow-up): raw buttons leaked to the bottom-left of the page. */
/* Sit above the bottom-bar (56px+safe, always shown during game) AND the composer
   (~72px, last flex child resting on the bar) so the riddle/chest action buttons
   never get covered by the "Co robisz?" belka. */
.dungeon-nav { position: fixed; right: 14px;
  bottom: calc(136px + env(safe-area-inset-bottom)); z-index: 210;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; }
.dungeon-nav[hidden] { display: none; }
.dungeon-nav__dirs { display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: linear-gradient(180deg, #211608 0%, #1a1206 100%);
  border: 1px solid #5a3518; border-radius: 12px; padding: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  /* #741: D-pad da się złapać i przeciągnąć — touch-action none, by gest nie scrollował strony. */
  cursor: grab; touch-action: none; }
.dungeon-nav.is-dragging .dungeon-nav__dirs { cursor: grabbing; }
.dungeon-nav.is-dragging { transition: none; user-select: none; }
.dungeon-nav__mid-row { display: flex; gap: 4px; align-items: center; }
.dungeon-nav__dir { width: 42px; height: 42px; border-radius: 8px;
  background: #2a1c0c; border: 1px solid #5a3518; color: #e09030;
  font-size: 1.15rem; line-height: 1; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s; }
.dungeon-nav__dir[hidden] { display: none; }
.dungeon-nav__dir:hover:not(:disabled) { background: #3a2810; }
.dungeon-nav__dir:active:not(:disabled) { transform: scale(0.92); }
/* #741: środek ⊕ to teraz aktywny skrót do mapy lochu (nie martwa ozdoba). */
.dungeon-nav__dir--center { background: #2a1c0c; border-color: #5a3518;
  color: #e09030; cursor: pointer; }
.dungeon-nav__dir--center:hover { background: #3a2810; }
.dungeon-nav__actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.dungeon-nav__action { background: #c9751a; border: none; border-radius: 8px;
  color: #0d0904; font-weight: 700; font-size: 0.8rem; padding: 8px 12px;
  cursor: pointer; white-space: nowrap; box-shadow: 0 2px 10px rgba(201,117,26,0.25); }
.dungeon-nav__action[hidden] { display: none; }
.dungeon-nav__action:hover { background: #e8951a; }
/* LB1 (#735): rest-on-cleared-tile */
.dungeon-nav__action--rest { background: #2f7d4f; box-shadow: 0 2px 10px rgba(47,125,79,0.3); }
.dungeon-nav__action--rest:hover { background: #379a5e; }
.dungeon-nav__pill { background: rgba(47,125,79,0.18); border: 1px solid #2f7d4f;
  border-radius: 8px; color: #8fdcab; font-weight: 700; font-size: 0.74rem;
  padding: 6px 10px; text-align: center; white-space: nowrap; }
.dungeon-nav__pill[hidden] { display: none; }

/* Riddle panel (shown below HUD during riddle rooms) */
.dungeon-riddle-panel { position: fixed;
  top: calc(var(--dungeon-hud-top, 64px) + var(--dungeon-hud-h, 41px) + 8px);
  left: 50%; transform: translateX(-50%);
  width: min(420px, 90vw); background: #0d0904; border: 1px solid #4a2510;
  border-radius: 10px; padding: 16px; z-index: 205;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7); }
.dungeon-riddle-panel[hidden] { display: none; }
.dungeon-riddle-title { font-family: Cinzel, serif; font-size: 0.82rem; color: #c9751a;
  margin-bottom: 10px; }
.dungeon-riddle-text { font-size: 0.88rem; color: #d4c09a; line-height: 1.55;
  margin-bottom: 12px; font-style: italic; }
.dungeon-riddle-hint { font-size: 0.78rem; color: #8a9060; margin-bottom: 10px;
  padding: 6px 10px; background: rgba(138,144,96,0.1); border-radius: 4px; }
.dungeon-riddle-hint[hidden] { display: none; }
.dungeon-riddle-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.dungeon-riddle-input { flex: 1; background: #12100c; border: 1px solid #3a2510;
  border-radius: 6px; color: #d4c09a; padding: 7px 10px; font-size: 0.85rem; }
.dungeon-riddle-input:focus { outline: none; border-color: #c9751a; }
.dungeon-riddle-submit { background: #c9751a; border: none; border-radius: 6px;
  color: #0d0904; font-weight: 700; font-size: 0.82rem; padding: 7px 14px; cursor: pointer; }
.dungeon-riddle-hint-btn { background: none; border: none; color: #6a6050;
  font-size: 0.75rem; cursor: pointer; padding: 0; text-decoration: underline; }
.dungeon-riddle-hint-btn:hover { color: #c9a060; }

/* Dungeon complete overlay */
.dungeon-complete-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; z-index: 1100; }
.dungeon-complete-overlay[hidden] { display: none; }
.dungeon-complete-box { background: #0d0904; border: 1px solid #4a2510;
  border-radius: 14px; padding: 32px 28px; text-align: center;
  max-width: 340px; width: 90%; box-shadow: 0 8px 40px rgba(201,117,26,0.2); }
.dungeon-complete-icon { font-size: 2.5rem; margin-bottom: 10px; }
.dungeon-complete-title { font-family: Cinzel, serif; font-size: 1.1rem; color: #c9751a;
  margin-bottom: 14px; }
.dungeon-complete-loot { font-size: 0.82rem; color: #a09070; margin-bottom: 10px;
  text-align: left; }
.dungeon-complete-loot ul { list-style: none; padding: 0; margin: 0; }
.dungeon-complete-loot li { padding: 3px 0; }
.dungeon-complete-cooldown { font-size: 0.75rem; color: #6a5040; margin-bottom: 18px; }
.dungeon-complete-btn { background: #c9751a; border: none; border-radius: 8px;
  color: #0d0904; font-weight: 700; padding: 10px 28px; cursor: pointer; font-size: 0.9rem; }
.dungeon-complete-btn:hover { background: #e8951a; }

/* ── L13 (#682): Dungeon modals (death / abandon / resume / boss) ────────── */
.dungeon-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center; z-index: 1200; padding: 20px; }
.dungeon-modal-overlay[hidden] { display: none; }
.dungeon-modal { background: #0d0904; border: 1px solid #4a2510; border-radius: 12px;
  padding: 28px 24px; max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 0 40px rgba(200,100,20,0.15); }
.dungeon-modal__icon { font-size: 2.2rem; margin-bottom: 10px; }
.dungeon-modal__title { font-family: Cinzel, serif; font-size: 1.05rem; color: #c9751a;
  font-weight: 700; margin-bottom: 16px; letter-spacing: 0.04em; }
.dungeon-modal__body { font-size: 0.85rem; color: #c0a880; margin-bottom: 20px; line-height: 1.5; }
.dungeon-modal__body p { margin: 6px 0; }
.dungeon-modal__warn { color: #e09030 !important; }
.dungeon-modal__muted { color: #6a5040 !important; font-size: 0.78rem !important; }
.dungeon-modal__highlight { color: #e09030 !important; font-family: Cinzel, serif; font-size: 0.9rem !important; }
.dungeon-modal__loot { font-size: 0.82rem; color: #a09070; margin-bottom: 10px; text-align: left; }
.dungeon-modal__loot ul { list-style: none; padding: 0; margin: 0; }
.dungeon-modal__loot li { padding: 3px 0; }
.dungeon-modal__btns { display: flex; flex-direction: column; gap: 10px; }
.dungeon-modal__btn { border: none; border-radius: 8px; padding: 11px 20px; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; transition: background 0.15s; }
.dungeon-modal__btn--primary { background: #c9751a; color: #0d0904; }
.dungeon-modal__btn--primary:hover { background: #e8951a; }
.dungeon-modal__btn--danger { background: #8a1010; color: #eee; }
.dungeon-modal__btn--danger:hover { background: #b01515; }
.dungeon-modal__btn--cancel { background: #1a1208; border: 1px solid #3a2510; color: #a09070; }
.dungeon-modal__btn--cancel:hover { border-color: #c9751a; color: #c9751a; }

/* ── L12b (#694): Tile image popup modal (like Dice Roll popup) ──────────── */
.dtile-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center; z-index: 1150; padding: 20px; }
.dtile-modal[hidden] { display: none; }
.dtile-modal__box { position: relative; background: #0d0904; border: 1px solid #5a3518;
  border-radius: 14px; padding: 16px; max-width: min(92vw, 440px); width: 100%;
  box-shadow: 0 8px 48px rgba(201,117,26,0.25); display: flex; flex-direction: column; gap: 12px;
  animation: dtile-pop 0.22s ease-out; }
@keyframes dtile-pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dtile-modal__close { position: absolute; top: 8px; right: 10px; background: rgba(0,0,0,0.5);
  border: 1px solid #3a2510; border-radius: 6px; color: #c0a070; font-size: 0.9rem;
  width: 30px; height: 30px; cursor: pointer; z-index: 2; line-height: 1; }
.dtile-modal__close:hover { color: #eee; border-color: #c9751a; }
.dtile-modal__name { font-family: Cinzel, serif; font-size: 0.95rem; color: #e09030;
  letter-spacing: 0.05em; text-align: center; text-shadow: 0 0 10px rgba(201,117,26,0.4);
  padding-right: 28px; }
.dtile-modal__img { display: block; width: 100%; height: auto; max-height: 56vh; object-fit: cover;
  border-radius: 10px; border: 1px solid #3a2510; }
.dtile-modal__img[hidden] { display: none; }
.dtile-modal__desc { font-size: 0.86rem; color: #c0a880; line-height: 1.55; text-align: left;
  max-height: 22vh; overflow-y: auto; }
.dtile-modal__desc:empty { display: none; }
/* L20b (#724): enemy/NPC portrait modal on combat start */
.portrait-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center; z-index: 1160;
  padding: 20px; cursor: pointer; }
.portrait-modal[hidden] { display: none; }
.portrait-modal__box { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  max-width: min(96vw, 720px); animation: dtile-pop 0.25s ease-out; pointer-events: none; }
.portrait-modal__card { background: #0d0904; border: 1px solid #5a3518; border-radius: 14px;
  overflow: hidden; width: min(76vw, 280px); box-shadow: 0 8px 48px rgba(201,117,26,0.3);
  display: flex; flex-direction: column; }
.portrait-modal__card-img { display: block; width: 100%; aspect-ratio: 9/16; object-fit: cover; }
.portrait-modal__card-img-placeholder { width: 100%; aspect-ratio: 9/16; background: #0a0a16;
  display: flex; align-items: center; justify-content: center; font-size: 3.5rem; opacity: 0.4; }
.portrait-modal__card-name { font-family: Cinzel, serif; font-size: 0.9rem; color: #e09030;
  text-align: center; padding: 10px 12px; letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(201,117,26,0.4); }
.portrait-modal__hint { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.35); font-size: 0.72rem; pointer-events: none; letter-spacing: 0.04em; }
/* L20b: initiative chip portrait thumbnail */
.init-chip__portrait-img { width: 24px; height: 24px; border-radius: 4px; object-fit: cover;
  border: 1px solid rgba(245,158,11,0.4); display: block; }
/* L12b (#696): chest result modal (reuses .dtile-modal overlay/box) */
.dchest__roll { font-size: 0.86rem; color: #c9a060; text-align: center;
  background: rgba(201,117,26,0.08); border: 1px solid #3a2510; border-radius: 8px; padding: 8px 10px; }
.dchest__loot { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.dchest__loot li { font-size: 0.9rem; color: #d4c09a; background: #12100c;
  border: 1px solid #3a2510; border-radius: 8px; padding: 8px 12px; }
.dchest__empty, .dchest__fail { font-size: 0.86rem; color: #a09070; text-align: center; }
.dchest__trap { font-size: 0.85rem; color: #e08040; text-align: center;
  background: rgba(224,128,64,0.08); border: 1px solid #5a3018; border-radius: 8px; padding: 7px 10px; }

/* ── Dungeon Map ─────────────────────────────────────────────────────────── */
.dmap-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1050; padding-bottom: 0; }
.dmap-overlay[hidden] { display: none; }

.dmap-box { background: #0d0904; border: 1px solid #3a2510; border-bottom: none;
  border-radius: 14px 14px 0 0; width: 100%; max-width: 600px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.8); }

.dmap-header { display: flex; justify-content: space-between; align-items: center;
  flex: 0 0 auto; padding: 12px 18px 10px; border-bottom: 1px solid #2a1a08; }
.dmap-title { font-family: Cinzel, serif; font-size: 0.82rem; color: #c9751a; letter-spacing: 0.08em; }
.dmap-close { background: none; border: none; color: #666; cursor: pointer; font-size: 1rem; padding: 4px 8px; }
.dmap-close:hover { color: #eee; }

.dmap-canvas-wrap { overflow: auto; flex: 1 1 auto; padding: 16px 18px 12px; }
.dmap-svg { display: block; min-height: 90px; }

.dmap-legend { display: flex; gap: 14px; flex: 0 0 auto; padding: 8px 18px 14px;
  font-size: 0.68rem; color: #4a3a20; }
.dmap-leg--current { color: #c9751a; }
.dmap-leg--cleared { color: #5a8040; }

/* Map toggle button in HUD */
.dungeon-hud__map-btn { background: none; border: 1px solid #3a2510; border-radius: 5px;
  font-size: 0.85rem; padding: 3px 7px; cursor: pointer; color: #7a6040; line-height: 1; }
.dungeon-hud__map-btn:hover { border-color: #c9751a; color: #c9a060; }

/* ── Spell Picker ────────────────────────────────────────────────────────── */
.combat-btn--spell { background: linear-gradient(135deg, #3730a3, #6d28d9); border-color: #818cf8; }
.combat-btn--spell:hover:not(:disabled) { background: linear-gradient(135deg, #4338ca, #7c3aed); }
.spell-picker-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: flex-end; justify-content: center; z-index: 1100; padding-bottom: 80px; }
.spell-picker-overlay[hidden] { display: none; }
.spell-picker-box { background: #0d0b0e; border: 1px solid #4c1d95;
  border-radius: 14px; width: min(440px, 94vw); max-height: 60vh; overflow-y: auto;
  box-shadow: 0 -4px 40px rgba(109,40,217,0.3); }
.spell-picker-header { display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid #2d1b69; position: sticky; top: 0;
  background: #0d0b0e; }
.spell-picker-title { font-family: Cinzel, serif; font-size: 0.82rem; color: #a78bfa; letter-spacing: 0.08em; flex: 1; }
.spell-picker-mana { font-size: 0.78rem; color: #818cf8; font-weight: 700; }
.spell-picker-close { background: none; border: none; color: #666; cursor: pointer; font-size: 1rem; }
.spell-picker-list { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.spell-pick-btn { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: #1a1428; border: 1px solid #3730a3; border-radius: 8px;
  cursor: pointer; width: 100%; text-align: left; transition: border-color 0.15s; }
.spell-pick-btn:hover:not(:disabled) { border-color: #818cf8; background: #1e1835; }
.spell-pick-btn--nomana { opacity: 0.4; cursor: not-allowed; }
.spell-pick-icon { font-size: 1.1rem; flex-shrink: 0; }
.spell-pick-name { flex: 1; font-size: 0.88rem; font-weight: 600; color: #e2e8f0; }
.spell-pick-cost { font-size: 0.75rem; color: #818cf8; font-weight: 700; white-space: nowrap; }
.spell-pick-die { font-size: 0.72rem; color: #f87171; }
.spell-pick-die.heal { color: #4ade80; }

/* ── Debug Log Copy ──────────────────────────────────────────────────────── */
.bubble-debug-id { font-size: 0.6rem; color: #6a9060; font-family: monospace;
  background: rgba(106,144,96,0.12); border-radius: 3px; padding: 0 4px;
  margin-left: 5px; cursor: pointer; }
.bubble-debug-id:hover { color: #8ac880; background: rgba(106,144,96,0.22); }

/* ── T33: Suggested Actions (Hybrid Input UI) ────────────────────────────── */
/* ── Suggested Actions Strip (T33) ─────────────────────────────────────────── */

#suggested-actions {
  display: flex;
  flex-direction: row;
  gap: 7px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  /* hide scrollbar but keep scrollability */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* edge fade to hint more content */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 18px), transparent 100%);
}
#suggested-actions::-webkit-scrollbar { display: none; }

.suggested-action-btn {
  /* Touch-friendly: min 44px tall per iOS HIG */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 14px;
  /* left-edge gold rune accent */
  border: 1px solid rgba(201, 165, 74, 0.22);
  border-left: 2px solid rgba(201, 165, 74, 0.55);
  border-radius: 4px;
  background: linear-gradient(135deg,
    rgba(26, 20, 12, 0.92) 0%,
    rgba(18, 14, 9, 0.88) 100%
  );
  color: rgba(232, 220, 196, 0.82);
  font-size: 0.76rem;
  letter-spacing: 0.015em;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
  /* stagger slide-in set by JS via --i */
  animation: suggActionIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes suggActionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.suggested-action-btn:hover:not([disabled]) {
  border-color: rgba(201, 165, 74, 0.65);
  border-left-color: var(--accent);
  background: linear-gradient(135deg,
    rgba(44, 34, 16, 0.95) 0%,
    rgba(30, 22, 10, 0.92) 100%
  );
  color: var(--accent-light);
  box-shadow: 0 0 8px rgba(201, 165, 74, 0.12), inset 0 0 0 1px rgba(201,165,74,0.08);
}

.suggested-action-btn:active:not([disabled]) {
  transform: scale(0.96);
  transition-duration: 0.08s;
}

.suggested-action-btn[disabled],
.suggested-action-btn.disabled {
  opacity: 0.32;
  cursor: not-allowed;
  border-left-color: rgba(201, 165, 74, 0.18);
  filter: grayscale(40%);
}

/* U32: travel pill highlight + anti-stuck banner */
.suggested-action-btn--travel {
  border-left-color: #4a9eff;
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.08) 0%, rgba(30, 44, 60, 0.9) 100%);
  color: #93c8ff;
}
.suggested-action-btn--travel:hover:not([disabled]) {
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.18) 0%, rgba(30, 44, 60, 1.0) 100%);
  border-color: #6ab4ff;
  color: #b8d9ff;
}

.travel-stuck-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: #93c8ff;
  background: rgba(74, 158, 255, 0.06);
  border-top: 1px solid rgba(74, 158, 255, 0.15);
  border-bottom: 1px solid rgba(74, 158, 255, 0.10);
  animation: travelBannerFade 0.4s ease;
}
.travel-stuck-banner[hidden] { display: none; }
.travel-stuck-banner__text { flex: 1; }
.travel-stuck-banner__dismiss {
  background: none; border: none; color: rgba(147, 200, 255, 0.5);
  cursor: pointer; font-size: 0.9rem; padding: 0 2px; line-height: 1;
}
.travel-stuck-banner__dismiss:hover { color: #93c8ff; }

@keyframes travelBannerFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* char counter */
.char-counter {
  font-size: 0.7rem;
  color: rgba(201, 165, 74, 0.45);
  text-align: right;
  padding: 0 16px 2px;
}

/* ── Stage 2C: X1 XP bar ─────────────────────────────────────────────────── */
.xp-bar-card {
  padding: 4px 0 8px;
}
.xp-bar { margin-top: 4px; background: var(--bg-secondary); }
.xp-bar__fill { background: #c9a54a; }
.xp-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.xp-pending { color: #c9a54a; }

/* ── Stage 2C: X5 rest buttons ───────────────────────────────────────────── */
.rest-actions { padding: 8px 0 4px; }
.rest-actions__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.rest-actions__row { display: flex; gap: 6px; flex-wrap: wrap; }
.rest-actions__note { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.rest-btn {
  flex: 1; min-width: 80px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-primary); cursor: pointer; font-size: 0.78rem;
  transition: background .15s, opacity .15s;
}
.rest-btn:hover:not([disabled]) { background: var(--bg-hover, rgba(255,255,255,.08)); }
.rest-btn--disabled, .rest-btn[disabled] { opacity: .38; cursor: not-allowed; }
.rest-btn--upgrade { border-color: rgba(201,165,74,.5); color: #c9a54a; }
.rest-charges { font-size: 0.7rem; color: var(--text-muted); margin-left: 4px; }

/* ── Awansuj panel (redesign) ────────────────────────────────────────────── */
.awansuj-hero-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; margin-bottom: 18px;
  background: rgba(201,165,74,.07); border: 1px solid rgba(201,165,74,.25);
  border-radius: 10px;
}
.awansuj-pd-col { display: flex; flex-direction: column; gap: 2px; }
.awansuj-pd-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.awansuj-pd-value { font-size: 1.5rem; font-weight: 700; color: #c9a54a; line-height: 1; }
.awansuj-pd-lifetime { font-size: 0.7rem; color: var(--text-muted); }

.awansuj-section { margin-bottom: 22px; }
.awansuj-section-hdr {
  font-size: 0.67rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 9px;
  display: flex; align-items: center; gap: 8px;
}
.awansuj-section-hdr::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

/* Skill / stat list rows */
.awrow {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 14px; align-items: center;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 9px; padding: 11px 14px;
  margin-bottom: 6px; transition: border-color .15s;
}
.awrow--affordable { border-color: rgba(64,190,180,.18); }
.awrow--affordable:hover { border-color: rgba(64,190,180,.4); }
.awrow--locked { opacity: .5; }
.awrow--spell { border-color: rgba(120,80,200,.25); }
.awrow--spell.awrow--affordable { border-color: rgba(120,80,200,.45); }

.awrow__name { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.awrow__stat {
  display: inline-flex; align-items: center; height: 17px; padding: 0 6px;
  margin-left: 7px; font-size: 0.6rem; font-weight: 700; letter-spacing: .05em;
  background: rgba(64,190,180,.1); color: rgba(64,190,180,.85);
  border-radius: 4px; vertical-align: middle;
}
.awrow--spell .awrow__stat { background: rgba(120,80,200,.15); color: rgba(160,120,250,.9); }
.awrow__desc {
  display: block; font-size: 0.73rem; color: var(--text-muted);
  margin-top: 3px; font-style: italic; line-height: 1.4;
}

/* Mastery notch track */
.awrow__track { display: flex; gap: 4px; align-items: center; }
.awrow__notch { width: 20px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); }
.awrow__notch--filled { background: #40beb4; }
.awrow__notch--next {
  background: rgba(201,165,74,.3);
  animation: awnotch-pulse 2.2s ease-in-out infinite;
}
@keyframes awnotch-pulse {
  0%, 100% { background: rgba(201,165,74,.25); }
  50%       { background: rgba(201,165,74,.65); }
}
.awrow__rank-lbl { font-size: 0.65rem; color: var(--text-muted); margin-top: 3px; white-space: nowrap; }

/* Action side */
.awrow__commit {
  padding: 7px 14px; border-radius: 7px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s; white-space: nowrap;
  background: rgba(64,190,180,.09); border: 1px solid rgba(64,190,180,.4); color: #40beb4;
}
.awrow__commit:hover { background: rgba(64,190,180,.2); transform: scale(1.03); }
.awrow--spell .awrow__commit { background: rgba(120,80,200,.1); border-color: rgba(120,80,200,.4); color: rgba(160,120,250,.9); }
.awrow--spell .awrow__commit:hover { background: rgba(120,80,200,.2); }
.awrow__gap { font-size: 0.71rem; color: var(--text-muted); white-space: nowrap; padding: 7px 4px; }

/* Inline confirm strip */
.awrow__confirm {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--border-color); margin-top: 4px;
  font-size: 0.8rem; color: var(--text-muted);
}
.awrow__confirm-yes {
  padding: 5px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; background: rgba(201,165,74,.13); border: 1px solid rgba(201,165,74,.45); color: #c9a54a;
  transition: background .15s;
}
.awrow__confirm-yes:hover { background: rgba(201,165,74,.28); }
.awrow__confirm-no {
  padding: 5px 10px; border-radius: 6px; font-size: 0.78rem;
  cursor: pointer; background: transparent; border: 1px solid var(--border-color); color: var(--text-muted);
  transition: background .15s;
}
.awrow__confirm-no:hover { background: rgba(255,255,255,.05); }

/* Legacy grid kept for any code that still references .awansuj-card */
.awansuj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.awansuj-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.awansuj-card--locked { opacity: .5; }
.awansuj-card--spell { border-color: rgba(120,80,200,.4); }
.awansuj-card__title { font-size: 0.8rem; font-weight: 600; }
.awansuj-card__detail { font-size: 0.7rem; color: var(--text-muted); }
.awansuj-card__btn { margin-top: auto; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 0.75rem; transition: background .15s; }
.awansuj-card__btn:hover:not([disabled]) { background: rgba(201,165,74,.15); }
.awansuj-card__btn[disabled] { cursor: not-allowed; opacity: .5; }

/* ── Stage 2C: X9 XP log ─────────────────────────────────────────────────── */
.xp-log-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.xp-log-table th { text-align: left; padding: 4px 8px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-color); }
.xp-log-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.xp-pos { color: #5cb85c; font-weight: 600; }
.xp-neg { color: #c9a54a; }

/* ──────────────────────────────────────────────────────────────────────────
   Stage 8 D3/D4 — Admin debug drawer
   ────────────────────────────────────────────────────────────────────────── */
.debug-drawer-toggle {
  position: fixed;
  /* Anchored top-right under the game header — clear of the composer + send button. */
  right: 14px;
  top: 100px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(28,24,32,0.92);
  border: 1px solid rgba(201,165,74,0.45);
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  transition: transform 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
  font-family: inherit;
  opacity: 0.7;
}
.debug-drawer-toggle:hover {
  transform: translateY(-1px);
  background: rgba(40,30,38,0.98);
  border-color: var(--accent);
  opacity: 1;
}
.debug-drawer-toggle:active { transform: scale(0.96); }
.debug-drawer-toggle[hidden] { display: none; }
#dev-inspector-toggle { top: 148px; }

.debug-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: linear-gradient(180deg, rgba(28,24,32,0.98) 0%, rgba(18,16,22,0.98) 100%);
  border-left: 1px solid rgba(201,165,74,0.35);
  box-shadow: -8px 0 28px rgba(0,0,0,0.55);
  z-index: 9200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.2,1,.4,1);
}
.debug-drawer--open { transform: translateX(0); }
@media (max-width: 768px) {
  .debug-drawer { width: 100vw; border-left: none; }
}

.debug-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(201,165,74,0.18);
}
.debug-drawer__header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.debug-drawer__actions { display: inline-flex; gap: 4px; }
.debug-drawer__refresh,
.debug-drawer__copy,
.debug-drawer__close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.debug-drawer__refresh:hover,
.debug-drawer__copy:hover,
.debug-drawer__close:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(201,165,74,0.45);
  color: var(--accent);
}

.debug-drawer__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.25);
}
.debug-tab {
  flex: 1;
  min-width: 60px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.debug-tab:hover {
  background: rgba(201,165,74,0.06);
  border-color: rgba(201,165,74,0.35);
}
.debug-tab--active {
  background: rgba(201,165,74,0.14);
  border-color: var(--accent);
  color: var(--accent);
}

.debug-drawer__body {
  flex: 1;
  margin: 0;
  padding: 12px 14px 16px;
  overflow: auto;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.18);
}

/* ──────────────────────────────────────────────────────────────────────────
   Stage 9 P6 — Victory Screen (warm-gold mirror of death-screen).
   ────────────────────────────────────────────────────────────────────────── */
.victory-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center bottom, #1a1006 0%, #0c0a06 55%, #000 100%);
  animation: victoryFadeIn 1.6s ease-out forwards;
  overflow: hidden;
}
.victory-screen[hidden] { display: none; }
@keyframes victoryFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Sun rays — slow rotating triangular slivers behind the laurel. */
.victory-rays {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 900px;
  height: 900px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: rays-spin 60s linear infinite;
}
.victory-rays .ray {
  position: absolute;
  top: 50%; left: 50%;
  width: 4px;
  height: 50%;
  background: linear-gradient(180deg, rgba(201,165,74,0.42) 0%, rgba(201,165,74,0) 90%);
  transform-origin: 0 0;
  filter: blur(1px);
}
.victory-rays .ray:nth-child(1) { transform: rotate(0deg); }
.victory-rays .ray:nth-child(2) { transform: rotate(45deg); }
.victory-rays .ray:nth-child(3) { transform: rotate(90deg); }
.victory-rays .ray:nth-child(4) { transform: rotate(135deg); }
.victory-rays .ray:nth-child(5) { transform: rotate(180deg); }
.victory-rays .ray:nth-child(6) { transform: rotate(225deg); }
.victory-rays .ray:nth-child(7) { transform: rotate(270deg); }
.victory-rays .ray:nth-child(8) { transform: rotate(315deg); }
@keyframes rays-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Warm embers floating UP (vs. death's chaotic embers) */
.victory-embers {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.victory-embers .vember {
  position: absolute;
  bottom: -10px;
  width: 4px; height: 4px;
  background: radial-gradient(circle, #ffd84a 0%, transparent 70%);
  border-radius: 50%;
  animation: vember-rise 6s linear infinite;
  opacity: 0;
}
.victory-embers .vember:nth-child(1)  { left: 8%;  animation-delay: 0s;   }
.victory-embers .vember:nth-child(2)  { left: 18%; animation-delay: 1.2s; }
.victory-embers .vember:nth-child(3)  { left: 28%; animation-delay: 2.4s; }
.victory-embers .vember:nth-child(4)  { left: 38%; animation-delay: 3.6s; }
.victory-embers .vember:nth-child(5)  { left: 48%; animation-delay: 0.6s; }
.victory-embers .vember:nth-child(6)  { left: 58%; animation-delay: 1.8s; }
.victory-embers .vember:nth-child(7)  { left: 68%; animation-delay: 3.0s; }
.victory-embers .vember:nth-child(8)  { left: 78%; animation-delay: 4.2s; }
.victory-embers .vember:nth-child(9)  { left: 88%; animation-delay: 5.4s; }
.victory-embers .vember:nth-child(10) { left: 13%; animation-delay: 4.8s; }
.victory-embers .vember:nth-child(11) { left: 63%; animation-delay: 5.0s; }
.victory-embers .vember:nth-child(12) { left: 73%; animation-delay: 0.3s; }
@keyframes vember-rise {
  0%   { transform: translateY(0)   scale(1);   opacity: 0;  }
  10%  { opacity: 0.85; }
  100% { transform: translateY(-110vh) scale(0.3); opacity: 0; }
}

.victory-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(20,12,6,0.8) 100%);
  pointer-events: none;
}

.victory-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 24px;
  max-width: 640px;
  text-align: center;
}

.victory-laurel {
  width: 110px;
  height: 110px;
  margin-bottom: 24px;
  color: var(--accent, #c9a54a);
  filter: drop-shadow(0 0 18px rgba(255,216,74,0.55));
  position: relative;
  animation: laurel-bloom 1.2s cubic-bezier(.2,1.3,.4,1) both;
}
.victory-laurel svg { width: 100%; height: 100%; }
.victory-laurel__glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(255,216,74,0.35) 0%, transparent 65%);
  filter: blur(8px);
  z-index: -1;
  animation: laurel-pulse 3.2s ease-in-out infinite;
}
@keyframes laurel-bloom {
  from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes laurel-pulse {
  0%,100% { opacity: 0.6; transform: scale(1);    }
  50%     { opacity: 1;   transform: scale(1.1);  }
}

.victory-subtitle {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: rgba(255,216,74,0.65);
  margin: 0 0 6px;
  animation: textFadeUp 1s ease-out 0.4s both;
}
.victory-title {
  font-size: 38px;
  font-weight: 700;
  color: var(--accent, #c9a54a);
  text-shadow: 0 0 24px rgba(255,216,74,0.45);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
  animation: textFadeUp 1.2s ease-out 0.6s both;
}
.victory-name {
  font-size: 18px;
  color: rgba(255,255,255,0.85);
  margin: 0 0 4px;
  font-weight: 600;
  animation: textFadeUp 1s ease-out 0.9s both;
}
.victory-meta {
  font-size: 13px;
  color: rgba(201,165,74,0.65);
  margin: 0 0 28px;
  letter-spacing: 0.05em;
  animation: textFadeUp 1s ease-out 1.1s both;
}
.victory-ending-title {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  margin: 0 0 12px;
  letter-spacing: 0.01em;
  animation: textFadeUp 1s ease-out 1.4s both;
}
.victory-ending-title:empty { display: none; }
.victory-ending-summary {
  font-size: 15px;
  font-style: italic;
  color: rgba(255,255,255,0.7);
  margin: 0 0 36px;
  max-width: 560px;
  line-height: 1.55;
  padding: 0 12px;
  animation: textFadeUp 1.2s ease-out 1.7s both;
}
.victory-ending-summary:empty { display: none; }

/* Stage 9 P7 — shared post-end button polish + new variants. */
.death-btn--new-adventure,
.death-btn--new-world,
.death-btn--new-hero {
  background: rgba(201,165,74,0.10);
  border: 1px solid rgba(201,165,74,0.45);
  color: var(--accent, #c9a54a);
}
.death-btn--new-adventure:hover,
.death-btn--new-world:hover,
.death-btn--new-hero:hover {
  background: rgba(201,165,74,0.22);
  border-color: var(--accent, #c9a54a);
  transform: translateY(-1px);
}
.death-btn__sub {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(201,165,74,0.55);
}

/* Stage 9 follow-up — "Mglista przygoda…" placeholder for campaigns whose
   GM plan is still generating. Italic title, pulsing ⏳ icon, dim card. */
.campaign-card--brewing {
  opacity: 0.78;
  background: linear-gradient(180deg, rgba(28,24,32,0.5) 0%, rgba(20,18,26,0.55) 100%);
  border-color: rgba(201,165,74,0.18) !important;
}
.campaign-card--brewing h3 {
  font-style: italic;
  color: rgba(201,165,74,0.75);
}
.campaign-card--brewing p {
  font-style: italic;
  color: rgba(255,255,255,0.45);
}
.campaign-card--brewing .campaign-card__icon span {
  animation: brewing-spin 2.8s cubic-bezier(.5,.0,.5,1) infinite;
  display: inline-block;
}
@keyframes brewing-spin {
  0%   { transform: rotate(0deg);   opacity: 0.6; }
  50%  { transform: rotate(180deg); opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.6; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Stage 9 P4 — Command palette modal
   ────────────────────────────────────────────────────────────────────────── */

/* ⌘ button in composer — small, low-contrast until hover */
.composer__palette {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  margin-left: 4px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.composer__palette:hover {
  background: rgba(201,165,74,0.08);
  border-color: rgba(201,165,74,0.45);
  color: var(--accent);
}
.composer__palette:active { transform: scale(0.95); }

/* Modal */
.command-palette {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}
.command-palette[hidden] { display: none; }
.command-palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(3px);
  animation: cp-fade-in 0.18s ease-out;
}
@keyframes cp-fade-in { from { opacity: 0; } to { opacity: 1; } }

.command-palette__card {
  position: relative;
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 28vh);
  background: linear-gradient(180deg, rgba(32,28,38,0.98) 0%, rgba(20,18,26,0.98) 100%);
  border: 1px solid rgba(201,165,74,0.35);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cp-pop 0.22s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes cp-pop {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.command-palette__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(201,165,74,0.18);
}
.command-palette__icon {
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}
.command-palette__search {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  padding: 6px 4px;
}
.command-palette__search::placeholder { color: var(--text-muted); }
.command-palette__kbd {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 10.5px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  color: var(--text-muted);
}

.command-palette__list {
  list-style: none;
  margin: 0;
  padding: 6px 6px;
  overflow-y: auto;
  max-height: 50vh;
}
.command-palette__item {
  display: grid;
  grid-template-columns: minmax(120px, 30%) 1fr;
  align-items: baseline;
  gap: 14px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.command-palette__item:hover {
  background: rgba(201,165,74,0.08);
}
.command-palette__item--active {
  background: rgba(201,165,74,0.16);
  outline: 1px solid rgba(201,165,74,0.45);
}
.command-palette__cmd {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.command-palette__desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.command-palette__empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

.command-palette__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.command-palette__footer kbd {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  color: var(--text-secondary);
  margin-right: 4px;
}

@media (max-width: 480px) {
  .command-palette { padding-top: 8vh; }
  .command-palette__card { width: calc(100vw - 16px); }
  .command-palette__item { grid-template-columns: 1fr; gap: 2px; }
}

/* ── Auth link buttons in login footer ─────────────────────────────────── */
.login__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xs);
}

.login__link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.login__link:hover { opacity: 1; text-decoration: underline; }

.login__link-sep {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  user-select: none;
}

/* ── Screens that reuse login background ──────────────────────────────── */
#register-screen,
#verify-email-screen,
#forgot-password-screen,
#reset-password-screen {
  background:
    radial-gradient(ellipse at center, rgba(201, 165, 74, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%),
    var(--bg-screen-login) center/cover no-repeat,
    linear-gradient(180deg, #12100e 0%, #0a0908 50%, #050404 100%);
}

/* ── Inviter card ─────────────────────────────────────────────────────── */
.inviter-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
  box-shadow: 0 0 24px rgba(201, 165, 74, 0.08);
}

.inviter-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-dark);
  color: var(--bg-primary);
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Cinzel', serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.inviter-card__body { flex: 1; min-width: 0; }

.inviter-card__label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.inviter-card__name {
  font-size: var(--font-size-base);
  color: var(--accent-light);
  font-weight: 600;
  margin-top: 2px;
}

.inviter-card__msg {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
  margin-top: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Register expiry note ─────────────────────────────────────────────── */
.register-expiry {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--space-xs);
}

/* ── Verify email card ────────────────────────────────────────────────── */
.verify-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  margin-bottom: var(--space-xl);
}

.verify-card__icon { font-size: 2rem; margin-bottom: var(--space-sm); }

.verify-card__hint {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Auth feedback messages ───────────────────────────────────────────── */
.auth-msg {
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: var(--font-size-sm);
  text-align: center;
  line-height: 1.5;
}

.auth-msg--error {
  background: rgba(201, 74, 74, 0.12);
  border: 1px solid rgba(201, 74, 74, 0.3);
  color: #e88080;
}

.auth-msg--success {
  background: rgba(34, 167, 70, 0.12);
  border: 1px solid rgba(34, 167, 70, 0.3);
  color: #6ad08a;
}

.auth-msg--info {
  background: rgba(90, 140, 200, 0.12);
  border: 1px solid rgba(90, 140, 200, 0.3);
  color: #8ab4e8;
}

.auth-countdown {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
}

/* ── Onboarding cinematic ──────────────────────────────────────────────── */
#onboarding-screen {
  background:
    radial-gradient(ellipse at center, rgba(201, 165, 74, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.85) 100%),
    var(--bg-screen-login) center/cover no-repeat,
    linear-gradient(180deg, #0a0806 0%, #050303 100%);
}

.onboarding {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.onboarding__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
}

/* Embers */
.onboarding__embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.onboarding-ember {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: onboarding-ember-rise 6s ease-in infinite;
}

.onboarding-ember:nth-child(1)  { left: 8%;  animation-delay: 0s;   animation-duration: 5.5s; width:3px; height:3px; }
.onboarding-ember:nth-child(2)  { left: 18%; animation-delay: 1.2s; animation-duration: 7s;   background: #d4b65e; }
.onboarding-ember:nth-child(3)  { left: 27%; animation-delay: 0.4s; animation-duration: 6.5s; width:3px; height:3px; }
.onboarding-ember:nth-child(4)  { left: 38%; animation-delay: 2.1s; animation-duration: 5s; }
.onboarding-ember:nth-child(5)  { left: 50%; animation-delay: 0.8s; animation-duration: 6.8s; background: #e8c870; width:5px; height:5px; }
.onboarding-ember:nth-child(6)  { left: 62%; animation-delay: 1.6s; animation-duration: 5.8s; }
.onboarding-ember:nth-child(7)  { left: 73%; animation-delay: 0.2s; animation-duration: 7.2s; width:3px; height:3px; }
.onboarding-ember:nth-child(8)  { left: 82%; animation-delay: 2.8s; animation-duration: 6.2s; background: #d4b65e; }
.onboarding-ember:nth-child(9)  { left: 91%; animation-delay: 1.0s; animation-duration: 5.3s; width:3px; height:3px; }
.onboarding-ember:nth-child(10) { left: 45%; animation-delay: 3.5s; animation-duration: 6.0s; }

@keyframes onboarding-ember-rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.9; }
  80%  { opacity: 0.6; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* Content */
.onboarding__content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.onboarding__logo {
  animation: onboarding-fade-in 1.5s ease-out;
}

.onboarding__crest {
  font-size: 3rem;
  color: var(--accent);
  filter: drop-shadow(0 0 20px rgba(201,165,74,0.5));
}

.onboarding__text {
  animation: onboarding-fade-in 2s ease-out 0.5s both;
}

.onboarding__subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xs);
}

.onboarding__title {
  font-family: 'Cinzel', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--accent-light);
  letter-spacing: 0.05em;
  text-shadow: 0 0 30px rgba(201,165,74,0.4);
  margin-bottom: var(--space-md);
}

.onboarding__lore {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
}

.onboarding__inviter {
  background: rgba(201, 165, 74, 0.08);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-xl);
  animation: onboarding-fade-in 2s ease-out 1s both;
}

.onboarding__inviter-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.onboarding__inviter-name {
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-lg);
  color: var(--accent-light);
  margin-top: var(--space-xs);
}

/* Progress bar */
.onboarding__progress {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 1px;
  overflow: hidden;
  animation: onboarding-fade-in 1s ease-out 1s both;
}

.onboarding__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width linear;
}

/* CTA button */
.onboarding__cta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-2xl);
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(201,165,74,0.3);
  animation: onboarding-fade-in 0.6s ease-out 5s both;
}

.onboarding__cta:hover {
  box-shadow: 0 6px 30px rgba(201,165,74,0.5);
  transform: translateY(-1px);
}

.onboarding__cta-icon { font-size: 1.1rem; }

/* ── Onboarding theme picker ── */
.onboarding__themes {
  opacity: 0;
  transform: translateY(8px);
  animation: onboarding-fade-in 0.6s ease-out 4s both;
  text-align: center;
  margin-bottom: var(--space-lg);
}

.onboarding__themes-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.onboarding__theme-cards {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

.onboarding__theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-sm);
  min-width: 120px;
}

.onboarding__theme-card:hover {
  border-color: rgba(201,165,74,0.4);
  background: rgba(201,165,74,0.06);
  color: var(--text-primary);
}

.onboarding__theme-card--selected,
.onboarding__theme-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(201,165,74,0.12);
  color: var(--accent);
}

.onboarding__theme-icon { font-size: 1.4rem; }
.onboarding__theme-name { font-size: 0.72rem; letter-spacing: 0.04em; }

/* ── CSS theme variables — applied to <body data-theme="..."> ── */
body[data-theme="classic"] {
  --bg-primary: #0f0e0c;
  --bg-secondary: #1a1714;
  --bg-tertiary: #231f1b;
  --accent: #b8956a;
  --accent-dark: #9a7a54;
  --text-primary: #e8ddd0;
  --text-secondary: #c4b49e;
  --text-muted: #8a7a68;
  --border: rgba(184,149,106,0.15);
}

@keyframes onboarding-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Profile screen — Adventurer's Ledger ───────────────────────────────── */
#profile-screen {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,165,74,0.04) 0%, transparent 60%),
    linear-gradient(180deg, #0d0b09 0%, #0a0908 100%);
  overflow-y: auto;
}

/* decorative corner marks */
.pf-corner {
  position: fixed;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.25;
}
.pf-corner--tl { top: 14px; left: 14px;
  border-top: 1px solid var(--accent); border-left: 1px solid var(--accent); }
.pf-corner--tr { top: 14px; right: 14px;
  border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); }

.pf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,9,8,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(201,165,74,0.12);
}

.pf-back {
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid rgba(201,165,74,0.25);
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.pf-back:hover { background: rgba(201,165,74,0.08); border-color: var(--accent); }

.pf-header__title {
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-sm);
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.8;
}

.pf-body {
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* ── Cards ── */
.pf-card {
  background: linear-gradient(145deg, #1a1612, #141210);
  border: 1px solid rgba(201,165,74,0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4),
              inset 0 1px 0 rgba(201,165,74,0.06);
  animation: pf-rise 0.4s ease-out both;
}
.pf-card:nth-child(2) { animation-delay: 0.05s; }
.pf-card:nth-child(3) { animation-delay: 0.10s; }
.pf-card:nth-child(4) { animation-delay: 0.15s; }

@keyframes pf-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pf-card--identity {
  border-color: rgba(201,165,74,0.35);
  background: linear-gradient(145deg, #1e1a14, #16130f);
}

.pf-card__ornament {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--accent);
  letter-spacing: 0.3em;
  opacity: 0.4;
}
.pf-card__ornament--bottom { margin-top: var(--space-sm); }

/* ── Identity ── */
.pf-identity {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

/* Avatar (shared with existing JS hooks) */
.profile-avatar-btn {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
.profile-avatar-btn:hover .profile-avatar-overlay { opacity: 1; }

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b8922a, #7a5c18);
  color: #0d0b09;
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 0 0 2px rgba(201,165,74,0.4), 0 0 24px rgba(201,165,74,0.15);
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--accent);
}

/* Name block */
.pf-name-block { flex: 1; min-width: 0; }

.pf-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.pf-name {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.pf-pencil {
  background: none;
  border: none;
  color: rgba(201,165,74,0.4);
  cursor: pointer;
  padding: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pf-pencil:hover { color: var(--accent); }

/* The name becomes editable in-place — no separate input */
.pf-name[contenteditable="true"] {
  outline: none;
  border-bottom: 1.5px solid var(--border-accent);
  padding-bottom: 2px;
  cursor: text;
  min-width: 60px;
  caret-color: var(--accent);
}
.pf-name[contenteditable="true"]:focus {
  border-bottom-color: var(--accent);
}

.pf-pencil--sm {
  padding: 2px 4px;
}

/* @username row */
.pf-login-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.pf-at {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-family: 'Lora', serif;
  font-style: italic;
}

.pf-login-hint {
  font-size: 11px;
  margin-left: var(--space-xs);
  transition: color 0.2s;
}
.pf-login-hint--ok  { color: var(--success); }
.pf-login-hint--err { color: var(--danger); }

/* Fix: prevent display:flex overriding [hidden] */
.pf-password-fields[hidden] { display: none !important; }

.pf-login {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
  font-family: 'Lora', serif;
  font-style: italic;
}

.pf-email {
  font-size: var(--font-size-xs);
  color: rgba(201,165,74,0.5);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ── Section label with rules ── */
.pf-section-label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.pf-section-label__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201,165,74,0.3), transparent);
}
.pf-section-label__text {
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-xs);
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.7;
}

/* ── Chronicle grid ── */
.pf-chronicle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: rgba(201,165,74,0.1);
  border: 1px solid rgba(201,165,74,0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pf-chronicle-item {
  background: rgba(10,9,8,0.6);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pf-chronicle-num {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.pf-chronicle-key {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Invite quota ── */
.pf-invite-quota {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
}

/* ── Action buttons ── */
.pf-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-sm);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
}
.pf-action-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.pf-action-btn--primary {
  background: rgba(201,165,74,0.1);
  border-color: rgba(201,165,74,0.35);
  color: var(--accent-light);
}
.pf-action-btn--primary:hover {
  background: rgba(201,165,74,0.18);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(201,165,74,0.15);
}

/* ── Row button (expandable) ── */
.pf-row-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  background: none;
  border: none;
  padding: var(--space-sm) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s;
  text-align: left;
}
.pf-row-btn:hover { color: var(--text-primary); }
.pf-row-btn__chevron { margin-left: auto; transition: transform 0.2s; }
.pf-row-btn.pf-row-btn--open .pf-row-btn__chevron { transform: rotate(180deg); }

.pf-row-btn--danger { color: rgba(201,74,74,0.7); }
.pf-row-btn--danger:hover { color: var(--danger); }

/* ── Inline password form ── */
.pf-password-form { display: flex; flex-direction: column; gap: var(--space-md); }
.pf-password-fields { display: flex; flex-direction: column; gap: var(--space-md); }

.pf-form-field { display: flex; flex-direction: column; gap: 6px; }

.pf-form-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pf-form-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
}
.pf-form-input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.pf-password-actions {
  display: flex;
  gap: var(--space-sm);
}
.pf-password-actions .pf-action-btn { flex: 1; }

/* ── Theme selector in profile ─────────────────────────────────────────── */
.theme-selector-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  padding: 12px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-size: 0.85rem;
}
.theme-selector-btn:hover {
  border-color: rgba(201,165,74,0.3);
  background: rgba(201,165,74,0.05);
  color: var(--text-primary);
}
.theme-selector-btn--selected {
  border-color: var(--accent);
  background: rgba(201,165,74,0.12);
  color: var(--accent);
  font-weight: 500;
}

/* ── Heroes invite chip ──────────────────────────────────────────────────── */ ──────────────────────────────────────────────────── */
.heroes-invite-row {
  display: flex;
  justify-content: center;
  padding: var(--space-md) 0 var(--space-sm);
}

.heroes-invite-chip {
  background: none;
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: var(--space-sm) var(--space-lg);
  color: var(--accent);
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}
.heroes-invite-chip:hover {
  background: var(--accent-glow);
  box-shadow: 0 2px 12px rgba(201,165,74,0.2);
}

/* ── Invite modal ──────────────────────────────────────────────────────── */
.invite-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: flex-end;
  justify-content: center;
}
.invite-modal:not([hidden]) {
  display: flex;
}

.invite-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.invite-modal__card {
  position: relative;
  z-index: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  max-height: 85vh;
  overflow-y: auto;
}

.invite-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.invite-modal__title {
  font-family: 'Cinzel', serif;
  font-size: var(--font-size-lg);
  color: var(--accent-light);
}

.invite-modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

.invite-modal__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.invite-result { display: flex; flex-direction: column; gap: var(--space-md); }

.invite-result__label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.invite-result__link-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.invite-result__link {
  flex: 1;
  background: var(--bg-input, #0f0d0b);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  color: var(--accent);
  font-size: var(--font-size-sm);
  font-family: monospace;
  min-width: 0;
}

.invite-result__copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.invite-result__copy-btn:hover { color: var(--accent); background: var(--bg-card-hover); }

/* ── C9: Long rest choice modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,2,1,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 9500; backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-box {
  background: #0e0a07; border: 1px solid #4a2010;
  box-shadow: 0 0 0 3px #0e0a07, 0 0 0 4px #2a1008, 0 8px 40px rgba(0,0,0,0.8);
  border-radius: 10px; padding: 20px 24px; max-width: 420px; width: 90%;
}
.modal-box__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-box__header h3 { margin: 0; color: var(--text-primary); font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
.modal-close:hover { color: var(--text-primary); }
.rest-choice-intro { color: var(--text-secondary); margin: 0 0 16px; font-size: 0.9rem; }
.rest-choice-btns { display: flex; flex-direction: column; gap: 10px; }
.rest-choice-btns .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 16px; text-align: left; }
.rest-choice-sub { font-size: 0.72rem; color: var(--text-muted); font-weight: normal; }

/* E25 — Onboarding card overlay */
.onboarding-card-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.2s ease;
}
.onboarding-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.onboarding-card__progress {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  text-align: right;
}
.onboarding-card__title {
  color: var(--accent);
  margin: 0 0 var(--space-md);
  font-size: 1.1rem;
}
.onboarding-card__content {
  color: var(--text-secondary);
  margin: 0 0 var(--space-lg);
  line-height: 1.6;
  font-size: 0.9rem;
}
.onboarding-card__btn-ok {
  width: 100%;
  font-size: 0.95rem;
}

/* E26 — Kodeks library nav */
.onboarding-card__nav {
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  margin-top: var(--space-md);
}
.onboarding-card__nav .btn { flex: 1; font-size: 0.82rem; }

/* ── U16 (#564) — durability bar + cost preview + shop modal ─────────────── */
.dura { margin-top: 4px; }
.dura__bar {
  height: 5px; border-radius: 3px; background: rgba(255,255,255,.10);
  overflow: hidden;
}
.dura--compact .dura__bar { height: 3px; }
.dura__fill { height: 100%; border-radius: 3px; transition: width .25s ease; }
.dura__fill--high   { background: #4caf50; }
.dura__fill--mid    { background: #f5c842; }
.dura__fill--low    { background: #ff8c42; }
.dura__fill--broken { background: #e05252; }
.dura__label { font-size: .72rem; margin-top: 2px; color: #9aa; }
.dura__label--low    { color: #ff8c42; }
.dura__label--broken { color: #e05252; font-weight: 600; }

.combat-dura-warn {
  margin-top: 6px; font-size: .76rem; color: #ff8c42;
  background: rgba(255,140,66,.10); border: 1px solid rgba(255,140,66,.25);
  border-radius: 6px; padding: 4px 8px;
}
.combat-dura-warn--broken { color: #e05252; background: rgba(224,82,82,.12); border-color: rgba(224,82,82,.3); }

/* Shop modal */
.shop-tab {
  flex: 1; background: #0e0e16; border: 1px solid rgba(255,255,255,.12);
  color: #aaa; border-radius: 8px 8px 0 0; padding: 8px; cursor: pointer; font-size: .9rem;
}
.shop-tab--active { color: #f5deb3; border-bottom-color: transparent; background: #1a1a26; }
.shop-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; background: #0e0e16;
}
.shop-row__info { flex: 1; min-width: 0; }
.shop-row__name { color: #eee; font-size: .9rem; }
.shop-row__preview { color: #f5c842; font-size: .76rem; margin-top: 2px; }
.shop-buy-btn, .shop-sell-btn {
  background: #22301a; border: 1px solid rgba(160,255,120,.3); color: #dfd;
  border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: .82rem; white-space: nowrap;
}
.shop-sell-btn { background: #2a2418; border-color: rgba(245,200,66,.3); color: #f5deb3; }
.shop-buy-btn:disabled, .shop-sell-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Item-detail action cards (repair / affix forge) */
.item-action-card {
  border: 1px solid rgba(245,158,11,.18); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 8px; background: rgba(245,158,11,.04);
}
.item-action-card__title { color: #f5deb3; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.item-action-card__preview { color: #f5c842; font-size: .76rem; margin-bottom: 6px; }
.item-action-card__btns { display: flex; flex-wrap: wrap; gap: 6px; }
.item-action-card__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.item-action-card__affix { color: #f5c842; font-size: .78rem; }
.item-action-btn {
  background: #22301a; border: 1px solid rgba(160,255,120,.3); color: #dfd;
  border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: .82rem;
}
.item-action-btn--sm { padding: 4px 8px; font-size: .72rem; background: #2a2418; border-color: rgba(245,200,66,.3); color: #f5deb3; }
.item-action-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── SF10 (#633): reaktywny modal uniku/bloku ───────────────────────────── */
.reaction-modal-overlay {
  position: fixed; inset: 0; z-index: 10050;
  background: rgba(8, 9, 8, 0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: reactionFade 0.12s ease-out;
}
@keyframes reactionFade { from { opacity: 0; } to { opacity: 1; } }
.reaction-modal {
  width: 100%; max-width: 420px;
  background: var(--bg-primary, #0a0908);
  border: 1px solid var(--accent, #c9a54a);
  border-radius: 14px; padding: 22px 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 24px var(--accent-glow, rgba(201,165,74,0.15));
  text-align: center;
}
.reaction-modal__title {
  font-size: 1.15rem; font-weight: 700; color: var(--danger, #c0392b);
  margin-bottom: 4px;
}
.reaction-modal__sub { font-size: 0.9rem; opacity: 0.75; margin-bottom: 16px; }
.reaction-modal__btns { display: flex; flex-direction: column; gap: 10px; }
.reaction-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--accent-dark, #a8893d);
  background: rgba(201,165,74,0.06); color: var(--text-primary, #ece6d8);
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.12s;
}
.reaction-btn:hover:not(:disabled) { background: var(--accent-glow, rgba(201,165,74,0.15)); border-color: var(--accent, #c9a54a); }
.reaction-btn:disabled { opacity: 0.5; cursor: default; }
.reaction-btn__glyph { font-size: 1.2rem; }
.reaction-btn--take { border-color: #6b6b6b; }
.reaction-btn--dodge { border-color: var(--accent, #c9a54a); }
.reaction-btn--block { border-color: #4a7ba8; }
.reaction-modal__timer { margin-top: 14px; font-size: 0.78rem; opacity: 0.6; }
.reaction-modal__timer #reaction-countdown { color: var(--accent, #c9a54a); font-weight: 700; }

/* #780 — bramka intencji po zdobyciu przewagi (3 przyciski) */
.advantage-gate-card {
    margin: 14px auto; max-width: 560px; padding: 14px 16px;
    border: 1px solid var(--accent, #c9a54a); border-radius: 12px;
    background: linear-gradient(180deg, rgba(201,165,74,0.10), rgba(0,0,0,0.18));
    box-shadow: 0 4px 18px rgba(0,0,0,0.25); animation: fadeIn 0.25s ease;
}
.advantage-gate-title { font-weight: 700; color: var(--accent, #c9a54a); margin-bottom: 10px; letter-spacing: 0.3px; }
.advantage-gate-options { display: flex; flex-direction: column; gap: 8px; }
.advantage-gate-btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    text-align: left; padding: 10px 12px; border-radius: 9px; cursor: pointer;
    border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04);
    color: inherit; transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.advantage-gate-btn:hover { transform: translateY(-1px); border-color: var(--accent, #c9a54a); background: rgba(201,165,74,0.12); }
.advantage-gate-btn .ag-label { font-weight: 600; font-size: 0.96rem; }
.advantage-gate-btn .ag-hint { font-size: 0.78rem; opacity: 0.7; }
.advantage-gate-btn--strike:hover { border-color: #c0584a; background: rgba(192,88,74,0.14); }
.advantage-gate-btn--withdraw:hover { border-color: #6b8ab0; background: rgba(107,138,176,0.14); }

/* #765: ammo recovery pill — post-combat 40% recover prompt */
.ammo-recover-pill {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none; padding-bottom: 18vh;
}
.ammo-recover-pill__card {
  pointer-events: auto;
  background: linear-gradient(180deg, #1f2733, #161c25);
  border: 1px solid #3a4858; border-radius: 14px;
  padding: 16px 20px; max-width: 340px; width: 88%;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  color: #e7eef6; text-align: center;
  animation: ammoPillIn .22s ease-out;
}
@keyframes ammoPillIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ammo-recover-pill__title { font-weight: 700; font-size: 1.02rem; margin-bottom: 6px; }
.ammo-recover-pill__body { font-size: 0.9rem; opacity: 0.92; margin-bottom: 14px; line-height: 1.4; }
.ammo-recover-pill__actions { display: flex; gap: 10px; justify-content: center; }
.ammo-recover-pill__btn {
  border: 1px solid #3a4858; border-radius: 9px; padding: 8px 16px;
  font-weight: 600; cursor: pointer; background: #232c38; color: #e7eef6;
  transition: background .15s, border-color .15s;
}
.ammo-recover-pill__btn--go { background: rgba(86,160,108,0.18); border-color: #4f8b5f; color: #aee9bd; }
.ammo-recover-pill__btn--go:hover:not(:disabled) { background: rgba(86,160,108,0.3); }
.ammo-recover-pill__btn--go:disabled { opacity: 0.6; cursor: default; }
.ammo-recover-pill__btn--skip:hover { border-color: #6b8ab0; }

/* ── Lobby Form (GF2 #922) — create-lobby-screen ───────────────────────── */
.lf-section { margin-bottom: 20px; }
.lf-section__label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent, #c9a54a);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.lf-timer-hint { font-weight: 400; opacity: 0.7; text-transform: none; letter-spacing: 0; }

/* Tiles (mode + max-players) */
.lf-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.lf-tiles--sm { gap: 8px; }
.lf-tile {
  flex: 1; min-width: 80px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  padding: 12px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); color: var(--text-primary, #ece6d8);
  transition: border-color 0.15s, background 0.15s;
}
.lf-tile--sm { flex: 0 0 52px; min-width: unset; font-size: 1rem; font-weight: 700; padding: 10px 6px; }
.lf-tile--on { border-color: var(--accent, #c9a54a); background: rgba(201,165,74,0.12); }
.lf-tile:hover:not(.lf-tile--on) { border-color: rgba(201,165,74,0.4); background: rgba(201,165,74,0.06); }
.lf-tile__icon { font-size: 1.3rem; }
.lf-tile__label { font-weight: 700; font-size: 0.9rem; }
.lf-tile__hint { font-size: 0.72rem; opacity: 0.6; }

/* Chips (timer presets) */
.lf-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.lf-chip {
  padding: 5px 12px; border-radius: 20px; cursor: pointer; font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04);
  color: var(--text-primary, #ece6d8); transition: border-color 0.12s, background 0.12s;
}
.lf-chip--on { border-color: var(--accent, #c9a54a); background: rgba(201,165,74,0.12); color: var(--accent, #c9a54a); font-weight: 700; }
.lf-chip:hover:not(.lf-chip--on) { border-color: rgba(201,165,74,0.4); }

/* Template list */
.lf-tpl-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.lf-tpl-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: left;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03);
  color: var(--text-primary, #ece6d8); transition: border-color 0.12s, background 0.12s;
}
.lf-tpl-card--on { border-color: var(--accent, #c9a54a); background: rgba(201,165,74,0.10); }
.lf-tpl-card:hover:not(.lf-tpl-card--on) { border-color: rgba(201,165,74,0.35); }
.lf-tpl-card__title { font-weight: 600; font-size: 0.9rem; }
.lf-tpl-card__diff { font-size: 0.75rem; color: var(--accent, #c9a54a); opacity: 0.8; white-space: nowrap; }
.lf-tpl-summary { margin-top: 8px; font-size: 0.82rem; opacity: 0.75; line-height: 1.4; padding: 8px 10px; border-left: 2px solid var(--accent-dark, #a8893d); }

/* Error */
.lf-error {
  padding: 10px 12px; border-radius: 9px; font-size: 0.88rem;
  background: rgba(192,88,74,0.12); border: 1px solid rgba(192,88,74,0.4);
  color: #e88; margin-bottom: 12px;
}

/* Create button */
.lf-create-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 16px; border-radius: 12px; cursor: pointer;
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.04em;
  border: 1px solid var(--accent, #c9a54a);
  background: linear-gradient(180deg, rgba(201,165,74,0.18), rgba(201,165,74,0.08));
  color: var(--accent, #c9a54a);
  box-shadow: 0 0 20px rgba(201,165,74,0.15); transition: background 0.15s, box-shadow 0.15s;
}
.lf-create-btn:hover:not(:disabled) { background: linear-gradient(180deg, rgba(201,165,74,0.28), rgba(201,165,74,0.14)); box-shadow: 0 0 28px rgba(201,165,74,0.25); }
.lf-create-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.lf-create-btn__ornament { font-size: 0.75rem; opacity: 0.6; }

/* GF7 (#939) — Party Chat panel + MP controls */
.party-chat-panel {
  position: fixed; bottom: 80px; right: 0; z-index: 900;
  width: min(320px, 92vw);
  background: rgba(20,16,12,0.97); border: 1px solid rgba(201,165,74,0.25);
  border-right: none; border-radius: 12px 0 0 12px;
  box-shadow: -4px 4px 24px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; overflow: hidden;
  font-size: 0.88rem;
}
/* Safari UA sheet doesn't !important [hidden], so display:flex would win — force hide. */
.party-chat-panel[hidden] { display: none !important; }
.party-chat-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(201,165,74,0.06);
}
.mp-chat-panel__toggle {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--accent,#c9a54a);
  cursor: pointer; font-size: 0.88rem; font-weight: 600; padding: 4px 6px;
}
.mp-chat-toggle__icon { font-size: 1rem; }
.mp-chat-badge {
  background: #e53935; color: #fff; border-radius: 99px;
  font-size: 0.7rem; font-weight: 700; padding: 1px 5px; min-width: 18px; text-align: center;
}
.mp-chat-nav-badge { color: #e53935; font-size: 0.6rem; }
.mp-header-actions { display: flex; align-items: center; gap: 6px; }
.mp-minimize-btn {
  background: none; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
  color: rgba(255,255,255,0.45); cursor: pointer; font-size: 0.82rem; padding: 2px 7px; line-height: 1;
}
.mp-minimize-btn:hover { border-color: rgba(255,255,255,0.4); color: rgba(255,255,255,0.8); }
.mp-leave-btn {
  background: none; border: 1px solid rgba(255,60,60,0.3); border-radius: 6px;
  color: rgba(255,120,120,0.8); cursor: pointer; font-size: 0.75rem; padding: 3px 8px;
}
.mp-leave-btn:hover { border-color: rgba(255,60,60,0.7); color: #ff6060; }
/* #950 — Minimized to right-edge icon */
.party-chat-panel--minimized {
  width: auto !important; overflow: visible;
  left: auto !important; right: 0 !important;
}
.party-chat-panel--minimized .mp-multiplayer-section,
.party-chat-panel--minimized #mp-chat-body,
.party-chat-panel--minimized #multiplayer-private-note,
.party-chat-panel--minimized .mp-header-actions,
.party-chat-panel--minimized .mp-chat-toggle__label { display: none !important; }
.party-chat-panel--minimized .party-chat-panel__header {
  border-bottom: none; background: rgba(20,16,12,0.97);
}
/* Drag cursor on header (except buttons) */
.party-chat-panel__header { cursor: grab; }
.party-chat-panel__header button { cursor: pointer; }
.mp-multiplayer-section { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.mp-invite-row { display: flex; gap: 6px; }
.mp-invite-input {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; color: var(--text-primary,#ece6d8); font-size: 0.82rem; padding: 4px 8px;
}
.mp-invite-btn {
  background: rgba(201,165,74,0.15); border: 1px solid rgba(201,165,74,0.4); border-radius: 6px;
  color: var(--accent,#c9a54a); cursor: pointer; font-size: 0.8rem; padding: 4px 10px;
  white-space: nowrap;
}
.mp-invite-msg { font-size: 0.78rem; display: block; min-height: 16px; margin-top: 3px; }
.mp-timer-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.mp-timer-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mp-timer-label { font-size: 0.78rem; opacity: 0.7; }
.mp-timer-input {
  width: 70px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; color: var(--text-primary,#ece6d8); font-size: 0.82rem; padding: 3px 6px;
}
.mp-timer-hint { font-size: 0.78rem; opacity: 0.65; }
.mp-timer-save-btn {
  background: rgba(201,165,74,0.15); border: 1px solid rgba(201,165,74,0.4); border-radius: 6px;
  color: var(--accent,#c9a54a); cursor: pointer; font-size: 0.78rem; padding: 3px 8px;
}
.mp-timer-msg { font-size: 0.78rem; display: block; min-height: 14px; margin-top: 3px; }
.mp-chat-body { display: flex; flex-direction: column; max-height: 280px; }
.mp-chat-messages {
  flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px;
  min-height: 80px; max-height: 200px;
}
.mp-chat-msg { font-size: 0.82rem; padding: 4px 8px; border-radius: 8px; max-width: 88%; word-break: break-word; }
.mp-chat-msg--mine { align-self: flex-end; background: rgba(201,165,74,0.15); border: 1px solid rgba(201,165,74,0.2); }
.mp-chat-msg--other { align-self: flex-start; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); }
.mp-chat-msg__name { font-size: 0.7rem; opacity: 0.6; margin-bottom: 2px; font-weight: 600; }
.mp-chat-input-row {
  display: flex; gap: 6px; padding: 6px 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.mp-chat-input-field {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: var(--text-primary,#ece6d8); font-size: 0.82rem; padding: 5px 10px;
}
.mp-chat-input-field:focus { outline: none; border-color: rgba(201,165,74,0.4); }
.mp-chat-send-btn {
  background: rgba(201,165,74,0.15); border: 1px solid rgba(201,165,74,0.35); border-radius: 8px;
  color: var(--accent,#c9a54a); cursor: pointer; padding: 5px 10px; flex-shrink: 0;
}
.mp-note { padding: 8px 10px; border-top: 1px solid rgba(255,255,255,0.07); }
.mp-note__tab {
  background: none; border: none; color: var(--accent,#c9a54a); cursor: pointer;
  font-size: 0.82rem; padding: 0; font-weight: 600;
}
.mp-note-body {
  margin-top: 6px; font-size: 0.82rem; opacity: 0.8; line-height: 1.4;
  display: none;
}
.mp-note--open .mp-note-body { display: block; }
.mp-round-divider {
  display: flex; align-items: center; gap: 10px; margin: 12px 0; opacity: 0.5;
}
.mp-round-divider::before, .mp-round-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.15);
}
.mp-round-divider__pill {
  font-size: 0.75rem; font-family: 'Cinzel', serif; letter-spacing: 0.05em;
  white-space: nowrap; padding: 2px 8px;
}
