:root {
  /* Opción B: Indigo Kifu & Tatami Studio (Kachi-iro Samurái + Estudio de Estrategia) */
  --bg-page: #0a101d;
  --bg-surface: #0f1829;
  --bg-card: #152136;
  --bg-dock: #0c1424;
  --border-subtle: rgba(148, 179, 224, 0.16);
  --border-gold: rgba(232, 185, 106, 0.48);
  --text-main: #f1f5f9;
  --text-muted: #94a7c4;
  --accent-gold: #e8b96a;
  --accent-gold-hover: #f5cd84;
  --accent-crimson: #d93829;
  --accent-jade: #2b9e76;
  --accent-indigo: #243b61;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 4px;

  /* Tipografías editoriales (Shippori Mincho + Plus Jakarta Sans) */
  --font-display: "Shippori Mincho", "Yu Mincho", Georgia, serif;
  --font-calligraphy: "Yuji Syuku", "Shippori Mincho", "Yu Mincho", serif;
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Shōgiban & Koma (Madera Kaya tradicional resaltando sobre Índigo Kachi-iro) */
  --wood-board-light: #e8c07a;
  --wood-board-dark: #cf9e50;
  --wood-frame: #2c190b;
  --grid-line: #231409;
  --koma-top: #fdf3de;
  --koma-bottom: #deb471;
  --koma-edge: #835721;
  --koma-ink: #170e06;
  --koma-promoted: #c41e14;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-block-size: 100dvb;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 15% 15%, rgba(43, 158, 118, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(56, 103, 180, 0.14) 0%, transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #070c16 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0.015em;
}

/* Header Indigo Studio */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.65rem;
  padding-inline: 1.5rem;
  background: rgba(9, 15, 28, 0.96);
  border-block-end: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: safe center;
  gap: 0.85rem;
}

