/* AI-GM Mobile-First Frontend - T28.5 */
/* Based on Figma design v18-20 */
@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Cinzel:wght@400;600;700&display=swap');

: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 */
  --bg-screen-login: url('../img/bg-login.jpg');
  --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;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.header__icon {
  font-size: 20px;
}

.header__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.header__subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* Game clock chip (T5) — "Dzień 3, 14:00 Popołudnie" */
.header__clock {
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 2px 0 0;
  color: rgba(201, 165, 74, 0.72);
  transition: color 0.3s ease;
}
.header__clock[hidden] { display: none; }
.header__clock[data-period="Rano"]       { color: rgba(255, 215, 130, 0.85); }
.header__clock[data-period="Popołudnie"] { color: rgba(201, 165, 74, 0.75); }
.header__clock[data-period="Wieczór"]    { color: rgba(220, 130, 80, 0.85); }
.header__clock[data-period="Noc"]        { color: rgba(120, 140, 200, 0.7); }

.header-hp-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  margin-top: 4px;
  width: 80px;
  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__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);
}

/* J3 — journal badge dot when new summary is ready */
#open-journal-btn {
  position: relative;
}
#open-journal-btn.journal-btn--badge::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-primary);
  animation: journal-badge-pulse 2s ease-in-out infinite;
}
@keyframes journal-badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

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

.header--game {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 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;
}

/* Heroes Screen — admin-uploadable background */
#heroes-screen {
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.82) 0%, rgba(10, 9, 8, 0.65) 50%, rgba(10, 9, 8, 0.9) 100%),
    var(--bg-screen-heroes) 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);
  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-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-history-modal__crest {
  font-size: 1.6rem;
  line-height: 1;
}
.hero-history-modal__hero-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  line-height: 1;
  margin-bottom: 2px;
}
.hero-history-modal__header h3 {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-weight: 400;
  font-style: italic;
}
.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;
}

/* ── Stage 12 J1: Journal chapter list ─────────────────────────────────── */
.journal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journal-chapter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.journal-chapter--victory   { border-top: 2px solid #4ade80; }
.journal-chapter--death     { border-top: 2px solid #f87171; }
.journal-chapter--abandoned { border-top: 2px solid rgba(201,165,74,0.5); }

.journal-chapter__eyebrow {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 5px;
}

.journal-chapter__title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 8px;
}

.journal-chapter__outcome-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.journal-chapter__outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.journal-chapter__outcome-badge--victory   { background: rgba(74,222,128,0.12); color: #4ade80; }
.journal-chapter__outcome-badge--death     { background: rgba(248,113,113,0.12); color: #f87171; }
.journal-chapter__outcome-badge--abandoned { background: rgba(201,165,74,0.12);  color: var(--accent); }

.journal-chapter__stats {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.journal-chapter__summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin: 0;
}
.journal-chapter__summary--pending {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.journal-empty {
  text-align: center;
  padding: 28px 16px;
}
.journal-empty__glyph { font-size: 2.5rem; margin-bottom: 12px; }
.journal-empty__text  { color: var(--text-muted); font-style: italic; font-size: 0.85rem; line-height: 1.5; }

/* J6 — cross-campaign minimap in hero journal modal */
.journal-minimap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.journal-minimap__title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.journal-minimap__svg-wrap {
  overflow: auto;
  border-radius: var(--radius-md);
  background: #0a0806;
  max-height: 220px;
  scrollbar-width: thin;
}
.journal-minimap__empty {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 0;
}

.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);
}

.chat-bubble--roll {
  align-self: center;
  background: rgba(201, 150, 26, 0.1);
  border: 1px solid rgba(201, 150, 26, 0.45);
  color: #d4a040;
  text-align: center;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
}


.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 {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  padding: 1px 4px;
}

.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;
  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__send--stopping {
  background: #7a2a1e;
  transition: background 0.2s;
}
.composer__send--stopping:hover {
  background: #9a3828;
}
.composer__send--stopping .send-icon--send { display: none !important; }
.composer__send--stopping .send-icon--stop { display: block !important; }

.composer__map-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 8px;
    opacity: 0.7;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.composer__map-btn:hover {
    opacity: 1;
}
@keyframes mapBtnPulse {
    0%,100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.25); }
}
.map-btn--pulse {
    animation: mapBtnPulse 0.5s ease-in-out 3;
}

.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"
    "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--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 — Grimoire v3
   ═══════════════════════════════════════════════════════ */

@keyframes settings-edge-pulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}

.settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 88vh;
  background: #100e0c;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 -3px 0 rgba(201, 165, 74, 0.55),
    0 -12px 60px rgba(0, 0, 0, 0.85),
    0 -1px 0 rgba(201,165,74,0.15);
}

.settings-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, transparent 0%, #c9a54a 20%, #f0d070 50%, #c9a54a 80%, transparent 100%);
  animation: settings-edge-pulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

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

/* Drag handle */
.settings-panel__handle {
  width: 48px;
  height: 4px;
  background: rgba(201,165,74,0.35);
  border-radius: 2px;
  margin: 16px auto 0;
}

.settings-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 40px;
  padding-bottom: calc(40px + var(--safe-bottom));
  scrollbar-width: thin;
  scrollbar-color: rgba(201,165,74,0.2) transparent;
}

/* ── Header ────────────────────────────────────────────── */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 18px 20px 10px;
  position: relative;
}

.settings-close-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(201,165,74,0.4);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
  z-index: 10;
}

.settings-close-btn:hover {
  color: var(--accent);
}

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

.settings-header__ornament:last-child {
  background: linear-gradient(270deg, transparent, rgba(201, 165, 74, 0.4));
}

.settings-header__title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(201,165,74,0.75);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 0 16px;
}

/* ── Dividers ──────────────────────────────────────────── */
.settings-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
}

.settings-divider::before,
.settings-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(201,165,74,0.12);
}

.settings-divider__ornament {
  color: rgba(201,165,74,0.4);
  font-size: 9px;
  letter-spacing: 0.08em;
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

.settings-divider--danger .settings-divider__ornament {
  color: rgba(200, 80, 80, 0.6);
}

.settings-divider--danger::before,
.settings-divider--danger::after {
  background: rgba(200, 80, 80, 0.12);
}

/* ── Section groups — Grimoire chapter style ───────────── */
.settings-group {
  margin-bottom: 8px;
}

.settings-group--foldable .settings-group__header {
  border-radius: 10px;
  transition: border-radius 0s 0.22s, background 0.15s;
}

.settings-group--foldable .settings-group__header.is-open {
  border-radius: 10px 10px 0 0;
  transition: border-radius 0s, background 0.15s;
}

.settings-group--admin {
  background: rgba(200,60,60,0.04);
  border: 1px solid rgba(200,60,60,0.15);
  border-radius: 10px;
  padding: 14px;
}

.settings-group--admin .settings-group__header {
  border: none;
  background: none;
  padding: 0 0 12px;
  margin-bottom: 0;
  border-left: none;
}

.settings-group__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  margin-bottom: 0;
  background: linear-gradient(90deg, rgba(201,165,74,0.08) 0%, rgba(201,165,74,0.02) 60%, transparent 100%);
  border: none;
  border-left: 3px solid rgba(201,165,74,0.6);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s;
}

.settings-group__header--toggle {
  cursor: pointer;
  user-select: none;
}

.settings-group__header--toggle:hover {
  background: linear-gradient(90deg, rgba(201,165,74,0.14) 0%, rgba(201,165,74,0.04) 60%, transparent 100%);
  border-color: rgba(201,165,74,0.9);
}

.settings-group__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.settings-group__icon--danger {
  color: #e05555;
}

.settings-group__title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(201,165,74,0.85);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex: 1;
}

.settings-group__title--danger {
  color: #e05555;
}

/* Navigation Button (legacy) */
.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(201, 165, 74, 0.06);
  border: none;
  border-left: 3px solid rgba(201,165,74,0.35);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

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

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

.settings-nav-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 16px;
  color: var(--accent);
}

.settings-nav-btn__text { flex: 1; text-align: left; font-weight: 500; }
.settings-nav-btn__arrow { font-size: 16px; color: rgba(201,165,74,0.5); }

/* ── Controls ──────────────────────────────────────────── */
.settings-control {
  margin-bottom: 18px;
}

.settings-label {
  display: block;
  font-size: 10px;
  font-family: 'Cinzel', serif;
  color: rgba(201,165,74,0.5);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

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

.settings-value {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: 'Cinzel', serif;
}

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

.settings-select {
  width: 100%;
  padding: 12px 40px 12px 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.settings-select__arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(201,165,74,0.6);
  pointer-events: none;
  font-size: 11px;
}

/* ── Toggle rows ───────────────────────────────────────── */
.settings-control--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.settings-control--toggle:last-child {
  border-bottom: none;
}

.settings-label--toggle {
  margin-bottom: 0;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  letter-spacing: normal;
  text-transform: none;
  font-family: inherit;
}

/* Toggle switch — slim sigil style */
.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: 40px;
  height: 22px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 11px;
  transition: background 0.22s, border-color 0.22s, box-shadow 0.22s;
  position: relative;
}

.settings-toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.22s;
}

.settings-toggle input:checked + .settings-toggle__track {
  background: rgba(201, 165, 74, 0.2);
  border-color: rgba(201,165,74,0.6);
  box-shadow: 0 0 10px rgba(201,165,74,0.15);
}

.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: 10px;
}

.settings-slider__min,
.settings-slider__max {
  color: rgba(201,165,74,0.45);
  font-weight: 600;
  font-family: 'Cinzel', serif;
}

.settings-slider__min { font-size: 10px; }
.settings-slider__max { font-size: 15px; }

.settings-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 40% 35%, #e8c96a, var(--accent) 60%, #8a6a20);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,0.5), 0 0 0 2px rgba(201,165,74,0.2);
  transition: transform 0.15s ease, box-shadow 0.15s;
}

.settings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 0 3px rgba(201,165,74,0.3);
}

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

.settings-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

/* ── Preview Parchment ─────────────────────────────────── */
.settings-preview {
  position: relative;
  padding: 18px 16px;
  background: rgba(201,165,74,0.04);
  border: 1px solid rgba(201,165,74,0.15);
  border-radius: 10px;
  margin-top: 12px;
}

.settings-preview__corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: rgba(201,165,74,0.4);
  border-style: solid;
}

.settings-preview__corner--tl { top: 7px; left: 7px; border-width: 1px 0 0 1px; border-radius: 3px 0 0 0; }
.settings-preview__corner--tr { top: 7px; right: 7px; border-width: 1px 1px 0 0; border-radius: 0 3px 0 0; }
.settings-preview__corner--bl { bottom: 7px; left: 7px; border-width: 0 0 1px 1px; border-radius: 0 0 0 3px; }
.settings-preview__corner--br { bottom: 7px; right: 7px; border-width: 0 1px 1px 0; border-radius: 0 0 3px 0; }

.settings-preview__text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
  font-style: italic;
}

/* ── Admin section button (legacy) ────────────────────── */
.settings-admin-actions { display: flex; flex-direction: column; gap: 8px; }

.settings-admin-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: rgba(200, 60, 60, 0.06);
  border: 1px solid rgba(200, 60, 60, 0.15);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.settings-admin-btn:hover {
  background: rgba(200, 60, 60, 0.12);
  border-color: rgba(200, 60, 60, 0.28);
}

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

.settings-admin-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(201, 74, 74, 0.15);
  border-radius: 8px;
  color: var(--danger);
  font-size: 18px;
}

.settings-admin-btn__content {
  flex: 1;
}

.settings-admin-btn__title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.settings-admin-btn__desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-admin-btn--test {
  background: rgba(107, 102, 94, 0.1);
  border-color: rgba(107, 102, 94, 0.3);
}

.settings-admin-btn--test:hover {
  background: rgba(107, 102, 94, 0.2);
  border-color: rgba(107, 102, 94, 0.5);
}

.settings-admin-btn--test .settings-admin-btn__icon {
  background: rgba(107, 102, 94, 0.2);
  color: var(--text-secondary);
}

/* 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: 10px;
  color: rgba(201,165,74,0.4);
  margin-left: auto;
  transition: transform 0.22s ease, color 0.22s;
  display: inline-block;
  transform: rotate(0deg);
}

.settings-group__header--toggle:hover .settings-group__chevron {
  color: rgba(201,165,74,0.7);
}

.settings-group__chevron--open {
  transform: rotate(90deg);
  color: rgba(201,165,74,0.7);
}

.settings-fold {
  padding: 14px 14px 10px 16px;
  background: rgba(0,0,0,0.25);
  border-left: 3px solid rgba(201,165,74,0.2);
  border-right: none;
  border-bottom: none;
  border-top: none;
  border-radius: 0 0 10px 10px;
  margin-top: 0;
}

/* 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;
}

.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 { font-size: 20px; 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; }

/* 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 */
.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);
  }
}

/* KW3 — knowledge tips tab */
.knowledge-category {
  margin-bottom: 16px;
}
.knowledge-category__label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.knowledge-tip {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border-left: 2px solid var(--border);
  transition: border-color 0.2s;
}
.knowledge-tip--highlight {
  border-left-color: var(--accent);
  background: rgba(201,165,74,0.06);
}
.knowledge-tip__title {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.knowledge-tip__body {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.knowledge-tip__cmd {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.65rem;
  font-family: monospace;
  color: var(--accent);
  opacity: 0.8;
}

/* KW6 — /help Wskazówki shortcut chip */
.help-wskazowki-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 4px 10px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 20px;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.help-wskazowki-chip:hover {
  background: rgba(212, 175, 55, 0.22);
  border-color: rgba(212, 175, 55, 0.6);
}

/* ================================================
   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);
}

.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);
}

.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) ─────────────────────────────────────────────────── */
.combat-zones {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  margin-top: 6px;
  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; }
}

/* 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); }

/* 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 */
.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);
}

/* 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);
}

.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);
}

.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);
}

/* ── 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;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 14px;
}
.wizard-stat-label-wrap { display: flex; align-items: center; gap: 4px; min-width: 42px; }
.wizard-stat-label-group {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-width: 0;
}
.wizard-stat-label {
  font-weight: 700;
  font-size: 0.9rem;
}
.wizard-stat-desc {
  font-size: 0.67rem;
  color: var(--text-muted);
  line-height: 1.3;
  opacity: 0.85;
}
.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;
}
.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;
}
.debug-block__roll {
  display: block;
  margin: 2px 0;
  padding: 4px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(100,255,150,0.25);
  border-radius: 6px;
  color: rgba(120,255,160,0.9);
  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-shake-hint[hidden] { display: none !important; }

/* Shake-to-roll hint (F3 / issue #66) */
#dice-shake-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  background: rgba(14, 9, 4, 0.85);
  border: 1px solid rgba(160, 100, 30, 0.4);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  text-align: center;
  max-width: 280px;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#dice-shake-hint .shake-hint-icon {
  font-size: 2.4rem;
  animation: shake-hint-wiggle 1.4s ease-in-out infinite;
  transform-origin: center bottom;
}
#dice-shake-hint .shake-hint-text {
  color: rgba(220, 180, 100, 0.95);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
@keyframes shake-hint-wiggle {
  0%, 100% { transform: rotate(-12deg); }
  50%      { transform: rotate(12deg); }
}

/* Manual roll fallback button (F3 #4) */
#dice-manual-roll-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  padding: 9px 22px;
  background: rgba(20, 12, 4, 0.85);
  border: 1px solid rgba(160, 100, 30, 0.5);
  border-radius: 22px;
  color: rgba(210, 170, 90, 0.92);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#dice-manual-roll-btn[hidden] { display: none !important; }
#dice-manual-roll-btn:hover,
#dice-manual-roll-btn:active {
  background: rgba(60, 36, 10, 0.92);
  color: #e6c070;
  border-color: rgba(200, 140, 50, 0.75);
}

#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; }

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

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

#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-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; }

#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; }

/* ── Combat dice overlay card ─────────────────────────────────────────────── */
#dice-combat-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;
}
#dice-combat-card[hidden] { display: none !important; }

#dice-combat-header {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: #c9961a;
  margin-bottom: 6px;
  text-align: center;
}

#dice-combat-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-combat-num.nat20 { color: #ffd700; text-shadow: 0 0 60px rgba(255, 215, 0, 0.8); }
#dice-combat-num.nat1  { color: #9b2020; text-shadow: 0 0 40px rgba(155, 32, 32, 0.6); }

#dice-combat-detail {
  margin-top: 8px;
  font-size: 1rem;
  color: rgba(200, 170, 110, 0.8);
  letter-spacing: 0.04em;
  text-align: center;
}

#dice-combat-verdict {
  margin-top: 12px;
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  text-align: center;
}
#dice-combat-verdict.hit    { color: #4caf78; text-shadow: 0 0 20px rgba(76, 175, 120, 0.4); }
#dice-combat-verdict.miss   { color: #9b2020; text-shadow: 0 0 20px rgba(155, 32, 32, 0.3); }
#dice-combat-verdict.nat20  { color: #ffd700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
#dice-combat-verdict.nat1   { color: #9b2020; }

/* ── 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; }

/* ── 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; }

/* ── Travel path on map SVG ─────────────────────────────────────────────────── */
/* Applied directly via inline style overrides in JS during animation */
.wmap-path-line {
  pointer-events: none;
}
.wmap-travel-cursor {
  pointer-events: none;
  animation: wmap-cursor-pulse 1.1s ease-in-out infinite;
}
.wmap-travel-cursor-ring {
  pointer-events: none;
  animation: wmap-cursor-ring 1.1s ease-in-out infinite;
}
@keyframes wmap-cursor-pulse {
  0%, 100% { opacity: 0.9; r: 5; }
  50% { opacity: 0.5; r: 7; }
}
@keyframes wmap-cursor-ring {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.08; }
}

/* ── Travel journal card ────────────────────────────────────────────────────── */
.wmap-travel-journal {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(8,5,3,0.96) 16%, #080503 100%);
  padding: 24px 16px 20px;
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.34, 1.2, 0.64, 1);
  pointer-events: none;
  z-index: 5;
}
.wmap-travel-journal:not([hidden]) {
  transform: translateY(0);
}
.wmap-travel-journal[hidden] {
  display: block !important; /* keep in DOM for CSS transition */
  pointer-events: none;
}