.brand-koma {
  display: grid;
  place-content: center;
  inline-size: 2.45rem;
  block-size: 2.65rem;
  background: linear-gradient(180deg, var(--koma-top), var(--koma-bottom));
  color: var(--koma-ink);
  font-family: var(--font-calligraphy);
  font-weight: 800;
  font-size: 1.3rem;
  clip-path: polygon(50% 4%, 93% 22%, 86% 96%, 14% 96%, 7% 22%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.brand h1 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.02em;
}

.brand h1 span {
  color: var(--accent-gold);
  font-weight: 500;
  margin-inline-start: 0.35rem;
}

.subtitle {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.room-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.45rem;
}

.room-pill,
.online-pill {
  display: inline-flex;
  align-items: safe center;
  gap: 0.45rem;
  padding-block: 0.32rem;
  padding-inline: 0.7rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-dot {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
  background: #777;
}

.status-dot.online {
  background: #39d98a;
}

.room-pill code {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

.role-badge {
  padding-block: 0.1rem;
  padding-inline: 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(217, 173, 101, 0.12);
  border: 1px solid rgba(217, 173, 101, 0.28);
  color: var(--accent-gold);
  font-size: 0.74rem;
  font-weight: 600;
}

/* Control de Música Zen Relajante (WCAG 1.4.2 Audio Control) */
.audio-control-pill {
  display: inline-flex;
  align-items: safe center;
  gap: 0.4rem;
  padding-block: 0.22rem;
  padding-inline: 0.45rem 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.audio-control-pill.playing {
  border-color: var(--accent-jade);
}

.btn-audio-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.18rem 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.btn-audio-toggle:hover {
  color: var(--text-main);
}

.audio-control-pill.playing .btn-audio-toggle {
  color: #6ee7b7;
}

.music-volume-slider {
  inline-size: 3.8rem;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.lang-switch-pill {
  display: flex;
  align-items: safe center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.25rem;
  transition: border-color 0.15s ease;
}

.lang-switch-pill:hover {
  border-color: var(--accent-gold);
}

.btn-lang-toggle {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.btn-lang-toggle:hover {
  color: var(--accent-gold);
}

/* ==========================================
   VISTA 1: STUDIO DE ESTRATEGIA (COMMAND DOCK LATERAL + LIENZO CENTRAL)
   ========================================== */
.lobby-page {
  max-inline-size: 1460px;
  inline-size: 100%;
  margin-inline: auto;
  padding-block: 1.25rem 2rem;
  padding-inline: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.studio-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.studio-sidebar {
  background: var(--bg-dock);
  border: 1px solid var(--border-subtle);
  border-block-start: 3px solid var(--accent-gold);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  position: sticky;
  top: 1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.dock-telemetry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.dock-telemetry .online-pill,
.dock-telemetry .queue-badge {
  justify-content: center;
  text-align: center;
  font-size: 0.76rem;
  padding-block: 0.38rem;
}

.dock-kicker {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-block-end: 0.25rem;
}

.hero-profile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.85rem 0.95rem;
}

.matchmake-card {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 185, 106, 0.12), transparent 60%),
    linear-gradient(180deg, #16243b 0%, #101b2d 100%);
  border: 1px solid rgba(232, 185, 106, 0.35);
  padding: 1.1rem;
}

.matchmake-card.searching {
  border-color: #39d98a;
  box-shadow: inset 0 0 0 1px #39d98a;
}

.matchmake-info h2 {
  margin: 0 0 0.3rem 0;
  font-size: 1.18rem;
  color: var(--text-main);
}

.matchmake-info h2 span {
  color: var(--accent-gold);
  font-weight: 500;
}

.matchmake-info p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.matchmake-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.btn-dock-main {
  width: 100%;
  padding-block: 0.78rem;
  font-size: 0.94rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dock-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
}

.dock-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.95rem;
}

.dock-section h2 {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dock-players-section .panel-header {
  margin-block-end: 0.65rem;
  padding-block-end: 0.45rem;
}

.studio-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-inline-size: 0;
}

.lobby-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1.15rem 1.25rem;
}

.lobby-panel-featured {
  border-block-start: 2px solid var(--accent-gold);
  position: relative;
}

.panel-title-with-seal {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hanko-mini {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 2px;
  background: var(--accent-crimson);
  border: 1px solid rgba(255, 232, 214, 0.8);
  color: #fff6ec;
  font-family: var(--font-calligraphy);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-input-row {
  display: flex;
  align-items: safe center;
  gap: 0.65rem;
  margin-block-start: 0.35rem;
}

.profile-input-row .text-input {
  margin-block-end: 0;
}

.queue-badge {
  padding-block: 0.32rem;
  padding-inline: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-lg {
  padding-block: 0.62rem;
  padding-inline: 1.15rem;
  font-size: 0.92rem;
}

.lobby-columns {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.1rem;
  align-items: stretch;
}

.panel-header {
  display: flex;
  align-items: safe center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block-end: 0.65rem;
  margin-block-end: 0.85rem;
  border-block-end: 1px solid var(--border-subtle);
}

.panel-header h2,
.lobby-panel h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-block-size: 380px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.room-row {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--accent-gold);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.room-row:hover {
  border-color: var(--accent-gold);
  background: #1a2942;
}

.room-row-info {
  min-inline-size: 0;
  flex: 1 1 180px;
}

.room-row-title {
  display: flex;
  align-items: safe center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.94rem;
  margin-block-end: 0.2rem;
}

.room-row-title code {
  font-size: 0.75rem;
  padding: 0.08rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(232, 185, 106, 0.14);
  border: 1px solid rgba(232, 185, 106, 0.3);
  color: var(--accent-gold);
}

.room-row-players {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.seat-open {
  color: #4ade80;
  font-weight: 600;
}

.empty-state {
  margin: 0;
  padding: 1.35rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(8, 13, 24, 0.45);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

.code-join-row {
  display: flex;
  gap: 0.5rem;
  margin-block-start: 0.55rem;
}

.code-join-row .text-input {
  margin-block-end: 0;
  flex: 1 1 auto;
}

.players-online-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-block-size: 150px;
  overflow-y: auto;
}

.player-chip {
  display: inline-flex;
  align-items: safe center;
  gap: 0.4rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
}

.player-chip.searching {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* 1. GALERÍA KOMA DE LA ACADEMIA DE SHŌGI (SIEMPRE #1 ARRIBA EN EL WORKSPACE) */
.tutorial-banner-card {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.3rem;
  background:
    radial-gradient(circle at 95% 0%, rgba(43, 158, 118, 0.16), transparent 55%),
    linear-gradient(135deg, #132238 0%, #0e192b 100%);
  border: 1px solid rgba(43, 158, 118, 0.45);
  border-block-start: 3px solid var(--accent-jade);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.tutorial-banner-info {
  width: 100%;
}

.tutorial-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-block-end: 0.25rem;
}

.tutorial-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5eead4;
  margin-block-end: 0.15rem;
}

.tutorial-banner-info h2 {
  margin: 0;
  font-size: 1.16rem;
  color: #fff;
}

.tutorial-banner-info p.tutorial-compact-desc {
  margin: 0 0 0.75rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Galería de 12 Fichas Pentagonales Koma 3D para cada Lección */
.tutorial-chapters-pills {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

.chapter-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.48rem 0.6rem;
  background: rgba(10, 16, 29, 0.72);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.chapter-pill:hover {
  transform: translateY(-2px);
  background: #1a2942;
  border-color: var(--accent-gold);
}

.mini-koma {
  flex: 0 0 2.05rem;
  inline-size: 2.05rem;
  block-size: 2.25rem;
  background: linear-gradient(180deg, var(--koma-top) 0%, var(--koma-bottom) 100%);
  color: var(--koma-ink);
  font-family: var(--font-calligraphy);
  font-size: 1.05rem;
  font-weight: 900;
  display: grid;
  place-content: center;
  padding-top: 0.15rem;
  clip-path: polygon(50% 3%, 95% 19%, 89% 96%, 11% 96%, 5% 19%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
}

.mini-koma.is-promoted {
  color: var(--koma-promoted);
}

.chapter-meta {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  line-height: 1.2;
}

.chapter-meta small {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.03em;
}

.chapter-meta strong {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1200px) {
  .tutorial-chapters-pills {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .tutorial-chapters-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 2. BARRA DE VISTAS DEL STUDIO (ONLINE | MODO HISTORIA | SALÓN DE LA FAMA) */
.lobby-hub-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--bg-dock);
  border: 1px solid var(--border-subtle);
}

.lobby-hub-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border: none;
  border-inline-end: 1px solid var(--border-subtle);
  border-block-end: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: center;
}

.lobby-hub-tab:last-child {
  border-inline-end: none;
}

.lobby-hub-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.lobby-hub-tab.active {
  background: var(--bg-card);
  border-block-end-color: var(--accent-gold);
  color: var(--accent-gold);
}

.hub-tab-icon {
  display: inline-grid;
  place-content: center;
  width: 24px;
  height: 24px;
  background: rgba(232, 185, 106, 0.12);
  border: 1px solid rgba(232, 185, 106, 0.35);
  font-family: var(--font-calligraphy);
  font-size: 0.86rem;
  color: var(--accent-gold);
}

.lobby-hub-tab.active .hub-tab-icon {
  background: var(--accent-crimson);
  border-color: rgba(255, 230, 210, 0.8);
  color: #fff;
}

.hub-tab-badge {
  background: rgba(217, 56, 41, 0.25);
  border: 1px solid rgba(217, 56, 41, 0.65);
  color: #fecaca;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.08rem 0.42rem;
  border-radius: var(--radius-sm);
}

@media (max-width: 780px) {
  .lobby-hub-tabs {
    grid-template-columns: 1fr;
  }
}

/* Panel del Sensei en la Partida Guiada */
.sensei-panel {
  inline-size: 100%;
  max-inline-size: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--accent-jade);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
}

.sensei-header {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-block-end: 0.75rem;
}

.sensei-badge {
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(53, 143, 108, 0.2);
  border: 1px solid rgba(53, 143, 108, 0.5);
  color: #6ee7b7;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sensei-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-main);
  flex: 1 1 auto;
}

.sensei-select {
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.sensei-progress {
  inline-size: 100%;
  block-size: 3px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.08);
  overflow: clip;
  margin-block-start: 0.2rem;
}

.sensei-progress-fill {
  inline-size: var(--progress, 8%);
  block-size: 100%;
  background: linear-gradient(90deg, #39d98a, var(--accent-gold));
  transition: inline-size 0.3s ease;
}

.sensei-body-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-block-end: 0.8rem;
}

.sensei-lesson-text {
  margin: 0 0 0.55rem 0;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.5;
}

.sensei-key-points {
  margin: 0;
  padding-inline-start: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.84rem;
  color: #d1fae5;
}

.sensei-key-points li strong {
  color: var(--accent-gold);
}

/* Brújula Visual de Movimiento (Mini-Tablero 3x3 / 5x5) */
.sensei-diagrams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.move-diagram-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: rgba(15, 20, 17, 0.78);
  border: 1px solid rgba(223, 177, 91, 0.4);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

.move-diagram-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.move-compass {
  display: grid;
  grid-template-columns: repeat(3, 1.85rem);
  grid-template-rows: repeat(3, 1.85rem);
  gap: 2px;
  background: #3b2816;
  border: 2px solid #6b4c2b;
  border-radius: 6px;
  padding: 2px;
}

.move-compass.compass-5x5 {
  grid-template-columns: repeat(5, 1.45rem);
  grid-template-rows: repeat(5, 1.45rem);
}

.compass-cell {
  display: grid;
  place-content: center;
  background: #dec089;
  color: #24160b;
  font-size: 0.78rem;
  font-weight: 900;
  border-radius: 2px;
}

.compass-cell.center-piece {
  background: #f59e0b;
  color: #1a1007;
  font-size: 0.88rem;
  box-shadow: inset 0 0 0 1px #78350f;
}

.compass-cell.step-one {
  background: #39d98a;
  color: #072415;
}

.compass-cell.step-ray {
  background: #38bdf8;
  color: #082f49;
}

.compass-cell.step-jump {
  background: #a855f7;
  color: #fff;
}

.compass-cell.step-forbidden {
  background: rgba(201, 59, 43, 0.25);
  color: #991b1b;
  font-size: 0.68rem;
}

.move-diagram-legend {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
}

.sensei-objective {
  margin: 0 0 0.8rem 0;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: rgba(223, 177, 91, 0.18);
  border-inline-start: 4px solid var(--accent-gold);
  font-size: 0.9rem;
  font-weight: 700;
  color: #fde68a;
}

.sensei-objective.completed {
  background: rgba(57, 217, 138, 0.22);
  border-inline-start-color: #39d98a;
  color: #a7f3d0;
}

.sensei-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (max-width: 680px) {
  .sensei-body-grid {
    grid-template-columns: 1fr;
  }
}

/* Resaltados guiados en el tablero y reserva */
.board-cell.tutorial-origin,
.hand-piece-btn.tutorial-origin {
  box-shadow: inset 0 0 0 3px #f59e0b, 0 0 14px rgba(245, 158, 11, 0.75);
  animation: pulse-tut-origin 1.1s infinite alternate;
}

.board-cell.tutorial-target {
  background: rgba(57, 217, 138, 0.36);
  box-shadow: inset 0 0 0 3px #39d98a;
}

@keyframes pulse-tut-origin {
  from {
    box-shadow: inset 0 0 0 3px #f59e0b, 0 0 6px rgba(245, 158, 11, 0.45);
  }
  to {
    box-shadow: inset 0 0 0 4px #fbbf24, 0 0 16px rgba(251, 191, 36, 0.9);
  }
}

/* ==========================================
   VISTA 2: ARENA DE JUEGO (TABLERO 9x9)
   ========================================== */
.arena {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(560px, 740px) minmax(250px, 300px);
  grid-template-areas: "left board right";
  justify-content: center;
  align-items: start;
  gap: 1.35rem;
  padding-block: 1rem;
  padding-inline: 1.25rem;
  max-inline-size: 1480px;
  margin-inline: auto;
  inline-size: 100%;
}

.side-left {
  grid-area: left;
}

.board-stage {
  grid-area: board;
  display: flex;
  flex-direction: column;
  align-items: safe center;
  gap: 0.65rem;
}

.side-right {
  grid-area: right;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Tarjetas de Identidad de Jugador y Bandeja Komadai en Pizarra Índigo */
.player-card,
.match-card,
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.05rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.player-card {
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-card.active-turn {
  border-color: #4299e1;
  border-block-start: 3px solid var(--accent-gold);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(232, 185, 106, 0.2);
}

.player-identity-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-block-end: 0.85rem;
  margin-block-end: 0.85rem;
  border-block-end: 1px solid var(--border-subtle);
}

.player-avatar-slot {
  position: relative;
  width: 54px;
  height: 54px;
  min-width: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar-img {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--accent-gold);
  background: var(--bg-dock);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.player-koma-avatar {
  width: 48px;
  height: 52px;
  background: linear-gradient(180deg, var(--koma-top) 0%, var(--koma-bottom) 100%);
  color: var(--koma-ink);
  font-family: var(--font-calligraphy);
  font-size: 1.45rem;
  font-weight: 900;
  display: grid;
  place-content: center;
  padding-top: 0.15rem;
  clip-path: polygon(50% 3%, 95% 19%, 89% 96%, 11% 96%, 5% 19%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
}

.player-koma-avatar.points-down {
  clip-path: polygon(11% 4%, 89% 4%, 95% 81%, 50% 97%, 5% 81%);
  padding-top: 0;
  padding-bottom: 0.2rem;
}

.player-side-crest {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--bg-dock);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.82rem;
  display: grid;
  place-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.player-meta {
  min-inline-size: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.player-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.player-army-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.player-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 700;
  color: #ffffff;
  overflow: clip;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-badges-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.p-meta-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.42rem;
  border-radius: 2px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
}

.p-meta-pill.is-you {
  background: rgba(43, 108, 176, 0.28);
  border-color: #63b3ed;
  color: #e0f2fe;
}

.p-meta-pill.is-elo {
  background: rgba(232, 185, 106, 0.14);
  border-color: rgba(232, 185, 106, 0.42);
  color: var(--accent-gold);
}

.p-meta-pill.is-verified {
  background: rgba(29, 111, 88, 0.26);
  border-color: rgba(74, 222, 160, 0.42);
  color: #6ee7b7;
}

.turn-tag {
  padding-block: 0.14rem;
  padding-inline: 0.48rem;
  border-radius: var(--radius-sm);
  background: #2b6cb0;
  border: 1px solid #63b3ed;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Bandeja Komadai en Pizarra Índigo Profunda (Sin bloque marrón) */
.komadai {
  background:
    radial-gradient(circle at 50% 0%, rgba(148, 179, 224, 0.06), transparent 70%),
    #0b1220;
  border: 1px solid rgba(148, 179, 224, 0.22);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  min-block-size: 124px;
}

.komadai-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-block-end: 0.5rem;
}

.komadai-title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.komadai-orient-hint {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--accent-gold);
  opacity: 0.85;
}

.komadai-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-block-size: 68px;
  align-items: safe center;
}

.komadai-empty {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(245, 237, 226, 0.5);
  font-style: italic;
}

.hand-piece-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  inline-size: 4.1rem;
  block-size: 4.4rem;
  padding: 0.15rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.hand-piece-btn:hover:not(:disabled) {
  transform: translateY(-3px);
}

.hand-piece-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.hand-piece-btn.selected .koma-tile {
  box-shadow: 0 0 0 3px var(--accent-jade), 0 6px 12px rgba(0, 0, 0, 0.5);
}

.hand-count {
  position: absolute;
  inset-block-start: -4px;
  inset-inline-end: -4px;
  background: var(--accent-crimson);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  min-inline-size: 1.25rem;
  block-size: 1.25rem;
  border-radius: 999px;
  display: grid;
  place-content: center;
  padding-inline: 0.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Shōgiban (Tablero 9x9 en Madera Kaya tallada) */
.shogiban-frame {
  inline-size: 100%;
  max-inline-size: 720px;
  background-color: var(--wood-board-light);
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(120, 72, 24, 0.045) 0px,
      rgba(120, 72, 24, 0.045) 2px,
      transparent 2px,
      transparent 9px
    ),
    linear-gradient(155deg, #ebc580 0%, #d8a75b 52%, #c59143 100%);
  border: 8px solid var(--wood-frame);
  outline: 1px solid rgba(226, 180, 90, 0.42);
  border-radius: 10px;
  padding: 0.7rem 0.8rem 0.9rem 0.9rem;
  box-shadow:
    0 24px 52px rgba(0, 0, 0, 0.78),
    0 4px 0 #231409,
    inset 0 0 28px rgba(74, 44, 18, 0.38);
}

.col-coords {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  margin-inline-end: 2.3rem;
  margin-block-end: 0.35rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #3b2816;
}

.board-with-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.3rem;
  align-items: stretch;
}

.row-coords {
  display: grid;
  grid-template-rows: repeat(9, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #3b2816;
  padding-inline-start: 0.45rem;
}

.row-coords span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.18rem;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  aspect-ratio: 1 / 1.04;
  border: 2px solid var(--grid-line);
  background: rgba(59, 40, 22, 0.08);
  position: relative;
}

.board-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-inline-size: 0;
  min-block-size: 0;
  border: 1px solid rgba(59, 40, 22, 0.65);
  background: transparent;
  padding: 1px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease;
}

.board-cell:hover {
  background: rgba(255, 255, 255, 0.18);
}

.board-cell:focus-visible {
  outline: 3px solid #1b5e20;
  outline-offset: -3px;
  z-index: 2;
}

.board-cell.selected {
  background: rgba(46, 139, 103, 0.36);
}

.board-cell.last-move {
  background: rgba(223, 177, 91, 0.38);
}

.board-cell.king-in-check {
  background: rgba(201, 59, 43, 0.48);
  animation: pulse-check 1.2s infinite alternate;
}

@keyframes pulse-check {
  from {
    background: rgba(201, 59, 43, 0.35);
  }
  to {
    background: rgba(201, 59, 43, 0.65);
  }
}

.board-cell.hoshi::after {
  content: "";
  position: absolute;
  inset-block-end: -4px;
  inset-inline-end: -4px;
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: var(--grid-line);
  pointer-events: none;
  z-index: 2;
}

.board-cell.legal-target::before {
  content: "";
  position: absolute;
  inline-size: 32%;
  block-size: 32%;
  border-radius: 50%;
  background: rgba(28, 126, 86, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 3;
}

.board-cell.legal-capture::before {
  inline-size: 86%;
  block-size: 86%;
  background: transparent;
  border: 3px solid rgba(201, 59, 43, 0.88);
  box-shadow: none;
}

/* Ficha Pentagonal Tradicional Tallada en 3D (Koma) */
.koma-tile {
  inline-size: 95%;
  block-size: 95%;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  gap: 2px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0%, transparent 48%, rgba(120, 74, 22, 0.14) 100%),
    linear-gradient(180deg, #fdf3de 0%, #edd09b 58%, #dfb46e 100%);
  color: var(--koma-ink);
  clip-path: polygon(50% 2%, 97% 17%, 93% 97%, 7% 97%, 3% 17%);
  filter: drop-shadow(0 3px 3px rgba(18, 10, 3, 0.68));
  padding-block-start: 0.35rem;
  padding-block-end: 0.15rem;
  padding-inline: 0.15rem;
  position: relative;
  transition: transform 0.12s ease;
}

.koma-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: inherit;
  border-block-end: 4px solid #7d521e;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

/* Pieza que apunta hacia abajo (Rival): giramos la silueta pentagonal pero NO el texto en español */
.koma-tile.points-down {
  background:
    linear-gradient(90deg, rgba(120, 74, 22, 0.14) 0%, transparent 52%, rgba(255, 255, 255, 0.24) 100%),
    linear-gradient(180deg, #dfb46e 0%, #edd09b 42%, #fdf3de 100%);
  clip-path: polygon(7% 3%, 93% 3%, 97% 83%, 50% 98%, 3% 83%);
  padding-block-start: 0.15rem;
  padding-block-end: 0.4rem;
}

.koma-tile.points-down::before {
  border-block-end: none;
  border-block-start: 4px solid #724918;
}

.koma-tile.promoted {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0%, transparent 50%, rgba(184, 31, 22, 0.08) 100%),
    linear-gradient(180deg, #fff5dc 0%, #f1c676 100%);
  color: var(--koma-promoted);
}

.koma-tile.promoted::before {
  border-color: #9e1b13;
}

.koma-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  line-height: 1;
}

.koma-kanji {
  font-family: var(--font-calligraphy);
  font-weight: 900;
  font-size: clamp(1.06rem, 1.9vw, 1.4rem);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.koma-code {
  font-size: clamp(0.64rem, 1.05vw, 0.78rem);
  font-weight: 800;
  padding: 0.06rem 0.24rem;
  border-radius: 4px;
  background: rgba(26, 16, 7, 0.12);
  color: inherit;
  line-height: 1.05;
}

.koma-tile.promoted .koma-code {
  background: #b91c1c;
  color: #fff8eb;
}

.koma-sub {
  inline-size: 94%;
  font-size: clamp(0.5rem, 0.85vw, 0.64rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
}

.koma-tile.promoted .koma-sub {
  color: #991b1b;
}

.board-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  max-inline-size: 54ch;
}

/* Estado de la Partida e Invitación */
.match-card h2,
.history-card h2 {
  margin: 0 0 0.65rem 0;
  font-size: 1rem;
}

.turn-banner {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(232, 185, 106, 0.14);
  border: 1px solid rgba(232, 185, 106, 0.35);
  font-weight: 600;
  font-size: 0.9rem;
  margin-block-end: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.turn-banner.is-thinking {
  background: rgba(43, 108, 176, 0.28);
  border-color: #63b3ed;
  color: #e0f2fe;
  box-shadow: 0 0 14px rgba(66, 153, 225, 0.25);
}

.thinking-spinner {
  inline-size: 1rem;
  block-size: 1rem;
  min-inline-size: 1rem;
  border: 2px solid rgba(224, 242, 254, 0.3);
  border-top-color: #63b3ed;
  border-radius: 50%;
  animation: dojo-spin 0.75s linear infinite;
}

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

.board-grid.is-busy {
  cursor: progress;
}

.board-grid.is-busy .board-cell {
  cursor: progress;
}

.turn-banner.winner {
  background: rgba(46, 139, 103, 0.25);
  border-color: #39d98a;
  color: #a7f3d0;
}

.check-alert {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(201, 59, 43, 0.25);
  border: 1px solid var(--accent-crimson);
  color: #fecaca;
  font-weight: 700;
  font-size: 0.88rem;
  margin-block-end: 0.65rem;
}

.invite-callout {
  background: var(--bg-surface);
  border: 1px dashed var(--accent-gold);
  border-radius: 8px;
  padding: 0.65rem;
  margin-block-end: 0.75rem;
  font-size: 0.82rem;
}

.invite-callout p {
  margin: 0 0 0.45rem 0;
  color: var(--text-muted);
}

.invite-row {
  display: flex;
  gap: 0.4rem;
}

.invite-row input {
  flex: 1 1 auto;
  min-inline-size: 0;
  padding: 0.38rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #14100d;
  color: var(--accent-gold);
  font-size: 0.8rem;
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Historial de Jugadas */
.history-header {
  display: flex;
  align-items: safe center;
  justify-content: space-between;
  margin-block-end: 0.5rem;
}

.move-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-list {
  margin: 0;
  padding-inline-start: 1.25rem;
  max-block-size: 240px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.history-list li {
  color: var(--text-main);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* Botones (Sistema de Color Japonés: Bermellón Shu-iro · Jade Tatami · Índigo Acero) */
.btn {
  padding-block: 0.46rem;
  padding-inline: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 179, 224, 0.26);
  background: linear-gradient(180deg, #1b2a44 0%, #131f33 100%);
  color: #e6eef8;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #243859 0%, #1a2942 100%);
  border-color: rgba(148, 179, 224, 0.55);
  color: #ffffff;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

/* Acción Primaria: Azul Cobalto Real Japonés (Ruri-iro 瑠璃色) — Elegante y no invasivo */
.btn-primary {
  background: linear-gradient(180deg, #2b6cb0 0%, #1e4e8c 100%);
  color: #f8fafc;
  border-color: #4299e1;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 12px rgba(15, 38, 74, 0.5);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #3182ce 0%, #2b6cb0 100%);
  border-color: #63b3ed;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 16px rgba(30, 78, 140, 0.6);
}

/* Acción de Academia / Aprendizaje: Verde Jade Tatami Suave (Seiji 青磁) */
.btn-jade {
  background: linear-gradient(180deg, #1d6f58 0%, #155240 100%);
  color: #ecfdf5;
  border-color: rgba(74, 222, 160, 0.45);
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 3px 10px rgba(12, 58, 43, 0.4);
}

.btn-jade:hover:not(:disabled) {
  background: linear-gradient(180deg, #23856a 0%, #1a634e 100%);
  border-color: #5eead4;
  color: #ffffff;
}

/* Acción Secundaria Destacada: Índigo Pizarra con borde sutil */
.btn-accent {
  background: linear-gradient(180deg, #223554 0%, #18273e 100%);
  color: #dbeafe;
  border-color: rgba(147, 197, 253, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(180deg, #2c446b 0%, #1f3352 100%);
  border-color: #93c5fd;
  color: #ffffff;
}

.btn-danger {
  background: rgba(184, 41, 29, 0.18);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.48);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(214, 54, 39, 0.32);
  border-color: #f87171;
  color: #ffffff;
}

.btn-block {
  inline-size: 100%;
  margin-block-start: 0.75rem;
  padding-block: 0.62rem;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Native <dialog> Modals */
dialog {
  padding: 0;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  max-inline-size: min(560px, 94dvw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.82);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(10, 8, 6, 0.78);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-box {
  padding: 1.35rem;
}

.dialog-compact {
  max-inline-size: 420px;
  text-align: center;
}

.dialog-wide {
  max-inline-size: min(860px, 95dvw);
}

.dialog-header {
  display: flex;
  align-items: safe center;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--border-subtle);
}

.dialog-header h1,
.dialog-compact h1 {
  margin: 0;
  font-size: 1.22rem;
  color: var(--accent-gold);
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-block-end: 0.35rem;
}

.text-input {
  inline-size: 100%;
  padding: 0.52rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #080d18;
  color: var(--text-main);
  font-size: 0.9rem;
  margin-block-end: 0.75rem;
}

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

.code-input {
  text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-align: center;
}

.choice-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem;
  margin: 0 0 0.75rem 0;
}

.choice-fieldset legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-inline: 0.35rem;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.86rem;
}

.radio-card span {
  display: flex;
  flex-direction: column;
}

.radio-card small {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.radio-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-pill {
  display: flex;
  align-items: safe center;
  gap: 0.35rem;
  font-size: 0.84rem;
  cursor: pointer;
}

.dialog-error {
  margin: 0.6rem 0 0 0;
  color: #fca5a5;
  font-size: 0.84rem;
}

.promote-preview {
  display: flex;
  align-items: safe center;
  justify-content: center;
  gap: 1.25rem;
  margin-block: 1rem;
}

.promote-preview .preview-koma {
  inline-size: 4.4rem;
  block-size: 4.8rem;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Glosario */
.pieces-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-block-end: 1.1rem;
}

.guide-card {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem;
}

.guide-koma {
  flex: 0 0 3.3rem;
  block-size: 3.7rem;
  background: linear-gradient(180deg, var(--koma-top), var(--koma-bottom));
  color: var(--koma-ink);
  clip-path: polygon(50% 4%, 93% 21%, 86% 96%, 14% 96%, 7% 21%);
  display: flex;
  flex-direction: column;
  align-items: safe center;
  justify-content: center;
  font-weight: 800;
}

.guide-koma small {
  font-size: 0.56rem;
}

.guide-card h2 {
  margin: 0 0 0.25rem 0;
  font-size: 0.92rem;
  color: var(--accent-gold);
}

.guide-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rules-notes h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: var(--accent-gold);
}

.rules-notes ul {
  margin: 0;
  padding-inline-start: 1.2rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Sección Editorial / SEO en el Lobby (Composición de Revista Japonesa sin tarjetas anidadas) */
.seo-editorial-section {
  background: transparent;
  border-block-start: 1px solid var(--border-subtle);
  padding-block: 1.5rem 0.5rem;
  margin-block-start: 0.75rem;
}

.seo-editorial-section h2 {
  margin: 0 0 1.15rem 0;
  font-size: 1.15rem;
  color: var(--text-main);
}

.seo-editorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.seo-article-card {
  background: transparent;
  border: none;
  border-inline-start: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 0.15rem 0 0.15rem 1.1rem;
}

.seo-article-card h3 {
  margin: 0 0 0.45rem 0;
  font-size: 0.96rem;
  color: var(--accent-gold);
}

.seo-article-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Footer Completo (Indigo Studio) */
.site-footer {
  inline-size: 100%;
  border-block-start: 1px solid var(--border-subtle);
  background: rgba(7, 12, 22, 0.96);
  margin-block-start: 2.5rem;
  padding-block: 2.25rem 2.75rem;
  padding-inline: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer-inner {
  max-inline-size: 1400px;
  margin-inline: auto;
}

.site-footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block-end: 1.5rem;
  border-block-end: 1px solid rgba(68, 55, 44, 0.65);
}

.site-footer-brand {
  max-inline-size: 480px;
}

.site-footer-logo {
  display: flex;
  align-items: safe center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-main);
  margin-block-end: 0.45rem;
}

.footer-koma-icon {
  display: inline-grid;
  place-content: center;
  inline-size: 1.65rem;
  block-size: 1.75rem;
  background: linear-gradient(180deg, var(--koma-top), var(--koma-bottom));
  color: var(--koma-ink);
  font-weight: 900;
  font-size: 0.88rem;
  clip-path: polygon(50% 4%, 93% 21%, 86% 96%, 14% 96%, 7% 21%);
}

.site-footer-brand p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 1.35rem;
  font-weight: 600;
  font-size: 0.84rem;
}

.site-footer-nav a,
.site-footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer-nav a:hover,
.site-footer-bottom a:hover,
.footer-link-btn:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.footer-link-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}

.bug-textarea {
  resize: vertical;
  min-block-size: 96px;
  font-family: inherit;
}

.bug-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bug-external-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bug-external-links a {
  flex: 1 1 160px;
  text-align: center;
  text-decoration: none;
}

.bug-success {
  margin: 0.75rem 0 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: rgba(57, 217, 138, 0.2);
  border: 1px solid #39d98a;
  color: #a7f3d0;
  font-size: 0.86rem;
  font-weight: 600;
}

.site-footer-bottom {
  padding-block-start: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: rgba(194, 178, 159, 0.78);
}

.site-footer-bottom p {
  margin: 0;
}

/* Páginas Legales (/sobre-nosotros, /politica-de-privacidad, /terminos-de-servicio) */
.legal-page-container {
  max-inline-size: 900px;
  inline-size: 100%;
  margin-inline: auto;
  padding-block: 2rem;
  padding-inline: 1.5rem;
}

.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.legal-card h1 {
  margin: 0 0 0.4rem 0;
  font-size: 1.85rem;
  color: var(--accent-gold);
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--border-subtle);
}

.legal-updated {
  margin: 0 0 1.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legal-section {
  margin-block-end: 1.6rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-main);
}

.legal-section h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  color: var(--accent-gold);
}

.legal-section p {
  margin: 0 0 0.65rem 0;
}

.legal-section ul {
  margin: 0.4rem 0 0.65rem 0;
  padding-inline-start: 1.35rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.legal-section a {
  color: var(--accent-gold);
}

.legal-highlight-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
}

.legal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-block-start: 0.75rem;
}

.legal-badges span {
  background: #16120e;
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: ui-monospace, Consolas, monospace;
}

.legal-mail-link {
  font-weight: 700;
}

@media (max-width: 1080px) {
  .studio-shell,
  .lobby-columns {
    grid-template-columns: 1fr;
  }

  .studio-sidebar {
    position: static;
  }

  .arena {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "board"
      "right";
    max-inline-size: 640px;
  }
}

/* ==========================================
   USUARIO Y GOOGLE AUTH EN TOPBAR
   ========================================== */
.user-auth-pill {
  display: flex;
  align-items: center;
}

.btn-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth:hover {
  background: #1a2942;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.google-icon {
  flex-shrink: 0;
}

.user-profile-widget {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid rgba(148, 179, 224, 0.35);
  padding: 0.2rem 0.55rem 0.2rem 0.25rem;
  border-radius: var(--radius-sm);
}

.btn-admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(180deg, #2b6cb0 0%, #1e4e8c 100%);
  border: 1px solid rgba(147, 197, 253, 0.5);
  color: #f8fafc !important;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: filter 0.15s ease;
}

.btn-admin-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.user-avatar-top {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-gold);
}

.user-meta-top {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name-top {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-rating-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-gold);
  font-family: ui-monospace, monospace;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.btn-logout:hover {
  color: #f87171;
}

/* ==========================================
   SALÓN DE LA FAMA & HISTORIAL DE PARTIDAS
   ========================================== */
.community-stats-section {
  margin-block-start: 0.25rem;
  margin-block-end: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(217, 173, 101, 0.1);
  color: var(--accent-gold);
  padding: 0.16rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217, 173, 101, 0.28);
}

.leaderboard-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.leaderboard-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-player-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.leaderboard-avatar {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

.rank-badge {
  font-weight: 700;
  display: inline-block;
  min-width: 22px;
  text-align: center;
}

.rank-1 { color: var(--accent-gold); font-size: 0.96rem; }
.rank-2 { color: #d6d3cd; font-size: 0.96rem; }
.rank-3 { color: #c78d52; font-size: 0.96rem; }

.recent-matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
}

.match-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.match-players {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.match-player-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.match-player-line.winner {
  color: var(--accent-gold);
  font-weight: 700;
}

.match-meta-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.match-reason-badge {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* ==========================================
   MODO HISTORIA: CRÓNICAS DEL SENGOKU (ARTE UKIYO-E & SELLOS HANKO)
   ========================================== */
.story-campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-block-start: 2px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
}

.story-campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block-end: 0.9rem;
  border-block-end: 1px solid var(--border-subtle);
}

.story-campaign-title-wrap {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.story-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.story-campaign-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.42rem;
  color: var(--text-main);
  margin: 0;
}

.story-campaign-title-wrap p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.story-campaign-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.story-progress-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-sm);
}

.story-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1rem;
}

.story-boss-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.18s ease, transform 0.18s ease;
  position: relative;
}

.story-boss-card:not(.is-locked):hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
}

.story-boss-card.is-completed {
  border-color: rgba(53, 143, 108, 0.55);
}

.story-boss-card.is-next {
  border-color: var(--accent-gold);
}

.story-boss-card.is-locked {
  opacity: 0.58;
  filter: saturate(0.4);
}

/* Cabecera Ilustrada Ukiyo-e de cada Personaje */
.story-boss-art-banner {
  position: relative;
  inline-size: 100%;
  block-size: 132px;
  overflow: hidden;
  background: #140e0a;
  border-block-end: 1px solid rgba(212, 175, 55, 0.3);
}

.story-boss-portrait {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center 18%;
  transition: transform 0.4s ease;
  display: block;
}

.story-boss-card:not(.is-locked):hover .story-boss-portrait {
  transform: scale(1.06);
}

.story-boss-art-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 10, 7, 0.45) 0%,
    transparent 38%,
    rgba(19, 13, 9, 0.96) 100%
  );
  pointer-events: none;
}

.story-boss-art-overlay {
  position: absolute;
  top: 0.55rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  z-index: 2;
}

/* Sello Imperial Hanko (朱印) en Rojo Bermellón */
.story-boss-mon {
  position: absolute;
  bottom: 0.55rem;
  right: 0.65rem;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: linear-gradient(145deg, #c6281c, #96180f);
  border: 1.5px solid rgba(255, 232, 214, 0.82);
  box-shadow:
    inset 0 0 0 2px #96180f,
    0 4px 10px rgba(0, 0, 0, 0.75);
  color: #fff6ec;
  font-family: var(--font-calligraphy);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-3deg);
}

.story-boss-body {
  padding: 0.85rem 1rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.story-boss-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.story-boss-chap {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f7DF9C;
  background: rgba(18, 12, 8, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.38);
  padding: 0.14rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.story-boss-name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.story-boss-kanji {
  font-family: var(--font-calligraphy);
  font-size: 0.84rem;
  color: var(--accent-gold);
}

.story-boss-role {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f39c12;
}

.story-boss-desc {
  font-size: 0.77rem;
  color: #cfc6b8;
  line-height: 1.42;
  margin: 0.15rem 0 0;
}

.story-boss-quote {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-style: italic;
  color: #d8cbb8;
  border-left: 2px solid #bc2a1e;
  padding-left: 0.55rem;
  margin: 0;
  line-height: 1.38;
}

.story-boss-footer {
  padding: 0.55rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: auto;
}

.story-boss-badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.story-stars {
  color: #f1c40f;
  letter-spacing: 0.05em;
}

.story-elo-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c6b59f;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.story-status-tag {
  font-weight: 700;
  padding: 0.14rem 0.48rem;
  border-radius: 4px;
  font-size: 0.66rem;
  backdrop-filter: blur(4px);
}

.story-status-tag.done {
  background: rgba(22, 101, 52, 0.88);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.story-status-tag.ready {
  background: rgba(180, 83, 9, 0.88);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.5);
}

.story-status-tag.locked {
  background: rgba(20, 14, 10, 0.85);
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* HUD DEL RIVAL EN LA ARENA DE JUEGO */
.story-hud-panel {
  width: 100%;
  max-width: 720px;
  background:
    radial-gradient(circle at 0% 50%, rgba(217, 56, 41, 0.16), transparent 55%),
    linear-gradient(135deg, #16243b, #0e1726);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
}

.story-hud-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.story-hud-avatar-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  min-width: 68px;
}

.story-hud-portrait {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid #d4af37;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
  display: block;
}

.story-hud-crest {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: linear-gradient(145deg, #c6281c, #96180f);
  border: 1px solid rgba(255, 235, 220, 0.85);
  color: #fff;
  font-family: var(--font-calligraphy);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  transform: rotate(-4deg);
}

.story-hud-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.story-hud-topline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
}

.story-hud-chapter-badge {
  background: linear-gradient(135deg, #b8251a, #8f1810);
  color: #fff5ea;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.story-hud-stars {
  color: #f1c40f;
  font-weight: 700;
}

.story-hud-era {
  color: var(--text-muted);
}

.story-hud-name {
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: #fff;
  margin: 0;
}

.story-hud-quote {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-style: italic;
  color: #fae5a3;
  margin: 0.1rem 0 0;
  line-height: 1.38;
}

.story-hud-actions {
  display: flex;
  align-items: center;
}

/* ==========================================
   TARJETA DE REANUDACIÓN DE PARTIDA EN CURSO (LOBBY)
   Y DIÁLOGO DE CONFIRMACIÓN DE SALIDA / ABANDONO
   ========================================== */
.resume-match-card {
  background: linear-gradient(155deg, rgba(16, 28, 49, 0.96), rgba(11, 18, 32, 0.98));
  border: 1px solid rgba(217, 173, 101, 0.55);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  box-shadow: 0 8px 22px rgba(2, 6, 14, 0.72), inset 0 0 18px rgba(217, 173, 101, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.resume-match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.resume-match-tag {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-gold);
  background: rgba(217, 173, 101, 0.14);
  border: 1px solid rgba(217, 173, 101, 0.36);
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
}

.resume-match-head code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #a9cefa;
  background: rgba(15, 25, 45, 0.85);
  padding: 0.14rem 0.42rem;
  border-radius: 4px;
  border: 1px solid rgba(112, 152, 218, 0.25);
}

.resume-match-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.resume-match-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.leave-dialog-body {
  padding: 1.15rem 1.25rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.leave-dialog-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.leave-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.p-meta-pill.is-disconnected {
  background: rgba(217, 119, 6, 0.22);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.55);
  animation: pulse-warn 1.5s infinite ease-in-out;
}

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