.wmap-tj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wmap-tj-title-text {
  font-family: Cinzel, serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: #c9961a;
  letter-spacing: 0.22em;
}
.wmap-tj-spinner {
  width: 14px; height: 14px;
  border: 1.5px solid rgba(201,150,26,0.2);
  border-top-color: #c9961a;
  border-radius: 50%;
  animation: wmap-spin 0.9s linear infinite;
  flex-shrink: 0;
}
.wmap-tj-spinner--done {
  border-color: rgba(240,192,64,0.4);
  border-top-color: #f0c040;
  animation-duration: 0.4s;
}
@keyframes wmap-spin { to { transform: rotate(360deg); } }

/* Route breadcrumbs */
.wmap-tj-route {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
  margin-bottom: 12px;
  min-height: 38px;
}
.wmap-tj-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(6px) scale(0.8);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.wmap-tj-stop--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.wmap-tj-stop-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,150,26,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.wmap-tj-stop-icon--active {
  border-color: rgba(240,192,64,0.6);
  background: rgba(240,192,64,0.07);
  box-shadow: 0 0 10px rgba(240,192,64,0.18);
}
.wmap-tj-stop-icon--arrived {
  border-color: #c9961a;
  background: rgba(201,150,26,0.14);
  box-shadow: 0 0 16px rgba(201,150,26,0.35), inset 0 0 6px rgba(201,150,26,0.1);
}
.wmap-tj-stop-icon--encounter {
  border-color: rgba(220,60,60,0.7);
  background: rgba(200,40,40,0.1);
  box-shadow: 0 0 10px rgba(220,40,40,0.3);
  animation: wmap-enc-icon-pulse 0.55s ease-in-out 3;
}
@keyframes wmap-enc-icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
.wmap-tj-arrow {
  font-size: 0.55rem;
  color: rgba(201,150,26,0.28);
  margin-bottom: 2px;
  flex-shrink: 0;
}

.wmap-tj-meta {
  font-family: Cinzel, serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #6a5030;
  margin-bottom: 7px;
  min-height: 1em;
}
.wmap-tj-atmo {
  font-size: 0.73rem;
  color: #8a7050;
  font-style: italic;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.7s 0.15s, transform 0.7s 0.15s;
  min-height: 0;
}
.wmap-tj-atmo--visible {
  opacity: 1;
  transform: translateY(0);
}
.wmap-tj-encounter-alert {
  margin-top: 10px;
  padding: 6px 12px;
  background: rgba(180,30,30,0.1);
  border: 1px solid rgba(200,40,40,0.32);
  border-radius: 4px;
  font-size: 0.72rem;
  color: #d04040;
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 7px;
}

/* GM Travel Hint Modal */
.travel-hint-modal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.travel-hint-modal[hidden] { display: none !important; }
.travel-hint-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(3px);
}
.travel-hint-modal__card {
  position: relative; z-index: 1;
  background: #1a1510; border: 1px solid #c9a54a55;
  border-radius: 12px; padding: 28px 32px;
  text-align: center; max-width: 320px; width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.travel-hint-modal__icon { font-size: 2.4rem; margin-bottom: 12px; }
.travel-hint-modal__title {
  font-family: Cinzel, serif; font-size: 1rem; font-weight: 700;
  color: #c9a54a; margin-bottom: 4px;
}
.travel-hint-modal__subtitle {
  font-size: 0.75rem; color: #7a6a4a; margin-bottom: 20px;
}
.travel-hint-modal__btns { display: flex; flex-direction: column; gap: 10px; }
.travel-hint-modal__btn {
  padding: 10px 20px; border-radius: 8px; border: none;
  font-size: 0.9rem; cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.travel-hint-modal__btn:hover { opacity: 0.85; }
.travel-hint-modal__btn--go {
  background: #c9a54a; color: #0d0b08; font-weight: 700;
}
.travel-hint-modal__btn--stay {
  background: #2a2010; color: #9a8a6a; border: 1px solid #3a3020;
}

/* ── 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; /* keep in layout for transitions */
  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;
}
/* dark vignette + grain */
.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;
}

/* Tip card */
.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; }

/* Footer — pinned to bottom */
.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: 6px;
  padding: 8px 16px 12px;
}

.settings-nav-mini-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 6px;
  background: rgba(201,165,74,0.06);
  border: 1px solid rgba(201,165,74,0.18);
  border-radius: 8px;
  color: rgba(201,165,74,0.55);
  font-size: 9px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
}

.settings-nav-mini-btn:hover {
  background: rgba(201,165,74,0.14);
  border-color: rgba(201,165,74,0.5);
  color: var(--accent);
}

.settings-nav-mini-btn svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* ── Wizard Step 4 — Tome / Identity (old-book redesign) ───────────────────── */
/* Legacy classes kept for any surviving references */
.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); }
/* New tome styles */
.wiz-tome-page {
  display: flex; flex-direction: column; gap: 0; padding-bottom: 16px;
}
.wiz-tome-section { padding: 14px 0 6px; }
.wiz-tome-label {
  font-family: 'Cinzel', serif; font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent-dark);
  margin-bottom: 10px; display: flex; align-items: center; gap: 10px;
}
.wiz-tome-label::after { content:''; flex:1; height:1px; background: linear-gradient(to right, rgba(168,137,61,0.35), transparent); }
.wiz-tome-divider {
  text-align: center; font-size: 0.7rem; color: rgba(168,137,61,0.25);
  letter-spacing: 0.6em; padding: 4px 0; user-select: none;
}
.wiz-tome-entry { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.wiz-tome-entry:last-child { margin-bottom: 0; }
.wiz-tome-entry-badge {
  display: inline-block; font-family: 'Cinzel', serif; font-size: 0.55rem;
  letter-spacing: 0.18em; text-transform: uppercase; padding: 3px 10px;
  border-radius: 3px; align-self: flex-start; user-select: none;
}
.wiz-tome-entry-badge--bond {
  background: rgba(201,165,74,0.08); border: 1px solid rgba(201,165,74,0.22);
  color: var(--accent);
}
.wiz-tome-entry-badge--flaw {
  background: rgba(160,50,50,0.10); border: 1px solid rgba(160,50,50,0.25);
  color: #c47070;
}
.wiz-tome-textarea {
  width: 100%; min-height: 56px; overflow: hidden; resize: none;
  background: rgba(0,0,0,0.22); border: 1px solid rgba(168,137,61,0.14);
  border-radius: 5px; color: var(--text-primary); padding: 10px 13px;
  font-family: 'IM Fell English', Georgia, serif; font-size: 0.88rem;
  line-height: 1.65; outline: none; transition: border-color 0.2s;
  box-sizing: border-box;
}
.wiz-tome-textarea:focus { border-color: rgba(201,165,74,0.38); background: rgba(0,0,0,0.28); }
.wiz-tome-textarea::placeholder { color: rgba(154,149,140,0.45); font-style: italic; }
.wiz-tome-secret {
  font-size: 0.7rem; color: var(--text-muted); margin-top: 14px;
  display: flex; align-items: center; gap: 6px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
/* GM loading state for step 4 */
.wiz-tome-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 48px 24px; text-align: center;
}
.wiz-tome-quill {
  font-size: 2.4rem; animation: wiz-quill-write 1.4s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes wiz-quill-write {
  0%,100% { transform: rotate(-12deg) translateY(0); }
  25%      { transform: rotate(8deg)  translateY(-4px); }
  50%      { transform: rotate(-6deg) translateY(1px); }
  75%      { transform: rotate(10deg) translateY(-3px); }
}
.wiz-tome-loading h3 {
  font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 600;
  color: var(--accent); letter-spacing: 0.06em;
}
.wiz-tome-loading p { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.wiz-tome-loading-dots { display: flex; gap: 6px; }
.wiz-tome-loading-dots span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent-dark);
  animation: wiz-dot-pulse 1.2s ease-in-out infinite;
}
.wiz-tome-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.wiz-tome-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wiz-dot-pulse {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40%          { transform: scale(1);   opacity: 1; }
}

/* ── 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__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; }

/* Dungeon HUD (top strip in game screen) */
.dungeon-hud { position: fixed; top: var(--dungeon-hud-top, 64px);
  left: var(--dungeon-hud-left, 0); width: var(--dungeon-hud-width, 100%);
  z-index: 200;
  background: linear-gradient(180deg, #211608 0%, #1a1206 100%);
  border-top: 1px solid #5a3518;
  border-bottom: 1px solid #5a3518;
  padding: 7px 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  box-shadow: 0 2px 12px rgba(201,117,26,0.12); }
.dungeon-hud[hidden] { display: none; }
/* Shift game chat down when dungeon HUD (+tile card) is active — see tile card CSS block below */
.dungeon-hud__label { font-family: Cinzel, serif; font-size: 0.78rem; color: #e09030;
  letter-spacing: 0.06em; flex-shrink: 0; text-shadow: 0 0 8px rgba(201,117,26,0.4); }
.dungeon-hud__progress { display: flex; gap: 5px; flex: 1; align-items: center; }
.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); }
.dungeon-hud__room-type { font-size: 0.7rem; color: #a08060; text-transform: uppercase;
  letter-spacing: 0.1em; white-space: nowrap; }
.dungeon-hud__advance { background: #c9751a; border: none; border-radius: 6px;
  color: #0d0904; font-weight: 700; font-size: 0.78rem; padding: 5px 12px; cursor: pointer; }
.dungeon-hud__advance:hover { background: #e8951a; }
.dungeon-hud__exit { background: none; border: 1px solid #3a2510; border-radius: 6px;
  color: #6a5040; font-size: 0.75rem; padding: 4px 8px; cursor: pointer; }
.dungeon-hud__exit:hover { color: #c06040; border-color: #c06040; }

/* Riddle panel (shown below HUD during riddle rooms) */
.dungeon-riddle-panel { position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  width: min(420px, 90vw); background: #0d0904; border: 1px solid #4a2510;
  border-radius: 10px; padding: 16px; z-index: 190;
  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; }

/* ── Dungeon Room Reveal ─────────────────────────────────────────────────── */
.drr-overlay { position: fixed; inset: 0; z-index: 1100;
  background: #000; display: flex; flex-direction: column; }
.drr-overlay[hidden] { display: none; }
.drr-zoom-wrap { flex: 1; overflow: hidden; position: relative;
  touch-action: none; cursor: grab; background: #000; }
.drr-zoom-wrap.grabbing { cursor: grabbing; }
.drr-image { display: block; width: 100%; height: auto;
  transform-origin: 0 0; will-change: transform;
  opacity: 0.9; user-select: none; pointer-events: none; }
.drr-footer { flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 14px 24px 20px;
  background: linear-gradient(rgba(0,0,0,0.7), #0a0604 80%); }
.drr-content { text-align: center; }
.drr-label { font-family: Cinzel, serif; font-size: 1.4rem; color: #c9a060;
  text-shadow: 0 2px 12px #000; margin-bottom: 4px; }
.drr-desc { font-size: 0.82rem; color: #b09060; text-shadow: 0 1px 6px #000;
  max-width: 420px; margin: 0 auto; line-height: 1.5; }
.drr-enter-btn { background: rgba(201,117,26,0.15); border: 1px solid #c9751a;
  color: #c9a060; font-family: Cinzel, serif; font-size: 0.9rem; letter-spacing: 0.1em;
  padding: 10px 32px; border-radius: 6px; cursor: pointer; }
.drr-enter-btn:hover { background: rgba(201,117,26,0.3); color: #e8c080; }

/* ── Dungeon Map (full screen) ───────────────────────────────────────────── */
.dmap-overlay { position: fixed; inset: 0; background: rgba(5,3,1,0.96);
  display: flex; flex-direction: column; z-index: 1050; }
.dmap-overlay[hidden] { display: none; }

.dmap-header { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px 10px; border-bottom: 1px solid #2a1a08; flex-shrink: 0; }
.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: 1.2rem; padding: 4px 10px; }
.dmap-close:hover { color: #eee; }

.dmap-canvas-wrap { flex: 1; overflow: hidden; position: relative;
  cursor: grab; touch-action: none; }
.dmap-canvas-wrap.grabbing { cursor: grabbing; }
.dmap-svg { display: block; transform-origin: 0 0; will-change: transform;
  position: absolute; top: 0; left: 0; }

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

/* Room button in HUD */
.dungeon-hud__room-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__room-btn:hover { border-color: #c9751a; color: #c9a060; }

/* Tile card: full viewport width on mobile */
@media (max-width: 640px) {
  .dungeon-tile-card { left: 0 !important; width: 100vw !important; }
  .dtc-image { width: 72px; height: 72px; }
  .dtc-thumb-wrap { width: 72px; }
}

/* ── Dungeon Tile Card (tile system) ─────────────────────────────────────── */
.dungeon-tile-card {
  position: fixed;
  top: calc(var(--dungeon-hud-top, 64px) + var(--dungeon-hud-h, 40px));
  left: var(--dungeon-hud-left, 0);
  width: var(--dungeon-hud-width, 100%);
  z-index: 190;
  background: rgba(9,6,3,0.97);
  border-bottom: 1px solid rgba(201,117,26,0.18);
  display: flex;
  align-items: stretch;
  max-height: 80px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0,0,0,0.55);
}
.dungeon-tile-card[hidden] { display: none; }
.game-screen--dungeon #chat-container {
  padding-top: calc(var(--dungeon-hud-h, 41px) + var(--dungeon-tile-card-h, 0px));
}
.dtc-thumb-wrap { flex-shrink: 0; width: 80px; background: #050302; overflow: hidden; }
.dtc-image { width: 80px; height: 80px; object-fit: cover; display: block; opacity: 0.82; }
.dtc-body { flex: 1; padding: 7px 12px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.dtc-header { display: flex; align-items: baseline; gap: 8px; }
.dtc-label { font-family: Cinzel, serif; font-size: 0.79rem; color: #d4a060; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.dtc-index { font-size: 0.63rem; color: #6a5030; flex-shrink: 0; }
.dtc-desc { font-size: 0.7rem; color: #7a6a4a; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dtc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.dtc-tag { font-size: 0.6rem; padding: 1px 5px; border-radius: 3px; line-height: 1.4; }
.dtc-tag--enemy { background: rgba(180,50,20,0.18); color: #c07060; border: 1px solid rgba(180,50,20,0.28); }
.dtc-tag--hazard { background: rgba(200,120,20,0.14); color: #b08030; border: 1px solid rgba(200,120,20,0.24); }
.dtc-tag--riddle { background: rgba(100,80,160,0.18); color: #a090c0; border: 1px solid rgba(100,80,160,0.28); }
.dtc-exits { flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 10px; min-width: 72px; }
.dtc-door-btn { background: #1a1208; border: 1px solid rgba(201,117,26,0.5); border-radius: 5px; color: #c9a060; font-size: 0.68rem; padding: 3px 7px; cursor: pointer; white-space: nowrap; transition: background 0.12s; }
.dtc-door-btn:hover { background: #c9751a; color: #0d0904; border-color: #c9751a; }

/* ── 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); }
.settings-debug-log { margin-top: var(--space-md); padding: var(--space-md);
  background: var(--bg-secondary); border-radius: var(--radius-md);
  border: 1px solid var(--border); }
.settings-debug-log__title { font-size: 0.82rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: var(--space-sm); }
.settings-debug-log__row { display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--space-sm); flex-wrap: wrap; }
.settings-debug-log__label { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.settings-debug-log__pills { display: flex; gap: 4px; }
.debug-turns-btn { background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-muted); font-size: 0.75rem; padding: 3px 8px; cursor: pointer; }
.debug-turns-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.settings-debug-log__hint { font-size: 0.7rem; color: var(--text-muted); margin-bottom: var(--space-sm); line-height: 1.4; }
.settings-debug-log__preview { width: 100%; height: 80px; background: var(--bg-base);
  border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted);
  font-size: 0.65rem; font-family: monospace; padding: 6px; resize: none;
  box-sizing: border-box; }

/* ── 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%);
}

/* Travel hint pill — glows to signal map use */
.suggested-action-btn--travel {
  border-left-color: #f0c040;
  color: #f0c040;
  animation: travelPillPulse 1.8s ease-in-out infinite;
}
@keyframes travelPillPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 192, 64, 0); }
  50% { box-shadow: 0 0 8px 2px rgba(240, 192, 64, 0.35); }
}

/* 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; }

/* ── J5: XP timeline ─────────────────────────────────────────────────────── */
.xp-timeline-card {
  padding: 10px 0 6px;
}
.xp-timeline__track-wrap {
  position: relative;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: visible;
}
.xp-timeline__fill {
  position: absolute;
  left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #8b6414 0%, var(--accent) 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}
/* 9 dividers at 10%, 20%...90% */
.xp-timeline__dividers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.xp-timeline__div {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 1px;
  background: var(--border);
  opacity: 0.6;
}
/* Current level highlight cap */
.xp-timeline__cursor {
  position: absolute;
  top: -3px;
  width: 3px; height: 14px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  box-shadow: 0 0 6px var(--accent);
  transition: left 0.5s ease;
}
/* Level labels row */
.xp-timeline__labels {
  display: flex;
  margin-top: 4px;
}
.xp-timeline__label {
  flex: 1;
  font-size: 0.58rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
  transition: color 0.3s;
}
.xp-timeline__label--current {
  color: var(--accent);
  font-weight: 600;
}
.xp-timeline__meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: right;
}

/* ── 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; }

/* ── Stage 2C: X6/X7/X8 Awansuj panel ───────────────────────────────────── */
.awansuj-xp-badge {
  background: rgba(201,165,74,.1); border: 1px solid rgba(201,165,74,.3);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
  font-size: 0.85rem; color: var(--text-primary);
}
.awansuj-section-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 12px 0 6px; }
.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; }
.awansuj-card__btn--armed {
  background: rgba(201,165,74,.25); border-color: var(--accent-gold);
  color: var(--accent-gold); font-weight: 600;
}
.awansuj-pending-note {
  font-size: 0.75rem; color: var(--text-muted); background: rgba(255,200,80,.06);
  border: 1px solid rgba(255,200,80,.2); border-radius: 6px;
  padding: 6px 10px; margin-bottom: 10px;
}

/* ── 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; }

/* Between-campaigns idle hero panel (bottom sheet) */
.idle-hero-panel {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.idle-hero-panel[hidden] { display: none; }
.idle-hero-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.idle-hero-panel__card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(28,22,18,0.99) 0%, rgba(18,14,10,0.99) 100%);
  border-top: 1px solid rgba(201,165,74,0.35);
  border-radius: 16px 16px 0 0;
  padding: 28px 24px 36px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.6);
  animation: slideUpPanel 0.28s cubic-bezier(.2,1,.4,1);
}
@keyframes slideUpPanel {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.idle-hero-panel__close {
  position: absolute;
  top: 14px; right: 16px;
  background: none; border: none;
  color: var(--text-muted); font-size: 1rem;
  cursor: pointer; padding: 6px;
  opacity: 0.6; transition: opacity 0.15s;
}
.idle-hero-panel__close:hover { opacity: 1; }
.idle-hero-panel__portrait {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.idle-hero-panel__avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,165,74,0.25), rgba(40,32,28,0.8));
  border: 2px solid rgba(201,165,74,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
  color: var(--accent);
}
.idle-hero-panel__identity { text-align: center; margin-bottom: 16px; }
.idle-hero-panel__name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0 0 4px;
}
.idle-hero-panel__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}
.idle-hero-panel__stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 0;
  border-top: 1px solid rgba(201,165,74,0.12);
  border-bottom: 1px solid rgba(201,165,74,0.12);
}
.idle-hero-stat {
  text-align: center;
}
.idle-hero-stat__val {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}
.idle-hero-stat__label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.idle-hero-panel__actions { display: flex; flex-direction: column; gap: 10px; }
.idle-hero-panel__secondary {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.idle-hero-action-btn {
  background: none;
  border: 1px solid rgba(201,165,74,0.25);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.idle-hero-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ──────────────────────────────────────────────────────────────────────────
   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; }

.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-countdown {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
}

/* ── Theme overrides ──────────────────────────────────────────────────── */
:root[data-theme="amber"] {
  --bg-primary: #0d0900;
  --bg-secondary: #191200;
  --bg-card: #211800;
  --bg-card-hover: #2c2000;
  --bg-input: #141000;
  --accent: #e0a000;
  --accent-light: #f0b400;
  --accent-dark: #c08800;
  --accent-glow: rgba(224, 160, 0, 0.15);
  --border: #2e2000;
  --border-accent: rgba(224, 160, 0, 0.4);
}

:root[data-theme="sepia"] {
  --bg-primary: #100c09;
  --bg-secondary: #1a1410;
  --bg-card: #241c16;
  --bg-card-hover: #2e231b;
  --bg-input: #150f0b;
  --accent: #c07040;
  --accent-light: #d08858;
  --accent-dark: #a05828;
  --accent-glow: rgba(192, 112, 64, 0.15);
  --text-primary: #ede4da;
  --border: #2e2018;
  --border-accent: rgba(192, 112, 64, 0.4);
}

:root[data-theme="light"] {
  --bg-primary: #f4efe6;
  --bg-secondary: #ebe5db;
  --bg-card: #fffdf8;
  --bg-card-hover: #f5f0e8;
  --bg-input: #ebe5db;
  --accent: #8b6914;
  --accent-light: #a07a1e;
  --accent-dark: #6e5010;
  --accent-glow: rgba(139, 105, 20, 0.12);
  --text-primary: #1a1206;
  --text-secondary: #5a5040;
  --text-muted: #9a8a70;
  --border: #d4ccc0;
  --border-accent: rgba(139, 105, 20, 0.4);
  --system-bubble: #eee8de;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
}

/* ── 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; }

@keyframes onboarding-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Step 2 — Theme picker */
.onboarding__content--hidden {
  display: none !important;
}

.onboarding__themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  width: 100%;
}

.onboarding__theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: border-color 0.2s, transform 0.15s;
}

.onboarding__theme-swatch:hover,
.onboarding__theme-swatch--active {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.onboarding__swatch-bg {
  display: block;
  width: 100%;
  height: 44px;
  border-radius: calc(var(--radius-md) - 4px);
  border: 2px solid transparent;
}

.onboarding__swatch-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── 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);
}

/* F1.2 — destructive action variant */
.pf-action-btn--danger {
  background: rgba(180, 50, 40, 0.12);
  border-color: rgba(200, 60, 50, 0.45);
  color: #e07058;
}
.pf-action-btn--danger:hover {
  background: rgba(200, 60, 50, 0.22);
  border-color: rgba(220, 80, 70, 0.7);
  color: #f08070;
  box-shadow: 0 0 16px rgba(200, 60, 50, 0.2);
}
.pf-delete-warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: rgba(180, 50, 40, 0.08);
  border-left: 3px solid rgba(200, 60, 50, 0.55);
  border-radius: 4px;
}
.pf-delete-warning strong { color: #e07058; }

/* F1.3 — Friends panel */
.pf-friends-search { margin-bottom: 10px; }
.pf-friends-section { margin-top: 14px; }
.pf-friends-heading {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pf-friends-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pf-friends-empty {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
}
.pf-friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}
.pf-friend-avatar {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,165,74,0.25), rgba(120,80,30,0.25));
  border: 1px solid rgba(201,165,74,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-light);
  font-size: 0.95rem;
  background-size: cover;
  background-position: center;
}
.pf-friend-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.pf-friend-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-friend-login {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-friend-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.pf-friend-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pf-friend-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.pf-friend-btn--accent {
  border-color: rgba(201,165,74,0.4);
  color: var(--accent-light);
  background: rgba(201,165,74,0.08);
}
.pf-friend-btn--accent:hover {
  border-color: var(--accent);
  background: rgba(201,165,74,0.16);
}
.pf-friend-btn--danger {
  border-color: rgba(200,60,50,0.3);
  color: #d07060;
}
.pf-friend-btn--danger:hover {
  border-color: rgba(200,60,50,0.6);
  background: rgba(200,60,50,0.1);
  color: #e08070;
}
.pf-friend-status-chip {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--text-muted);
  margin-right: 6px;
}

/* ── 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; }

/* ── 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); }

/* ── T25V2 Level-up overlay ───────────────────────────────────────────────── */
.levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 0.4s;
  pointer-events: none;
}
.levelup-overlay--active {
  background: rgba(0,0,0,0.65);
  pointer-events: auto;
  cursor: pointer;
}
.levelup-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: scale(0.6) translateY(40px);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(.17,.67,.3,1.3), opacity 0.35s;
}
.levelup-overlay--active .levelup-overlay__inner {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.levelup-overlay__badge {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 14px;
  border-radius: 2px;
}
.levelup-overlay__level {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 40px var(--accent), 0 0 80px rgba(201,150,26,0.5);
  line-height: 1;
}
.levelup-overlay__gains {
  display: flex;
  gap: 16px;
  font-size: 1.1rem;
  color: #a8c8a0;
  font-family: 'Cinzel', serif;
}
.levelup-overlay__tap {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  margin-top: 8px;
}

/* ── Wizard Step 2 — Dice Roll Animation ─────────────────────────────────── */
@keyframes wiz-dice-tumble {
  0%,100% { transform: rotate(-6deg) scale(1);    }
  25%      { transform: rotate(5deg)  scale(0.96); }
  50%      { transform: rotate(-3deg) scale(1.03); }
  75%      { transform: rotate(7deg)  scale(0.97); }
}
@keyframes wiz-dice-settle {
  0%   { transform: scale(1.2); box-shadow: 0 0 22px rgba(201,165,74,0.65); border-color: var(--accent); }
  60%  { transform: scale(0.96); }
  100% { transform: scale(1);   box-shadow: 0 2px 6px rgba(0,0,0,0.6); border-color: rgba(201,165,74,0.4); }
}
@keyframes wiz-stats-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wiz-dice-stage {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px; padding: 20px 0 8px;
}
.wiz-dice-header { text-align: center; }
.wiz-dice-header-icon { font-size: 2rem; display: block; margin-bottom: 6px; }
.wiz-dice-header h3 {
  font-family: 'Cinzel', serif; font-size: 1.05rem; font-weight: 600;
  color: var(--accent); letter-spacing: 0.06em; margin-bottom: 4px;
}
.wiz-dice-header p { font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.wiz-dice-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 8px; width: 100%;
}
.wiz-dice-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wiz-dice-face {
  width: 40px; height: 40px;
  background: linear-gradient(145deg, #281608 0%, #160b02 100%);
  border: 2px solid rgba(201,165,74,0.65);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 700; color: #f5e2b0;
  font-family: 'Cinzel', serif;
  animation: wiz-dice-tumble 0.35s ease-in-out infinite;
  box-shadow: 0 0 14px rgba(201,165,74,0.22), inset 0 1px 0 rgba(255,255,255,0.06);
}
.wiz-dice-face.settled {
  animation: wiz-dice-settle 0.45s ease-out forwards;
  font-size: 1.1rem;
}
.wiz-dice-stat-abbr {
  font-family: 'Cinzel', serif; font-size: 0.55rem; font-weight: 700;
  color: var(--accent); letter-spacing: 0.1em;
}
.wiz-dice-stat-name {
  font-size: 0.5rem; color: var(--text-muted); letter-spacing: 0.03em;
  text-align: center; line-height: 1.2;
}
/* Fade-in animation when stat grid appears after dice */
.wiz-stats-reveal { animation: wiz-stats-fade-in 0.5s ease-out; }

/* ── Wizard Step 3 — Locked skill indicator (legacy rows) ────────────────── */
.wizard-skill-row--locked {
  opacity: 0.88;
  border-left: 2px solid rgba(201,165,74,0.18);
}
.wizard-skill-row--locked .wizard-skill-name { color: var(--text-secondary); }
.wiz-skill-lock {
  font-size: 0.65rem; opacity: 0.5; cursor: default; user-select: none;
  flex-shrink: 0;
}

/* ── Wizard Step 3 — Card-based skill deck ───────────────────────────────── */
@keyframes wiz-card-deal {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Gold dice face for locked slots in step 3 reveal */
.wiz-dice-face--gold {
  border-color: var(--accent) !important;
  background: linear-gradient(145deg, #2e1a04 0%, #1a0e02 100%) !important;
  color: #f5d97a !important;
  box-shadow: 0 0 18px rgba(201,165,74,0.45), inset 0 1px 0 rgba(255,255,255,0.08) !important;
}

/* Deck container */
.wiz-skill-deck {
  display: flex; flex-direction: column; gap: 6px;
  padding: 2px 0 12px;
}

/* Section header */
.wiz-sdeck-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 4px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 2px;
}
.wiz-sdeck-hdr::before {
  content: ''; flex: 0 0 3px; height: 14px; border-radius: 2px;
  background: var(--accent);
}
.wiz-sdeck-hdr--swap::before { background: #6db5a0; }
.wiz-sdeck-hdr > span:first-child {
  font-family: 'Cinzel', serif; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; margin: 0;
  color: rgba(255,255,255,0.75);
}
.wiz-sdeck-count {
  margin-left: auto; font-size: 0.6rem; color: var(--text-muted);
  font-style: italic; white-space: nowrap;
}

/* Base card */
.wiz-scard {
  background: #1c1610;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  animation: wiz-card-deal 0.35s cubic-bezier(.22,.68,0,1.2) forwards;
  animation-delay: calc(var(--deal-i, 0) * 60ms);
  transition: border-color 0.2s, background 0.2s;
}
.wiz-scard--locked {
  border-left: 3px solid rgba(201,165,74,0.55);
  background: #1e1810;
}
.wiz-scard--swap {
  border-left: 3px solid rgba(109,181,160,0.3);
}
.wiz-scard--swap:hover:not(.wiz-scard--open) {
  border-color: rgba(109,181,160,0.5);
  background: #1a1e1c;
}
.wiz-scard--changed {
  border-left-color: #6db5a0;
  background: #181e1b;
}
.wiz-scard--open {
  border-color: rgba(109,181,160,0.45);
  background: #161d1a;
}

/* Card inner layout */
.wiz-scard-body {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 10px;
}
.wiz-scard-main {
  flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.wiz-scard-name {
  font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.wiz-scard--locked .wiz-scard-name { color: #e8d490; }
.wiz-scard-stat {
  font-family: 'Cinzel', serif; font-size: 0.6rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 0.1em;
}
.wiz-scard-desc {
  font-size: 0.62rem; color: var(--text-muted); line-height: 1.3;
  opacity: 0.75; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 1px;
}

.wiz-scard-foot {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

/* Rank dots */
.wiz-scard-dots { display: flex; gap: 3px; align-items: center; }
.wiz-rdot {
  font-size: 0.7rem; color: rgba(255,255,255,0.18); line-height: 1;
  user-select: none;
}
.wiz-rdot--on { color: var(--accent); }

/* Rank +/- controls */
.wiz-scard-rank-ctrl {
  display: flex; align-items: center; gap: 3px;
}
.wiz-scard-rank-btn {
  width: 22px; height: 22px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.55);
  font-size: 0.85rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.wiz-scard-rank-btn:hover:not(:disabled) {
  background: rgba(201,165,74,0.15); color: var(--accent);
  border-color: rgba(201,165,74,0.3);
}
.wiz-scard-rank-btn:disabled {
  opacity: 0.25; cursor: default;
}
.wiz-scard-rank-num {
  font-family: 'Cinzel', serif; font-size: 0.7rem; font-weight: 700;
  color: var(--accent); min-width: 12px; text-align: center;
}

/* Action buttons (lock/swap/revert) */
.wiz-scard-lock {
  font-size: 0.75rem; opacity: 0.55; user-select: none; cursor: default;
  padding: 3px;
}
.wiz-scard-swap-btn, .wiz-scard-revert-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(109,181,160,0.25);
  background: rgba(109,181,160,0.06); color: #6db5a0;
  font-size: 0.95rem; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  padding: 0;
}
.wiz-scard-swap-btn:hover { background: rgba(109,181,160,0.14); border-color: rgba(109,181,160,0.5); transform: scale(1.08); }
.wiz-scard-revert-btn { color: #c4907a; border-color: rgba(196,144,122,0.25); background: rgba(196,144,122,0.06); }
.wiz-scard-revert-btn:hover { background: rgba(196,144,122,0.14); border-color: rgba(196,144,122,0.5); transform: scale(1.08); }

/* Pool drawer */
.wiz-scard-pool {
  display: none;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(109,181,160,0.15);
  background: rgba(0,0,0,0.18);
}
.wiz-scard--open .wiz-scard-pool { display: block; }
.wiz-scard-pool-label {
  font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.1em; display: block; margin-bottom: 7px;
}
.wiz-scard-pool-chips {
  display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px;
}
.wiz-pool-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 14px;
  border: 1px solid rgba(109,181,160,0.3);
  background: rgba(109,181,160,0.07); color: #a8d5c8;
  font-size: 0.72rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.wiz-pool-chip:hover {
  background: rgba(109,181,160,0.18); border-color: rgba(109,181,160,0.6);
  color: #d4eee8; transform: scale(1.04);
}
.wiz-pool-chip-stat {
  font-family: 'Cinzel', serif; font-size: 0.55rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 0.08em;
  opacity: 0.7;
}
.wiz-pool-empty {
  font-size: 0.7rem; color: var(--text-muted); font-style: italic;
}
.wiz-scard-pool-cancel {
  font-size: 0.65rem; color: var(--text-muted); background: none;
  border: none; cursor: pointer; padding: 2px 4px;
  transition: color 0.15s;
}
.wiz-scard-pool-cancel:hover { color: #e07070; }

/* ── Prebuilt campaign — item chips & popup ───────────────────────────────── */
.prebuilt-items-row {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.prebuilt-items-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.prebuilt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Individual item chip */
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--chip-border, #4a4540);
  border-radius: 99px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  box-shadow: inset 0 0 0 0 var(--chip-border, transparent);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
}
.item-chip:hover, .item-chip--active {
  background: rgba(255,255,255,0.08);
  border-color: color-mix(in srgb, var(--chip-border, #4a4540) 100%, white 30%);
  transform: translateY(-1px);
  color: var(--text-primary);
}
.item-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

/* Item popup — shared */
#item-popup {
  z-index: 9999;
  background: #161210;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px 16px;
  width: 260px;
  overflow: hidden;
  font-family: inherit;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
}
/* Radial glow behind content */
#item-popup .ip-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--ip-glow, transparent) 0%, transparent 70%);
  pointer-events: none;
}
/* Rarity accent line at top */
#item-popup .ip-accent-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
  opacity: 0.9;
}
#item-popup .ip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  position: relative;
}
#item-popup .ip-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#item-popup .ip-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
#item-popup .ip-close:hover { color: var(--text-primary); }
#item-popup .ip-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 7px;
  position: relative;
}
#item-popup .ip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
  position: relative;
}
#item-popup .ip-stat {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  color: var(--text-secondary);
  font-family: monospace;
}
#item-popup .ip-rarity {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  position: relative;
}
#item-popup .ip-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 8px;
  margin-top: 2px;
  position: relative;
}

/* Desktop: floating card above chip */
#item-popup.ip--desktop {
  position: fixed;
  animation: ip-fade-up 0.15s ease;
}
@keyframes ip-fade-up {
  from { opacity: 0; transform: translateY(calc(-100% + 8px)); }
  to   { opacity: 1; transform: translateY(-100%); }
}

/* Mobile: bottom sheet */
#item-popup.ip--sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-radius: 16px 16px 0 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}
#item-popup.ip--sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  margin: 0 auto 14px;
}
#item-popup.ip--sheet-open {
  transform: translateY(0);
}
#item-popup.ip--sheet .ip-name {
  font-size: 16px;
}
@media (min-width: 600px) {
  #item-popup.ip--sheet {
    max-width: 400px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    border-radius: 16px 16px 0 0;
  }
  #item-popup.ip--sheet-open {
    transform: translateX(-50%) translateY(0);
  }
}

/* ── Encounter Reveal ─────────────────────────────────────────────────────── */
.encounter-reveal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.encounter-reveal--in {
  opacity: 1;
  pointer-events: auto;
}
.encounter-reveal--out {
  opacity: 0;
  pointer-events: none;
}
.encounter-reveal__card {
  position: relative;
  width: min(80vw, 320px);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255,255,255,0.08);
  transform: scale(0.88);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.encounter-reveal--in .encounter-reveal__card {
  transform: scale(1);
}
.encounter-reveal--out .encounter-reveal__card {
  transform: scale(0.88);
}
.encounter-reveal__img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}
.encounter-reveal__footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 14px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
  text-align: center;
}
.encounter-reveal__name {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f0e6c8;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  letter-spacing: 0.04em;
}
.encounter-reveal__hint {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
}
.encounter-reveal--npc .encounter-reveal__footer {
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(30,20,50,0.4) 60%, transparent 100%);
}
.encounter-reveal--npc .encounter-reveal__name {
  color: #e0d4f8;
}

/* ── Bug Report Button & Modal ─────────────────────────────── */
#bug-report-btn {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  touch-action: none;
  user-select: none;
  background: rgba(30, 22, 14, 0.92);
  border: 1px solid rgba(201, 165, 74, 0.35);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#bug-report-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(201, 165, 74, 0.08);
}
#bug-report-btn[hidden] { display: none !important; }

#bug-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#bug-report-overlay[hidden] { display: none !important; }

.bug-modal {
  background: var(--bg-card, #1a1612);
  border: 1px solid rgba(201, 165, 74, 0.3);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bug-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bug-modal__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #e8e4dc);
  letter-spacing: 0.02em;
}
.bug-modal__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}
.bug-modal label {
  font-size: 12px;
  color: var(--text-secondary, #9a958c);
  display: block;
  margin-bottom: 4px;
}
.bug-modal textarea {
  width: 100%;
  background: var(--bg-input, #0f0d0b);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-primary, #e8e4dc);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.bug-modal textarea:focus {
  outline: none;
  border-color: var(--accent, #c9a54a);
}
.bug-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.bug-modal__submit {
  background: var(--accent, #c9a54a);
  color: #0a0908;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.bug-modal__submit:disabled { opacity: 0.5; cursor: default; }
.bug-modal__cancel {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.bug-modal__note {
  font-size: 11px;
  color: var(--text-muted, #6b665e);
  text-align: center;
}

/* ── Multiplayer Private Note "Szept Mistrza Gry" ─────────────────────────── */
.mp-note {
  border-top: 1px solid rgba(201,165,74,.18);
}
.mp-note[hidden] { display: none; }

.mp-note__tab {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 14px;
  background: rgba(201,165,74,.06);
  border: none;
  cursor: pointer;
  color: rgba(201,165,74,.75);
  font-size: 11px;
  font-family: 'Cinzel', 'Georgia', serif;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  transition: background .2s;
}
.mp-note__tab:hover {
  background: rgba(201,165,74,.1);
}

.mp-note__tab-label {
  font-weight: 700;
}

.mp-note__tab-badge {
  font-size: 9px;
  letter-spacing: .06em;
  opacity: .5;
  background: rgba(201,165,74,.12);
  padding: 1px 7px;
  border-radius: 99px;
  font-family: inherit;
}

.mp-note__tab-chevron {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform .3s;
}
.mp-note--open .mp-note__tab-chevron {
  transform: rotate(180deg);
}

.mp-note__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s cubic-bezier(0.16,1,0.3,1);
  background: rgba(33,28,16,.55);
  border-top: 1px solid rgba(201,165,74,.1);
}
.mp-note--open .mp-note__panel {
  max-height: 300px;
}

.mp-note-body {
  padding: 14px 16px 8px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,248,230,.88);
  font-style: italic;
  white-space: pre-wrap;
}

.mp-note__dismiss {
  display: block;
  margin: 4px 16px 12px auto;
  padding: 4px 14px;
  background: none;
  border: 1px solid rgba(201,165,74,.22);
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(201,165,74,.55);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.mp-note__dismiss:hover {
  border-color: rgba(201,165,74,.55);
  color: rgba(201,165,74,.9);
  background: rgba(201,165,74,.07);
}

/* ── Round divider bubble ─────────────────────────────────────────────────── */
.mp-round-divider {
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  pointer-events: none;
}
.mp-round-divider__pill {
  background: rgba(201,165,74,.13);
  border: 1px solid rgba(201,165,74,.32);
  color: #c9a54a;
  padding: 5px 20px;
  border-radius: 999px;
  font-size: 11px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ── Bottom nav SVG icons ─────────────────────────────────────────────────── */
.mbb-btn__icon { display: flex; align-items: center; justify-content: center; }
.mbb-btn__icon svg { width: 22px; height: 22px; }

/* ── Create Lobby screen redesign ─────────────────────────────────────────── */
#create-lobby-screen {
  background:
    radial-gradient(ellipse at 50% 110%, rgba(201,165,74,.07) 0%, transparent 55%),
    var(--bg-primary);
}

.lf-body {
  padding: 0 22px 40px;
  max-width: 460px;
  margin: 0 auto;
  overflow-y: auto;
}

/* Crest ornament */
.lf-crest {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 0 10px;
}
.lf-crest__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201,165,74,.4));
}
.lf-crest__rule--r {
  background: linear-gradient(to left, transparent, rgba(201,165,74,.4));
}
.lf-crest__icon {
  flex-shrink: 0;
  color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(201,165,74,.4));
}

.lf-tagline {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 30px;
}

/* Form sections */
.lf-section {
  margin-bottom: 30px;
}

.lf-legend {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 12px;
}

.lf-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.lf-legend-row .lf-legend {
  margin-bottom: 0;
}

/* Quest name input — dramatic underline only */
.lf-quest-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(201,165,74,.28);
  border-radius: 0;
  padding: 10px 0;
  font-family: 'IM Fell English', 'Georgia', serif;
  font-size: 21px;
  font-style: italic;
  color: var(--text-primary);
  outline: none;
  transition: border-color .3s;
  box-sizing: border-box;
}
.lf-quest-input::placeholder {
  color: var(--text-muted);
  opacity: .65;
}
.lf-quest-input:focus {
  border-bottom-color: var(--accent);
}

/* Timer badge — inline editable value */
.lf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(201,165,74,.07);
  border: 1px solid rgba(201,165,74,.22);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--accent);
}
.lf-badge input[type="number"] {
  background: none;
  border: none;
  outline: none;
  width: 40px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 0;
  -moz-appearance: textfield;
}
.lf-badge input[type="number"]::-webkit-outer-spin-button,
.lf-badge input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.lf-badge__unit { opacity: .6; font-size: 10px; }
.lf-badge__sep  { opacity: .3; }
.lf-badge__hint { opacity: .75; font-size: 10px; font-style: italic; }

/* Timer chips */
.lf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.lf-chip {
  padding: 5px 13px;
  background: rgba(201,165,74,.04);
  border: 1px solid rgba(201,165,74,.18);
  border-radius: 999px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(201,165,74,.5);
  cursor: pointer;
  transition: all .18s;
}
.lf-chip:hover {
  background: rgba(201,165,74,.1);
  border-color: rgba(201,165,74,.4);
  color: rgba(201,165,74,.85);
}
.lf-chip--on {
  background: rgba(201,165,74,.14);
  border-color: rgba(201,165,74,.6);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(201,165,74,.12);
}

/* Player tiles */
.lf-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.lf-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px 14px;
  background: rgba(201,165,74,.03);
  border: 1px solid rgba(201,165,74,.14);
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
}
.lf-tile:hover {
  background: rgba(201,165,74,.08);
  border-color: rgba(201,165,74,.35);
}
.lf-tile--on {
  background: rgba(201,165,74,.11);
  border-color: rgba(201,165,74,.55);
  box-shadow: 0 0 14px rgba(201,165,74,.1), inset 0 1px 0 rgba(201,165,74,.1);
}
.lf-tile__icon {
  color: var(--accent);
  opacity: .7;
  height: 14px;
  display: flex;
  align-items: center;
}
.lf-tile--on .lf-tile__icon { opacity: 1; }
.lf-tile__num {
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
  transition: color .2s;
}
.lf-tile--on .lf-tile__num { color: var(--accent); }
.lf-tile__sub {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Template picker cards (create-lobby prebuilt mode) */
.lf-tpl-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: rgba(201,165,74,.04);
  border: 1px solid rgba(201,165,74,.15);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all .18s;
}
.lf-tpl-card:hover { background: rgba(201,165,74,.09); border-color: rgba(201,165,74,.35); }
.lf-tpl-card--on { background: rgba(201,165,74,.14); border-color: rgba(201,165,74,.55); color: var(--accent); }
.lf-tpl-card__title { font-weight: 600; }
.lf-tpl-card__diff { font-size: 11px; opacity: .65; flex-shrink: 0; }

/* Create button */
@keyframes lfShimmer {
  from { transform: translateX(-100%) skewX(-12deg); }
  to   { transform: translateX(300%) skewX(-12deg); }
}
.lf-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 17px;
  background: linear-gradient(135deg, rgba(201,165,74,.16) 0%, rgba(201,165,74,.09) 100%);
  border: 1px solid rgba(201,165,74,.45);
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all .3s;
  margin-top: 8px;
}
.lf-create-btn::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -60%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(201,165,74,.18), transparent);
  transform: skewX(-12deg);
}
.lf-create-btn:hover {
  background: linear-gradient(135deg, rgba(201,165,74,.22) 0%, rgba(201,165,74,.13) 100%);
  border-color: rgba(201,165,74,.7);
  box-shadow: 0 0 24px rgba(201,165,74,.14), inset 0 1px 0 rgba(201,165,74,.12);
}
.lf-create-btn:hover::after {
  animation: lfShimmer .7s ease forwards;
}
.lf-create-btn:active {
  transform: scale(.985);
}
.lf-create-btn__ornament {
  font-size: 9px;
  opacity: .55;
}

/* Error */
.lf-error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  display: none;
}

/* ── Lobby: party slots ───────────────────────────────────────────────────── */
.lf-party {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.lf-party-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  transition: border-color .2s, background .2s;
}
.lf-party-slot--joined {
  border-color: rgba(201,165,74,.3);
  background: rgba(201,165,74,.06);
}
.lf-party-slot--pending {
  border-color: rgba(255,255,255,.09);
}
.lf-party-slot--empty {
  opacity: .3;
  border-style: dashed;
}
.lf-party-slot__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201,165,74,.15);
  border: 1px solid rgba(201,165,74,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  color: #c9a54a;
  flex-shrink: 0;
}
.lf-party-slot__avatar--empty {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.25);
  font-size: 10px;
}
.lf-party-slot__info { flex: 1; min-width: 0; }
.lf-party-slot__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, rgba(255,255,255,.9));
}
.lf-party-slot__meta {
  font-size: 10px;
  opacity: .45;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px;
}
.lf-party-slot__kick {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.25);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.lf-party-slot__kick:hover {
  color: rgba(229,57,53,.8);
  background: rgba(229,57,53,.08);
}

/* ── Lobby: invite controls ──────────────────────────────────────────────── */
.lf-invite-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.lf-invite-btn {
  background: rgba(201,165,74,.14);
  border: 1px solid rgba(201,165,74,.35);
  color: #c9a54a;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.lf-invite-btn:hover {
  background: rgba(201,165,74,.24);
  border-color: rgba(201,165,74,.55);
}
.lf-invite-btn--muted {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.45);
}
.lf-invite-btn--muted:hover {
  background: rgba(229,57,53,.07);
  border-color: rgba(229,57,53,.2);
  color: rgba(229,57,53,.7);
}
.lf-link-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.5);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: border-color .2s, color .2s;
  margin-bottom: 4px;
}
.lf-link-btn:hover {
  border-color: rgba(201,165,74,.3);
  color: rgba(201,165,74,.8);
}
.lf-link-box {
  margin-top: 6px;
  padding: 10px 14px;
  background: rgba(0,0,0,.25);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.07);
}
.lf-link-text {
  font-size: 11px;
  opacity: .6;
  word-break: break-all;
  margin-bottom: 8px;
}
.lf-msg {
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}
.lf-guest-msg {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 17px;
  color: rgba(201,165,74,.65);
  text-align: center;
  padding: 16px 0 20px;
  line-height: 1.5;
}
.lf-leave-btn {
  display: block;
  width: 100%;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.4);
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s;
}
.lf-leave-btn:hover {
  background: rgba(229,57,53,.07);
  border-color: rgba(229,57,53,.18);
  color: rgba(229,57,53,.6);
}
.lf-start-hint {
  font-size: 11px;
  opacity: .45;
  text-align: center;
  margin-top: 8px;
}
#lobby-start-btn:disabled {
  opacity: .3;
  pointer-events: none;
}

/* ── Campaigns page: mp-list-card (invites + lobby + active games) ────────── */
.mp-list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 6px;
  position: relative;
}
.mp-list-card--invite {
  border-left: 3px solid rgba(201,165,74,.45);
  background: rgba(201,165,74,.04);
}
.mp-list-card--lobby {
  border-left: 3px solid rgba(255,255,255,.15);
}
.mp-list-card--active {
  border-left: 3px solid rgba(76,175,80,.45);
  background: rgba(76,175,80,.04);
}
.mp-list-card__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201,165,74,.12);
  border-radius: var(--radius-md);
  font-size: 16px;
  flex-shrink: 0;
}
.mp-list-card__body {
  flex: 1;
  min-width: 0;
}
.mp-list-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-list-card__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.mp-list-card__badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #c9a54a;
  background: rgba(201,165,74,.12);
  border: 1px solid rgba(201,165,74,.25);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mp-list-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Party Chat Panel ──────────────────────────────────────────────── */
#party-chat-panel { width: 100%; position: relative; z-index: 20; }

.mp-chat-panel {
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  position: relative;
}

.mp-chat-panel__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255,255,255,.55));
  font-size: 12px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.mp-chat-panel__toggle:hover { color: var(--accent, #c9a54a); }

.mp-chat-panel__badge {
  background: var(--accent, #c9a54a);
  color: #1a1209;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: auto;
}

.mp-chat-panel__body {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(10,9,8,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 0 12px 8px;
}

.mp-chat-panel__messages {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 4px;
}

.mp-chat-msg {
  font-size: 13px;
  line-height: 1.4;
  padding: 5px 10px;
  border-radius: 8px;
  max-width: 88%;
  word-break: break-word;
}
.mp-chat-msg--mine {
  align-self: flex-end;
  background: rgba(201,165,74,.14);
  border: 1px solid rgba(201,165,74,.25);
  color: #e8d9a0;
}
.mp-chat-msg--other {
  align-self: flex-start;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.82);
}
.mp-chat-msg__name {
  font-size: 10px;
  font-weight: 700;
  opacity: .55;
  margin-bottom: 2px;
  font-family: 'Cinzel', serif;
  letter-spacing: .04em;
}

.mp-chat-panel__composer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.mp-chat-panel__composer input {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: inherit;
  font-size: 13px;
  outline: none;
}
.mp-chat-panel__composer input:focus {
  border-color: rgba(201,165,74,.4);
}
.mp-chat-panel__send {
  background: rgba(201,165,74,.15);
  border: 1px solid rgba(201,165,74,.3);
  border-radius: 8px;
  color: var(--accent, #c9a54a);
  width: 36px;
  font-size: 16px;
  cursor: pointer;
}

.mp-chat-nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent, #c9a54a);
  border-radius: 50%;
  display: block;
}

.mp-chat-msg--whisper {
  font-style: italic;
  opacity: .85;
  border-style: dashed !important;
}

/* Whisper bubbles in main chat stream */
.chat-bubble--whisper {
  background: rgba(180, 40, 40, 0.18);
  border: 1px dashed rgba(220, 100, 100, 0.45);
  color: rgba(255, 200, 200, 0.95);
}

.chat-bubble--whisper-sent {
  align-self: flex-end;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-bubble--whisper-recv {
  align-self: flex-start;
  border-bottom-left-radius: var(--radius-sm);
}

/* ── Knowledge Tip Popup — context-aware, slides above composer ─────────── */
.ktip-popup {
  position: relative;
  margin: 0 8px 6px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(28,22,14,0.98) 0%, rgba(18,16,26,0.98) 100%);
  border: 1px solid rgba(201,165,74,0.3);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(201,165,74,0.06);
  overflow: hidden;
  animation: ktip-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.ktip-popup[hidden] { display: none !important; }
.ktip-popup--out    { animation: ktip-out 0.25s ease-in both; }

@keyframes ktip-in  {
  from { opacity:0; transform:translateY(14px) scale(0.97); }
  to   { opacity:1; transform:translateY(0)    scale(1);    }
}
@keyframes ktip-out {
  from { opacity:1; transform:translateY(0)    scale(1);    }
  to   { opacity:0; transform:translateY(10px) scale(0.96); }
}

.ktip-popup__inner {
  display: flex;
  align-items: stretch;
  min-height: 78px;
}

/* Category art panel */
.ktip-popup__art {
  width: 70px;
  min-width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.22);
  border-right: 1px solid rgba(201,165,74,0.12);
  flex-shrink: 0;
}
.ktip-popup__art svg {
  width: 38px;
  height: 38px;
}

/* Body text */
.ktip-popup__body {
  flex: 1;
  padding: 10px 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ktip-popup__label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #c9a54a);
  opacity: 0.75;
  line-height: 1;
}
.ktip-popup__title {
  font-size: 0.87rem;
  font-weight: 700;
  color: #e8dcc4;
  line-height: 1.2;
  margin-top: 2px;
}
.ktip-popup__text {
  font-size: 0.77rem;
  color: rgba(220,210,190,0.72);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}
.ktip-popup__more {
  background: none;
  border: none;
  padding: 0;
  margin-top: 5px;
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--accent, #c9a54a);
  cursor: pointer;
  text-align: left;
  opacity: 0.8;
  width: fit-content;
}
.ktip-popup__more:hover { opacity:1; text-decoration:underline; }

/* Close button */
.ktip-popup__close {
  background: none;
  border: none;
  color: rgba(220,210,190,0.35);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 8px 12px 8px 4px;
  align-self: flex-start;
  margin-top: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}
.ktip-popup__close:hover { color: rgba(220,210,190,0.85); }

/* Auto-dismiss progress bar */
.ktip-popup__progress {
  height: 2px;
  background: rgba(201,165,74,0.12);
  transform-origin: left;
  animation: ktip-prog var(--ktip-dur, 12s) linear forwards;
}
@keyframes ktip-prog {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

