:root {
  color-scheme: dark;
  --bg-main: #0c0f14;
  --bg-card: #151a23;
  --bg-card-hover: #1c2330;
  --border-color: #273142;
  --gold-primary: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --gold-dark: #b45309;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Cinzel', 'Georgia', 'Times New Roman', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

/* Header & Navigation Sticky Container */
.app-top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111620;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

header.app-header {
  background: linear-gradient(180deg, #18202c 0%, #111620 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-crown {
  font-size: 26px;
  filter: drop-shadow(0 0 10px var(--gold-glow));
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--gold-primary);
  text-shadow: 0 0 12px var(--gold-glow);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Nav tabs */
nav.app-nav {
  display: flex;
  background: #111620;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
}
nav.app-nav::-webkit-scrollbar { display: none; }

.nav-tab {
  flex: 1;
  min-width: 85px;
  padding: 12px 10px;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.nav-tab .tab-icon {
  font-size: 18px;
}

.nav-tab.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.05);
}

.nav-tab:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

/* Main Container */
main.app-main {
  flex: 1;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
main.app-main.live-match-wide {
  max-width: 1920px;
  padding-left: clamp(8px, 1.2vw, 22px);
  padding-right: clamp(8px, 1.2vw, 22px);
}

/* Barra de Navegación Lateral Izquierda en PC (>= 861px) */
@media (min-width: 861px) {
  :root {
    --sidebar-w: 98px;
  }
  html {
    scroll-padding-top: 16px;
  }
  body {
    padding-left: var(--sidebar-w);
  }
  body.book-fullscreen-active,
  body.match-fullscreen-active,
  body.tv-mode {
    padding-left: 0 !important;
  }
  .app-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    z-index: 120;
    background: linear-gradient(180deg, #131925 0%, #0d121b 100%);
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 22px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
  }
  nav.app-nav {
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: stretch;
    height: 100%;
    background: transparent;
    border-bottom: none;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 0;
    gap: 2px;
  }
  .nav-tab {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    padding: 8px 4px;
    font-size: 11.5px;
    gap: 4px;
    justify-content: center;
    border-bottom: none;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
  }
  .nav-tab .tab-icon {
    font-size: 20px;
    line-height: 1;
  }
  .nav-tab.active {
    color: var(--gold-primary);
    border-bottom-color: transparent;
    border-left-color: var(--gold-primary);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.03) 100%);
  }
  .nav-tab:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
  }
  main.app-main.torres-wide,
  main.app-main.desafios-wide {
    max-width: 1760px;
    padding: 12px clamp(12px, 1.5vw, 24px);
  }
}

/* Modo Partida en Vivo y Pantalla Completa (se adapta al 100% del alto en PC y reajusta cuando el banner de desafío desaparece) */
body.match-fullscreen-active .app-top-bar,
body.match-fullscreen-active .fab-live-editor-btn {
  display: none !important;
}
body.match-fullscreen-active main.app-main.live-match-wide {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: min(1960px, 99vw);
  padding: 10px clamp(8px, 1.1vw, 18px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
body.match-fullscreen-active #tab-partida {
  width: 100%;
}
body.match-fullscreen-active .scoreboard-panel {
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
}
@media (min-width: 1024px) {
  body.match-fullscreen-active {
    overflow: hidden;
  }
  main.app-main.live-match-wide {
    height: 100vh;
    height: 100dvh;
    padding: 10px clamp(8px, 1.1vw, 18px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }
  main.app-main.live-match-wide #tab-partida.active {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  main.app-main.live-match-wide #match-active-screen:not([style*="display: none"]) {
    flex: 1 1 0;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
  }
  main.app-main.live-match-wide #pvp-banner,
  main.app-main.live-match-wide #desafio-banner {
    flex: 0 0 auto;
    margin-bottom: 8px;
  }
  main.app-main.live-match-wide #live-scoreboard-wrapper.split-scoreboard-wrapper {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }
  main.app-main.live-match-wide .scoreboard-left-column {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  main.app-main.live-match-wide #scoreboard-split-card-upper {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  main.app-main.live-match-wide #player-personal-match-hud {
    flex: 0 0 auto;
  }
  main.app-main.live-match-wide #scoreboard-split-card-lower {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  main.app-main.live-match-wide #match-center-status-card {
    height: 100%;
    min-height: 0;
    align-self: stretch;
    box-sizing: border-box;
    overflow: hidden;
  }
  main.app-main.live-match-wide #match-used-bonuses-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
  main.app-main.live-match-wide .scoreboard-panel-title {
    flex: 0 0 auto;
    padding: clamp(6px, 0.9vh, 11px) clamp(10px, 1.8cqi, 16px);
  }
  main.app-main.live-match-wide .scoreboard-panel {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    display: block;
    overflow-x: auto;
    overflow-y: auto;
  }
  main.app-main.live-match-wide .scoreboard-split-card,
  main.app-main.live-match-wide .scoreboard-split-card[data-density] {
    --live-pad-y: clamp(3px, 0.7vh, 10px);
  }
  main.app-main.live-match-wide table.scoreboard.live-scoreboard {
    height: 100% !important;
  }
  main.app-main.live-match-wide table.scoreboard.live-scoreboard thead tr {
    height: clamp(38px, 5.5vh, 58px);
  }
}
#btn-match-fullscreen:hover {
  background: rgba(56, 189, 248, 0.16);
}
body.match-fullscreen-active #btn-match-fullscreen {
  background: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.28);
}

.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #111;
  border-color: #f59e0b;
  box-shadow: 0 2px 10px var(--gold-glow);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold-primary);
}
.btn-outline.active, .stat-tab-btn.active {
  background: var(--gold-primary) !important;
  color: #0b0f17 !important;
  border-color: var(--gold-primary) !important;
  font-weight: 800 !important;
}

/* ========================================================
   DESPLEGABLES Y SELECTORES DEL REINO (SELECT & OPTION)
   ======================================================== */
select,
select.btn,
select.btn-outline {
  color-scheme: dark !important;
  background-color: #0e141f !important;
  color: #f3f4f6 !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: calc(100% - 12px) center !important;
  padding-right: 36px !important;
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all 0.2s ease;
}

select:hover,
select.btn:hover,
select.btn-outline:hover {
  border-color: var(--gold-primary) !important;
  background-color: #141c2c !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2) !important;
}

select:focus,
select.btn:focus,
select.btn-outline:focus {
  outline: none !important;
  border-color: var(--gold-primary) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35) !important;
  background-color: #141c2c !important;
}

/* Opciones de la lista desplegable nativa del navegador */
select option,
select optgroup {
  background-color: #0c121d !important;
  color: #f3f4f6 !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
}

select option:checked {
  background-color: #1e293b !important;
  color: var(--gold-primary) !important;
  font-weight: 700;
}

select option:hover {
  background-color: #1e293b !important;
  color: #ffffff !important;
}

.btn-tv {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border-color: #60a5fa;
}
.btn-tv:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================================
   PANTALLA DE BIENVENIDA (CASTILLO DE LÁGAREN)
   ======================================================== */
.welcome-container {
  text-align: center;
  padding: 40px 20px;
  border: 2px solid #2d3748;
  background: radial-gradient(circle at 50% 20%, #1a2333 0%, #101520 80%);
}

.welcome-shield {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px var(--gold-glow));
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--gold-primary);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.welcome-desc {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 28px auto;
  font-size: 15px;
  line-height: 1.6;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
}

.quick-access-card {
  background: #141b26;
  border: 1px solid #253041;
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.quick-access-card:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  background: #192333;
}
.quick-access-card .quick-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}
.quick-access-card .quick-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 15px;
  margin-bottom: 4px;
}
.quick-access-card .quick-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================================
   VISTA PARTIDA (MATCH VIEW)
   ======================================================== */
.match-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(135deg, #1c2433 0%, #151b26 100%);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 12px 20px;
  margin-bottom: 16px;
}

.pvp-banner {
  width: 100%;
  background: linear-gradient(90deg, #7c2d12 0%, #991b1b 50%, #7c2d12 100%);
  border: 2px solid #ef4444;
  border-radius: 10px;
  padding: 12px 18px;
  text-align: center;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  animation: pulsePvp 2s infinite ease-in-out;
  display: none;
  margin-bottom: 16px;
}
.pvp-banner.visible { display: block; }

@keyframes pulsePvp {
  0%, 100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.7); }
}

/* Scoreboard Table */
.scoreboard-container {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0e131b;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

table.scoreboard {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
  font-size: 14px;
}

table.scoreboard th, table.scoreboard td {
  padding: 9px 11px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.scoreboard th:first-child, table.scoreboard td:first-child {
  border-left: 1px solid var(--border-color);
}

table.scoreboard thead tr:first-child th {
  border-top: 1px solid var(--border-color);
}

table.scoreboard thead {
  position: sticky;
  top: 0;
  z-index: 25;
}

table.scoreboard thead th {
  background: #182233;
  position: sticky;
  top: 0;
  z-index: 25;
  border-bottom: 2px solid var(--gold-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

table.scoreboard th.header-cat {
  background: #141b26;
  text-align: left;
  font-weight: 700;
  width: auto;
  min-width: 120px;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 35;
  color: var(--text-muted);
  border-right: 2px solid var(--border-color);
}

table.scoreboard th.header-player {
  background: #182233;
  color: var(--gold-primary);
  font-size: 15px;
  font-weight: 800;
  min-width: 0;
}

table.scoreboard td.cat-name {
  background: #10151f;
  text-align: left;
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 12;
  color: var(--text-main);
  border-right: 2px solid var(--border-color);
}

/* Marcador Vivo Dividido en Dos Cuadros + Tarjeta Central + Adaptación Fluida por Jugadores */
.cat-label-full {
  display: inline;
}
.cat-label-short {
  display: none;
}

.split-scoreboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.scoreboard-left-column {
  display: contents;
}

@media (max-width: 1023px) {
  #match-center-status-card { order: 0; }
  #scoreboard-split-card-upper { order: 1; }
  #scoreboard-split-card-lower { order: 2; }
  #player-personal-match-hud { order: 3; }
}

.scoreboard-split-card {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0e131b;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  container-type: inline-size;
  --cat-col-w: clamp(124px, 23cqi, 180px);
  --live-cat-fs: clamp(12px, 1.95cqi, 15.5px);
  --live-header-fs: clamp(12.5px, 2.15cqi, 18px);
  --live-cell-fs: clamp(13.5px, 2.35cqi, 19.5px);
  --live-total-fs: clamp(15px, 2.65cqi, 22px);
  --live-pad-y: clamp(7px, min(1.3cqi, 1.1vh), 12px);
  --live-pad-x: clamp(4px, 0.9cqi, 10px);
  --live-chip-fs: clamp(9px, 1.35cqi, 12px);
  --live-title-fs: clamp(11.5px, 1.75cqi, 15px);
  --live-turn-fs: clamp(8.5px, 1.25cqi, 11px);
  --live-badge-fs: clamp(10px, 1.5cqi, 13.5px);
}

.scoreboard-split-card[data-density="2"] {
  --cat-col-w: clamp(144px, 27cqi, 220px);
  --live-cat-fs: clamp(13.5px, 2.35cqi, 18px);
  --live-header-fs: clamp(15px, 2.85cqi, 23px);
  --live-cell-fs: clamp(16px, 3.15cqi, 25px);
  --live-total-fs: clamp(18px, 3.45cqi, 27px);
  --live-pad-y: clamp(8px, min(1.65cqi, 1.25vh), 15px);
  --live-pad-x: clamp(7px, 1.4cqi, 14px);
  --live-chip-fs: clamp(10.5px, 1.65cqi, 13.5px);
  --live-title-fs: clamp(12.5px, 1.95cqi, 16px);
  --live-turn-fs: clamp(9.5px, 1.45cqi, 12px);
  --live-badge-fs: clamp(11.5px, 1.8cqi, 15px);
}

.scoreboard-split-card[data-density="3"] {
  --cat-col-w: clamp(134px, 25cqi, 200px);
  --live-cat-fs: clamp(13px, 2.15cqi, 16.5px);
  --live-header-fs: clamp(14px, 2.5cqi, 20px);
  --live-cell-fs: clamp(15px, 2.75cqi, 22px);
  --live-total-fs: clamp(16.5px, 3cqi, 24px);
  --live-pad-y: clamp(8px, min(1.5cqi, 1.2vh), 13.5px);
  --live-pad-x: clamp(6px, 1.15cqi, 12px);
  --live-chip-fs: clamp(10px, 1.5cqi, 13px);
  --live-title-fs: clamp(12px, 1.85cqi, 15.5px);
  --live-turn-fs: clamp(9px, 1.35cqi, 11.5px);
  --live-badge-fs: clamp(11px, 1.65cqi, 14px);
}

.scoreboard-split-card[data-density="4"] {
  --cat-col-w: clamp(124px, 23cqi, 180px);
  --live-cat-fs: clamp(12.5px, 1.95cqi, 15.5px);
  --live-header-fs: clamp(13px, 2.2cqi, 18px);
  --live-cell-fs: clamp(14px, 2.4cqi, 19.5px);
  --live-total-fs: clamp(15.5px, 2.65cqi, 21.5px);
  --live-pad-y: clamp(7px, min(1.35cqi, 1.1vh), 12px);
  --live-pad-x: clamp(5px, 0.95cqi, 10px);
  --live-chip-fs: clamp(9.5px, 1.38cqi, 12px);
  --live-title-fs: clamp(11.5px, 1.75cqi, 15px);
  --live-turn-fs: clamp(8.5px, 1.25cqi, 11px);
  --live-badge-fs: clamp(10.5px, 1.5cqi, 13.5px);
}

.scoreboard-split-card[data-density="5"] {
  --cat-col-w: clamp(114px, 20.5cqi, 162px);
  --live-cat-fs: clamp(11.5px, 1.78cqi, 14.5px);
  --live-header-fs: clamp(12px, 1.92cqi, 16.5px);
  --live-cell-fs: clamp(12.5px, 2.08cqi, 17.5px);
  --live-total-fs: clamp(14px, 2.35cqi, 19.5px);
  --live-pad-y: clamp(6.5px, min(1.18cqi, 1.02vh), 10.5px);
  --live-pad-x: clamp(4px, 0.75cqi, 8px);
  --live-chip-fs: clamp(8.5px, 1.22cqi, 11.5px);
  --live-title-fs: clamp(11px, 1.65cqi, 14.5px);
  --live-turn-fs: clamp(8px, 1.15cqi, 10.5px);
  --live-badge-fs: clamp(9.5px, 1.38cqi, 12.5px);
}

.scoreboard-split-card[data-density="6"] {
  --cat-col-w: clamp(104px, 18.8cqi, 148px);
  --live-cat-fs: clamp(11px, 1.62cqi, 13.8px);
  --live-header-fs: clamp(11.2px, 1.7cqi, 15px);
  --live-cell-fs: clamp(11.8px, 1.85cqi, 16px);
  --live-total-fs: clamp(13px, 2.08cqi, 18px);
  --live-pad-y: clamp(6px, min(1.05cqi, 0.95vh), 9.5px);
  --live-pad-x: clamp(3px, 0.58cqi, 6.5px);
  --live-chip-fs: clamp(8px, 1.1cqi, 10.5px);
  --live-title-fs: clamp(11px, 1.55cqi, 14px);
  --live-turn-fs: clamp(7.5px, 1.05cqi, 10px);
  --live-badge-fs: clamp(9px, 1.25cqi, 12px);
}

.scoreboard-split-card[data-density="7"],
.scoreboard-split-card[data-density="8plus"] {
  --cat-col-w: clamp(94px, 17cqi, 136px);
  --live-cat-fs: clamp(10.5px, 1.48cqi, 13px);
  --live-header-fs: clamp(10.5px, 1.52cqi, 13.8px);
  --live-cell-fs: clamp(11px, 1.65cqi, 14.8px);
  --live-total-fs: clamp(12.2px, 1.85cqi, 16.5px);
  --live-pad-y: clamp(5.5px, min(0.95cqi, 0.9vh), 9px);
  --live-pad-x: clamp(2px, 0.45cqi, 5.5px);
  --live-chip-fs: clamp(7.5px, 1cqi, 10px);
  --live-title-fs: clamp(10.5px, 1.48cqi, 13.5px);
  --live-turn-fs: clamp(7px, 0.95cqi, 9.5px);
  --live-badge-fs: clamp(8.5px, 1.15cqi, 11px);
}

/* Cambio automático a etiquetas compactas cuando el espacio horizontal es ajustado */
@container (max-width: 420px) {
  .scoreboard-split-card .cat-label-full { display: none; }
  .scoreboard-split-card .cat-label-short { display: inline; }
}
@container (max-width: 520px) {
  .scoreboard-split-card[data-density="6"] .cat-label-full { display: none; }
  .scoreboard-split-card[data-density="6"] .cat-label-short { display: inline; }
}
@container (max-width: 640px) {
  .scoreboard-split-card[data-density="7"] .cat-label-full,
  .scoreboard-split-card[data-density="8plus"] .cat-label-full { display: none; }
  .scoreboard-split-card[data-density="7"] .cat-label-short,
  .scoreboard-split-card[data-density="8plus"] .cat-label-short { display: inline; }
}

.match-center-status-card {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 0;
}

.match-center-badges,
.match-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

@media (min-width: 1024px) {
  .split-scoreboard-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--center-card-w, clamp(164px, 11.2vw, 200px)) minmax(0, 1fr);
    gap: clamp(10px, 1vw, 16px);
    align-items: start;
    width: 100%;
  }
  .scoreboard-left-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    width: 100%;
  }
  #live-scoreboard-wrapper[data-density="2"] {
    --center-card-w: clamp(176px, 12.2vw, 214px);
  }
  #live-scoreboard-wrapper[data-density="3"] {
    --center-card-w: clamp(170px, 11.8vw, 206px);
  }
  #live-scoreboard-wrapper[data-density="4"] {
    --center-card-w: clamp(162px, 11vw, 196px);
  }
  #live-scoreboard-wrapper[data-density="5"] {
    --center-card-w: clamp(152px, 10.2vw, 184px);
  }
  #live-scoreboard-wrapper[data-density="6"] {
    --center-card-w: clamp(144px, 9.5vw, 174px);
  }
  #live-scoreboard-wrapper[data-density="7"],
  #live-scoreboard-wrapper[data-density="8plus"] {
    --center-card-w: clamp(138px, 9vw, 164px);
  }
  #scoreboard-split-card-upper,
  #scoreboard-split-card-lower {
    justify-self: stretch;
    width: 100%;
  }
  .match-center-status-card {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 12px 10px;
    gap: 10px;
    align-self: stretch;
  }
  .match-center-badges {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }
  .match-center-badges .badge {
    text-align: center;
    white-space: normal;
    line-height: 1.25;
    padding: 6px 8px;
    font-size: clamp(10.5px, 0.8vw, 12.5px);
  }
  .match-center-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    margin-top: auto;
  }
  .match-center-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: clamp(11.5px, 0.85vw, 13.5px) !important;
  }
}

.scoreboard-panel-title {
  background: linear-gradient(90deg, #141c29 0%, #192436 100%);
  border-bottom: 1px solid var(--border-color);
  padding: clamp(7px, 1.1cqi, 11px) clamp(10px, 1.8cqi, 16px);
  font-size: var(--live-title-fs, 12px);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #cbd5e1;
}

.scoreboard-panel {
  max-width: 100%;
  max-height: calc(100vh - 125px);
  max-height: calc(100dvh - 125px);
  overflow-x: auto;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

table.scoreboard.live-scoreboard {
  width: 100% !important;
  min-width: var(--live-table-min-w, 0) !important;
  table-layout: fixed !important;
}

table.scoreboard.live-scoreboard th,
table.scoreboard.live-scoreboard td {
  padding: var(--live-pad-y, 7px) var(--live-pad-x, 5px);
  font-size: var(--live-cell-fs, 14px);
}

table.scoreboard.live-scoreboard th.header-cat,
table.scoreboard.live-scoreboard td.cat-name {
  min-width: 0;
  width: var(--cat-col-w, 124px);
  padding: var(--live-pad-y, 7px) clamp(6px, 1.4cqi, 13px);
  font-size: var(--live-cat-fs, 12.5px);
  overflow: hidden;
  text-overflow: ellipsis;
}

table.scoreboard.live-scoreboard th.header-player {
  min-width: 0;
  width: auto;
  padding: var(--live-pad-y, 7px) var(--live-pad-x, 5px);
  font-size: var(--live-header-fs, 13.5px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-player-name,
table.scoreboard.live-scoreboard th.header-player .header-player-name {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  vertical-align: bottom;
}

table.scoreboard.live-scoreboard td.score-cell {
  min-width: 0;
  width: auto;
  padding: var(--live-pad-y, 7px) var(--live-pad-x, 5px);
  font-size: var(--live-cell-fs, 14px);
  overflow: hidden;
  text-overflow: ellipsis;
}

table.scoreboard.live-scoreboard tr.row-total td.score-cell {
  font-size: var(--live-total-fs, 16px);
}

table.scoreboard.live-scoreboard tr.row-total td.cat-name {
  font-size: var(--live-cat-fs, 13px);
  letter-spacing: 0.3px;
}

.score-cell-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 3px;
  line-height: 1.15;
  max-width: 100%;
}

.score-cell-badges {
  font-size: var(--live-badge-fs, 10.5px);
  line-height: 1;
}

.extra-play-chip {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: var(--live-chip-fs, 9.5px);
  font-weight: 800;
  line-height: 1.15;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  vertical-align: middle;
}

.turn-pill-mini {
  font-size: var(--live-turn-fs, 9px);
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.header-player.header-annotatable {
  cursor: pointer;
  transition: background 0.15s ease;
}

.header-player.header-annotatable:hover {
  background: #223047 !important;
}

table.scoreboard tr.row-subtotal {
  background: rgba(59, 130, 246, 0.1);
  font-weight: 800;
}
table.scoreboard tr.row-total {
  background: rgba(245, 158, 11, 0.15);
  font-weight: 900;
  font-size: 16px;
  color: var(--gold-primary);
}

.score-cell {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.15s ease;
  min-width: 80px;
}
.score-cell:hover:not(.filled) {
  background: rgba(245, 158, 11, 0.15);
  outline: 2px solid var(--gold-primary);
}
.score-cell.filled {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.score-cell.servida {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}
.score-cell.incorporea {
  color: #fb923c;
  text-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
}
.score-cell.tachada {
  color: #ef4444;
  font-style: italic;
  opacity: 0.8;
}

/* ========================================================
   MODAL DE ANOTACIÓN TÁCTIL (TOUCH SCORING MODAL)
   ======================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal-content {
  background: #141b25;
  border: 1px solid var(--gold-primary);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px var(--gold-glow);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  margin: auto;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-primary) #0a0f18;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}
.modal-content::-webkit-scrollbar-track {
  background: #0a0f18;
  border-radius: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
  background: var(--gold-primary);
  border-radius: 6px;
  border: 2px solid #0a0f18;
}
.modal-content::-webkit-scrollbar-thumb:hover {
  background: #fbbf24;
}
@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.score-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.btn-score-choice {
  padding: 16px 10px;
  background: #1d2533;
  border: 1px solid #374151;
  color: #fff;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-score-choice:hover {
  background: var(--gold-primary);
  color: #111;
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.servida-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed var(--gold-primary);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  cursor: pointer;
}

/* ========================================================
   VISTA TORRES: LAYOUT TRÍPTICO (50 CASILLEROS - CASTILLO CENTRO - 50 CASILLEROS)
   ======================================================== */
.tower-tabs-center-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tower-tabs-center-bar .btn-tower-tab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  background: #141b25;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tower-tabs-center-bar .btn-tower-tab.active {
  background: var(--gold-primary);
  color: #111;
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px var(--gold-glow);
}

.tower-view-triptych {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: clamp(12px, 1.4vw, 22px);
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  max-height: none;
  min-height: 460px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.tower-castle-card {
  background: radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.08) 0%, rgba(15, 23, 42, 0.96) 80%), #0c121d;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1vh, 14px);
  height: 100%;
  box-sizing: border-box;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
}

.castle-interactive-stage {
  position: relative;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 656 / 1006;
  width: auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  margin: 0 auto;
}

.castle-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.castle-base-layer {
  position: relative;
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  z-index: 1;
  filter: drop-shadow(0 0 24px rgba(245, 158, 11, 0.45)) brightness(1.05);
  pointer-events: none;
}

.tower-overlay-layer {
  z-index: 2;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.22s ease, filter 0.22s ease;
  pointer-events: none;
}

/* Efecto Hover sobre la Capa PNG de la Torre */
.tower-overlay-layer.hovered {
  opacity: 0.75;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 1))
          drop-shadow(0 0 28px rgba(245, 158, 11, 0.9))
          sepia(1) saturate(5) hue-rotate(5deg);
}

/* Efecto Torre Activa (Seleccionada) en Capa PNG */
.tower-overlay-layer.active {
  opacity: 0.9;
  filter: drop-shadow(0 0 16px rgba(251, 191, 36, 1))
          drop-shadow(0 0 36px rgba(245, 158, 11, 0.95))
          sepia(1) saturate(6) hue-rotate(5deg);
}

/* Capa SVG Vectorial */
.castle-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: auto;
}

#tower-hit-polygons {
  pointer-events: auto;
}

/* Polígonos interactivos de cada Torre */
.tower-polygon-hit {
  fill: rgba(245, 158, 11, 0.001);
  stroke: rgba(245, 158, 11, 0);
  stroke-width: 2.5;
  cursor: pointer;
  transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease;
  pointer-events: all;
}

/* Hover: ilumina la sección del dibujo en dorado */
.tower-polygon-hit:hover,
.tower-polygon-hit.hovered {
  fill: rgba(251, 191, 36, 0.32);
  stroke: #fbbf24;
  stroke-width: 3.5;
  filter: url(#glow-gold);
}

/* Activa: sección seleccionada con brillo dorado radiante */
.tower-polygon-hit.active {
  fill: rgba(245, 158, 11, 0.42);
  stroke: #f59e0b;
  stroke-width: 4;
  filter: url(#glow-gold-active);
}

.tower-polygon-hit.active:hover {
  fill: rgba(251, 191, 36, 0.52);
  stroke: #ffffff;
  stroke-width: 4.5;
}

/* Tooltip / Insignia Flotante en la Base del Castillo */
.castle-tower-tooltip {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8), 0 0 12px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
  max-width: 92%;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Tarjetas Laterales del Tríptico (Izquierda y Derecha) */
.tower-triptych-card,
.tower-subgrid-card {
  flex: 1 1 0;
  max-width: 560px;
  min-width: 260px;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  margin-bottom: 0 !important;
  padding: clamp(8px, 1vh, 14px) clamp(10px, 1vw, 14px) !important;
  background: #0f1520;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* Barra de navegación de páginas en tarjetas */
.tower-card-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.tower-nav-arrow {
  background: #141c2b;
  border: 1px solid #27364b;
  color: #fbbf24;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tower-nav-arrow:hover {
  background: var(--gold-primary);
  color: #0b0f17;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  transform: scale(1.06);
}

.tower-nav-arrow:active {
  transform: scale(0.92);
}

.tower-nav-label {
  font-family: var(--font-serif);
  font-size: clamp(12.5px, 1.55vh, 17px);
  font-weight: 800;
  color: var(--gold-primary);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-nav-page-badge {
  background: #1e293b;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #334155;
  font-family: var(--font-sans);
}

/* Cuerpo con scroll propio para la tarjeta izquierda */
.tower-card-body-scrollable {
  flex: 1;
  height: calc(100% - 44px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
}

.tower-card-body-scrollable::-webkit-scrollbar {
  width: 5px;
}

.tower-card-body-scrollable::-webkit-scrollbar-thumb {
  background: #273549;
  border-radius: 4px;
}

.tower-card-body-scrollable::-webkit-scrollbar-thumb:hover {
  background: #f59e0b;
}

/* Tarjeta del Zar en Página 1 Izquierda */
.zar-card-presentation {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zar-presentation-top {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #080c14;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px;
}

.zar-portrait-frame {
  width: 74px;
  height: 94px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.zar-portrait-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
}

.zar-info-block {
  flex: 1;
  min-width: 0;
}

.zar-name-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 800;
  color: #fbbf24;
  line-height: 1.2;
}

.zar-alias-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.zar-siglo-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  background: #162030;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.zar-status-unlocked {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #34d399;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  margin-top: 6px;
}

.zar-status-locked {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 6px;
}

.zar-challenge-section {
  background: #090e17;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
}

.zar-challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.zar-challenge-name {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
}

.zar-reward-tag {
  font-size: 11px;
  font-weight: 800;
  color: #ffd966;
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.zar-rule-callout {
  background: #141b27;
  border-left: 3px solid #ef4444;
  border-radius: 0 6px 6px 0;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.zar-rule-label {
  font-size: 10px;
  font-weight: 800;
  color: #f87171;
  text-transform: uppercase;
}

.zar-rule-body {
  font-size: 11.5px;
  color: #e2e8f0;
  margin-top: 2px;
  line-height: 1.35;
}

.zar-objectives-list {
  margin-bottom: 8px;
}

.zar-obj-title {
  font-size: 10.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.zar-obj-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.3;
  margin-bottom: 3px;
}

.zar-bullet {
  color: #fbbf24;
}

.zar-action-row {
  text-align: right;
  margin-top: 6px;
}

.zar-book-button {
  font-size: 11px !important;
  padding: 4px 10px !important;
  font-weight: 800 !important;
}

.zar-lore-section {
  background: #080c14;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 10px;
}

.zar-lore-label {
  font-size: 10.5px;
  font-weight: 800;
  color: #f87171;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.zar-lore-paragraph {
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
  margin: 0;
}

/* Página 2 Izquierda: Aportes por Jugador */
.tower-player-donuts-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.tower-donut-target-toggle {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-donut-pill {
  background: #141c2b;
  border: 1px solid #27364b;
  color: #94a3b8;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-donut-pill.active {
  background: var(--gold-primary);
  color: #0b0f17;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.mini-donut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tower-pie-chart-box {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tower-pie-chart-box svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.mini-donut-svg-box {
  position: relative;
  width: 124px;
  height: 124px;
}

.mini-donut-svg-box svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.mini-donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.mini-center-val {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  font-family: var(--font-serif);
  line-height: 1;
}

.mini-center-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--gold-primary);
  margin-top: 2px;
}

.mini-donut-legend {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.mini-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  border-radius: 5px;
  background: #090e17;
  border: 1px solid #1a2333;
  font-size: 9.5px;
  min-width: 0;
}

.mini-legend-item.pending {
  border-style: dashed;
  opacity: 0.8;
}

.mini-legend-item .legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  flex-shrink: 0;
}

.mini-legend-item .legend-player {
  font-weight: 700;
  color: #e2e8f0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.mini-legend-item .legend-count {
  font-weight: 800;
  color: #fff;
  margin-right: 2px;
  font-size: 9px;
}

.mini-legend-item .legend-pct {
  font-size: 8.5px;
  color: var(--gold-primary);
  min-width: 25px;
  text-align: right;
}

/* Banner de Estado de Desafío (Bloqueado / Desbloqueado con Progreso) */
.tower-challenge-lock-banner {
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.tower-challenge-lock-banner.locked {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(30, 15, 20, 0.6));
  border: 1.5px solid rgba(239, 68, 68, 0.45);
}

.tower-challenge-lock-banner.unlocked {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(6, 78, 59, 0.35));
  border: 1.5px solid #10b981;
}

/* Grid de Aportes por Jugador en Página 3 */
.tower-player-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px 4px 6px 2px;
  box-sizing: border-box;
}

.tower-player-stats-grid::-webkit-scrollbar {
  width: 4px;
}
.tower-player-stats-grid::-webkit-scrollbar-thumb {
  background: #273549;
  border-radius: 4px;
}
.tower-player-stats-grid::-webkit-scrollbar-thumb:hover {
  background: #f59e0b;
}

.tower-player-stat-card {
  background: #090e17;
  border: 1px solid #1a2536;
  border-radius: 7px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.tower-player-stat-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.tower-player-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tower-player-stat-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.tower-player-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tower-player-stat-name {
  font-size: 11.5px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tower-player-stat-numbers {
  display: flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tower-player-stat-count {
  font-size: 11px;
  font-weight: 900;
  color: #fbbf24;
}

.tower-player-stat-pct {
  font-size: 9.5px;
  font-weight: 700;
}

.tower-player-stat-bar-track {
  width: 100%;
  height: 4px;
  background: #111a28;
  border-radius: 999px;
  overflow: hidden;
}

.tower-player-stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.tower-triptych-card .tower-grid-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: clamp(5px, 0.8vh, 10px);
  background: #0a0d13;
  border: 1.5px solid #273142;
  border-radius: 10px;
  box-sizing: border-box;
  container-type: size;
}

#tower-grid-left,
#tower-grid-right,
.tower-grid-5col {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(10, minmax(0, 1fr)) !important;
  gap: clamp(3px, 0.48cqh, 6px) !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  margin: 0 auto;
}

.tower-triptych-card .tower-cell,
.tower-subgrid-card .tower-cell {
  aspect-ratio: unset !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  padding: 2px 3px !important;
  box-sizing: border-box;
}

.tower-triptych-card .tower-cell .cell-score,
.tower-subgrid-card .tower-cell .cell-score {
  font-size: clamp(11px, min(3.4cqi, 2.5cqh), 21px);
  font-weight: 800;
  line-height: 1;
}

.tower-triptych-card .tower-cell .cell-player,
.tower-subgrid-card .tower-cell .cell-player {
  font-size: clamp(7.5px, min(2.05cqi, 1.45cqh), 12.5px);
  font-weight: 700;
  line-height: 1;
  margin-top: clamp(1px, 0.3cqh, 4px);
}

/* Escenario Central del Castillo (escalado fluido al alto de la pantalla) */
.tower-view-triptych .tower-castle-card {
  flex: 0 1 auto;
  width: auto;
  max-width: min(38vw, 600px);
  min-width: 240px;
  padding: clamp(8px, 1vh, 14px);
}

@media (max-width: 860px) {
  .tower-view-triptych {
    flex-direction: column;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    align-items: center;
    gap: 14px;
  }
  .tower-view-triptych .tower-castle-card {
    order: 1;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 340px !important;
    min-width: 0 !important;
    height: 350px !important;
  }
  .tower-triptych-card,
  .tower-subgrid-card,
  .tower-card-left,
  .tower-subgrid-left,
  .tower-card-right,
  .tower-subgrid-right {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 400px !important;
    min-width: 0 !important;
    height: 450px !important;
    min-height: 450px !important;
    max-height: none !important;
  }
  .tower-card-left,
  .tower-subgrid-left {
    order: 2;
  }
  .tower-card-right,
  .tower-subgrid-right {
    order: 3;
  }
  .tower-triptych-card .tower-grid-wrapper,
  .tower-triptych-card .tower-card-body-scrollable {
    flex: 1 1 auto !important;
    height: calc(100% - 44px) !important;
    min-height: 360px !important;
  }
  #tower-grid-left,
  #tower-grid-right,
  .tower-grid-5col {
    min-height: 340px !important;
  }
  .tower-triptych-card .tower-cell,
  .tower-subgrid-card .tower-cell {
    min-height: 30px !important;
  }
}

/* ========================================================
   VISTA TORRES (TOWER DISPLAY) - COLORES EXACTOS
   ======================================================== */
.tower-header-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.tower-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.legend-gold {
  background: #ffd966;
  border: 1px solid #d97706;
}
.legend-gray {
  background: #cccccc;
  border: 1px solid #999;
}
.legend-dark {
  background: #121721;
  border: 1px solid #1f2735;
}

.tower-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.btn-tower-tab {
  padding: 10px 16px;
  background: #141b25;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.btn-tower-tab.active {
  background: var(--gold-primary);
  color: #111;
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px var(--gold-glow);
}

.tower-grid-wrapper {
  background: #0a0d13;
  border: 1.5px solid #273142;
  border-radius: 10px;
  padding: 8px;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.8);
}

.tower-grid:not(.tower-grid-5col) {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.tower-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #121721;
  border: 1px solid #1f2735;
  border-radius: 5px;
  padding: 1px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  user-select: none;
  line-height: 1.1;
  cursor: pointer;
  position: relative;
}

/* Efecto hover interactivo estilo botón */
.tower-cell:hover {
  transform: translateY(-2px) scale(1.08);
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 10px rgba(56, 189, 248, 0.45);
  border-color: #38bdf8;
}

.tower-cell:active {
  transform: scale(0.95);
}

/* Hover en casillero Dorado (Natural) */
.tower-cell.conquered-natural:hover {
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 14px rgba(245, 158, 11, 0.9);
}

/* Hover en casillero Gris (Con bonus) */
.tower-cell.conquered-bonus:hover {
  border-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 12px rgba(203, 213, 225, 0.85);
}

/* Hover en casillero Especial (Naranja) */
.tower-cell.conquered-especial:hover {
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 14px rgba(251, 146, 60, 0.95);
}

/* Hover en casillero Pendiente (Oscuro) */
.tower-cell:not(.conquered-natural):not(.conquered-bonus):not(.conquered-especial):hover {
  background: #1e293b;
  border-color: #64748b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 8px rgba(148, 163, 184, 0.4);
}
.tower-cell .cell-score {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.tower-cell .cell-player {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-top: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.95;
}

/* Color Dorado (Partida sin bonus) */
.tower-cell.conquered-natural {
  background: #ffd966;
  color: #1a1a1a;
  border-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
.tower-cell.conquered-natural .cell-player {
  color: #78350f;
  font-weight: 800;
}

/* Color Gris (Partida con bonus) */
.tower-cell.conquered-bonus {
  background: #cccccc;
  color: #1a1a1a;
  border-color: #9ca3af;
  box-shadow: 0 0 6px rgba(200, 200, 200, 0.3);
}
.tower-cell.conquered-bonus .cell-player {
  color: #374151;
  font-weight: 800;
}

/* Color Especial (Naranja) */
.tower-cell.conquered-especial {
  background: #ff9900;
  color: #fff;
  border-color: #fb923c;
  box-shadow: 0 0 10px rgba(255, 153, 0, 0.6);
}

.match-note-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin-top: 4px;
  font-style: italic;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================
   VISTA HISTORIAL DE PARTIDAS - COMPACTO Y SIN SLIDERS
   ======================================================== */
.history-card {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 12px 14px !important;
}

#history-scroll-container {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: calc(100vh - 275px);
  max-height: calc(100vh - 275px);
  min-height: 240px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #0d131c;
}

#history-scroll-container table.scoreboard {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate;
  border-spacing: 0;
}

#history-scroll-container table.scoreboard th,
#history-scroll-container table.scoreboard td {
  padding: 8px 6px !important;
  font-size: 12px !important;
  box-sizing: border-box;
  vertical-align: middle !important;
}

#history-scroll-container table.scoreboard th {
  white-space: nowrap !important;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(18, 24, 36, 0.98);
}

#history-scroll-container table.scoreboard td.col-fecha {
  white-space: normal !important;
  line-height: 1.25 !important;
  word-break: normal !important;
  padding: 6px 4px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #cbd5e1 !important;
}

#history-scroll-container table.scoreboard td.col-fecha,
#history-scroll-container table.scoreboard td.col-fecha * {
  font-size: 11.5px !important;
  font-weight: 700 !important;
}

#history-scroll-container table.scoreboard td.col-players {
  white-space: normal !important;
  line-height: 1.4;
  overflow: visible;
  word-break: break-word;
}

#history-scroll-container table.scoreboard td.col-winner {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#history-scroll-container .badge {
  font-size: 10.5px !important;
  padding: 2px 7px !important;
  letter-spacing: 0.3px;
  max-width: 100%;
  white-space: nowrap;
}

.history-view-btn {
  padding: 3px 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  background: rgba(15, 23, 42, 0.7) !important;
  white-space: nowrap !important;
  cursor: pointer;
  transition: all 0.15s ease !important;
}

.history-view-btn:hover {
  border-color: var(--gold-primary) !important;
  color: var(--gold-primary) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.25) !important;
}

@media (max-width: 768px) {
  #history-scroll-container {
    overflow-x: auto !important;
    height: calc(100vh - 250px) !important;
    max-height: calc(100vh - 250px) !important;
  }
  #history-scroll-container table.scoreboard {
    min-width: 650px;
  }
}

/* ========================================================
   MODAL DE PLANILLA HISTÓRICA DETALLADA - HEADER FIJO
   ======================================================== */
#match-detail-modal .modal-content {
  max-width: min(96vw, var(--modal-ideal-w, 1180px)) !important;
  width: min(96vw, var(--modal-ideal-w, 1180px)) !important;
  height: 90vh !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 20px 24px !important;
}

#match-detail-modal .modal-header {
  flex-shrink: 0 !important;
  margin-bottom: 8px !important;
}

#detail-modal-content {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  margin-top: 6px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-color) !important;
  background: #0e131b !important;
  container-type: inline-size;
  --modal-cat-w: clamp(148px, 19cqi, 215px);
  --detail-cat-fs: clamp(12.5px, 1.35cqi, 15.5px);
  --detail-header-fs: clamp(13.5px, 1.55cqi, 18px);
  --detail-cell-fs: clamp(13.5px, 1.55cqi, 17.5px);
  --detail-total-fs: clamp(15px, 1.75cqi, 20px);
  --detail-pad-y: clamp(7px, 0.85cqi, 11px);
  --detail-pad-x: clamp(6px, 0.85cqi, 12px);
  --detail-bonus-fs: clamp(11px, 1.1cqi, 13px);
  --live-chip-fs: clamp(9.5px, 1.05cqi, 12px);
}

#detail-modal-content[data-density="2"] {
  --modal-cat-w: clamp(165px, 23cqi, 235px);
  --detail-cat-fs: clamp(14px, 1.75cqi, 17px);
  --detail-header-fs: clamp(15px, 2.05cqi, 21px);
  --detail-cell-fs: clamp(15px, 2.05cqi, 20px);
  --detail-total-fs: clamp(17px, 2.3cqi, 23px);
  --detail-pad-y: clamp(8px, 1.1cqi, 12.5px);
  --detail-pad-x: clamp(8px, 1.2cqi, 14px);
  --detail-bonus-fs: clamp(12px, 1.35cqi, 14px);
  --live-chip-fs: clamp(10.5px, 1.25cqi, 13px);
}

#detail-modal-content[data-density="3"] {
  --modal-cat-w: clamp(158px, 21cqi, 220px);
  --detail-cat-fs: clamp(13.5px, 1.55cqi, 16.5px);
  --detail-header-fs: clamp(14.5px, 1.8cqi, 19.5px);
  --detail-cell-fs: clamp(14.5px, 1.8cqi, 19px);
  --detail-total-fs: clamp(16px, 2cqi, 21.5px);
  --detail-pad-y: clamp(8px, 0.95cqi, 11.5px);
  --detail-pad-x: clamp(7px, 1cqi, 12px);
  --detail-bonus-fs: clamp(11.5px, 1.2cqi, 13.5px);
  --live-chip-fs: clamp(10px, 1.15cqi, 12.5px);
}

#detail-modal-content[data-density="4"] {
  --modal-cat-w: clamp(148px, 19cqi, 205px);
  --detail-cat-fs: clamp(13px, 1.4cqi, 15.5px);
  --detail-header-fs: clamp(14px, 1.6cqi, 18px);
  --detail-cell-fs: clamp(13.5px, 1.58cqi, 17.5px);
  --detail-total-fs: clamp(15px, 1.78cqi, 20px);
  --detail-pad-y: clamp(7px, 0.85cqi, 11px);
  --detail-pad-x: clamp(6px, 0.85cqi, 11px);
  --detail-bonus-fs: clamp(11px, 1.1cqi, 13px);
}

#detail-modal-content[data-density="5"] {
  --modal-cat-w: clamp(138px, 17cqi, 188px);
  --detail-cat-fs: clamp(12.5px, 1.28cqi, 15px);
  --detail-header-fs: clamp(13px, 1.42cqi, 17px);
  --detail-cell-fs: clamp(13px, 1.42cqi, 16.5px);
  --detail-total-fs: clamp(14.5px, 1.62cqi, 18.5px);
  --detail-pad-y: clamp(6.5px, 0.78cqi, 10px);
  --detail-pad-x: clamp(5px, 0.7cqi, 9px);
  --detail-bonus-fs: clamp(10.5px, 1cqi, 12.5px);
}

#detail-modal-content[data-density="6"],
#detail-modal-content[data-density="7"],
#detail-modal-content[data-density="8plus"] {
  --modal-cat-w: clamp(122px, 14.5cqi, 172px);
  --detail-cat-fs: clamp(11.5px, 1.12cqi, 14px);
  --detail-header-fs: clamp(12px, 1.25cqi, 15.5px);
  --detail-cell-fs: clamp(12px, 1.22cqi, 15px);
  --detail-total-fs: clamp(13.5px, 1.42cqi, 17px);
  --detail-pad-y: clamp(6px, 0.68cqi, 9px);
  --detail-pad-x: clamp(4px, 0.55cqi, 8px);
  --detail-bonus-fs: clamp(10px, 0.92cqi, 12px);
  --live-chip-fs: clamp(8.5px, 0.9cqi, 11px);
}

@container (max-width: 560px) {
  #detail-modal-content .cat-label-full { display: none; }
  #detail-modal-content .cat-label-short { display: inline; }
}

#detail-modal-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#detail-modal-content::-webkit-scrollbar-track {
  background: #0a0f18;
  border-radius: 6px;
}
#detail-modal-content::-webkit-scrollbar-thumb {
  background: var(--gold-primary);
  border-radius: 6px;
  border: 2px solid #0a0f18;
}
#detail-modal-content::-webkit-scrollbar-thumb:hover {
  background: #fbbf24;
}

#detail-modal-content table.scoreboard {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
  min-width: var(--detail-table-min-w, 0) !important;
  table-layout: fixed !important;
}

#detail-modal-content table.scoreboard thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 35 !important;
}

#detail-modal-content table.scoreboard thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 35 !important;
  background: #182233 !important;
  border-bottom: 2px solid var(--gold-primary) !important;
  border-right: 1px solid var(--border-color) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7) !important;
}

#detail-modal-content table.scoreboard thead th.header-cat {
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 45 !important;
  width: var(--modal-cat-w, 150px) !important;
  min-width: var(--modal-cat-w, 150px) !important;
  padding: var(--detail-pad-y, 8px) clamp(8px, 1cqi, 14px) !important;
  font-size: var(--detail-cat-fs, 13.5px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #141b26 !important;
  border-right: 2px solid var(--border-color) !important;
  border-bottom: 2px solid var(--gold-primary) !important;
}

#detail-modal-content table.scoreboard thead th.header-player {
  background: #182233 !important;
  color: var(--gold-primary) !important;
  padding: var(--detail-pad-y, 8px) var(--detail-pad-x, 6px) !important;
  font-size: var(--detail-header-fs, 15px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

#detail-modal-content table.scoreboard td.cat-name {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  width: var(--modal-cat-w, 150px) !important;
  min-width: var(--modal-cat-w, 150px) !important;
  padding: var(--detail-pad-y, 7px) clamp(8px, 1cqi, 14px) !important;
  font-size: var(--detail-cat-fs, 13.5px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #10151f !important;
  border-right: 2px solid var(--border-color) !important;
}

#detail-modal-content table.scoreboard td.detail-annotatable-cell,
#detail-modal-content table.scoreboard td.detail-eco-cell {
  padding: var(--detail-pad-y, 7px) var(--detail-pad-x, 6px) !important;
  font-size: var(--detail-cell-fs, 14px) !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

#detail-modal-content table.scoreboard tr.row-total td.detail-annotatable-cell {
  font-size: var(--detail-total-fs, 16px) !important;
}

#detail-modal-content table.scoreboard td.detail-bonus-cell {
  white-space: normal !important;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-size: var(--detail-bonus-fs, 11.5px) !important;
  color: var(--text-muted);
  padding: var(--detail-pad-y, 6px) var(--detail-pad-x, 5px) !important;
}

@media (max-width: 768px) {
  #match-detail-modal .modal-content {
    width: 98% !important;
    max-width: 98vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    padding: 14px 10px !important;
  }
  #detail-modal-content,
  #detail-modal-content[data-density] {
    --modal-cat-w: 108px;
    --detail-cat-fs: 11.5px;
    --detail-header-fs: 12.5px;
    --detail-cell-fs: 12.5px;
    --detail-total-fs: 14px;
    --detail-pad-y: 6px;
    --detail-pad-x: 4px;
  }
  #detail-modal-content[data-density="2"],
  #detail-modal-content[data-density="3"] {
    --modal-cat-w: 122px;
    --detail-cat-fs: 13px;
    --detail-header-fs: 14px;
    --detail-cell-fs: 14px;
    --detail-total-fs: 15.5px;
  }
  #detail-modal-content table.scoreboard {
    min-width: calc(var(--modal-cat-w, 112px) + var(--player-count, 2) * 64px) !important;
  }
  #detail-modal-content[data-density="2"] table.scoreboard,
  #detail-modal-content[data-density="3"] table.scoreboard {
    min-width: 0 !important;
  }
}

/* ========================================================
   ESTILOS ESPECIALES DE CELDAS DE PLANILLAS
   ======================================================== */
.cell-generala-servida {
  background: rgba(70, 189, 198, 0.25) !important;
  border: 1px solid #46bdc6 !important;
  color: #38bdf8 !important;
  font-weight: 800 !important;
}

.cell-generala-incorporea {
  background: rgba(255, 109, 1, 0.28) !important;
  border: 1px solid #ff6d01 !important;
  color: #ffedd5 !important;
  font-weight: 800 !important;
}

.cell-generala-triple {
  background: rgba(251, 188, 4, 0.28) !important;
  border: 1px solid #fbbc04 !important;
  color: #fef08a !important;
  font-weight: 900 !important;
}

.cell-with-note {
  background: rgba(245, 158, 11, 0.22) !important;
  box-shadow: inset 0 0 0 2px #f59e0b !important;
  position: relative;
}

.header-with-note {
  background: rgba(245, 158, 11, 0.25) !important;
  box-shadow: inset 0 0 0 2px #f59e0b !important;
}

/* ========================================================
   VISTA PERFILES DETALLADOS Y REDISEÑO VISUAL
   ======================================================== */
.profile-detailed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.profile-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.profile-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-avatar-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 0 15px var(--gold-glow);
}
.profile-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-galearen-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--gold-primary);
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.profile-kpi-card {
  background: #0f1520;
  border: 1px solid #1f2838;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: transform 0.15s ease;
}
.profile-kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-primary);
}
.profile-kpi-val {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  margin: 4px 0;
}
.profile-kpi-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profile-kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.profile-section-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-primary);
  margin: 18px 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-top-unified-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.profile-dual-unified-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}
.profile-modes-and-records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.profile-records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.profile-rec-card {
  background: #0d121a;
  border: 1px solid #1e2634;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.profile-rec-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
}
.profile-rec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #161e2b;
}
.profile-rec-row:last-child { border-bottom: none; }

.profile-badges-flex {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.profile-feat-badge {
  background: #141b26;
  border: 1px solid #232d3d;
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.profile-feat-badge b {
  font-size: 16px;
  color: #fff;
}

.profile-stat-box {
  background: #0d121a;
  border: 1px solid #20293a;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

/* Subpestañas del Perfil */
.profile-subtabs-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 20px 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.profile-subtab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-subtab-btn:hover {
  background: rgba(245, 158, 11, 0.08);
  color: #fff;
  border-color: rgba(245, 158, 11, 0.4);
}

.profile-subtab-btn.active {
  background: var(--gold-primary);
  color: #0b0f17;
  border-color: var(--gold-primary);
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

/* ========================================================
   MENÚ CENTRAL DE PERFIL (ESTILO VIDEOJUEGO)
   ======================================================== */
.profile-game-menu-container {
  width: 100%;
  max-width: 600px;
  margin: 20px auto 40px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

.profile-game-menu-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 769px) {
  .profile-game-menu-container {
    max-width: 920px;
    margin: 16px auto 16px auto;
  }
  .profile-game-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }
  .profile-game-menu-grid > .profile-game-menu-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc(50% - 7px);
    justify-self: center;
  }
}

.profile-game-menu-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(90deg, #131d2e 0%, #0d1522 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  padding: 13px 20px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.profile-game-menu-btn:hover {
  background: linear-gradient(90deg, #1a273d 0%, #10192a 100%);
  border-color: var(--gold-primary);
  transform: translateX(6px);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.25), 0 0 14px rgba(245, 158, 11, 0.15);
}

.profile-game-menu-btn:active {
  transform: scale(0.99) translateX(4px);
}

.pg-btn-icon-wrap {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.profile-game-menu-btn:hover .pg-btn-icon-wrap {
  transform: scale(1.12);
}

.pg-btn-text-wrap {
  flex: 1;
}

.pg-btn-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
  transition: color 0.15s ease;
}

.profile-game-menu-btn:hover .pg-btn-title {
  color: #fbbf24;
}

.pg-btn-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

.pg-btn-arrow {
  font-size: 16px;
  color: #64748b;
  font-weight: 800;
  transition: all 0.2s ease;
  padding-right: 4px;
}

.profile-game-menu-btn:hover .pg-btn-arrow {
  color: #fbbf24;
  transform: translateX(4px);
}

/* Tarjetas de Modalidad (Normal, Ordenada, PVP) */
.profile-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.profile-mode-card {
  background: #0f1521;
  border: 1px solid #1f2838;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.profile-mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
}

.profile-mode-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e2634;
}

/* Chips de Casilleros Conquistados en Torres Personales */
.tower-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px;
  background: #0a0e16;
  border-radius: 8px;
  border: 1px solid #1b2333;
  margin-top: 10px;
}

.tower-conquest-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  font-family: monospace;
  cursor: pointer;
  outline: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.tower-conquest-chip:hover {
  transform: translateY(-2px) scale(1.08);
  filter: brightness(1.25);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.tower-conquest-chip.natural {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.tower-conquest-chip.natural:hover {
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.tower-conquest-chip.bonus {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.tower-conquest-chip.bonus:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Tarjetas de Servidos Visuales */
.profile-servidos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.profile-servido-card {
  background: #0d131f;
  border: 1px solid #1e2738;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 14px;
}
.profile-table th, .profile-table td {
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  text-align: center;
}
.profile-table th {
  background: #161e2b;
  color: var(--gold-primary);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.profile-table tr.profile-section-hdr td {
  background: #182233;
  color: #fbbf24;
  font-weight: 800;
  text-align: left;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 12px;
}
.profile-table td:first-child {
  text-align: left;
  font-weight: 600;
  background: #111722;
  color: var(--text-main);
}

/* Metric Range Gauge Cards */
.profile-range-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.profile-range-card {
  background: #0d131f;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.profile-range-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
}

.profile-range-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.profile-range-title {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-range-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-range-track {
  position: relative;
  height: 8px;
  background: #1e293b;
  border-radius: 9999px;
  margin: 18px 0 10px 0;
  overflow: visible;
}

.profile-range-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #ef4444 0%, #38bdf8 50%, #fbbf24 100%);
}

.profile-range-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 10px #38bdf8;
  z-index: 2;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-range-labels {
  display: flex;
  justify-content: center;
  align-items: baseline;
  font-size: 12px;
}

.profile-range-val-min {
  color: #ef4444;
  font-weight: 700;
}

.profile-range-val-avg {
  color: #38bdf8;
  font-weight: 800;
}

.profile-range-val-max {
  color: #fbbf24;
  font-weight: 800;
}

.profile-gauge-mode-btn,
.profile-matrix-mode-btn,
.profile-eco-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-gauge-mode-btn:hover,
.profile-matrix-mode-btn:hover,
.profile-eco-mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.profile-gauge-mode-btn.active,
.profile-matrix-mode-btn.active,
.profile-eco-mode-btn.active {
  background: var(--gold-primary) !important;
  color: #0b0f17 !important;
  border-color: var(--gold-primary) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

/* Modern Matrix Pill */
.profile-rate-pill {
  display: inline-block;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* Modern Matrix Table */
.profile-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  margin-top: 10px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.profile-matrix-table th {
  background: #111827;
  color: var(--gold-primary);
  font-weight: 800;
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid #1e293b;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.profile-matrix-table th:first-child {
  text-align: left;
}

.profile-matrix-table td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  text-align: center;
  color: #cbd5e1;
  background: #0a0f18;
}

.profile-matrix-table tr:hover td {
  background: rgba(245, 158, 11, 0.04);
}

.profile-matrix-table tr.profile-matrix-hdr td {
  background: #131d2e;
  color: #fbbf24;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 8px 14px;
  border-top: 1px solid #1e293b;
}

.profile-matrix-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: #f1f5f9;
}

/* Tower Inspector Card */
.tower-inspector-card {
  margin-top: 16px;
  background: linear-gradient(135deg, #151d29 0%, #0d121a 100%);
  border: 1px solid var(--gold-primary);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 15px var(--gold-glow);
  transition: all 0.2s ease;
}
.tower-inspector-card .inspector-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.tower-inspector-card .inspector-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-primary);
  margin-bottom: 2px;
}
.tower-inspector-card .inspector-desc {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.4;
}

/* Tratado Capítulos */
.chapter-container {
  background: #121824;
  border: 1px solid #253043;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.chapter-header {
  border-bottom: 2px solid rgba(245, 158, 11, 0.3);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.chapter-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-primary);
}
.chapter-preamble {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
  margin-top: 6px;
}
.article-item {
  background: #0e131d;
  border: 1px solid #1e2736;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.article-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.article-num-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-weight: 800;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}
.article-title-text {
  font-weight: 700;
  color: #fff;
  font-size: 14px;
}
.article-body-text {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

/* ========================================================
   LECTOR DE LIBROS ANTIGUOS (DOS PÁGINAS ABIERTAS)
   ======================================================== */

.antique-reader-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto 16px auto;
  user-select: text;
}

.antique-book-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #0d1219;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 22px;
}

.antique-book-open {
  position: relative;
  background: #23140e;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 5px 15px rgba(0, 0, 0, 0.5);
  border: 2px solid #3d2314;
  perspective: 1800px;
}

/* Cintas Marcadoras de Capítulos estilo Tomo Antiguo */
.book-ribbon-markers {
  position: absolute;
  top: -14px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  z-index: 25;
  pointer-events: none;
}

.book-ribbon-tab {
  pointer-events: auto;
  position: relative;
  min-width: 44px;
  max-width: 82px;
  height: 32px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5px 8px 0 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
  transition: height 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), transform 0.2s ease, filter 0.2s ease;
  border: none;
  border-top: 3px solid #ca8a04;
  outline: none;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-ribbon-tab:hover {
  height: 44px;
  color: #fff;
  filter: brightness(1.22);
}

/* El marcador del capítulo activo se extiende más largo hacia abajo */
.book-ribbon-tab.active {
  height: 60px;
  border-top-width: 4px;
  border-top-color: #fbbf24 !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.65), 0 0 14px rgba(251, 191, 36, 0.4);
  color: #fff;
  font-weight: 900;
  font-size: 11.5px;
  z-index: 30;
  filter: brightness(1.08);
}


.antique-book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  background: linear-gradient(
    to right,
    #ded1b0 0%,
    #f4ecda 3%,
    #fcf8ec 46%,
    #ebdcc2 49%,
    #b8a176 50%,
    #ebdcc2 51%,
    #fcf8ec 54%,
    #f4ecda 97%,
    #ded1b0 100%
  );
  border-radius: 8px;
  box-shadow: inset 0 0 45px rgba(139, 94, 60, 0.15), 0 2px 8px rgba(0,0,0,0.25);
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, height 0.25s ease;
  height: 600px;
  transform-style: preserve-3d;
}

@media (min-width: 861px) {
  .antique-book-spread {
    height: clamp(480px, calc(100dvh - 175px), 860px);
  }
}

/* Modo Lectura de Libro en Pantalla Completa (solo el libro en pantalla completa del navegador, sin barras superiores) */
body.book-fullscreen-active {
  overflow: hidden;
}
body.book-fullscreen-active .app-top-bar,
body.book-fullscreen-active #tab-biblioteca > .card > .card-header,
body.book-fullscreen-active .antique-book-toolbar,
body.book-fullscreen-active .fab-live-editor-btn {
  display: none !important;
}
body.book-fullscreen-active main.app-main {
  max-width: min(1820px, 98.5vw);
  height: 100dvh;
  padding: 18px clamp(22px, 3vw, 48px) 10px;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
body.book-fullscreen-active #tab-biblioteca {
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
}
body.book-fullscreen-active #tab-biblioteca > .card {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
body.book-fullscreen-active #biblio-interactive-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
}
body.book-fullscreen-active .antique-reader-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 1620px;
  display: flex;
  flex-direction: column;
}
body.book-fullscreen-active .antique-book-open {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.book-fullscreen-active .antique-book-spread {
  flex: 1 1 auto;
  height: calc(100dvh - 54px) !important;
  min-height: 440px;
}

.antique-book-page.page-turning-next {
  animation: pageTurnForward 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: left center;
  z-index: 15;
}

@keyframes pageTurnForward {
  0% {
    transform: perspective(1600px) rotateY(0deg);
    box-shadow: inset 15px 0 20px -10px rgba(0, 0, 0, 0.12);
  }
  45% {
    transform: perspective(1600px) rotateY(-45deg) skewY(-1deg);
    box-shadow: -22px 0 35px rgba(0, 0, 0, 0.4), inset 40px 0 30px rgba(0, 0, 0, 0.25);
  }
  100% {
    transform: perspective(1600px) rotateY(0deg);
    box-shadow: inset 15px 0 20px -10px rgba(0, 0, 0, 0.12);
  }
}

.antique-book-page.page-turning-prev {
  animation: pageTurnBackward 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: right center;
  z-index: 15;
}

@keyframes pageTurnBackward {
  0% {
    transform: perspective(1600px) rotateY(0deg);
    box-shadow: inset -15px 0 20px -10px rgba(0, 0, 0, 0.12);
  }
  45% {
    transform: perspective(1600px) rotateY(45deg) skewY(1deg);
    box-shadow: 22px 0 35px rgba(0, 0, 0, 0.4), inset -40px 0 30px rgba(0, 0, 0, 0.25);
  }
  100% {
    transform: perspective(1600px) rotateY(0deg);
    box-shadow: inset -15px 0 20px -10px rgba(0, 0, 0, 0.12);
  }
}

.antique-book-spread.turning-next .antique-book-spine,
.antique-book-spread.turning-prev .antique-book-spine {
  animation: spineShadowPulse 0.45s ease-in-out;
}

@keyframes spineShadowPulse {
  0% { opacity: 0.8; }
  50% { opacity: 1.5; transform: translateX(-50%) scaleX(1.4); }
  100% { opacity: 0.8; }
}

.antique-book-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 26px;
  transform: translateX(-50%);
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.06) 0%,
    rgba(90, 60, 30, 0.22) 50%,
    rgba(0,0,0,0.06) 100%
  );
  pointer-events: none;
  z-index: 5;
}

.antique-book-page {
  position: relative;
  padding: 18px 36px 14px 36px;
  color: #1a1612;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  height: 100%;
  overflow: hidden;
  cursor: pointer;
  user-select: text;
}

.antique-book-page.page-left {
  padding-right: 30px;
  box-shadow: inset -15px 0 20px -10px rgba(0, 0, 0, 0.12);
}

.antique-book-page.page-right {
  padding-left: 30px;
  box-shadow: inset 15px 0 20px -10px rgba(0, 0, 0, 0.12);
}

.book-page-header {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6b4c2c;
  border-bottom: 1px solid rgba(139, 94, 60, 0.25);
  padding-bottom: 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.book-page-body {
  flex: 1;
  font-family: 'Georgia', 'Cambria', serif;
  font-size: 13.5px;
  line-height: 1.58;
  color: #1a1612;
  text-align: justify;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.book-page-footer {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: #7c5835;
  text-align: center;
  border-top: 1px solid rgba(139, 94, 60, 0.2);
  padding-top: 5px;
  margin-top: 6px;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.book-chapter-title {
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 19px;
  font-weight: 800;
  color: #3b1807;
  text-align: center;
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}

.book-chapter-sub {
  font-family: 'Georgia', serif;
  font-size: 13px;
  font-style: italic;
  color: #5c3a21;
  text-align: center;
  margin-bottom: 10px;
}

.book-ornament {
  text-align: center;
  color: #966f44;
  font-size: 13px;
  margin: 6px 0 12px 0;
  user-select: none;
}

.book-paragraph {
  margin-bottom: 9px;
  text-indent: 0;
  color: #1a1612;
  font-size: 14px;
  line-height: 1.65;
}

.book-paragraph:first-of-type {
  text-indent: 0;
}

.book-drop-cap {
  float: left;
  font-family: 'Cinzel', serif;
  font-size: 42px;
  line-height: 34px;
  padding-top: 4px;
  padding-right: 8px;
  padding-bottom: 2px;
  color: #7a2208;
  font-weight: bold;
}

.book-article {
  margin-bottom: 16px;
  padding: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.book-article-header {
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 14.5px;
  font-weight: 800;
  color: #451a03;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.book-article-num {
  font-weight: 900;
  color: #7a2208;
  margin-right: 6px;
}

.book-article-text {
  font-family: 'Georgia', serif;
  font-size: 14.5px;
  line-height: 1.75;
  color: #1a1612;
  margin: 0;
  text-align: justify;
}

.btn-turn-page {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(13, 18, 25, 0.92);
  border: 1px solid var(--gold-primary);
  color: var(--gold-primary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}

.btn-turn-page:hover {
  background: var(--gold-primary);
  color: #000;
  transform: translateY(-50%) scale(1.1);
}

.btn-turn-page.btn-prev { left: -18px; }
.btn-turn-page.btn-next { right: -18px; }

.btn-turn-page:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-fav-ribbon {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s, transform 0.2s;
  padding: 0 4px;
}
.btn-fav-ribbon:hover, .btn-fav-ribbon.is-fav {
  opacity: 1;
  transform: scale(1.15);
}

@media (max-width: 820px) {
  .book-ribbon-markers {
    top: -12px;
    left: 8px;
    right: 8px;
    gap: 6px;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .book-ribbon-markers::-webkit-scrollbar {
    display: none;
  }
  .book-ribbon-tab {
    min-width: 38px;
    font-size: 10px;
    height: 28px;
    padding: 4px 6px 0 6px;
  }
  .book-ribbon-tab.active {
    height: 48px;
  }
  .antique-book-spread {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: auto !important;
    background: linear-gradient(
      to right,
      #e2d5b5 0%,
      #f6eedc 6%,
      #fcf8ec 50%,
      #f6eedc 94%,
      #e2d5b5 100%
    ) !important;
  }
  .antique-book-spine {
    display: none !important;
  }
  .antique-book-page {
    padding: 22px 16px 18px 16px !important;
    height: auto !important;
    min-height: 420px;
    overflow: visible !important;
    background: transparent !important;
  }
  .antique-book-page.page-left {
    box-shadow: none !important;
    border-bottom: none !important;
    padding-right: 16px !important;
  }
  .antique-book-page.page-right {
    display: none !important;
  }
  .book-page-header {
    gap: 8px;
    flex-wrap: wrap;
    font-size: 10px;
    letter-spacing: 1px;
  }
  .btn-turn-page.btn-prev { left: -8px; }
  .btn-turn-page.btn-next { right: -8px; }
}

/* ========================================================
   MODO TV (PANTALLA GIGANTE / HDMI)
   ======================================================== */
body.tv-mode {
  background: #080a0e;
  font-size: 20px;
}

body.tv-mode header.app-header {
  padding: 16px 32px;
}
body.tv-mode .brand-title {
  font-size: 32px;
}

body.tv-mode nav.app-nav {
  display: none;
}

body.tv-mode main.app-main {
  max-width: 98vw;
  padding: 24px;
}

body.tv-mode table.scoreboard {
  font-size: 22px;
}
body.tv-mode table.scoreboard th, body.tv-mode table.scoreboard td {
  padding: 14px 18px;
}
body.tv-mode .score-cell {
  font-size: 24px;
}
body.tv-mode table.scoreboard.live-scoreboard th.header-cat,
body.tv-mode table.scoreboard.live-scoreboard td.cat-name {
  font-size: calc(var(--live-cat-fs, 14px) * 1.16);
  padding: calc(var(--live-pad-y, 9px) * 1.15) clamp(8px, 1.5cqi, 16px);
}
body.tv-mode table.scoreboard.live-scoreboard th.header-player {
  font-size: calc(var(--live-header-fs, 16px) * 1.18);
  padding: calc(var(--live-pad-y, 9px) * 1.15) var(--live-pad-x, 6px);
}
body.tv-mode table.scoreboard.live-scoreboard td.score-cell {
  font-size: calc(var(--live-cell-fs, 17px) * 1.2);
  padding: calc(var(--live-pad-y, 9px) * 1.15) var(--live-pad-x, 6px);
}
body.tv-mode table.scoreboard.live-scoreboard tr.row-total td.score-cell {
  font-size: calc(var(--live-total-fs, 19px) * 1.2);
}

body.tv-mode .pvp-banner {
  font-size: 30px;
  padding: 20px;
}

body.tv-mode .tower-cell .cell-score {
  font-size: 16px;
}
body.tv-mode .tower-cell .cell-player {
  font-size: 12px;
}

/* ========================================================
   RESPONSIVE DESIGN (MÓVIL & TABLET)
   ======================================================== */
@media (max-width: 768px) {
  html {
    scroll-padding-top: 64px;
  }
  
  body {
    overflow-x: hidden;
    width: 100%;
  }

  /* Header compacto */
  header.app-header {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand-title {
    font-size: 15px;
    letter-spacing: 0.5px;
  }
  .brand-subtitle {
    display: none !important;
  }
  .logo-container {
    gap: 8px;
  }
  .logo-container img {
    height: 38px !important;
  }
  #btn-toggle-tv {
    display: none !important; /* El modo TV no aplica a pantallas móviles */
  }
  .header-actions {
    gap: 6px;
  }
  .user-session-widget {
    padding: 4px 8px;
    font-size: 11px;
    gap: 6px;
  }
  .user-pill-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  #btn-header-new-match {
    font-size: 11.5px;
    padding: 6px 10px;
  }

  /* Navegación fluida por toque */
  nav.app-nav {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }
  .nav-tab {
    min-width: 58px;
    padding: 8px 3px;
    font-size: 10.5px;
    gap: 2px;
    flex-shrink: 0;
  }
  .nav-tab .tab-icon {
    font-size: 16px;
  }

  /* Contenedor principal y tarjetas */
  main.app-main {
    padding: 10px 8px;
    width: 100%;
    box-sizing: border-box;
  }
  .card {
    padding: 14px 10px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-sizing: border-box;
  }
  .card .card {
    padding: 10px 8px;
    margin-bottom: 10px;
  }

  /* Pestaña Perfil: Grids y Ficha */
  .profile-gamer-tag-card {
    padding: 14px 12px !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }
  .profile-game-menu-container {
    margin: 10px auto 24px auto !important;
    padding: 0 4px !important;
    gap: 10px !important;
  }
  .profile-game-menu-btn {
    padding: 10px 14px !important;
    gap: 12px !important;
    border-radius: 12px !important;
  }
  .profile-game-menu-btn .pg-btn-icon-wrap {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
  }
  .profile-game-menu-btn .pg-btn-title {
    font-size: 14px !important;
  }
  .profile-detailed-card {
    padding: 12px 10px !important;
  }
  .profile-dual-unified-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-top: 14px !important;
    margin-bottom: 18px !important;
  }
  .profile-top-unified-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .profile-modes-and-records-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .profile-records-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .profile-matrix-table th, 
  .profile-matrix-table td {
    padding: 6px 4px !important;
    font-size: 11.5px !important;
  }
  .profile-matrix-tabs-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .profile-avatars-shelf {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 6px !important;
  }

  /* Pestaña Historial: Scroll horizontal fluido en móviles */
  #history-scroll-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: calc(100vh - 230px) !important;
    max-height: calc(100vh - 230px) !important;
  }
  #history-scroll-container table.scoreboard {
    min-width: 650px !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  /* Pestaña Tienda: Grilla 2x2 en móviles */
  .store-bonus-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }
  .bonus-card-container {
    padding: 10px 8px !important;
  }
  .bonus-card-art {
    max-width: 92px !important;
    max-height: 132px !important;
  }
  .bonus-card-container h3 {
    font-size: 15px !important;
    margin-bottom: 2px !important;
  }
  .bonus-card-container p {
    font-size: 11px !important;
    line-height: 1.35 !important;
    margin-top: 6px !important;
  }

  /* Pestaña Mesa / Partida en Vivo */
  .match-status-bar {
    padding: 10px 10px !important;
    gap: 8px !important;
  }
  .split-scoreboard-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .scoreboard-split-card,
  .scoreboard-split-card[data-density] {
    --cat-col-w: 102px;
    --live-cat-fs: 11.5px;
    --live-header-fs: 12px;
    --live-cell-fs: 12.5px;
    --live-total-fs: 14px;
    --live-pad-y: 6px;
    --live-pad-x: 4px;
    width: 100% !important;
  }
  .scoreboard-split-card[data-density="2"] {
    --cat-col-w: 122px;
    --live-cat-fs: 13px;
    --live-header-fs: 14.5px;
    --live-cell-fs: 15px;
    --live-total-fs: 17px;
    --live-pad-y: 8px;
    --live-pad-x: 6px;
  }
  .scoreboard-split-card[data-density="3"] {
    --cat-col-w: 112px;
    --live-cat-fs: 12.5px;
    --live-header-fs: 13.5px;
    --live-cell-fs: 14px;
    --live-total-fs: 15.5px;
    --live-pad-y: 7px;
    --live-pad-x: 5px;
  }
  .scoreboard-split-card[data-density="4"] {
    --cat-col-w: 106px;
    --live-cat-fs: 12px;
    --live-header-fs: 12.8px;
    --live-cell-fs: 13px;
    --live-total-fs: 14.5px;
    --live-pad-y: 6.5px;
    --live-pad-x: 4px;
  }
  .scoreboard-container {
    max-height: 70vh !important;
    max-height: 70dvh !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  table.scoreboard.live-scoreboard {
    min-width: calc(var(--cat-col-w, 104px) + var(--player-count, 2) * 56px) !important;
  }
  .scoreboard-split-card[data-density="2"] table.scoreboard.live-scoreboard,
  .scoreboard-split-card[data-density="3"] table.scoreboard.live-scoreboard,
  .scoreboard-split-card[data-density="4"] table.scoreboard.live-scoreboard {
    min-width: 0 !important;
  }
  table.scoreboard.live-scoreboard th.header-cat,
  table.scoreboard.live-scoreboard td.cat-name {
    width: var(--cat-col-w, 104px) !important;
    min-width: var(--cat-col-w, 104px) !important;
    font-size: var(--live-cat-fs, 11.5px) !important;
    padding: var(--live-pad-y, 6px) 6px !important;
  }
  table.scoreboard.live-scoreboard th.header-player {
    min-width: 0 !important;
    font-size: var(--live-header-fs, 12.5px) !important;
    padding: var(--live-pad-y, 6px) var(--live-pad-x, 5px) !important;
  }
  table.scoreboard.live-scoreboard td.score-cell {
    padding: var(--live-pad-y, 6px) var(--live-pad-x, 5px) !important;
    font-size: var(--live-cell-fs, 12.5px) !important;
  }
  table.scoreboard.live-scoreboard tr.row-total td.score-cell {
    font-size: var(--live-total-fs, 14px) !important;
  }

  /* Modales en Móviles */
  .modal-overlay {
    padding: 10px !important;
  }
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px 12px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  /* Toast en Móvil */
  .live-toast-card.epic-toast-card {
    min-width: unset !important;
    width: calc(100vw - 24px) !important;
    max-width: 340px !important;
    padding: 14px 16px !important;
  }

  /* Torres del Reino */
  .tower-grid {
    gap: 2px !important;
  }
  .tower-cell {
    font-size: 9.5px !important;
  }
  .tower-pie-section {
    flex-direction: column !important;
    align-items: center !important;
  }
  .donut-legend-grid {
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* Pantallas Extra Pequeñas (Celulares estrechos < 480px) */
@media (max-width: 480px) {
  header.app-header {
    padding: 8px 8px;
  }
  .brand-title {
    font-size: 13.5px !important;
  }
  .profile-gamer-tag-card {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .profile-gamer-wallet-pill {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: center !important;
    padding: 8px 12px !important;
  }
  .store-bonus-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .bonus-card-art {
    max-width: 95px !important;
  }
}

@media (max-width: 340px) {
  .store-bonus-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================================
   GRÁFICO DE TORTA / DONUT DE TORRES DEL REINO
   ======================================================== */
.tower-pie-section {
  position: relative;
  overflow: hidden;
}

.donut-chart-box {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart-box svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-slice {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform-origin: center;
}

.donut-slice:hover {
  opacity: 0.9;
  filter: brightness(1.2);
}

.donut-center-info {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.donut-center-val {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 900;
  color: var(--gold-primary);
  line-height: 1.1;
}

.donut-center-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.donut-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
  max-width: 480px;
  flex: 1;
}

.donut-legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #141b26;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.donut-legend-row:hover {
  background: #1a2332;
  border-color: var(--border-color);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ========================================================
   INSPECTOR DE CASILLERO ENRIQUECIDO (DATITOS & ANÉCDOTAS)
   ======================================================== */
.inspector-enriched-box {
  background: #101622;
  border: 1px solid #273142;
  border-radius: 8px;
  padding: 14px;
  margin-top: 10px;
}

.inspector-trivia-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  margin: 3px 4px 3px 0;
}

.inspector-photo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #182233;
  border: 1px solid var(--gold-primary);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.inspector-photo-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.inspector-photo-badge img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--gold-primary);
}

/* ========================================================
   BIBLIOTECA IMPERIAL & PORTADAS ESTILO LIBRO ANTIGUO
   ======================================================== */
.biblio-books-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 28px;
  justify-content: center;
  align-items: center;
  padding: 30px 10px 40px 10px;
  perspective: 1200px;
}

.vintage-book-cover {
  position: relative;
  width: 220px;
  height: 330px;
  border-radius: 3px 12px 12px 3px;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 16px 18px 28px;
  box-sizing: border-box;
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 0.28s ease;
  box-shadow: 
    inset 16px 0 20px -6px rgba(0, 0, 0, 0.95),
    inset -3px 0 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.15),
    0 12px 28px rgba(0, 0, 0, 0.75),
    0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Efecto de lomo / hendidura del lomo en el borde izquierdo */
.vintage-book-cover::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 2px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* Marco dorado perimetral ("bordo en toda la tapa") */
.vintage-book-cover-frame {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 28px;
  right: 14px;
  border: 2px solid rgba(212, 175, 55, 0.75);
  border-radius: 4px;
  pointer-events: none;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.vintage-book-cover-frame::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  right: 4px;
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 2px;
}

.vintage-book-cover-frame .corner {
  position: absolute;
  font-size: 9px;
  color: #fbbf24;
  line-height: 1;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

.vintage-book-cover-frame .corner-tl { top: 6px; left: 6px; }
.vintage-book-cover-frame .corner-tr { top: 6px; right: 6px; }
.vintage-book-cover-frame .corner-bl { bottom: 6px; left: 6px; }
.vintage-book-cover-frame .corner-br { bottom: 6px; right: 6px; }

.vintage-book-cover:hover {
  transform: translateY(-10px) rotate(-0.5deg) scale(1.025);
  box-shadow: 
    inset 16px 0 20px -6px rgba(0, 0, 0, 0.95),
    inset -3px 0 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 4px rgba(255, 255, 255, 0.25),
    0 22px 42px rgba(0, 0, 0, 0.85),
    0 0 24px rgba(212, 175, 55, 0.25);
}

.vintage-book-cover:active {
  transform: translateY(-4px) scale(1.01);
}

/* Colores de piel de libro antiguo por obra */
.book-theme-lore {
  background: radial-gradient(circle at 45% 25%, #461318 0%, #290b0e 55%, #150305 100%);
  border: 1px solid #5c1d23;
  border-left: 9px solid #1a0507;
}

.book-theme-manual {
  background: #ffffff !important;
  border: 1px solid #d4d4d8 !important;
  border-left: 10px solid #9ca3af !important;
  padding: 10px 8px 10px 14px !important;
  box-shadow: 
    inset 14px 0 16px -6px rgba(0, 0, 0, 0.22),
    inset -2px 0 6px rgba(0, 0, 0, 0.05),
    0 12px 28px rgba(0, 0, 0, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.book-theme-manual::before {
  background: rgba(0, 0, 0, 0.12) !important;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04) !important;
}

.book-theme-manual:hover {
  box-shadow: 
    inset 14px 0 16px -6px rgba(0, 0, 0, 0.22),
    inset -2px 0 6px rgba(0, 0, 0, 0.08),
    0 20px 40px rgba(0, 0, 0, 0.75),
    0 0 16px rgba(255, 255, 255, 0.2) !important;
}

.manual-cover-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  box-sizing: border-box;
  padding: 12px 6px 8px 10px;
}

.manual-cover-header {
  width: 100%;
  text-align: center;
  margin-bottom: 6px;
}

.manual-cover-title-line {
  font-family: Arial, 'Segoe UI', Helvetica, sans-serif;
  font-style: italic;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2.5px;
  color: #000000;
  line-height: 1.25;
  text-transform: none;
  text-shadow: none;
  font-size: 11.5px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.manual-cover-artwork-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-bottom: 2px;
}

.manual-cover-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

.book-theme-jurisprudencia {
  background: #ffffff !important;
  border: 1px solid #d4d4d8 !important;
  border-left: 10px solid #9ca3af !important;
  box-shadow: 
    inset 14px 0 16px -6px rgba(0, 0, 0, 0.22),
    inset -2px 0 6px rgba(0, 0, 0, 0.05),
    0 12px 28px rgba(0, 0, 0, 0.6),
    0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.book-theme-jurisprudencia::before {
  background: rgba(0, 0, 0, 0.12) !important;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04) !important;
}

.book-theme-jurisprudencia:hover {
  box-shadow: 
    inset 14px 0 16px -6px rgba(0, 0, 0, 0.22),
    inset -2px 0 6px rgba(0, 0, 0, 0.08),
    0 20px 40px rgba(0, 0, 0, 0.75),
    0 0 16px rgba(255, 255, 255, 0.2) !important;
}

.jurisprudencia-cover-content {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  padding: 16px 8px 14px 14px;
  color: #000000;
  font-family: 'Times New Roman', 'Georgia', serif;
}

.juris-top-author {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 13.5px;
  color: #000000;
  font-weight: 500;
  letter-spacing: 0.2px;
  margin-top: 6px;
  text-transform: none;
}

.juris-middle-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 10px 0;
}

.juris-main-title {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 21px;
  font-weight: 400;
  color: #000000;
  line-height: 1.25;
  letter-spacing: 0.2px;
  margin-bottom: 12px;
  text-transform: none;
  text-shadow: none;
}

.juris-sub-title {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 13px;
  font-weight: 400;
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-transform: none;
  text-shadow: none;
}

.juris-bottom-block {
  width: 100%;
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 9.5px;
  font-weight: 700;
  color: #000000;
  line-height: 1.45;
  text-decoration: underline;
  text-underline-offset: 2.5px;
  text-align: center;
  margin-bottom: 4px;
  padding: 0 4px;
  text-transform: none;
}

.book-theme-cartografia {
  background: radial-gradient(circle at 45% 25%, #113624 0%, #0a2116 55%, #05110b 100%);
  border: 1px solid #1b4b33;
  border-left: 9px solid #06140d;
}

.book-theme-desafios {
  background: radial-gradient(circle at 45% 25%, #281635 0%, #190d21 55%, #0c0611 100%);
  border: 1px solid #3e2451;
  border-left: 9px solid #0e0614;
}
.book-theme-cronologia {
  background: radial-gradient(circle at 45% 25%, #3b2314 0%, #24140a 55%, #120904 100%);
  border: 1px solid #5c3820;
  border-left: 9px solid #140a04;
}

/* Tipografía de la tapa */
.vintage-cover-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  padding: 10px 4px;
}

.vintage-cover-top {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vintage-cover-seal {
  font-size: 28px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.vintage-cover-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.vintage-cover-ornament-line {
  color: #d4af37;
  font-size: 9px;
  letter-spacing: 3px;
  opacity: 0.75;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  margin: 4px 0;
}

.vintage-cover-title {
  font-family: 'Cinzel', serif;
  font-size: 14.5px;
  font-weight: 800;
  color: #fce79f;
  letter-spacing: 1.6px;
  line-height: 1.35;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 1px #967425;
  margin: 6px 0;
  padding: 0 4px;
}

.vintage-cover-sub {
  font-family: 'Cinzel', serif;
  font-size: 9.5px;
  font-weight: 600;
  color: #e5c158;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  margin-top: 2px;
}

.vintage-cover-bottom {
  width: 100%;
  padding-bottom: 2px;
}

.vintage-cover-author {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.2px;
  color: #e5c158;
  text-transform: uppercase;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.vintage-cover-footer-legend {
  font-family: 'Cinzel', serif;
  font-size: 7.8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  line-height: 1.35;
  color: #e5c158;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  padding: 0 4px;
}

@media (max-width: 768px) {
  .biblio-books-shelf {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    gap: 24px;
    padding: 18px 10px 28px;
  }
  .vintage-book-cover {
    width: min(255px, 78vw);
    height: auto;
    aspect-ratio: 2 / 3;
    padding: 22px 16px 18px 28px;
  }
}

.biblio-book-card {
  background: linear-gradient(145deg, #161e2b, #0f1520);
  border: 1px solid #2e3a4e;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.biblio-book-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-primary);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.book-card-cover {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.book-card-seal {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.05));
  border: 1px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.book-card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 800;
  color: var(--gold-primary);
  line-height: 1.2;
}

.book-card-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 3px;
}

.book-card-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 18px;
  flex-grow: 1;
}

.book-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Lector de Manuscrito en Formato de Libro Abierto */
.imperial-book-spread-wrapper {
  perspective: 1500px;
  margin-top: 10px;
}

.imperial-book-spread {
  position: relative;
  background: #141a24;
  border: 8px solid #281d14;
  border-radius: 12px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.8),
    inset 0 0 30px rgba(0, 0, 0, 0.7);
  padding: 12px;
  min-height: 75vh;
  display: flex;
  flex-direction: column;
}

.imperial-pdf-iframe {
  width: 100%;
  height: 82vh;
  border: none;
  background: #0f141d;
}

/* Cartas de Bonus de la Tienda */
.bonus-card-container {
  margin-bottom: 0;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.bonus-card-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.bonus-img-wrapper {
  cursor: pointer;
  margin-bottom: 6px;
  border-radius: 8px;
  overflow: hidden;
  padding: 2px;
}
.bonus-card-art {
  width: auto;
  max-width: 108px;
  max-height: 155px;
  height: auto;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease;
  margin: 0 auto;
  display: block;
}
.bonus-img-wrapper:hover .bonus-card-art {
  transform: scale(1.04);
}

/* Items del Editor de Textos */
.editor-chapter-btn {
  background: #141b26;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.editor-chapter-btn:hover {
  background: #1e2634;
  color: #fff;
}
.editor-chapter-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  font-weight: 700;
}

/* ========================================================
   Galería de Avatares Circulares de Perfiles y Navegación
   ======================================================== */
.profile-avatars-shelf {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 4px 10px 4px;
  scrollbar-width: thin;
}

@media (min-width: 769px) {
  .profile-avatars-shelf {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

.profile-avatar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 74px;
  color: var(--text-muted);
}

.profile-avatar-btn:hover {
  transform: translateY(-3px);
  color: #fff;
}

.profile-avatar-btn.active {
  color: var(--gold-primary);
  transform: scale(1.06);
}

.avatar-round-frame {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 24px;
  position: relative;
  background: #141b26;
  border: 3px solid #334155;
  transition: all 0.25s ease;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}

.avatar-round-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-btn.active .avatar-round-frame {
  border-color: var(--gold-primary);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.65), inset 0 0 10px rgba(245, 158, 11, 0.35);
}

.avatar-btn-name {
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

/* Modo Edición Visual de Textos Web */
.web-editable-active [data-web-editable="true"]:hover {
  outline: 2px dashed #f59e0b !important;
  cursor: text !important;
  background: rgba(245, 158, 11, 0.08) !important;
  border-radius: 4px;
}
.web-editable-active [data-web-editable="true"]:focus {
  outline: 2px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.15) !important;
  border-radius: 4px;
}

/* En modo de edición, los botones de la página muestran cursor de texto y no se comportan como botones normales */
.web-editable-active button:not(#live-web-editor-bar *):not(#modal-ui-texts-manager *):not(#btn-toggle-live-editor):not(#btn-open-ui-manager),
.web-editable-active a:not(#live-web-editor-bar *):not(#modal-ui-texts-manager *),
.web-editable-active .nav-tab {
  cursor: text !important;
}

.web-editable-active #live-web-editor-bar button,
.web-editable-active #modal-ui-texts-manager button,
.web-editable-active #btn-toggle-live-editor,
.web-editable-active #btn-open-ui-manager {
  cursor: pointer !important;
}

#modal-ui-texts-manager {
  z-index: 10050 !important;
}

/* ========================================================
   CRONOLOGÍA VISUAL INTERACTIVA (LÍNEA DE TIEMPO)
   ======================================================== */
.timeline-visual-wrapper {
  position: relative;
  padding: 20px 10px 40px 10px;
  max-width: 900px;
  margin: 0 auto;
}

.timeline-visual-wrapper::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 20px;
  left: 30px;
  width: 4px;
  background: linear-gradient(180deg, #f59e0b, #d97706, #3b82f6, #ec4899);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

@media (min-width: 768px) {
  .timeline-visual-wrapper::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-entry {
  position: relative;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .timeline-entry {
    flex-direction: row;
    justify-content: flex-end;
  }
  .timeline-entry:nth-child(even) {
    justify-content: flex-start;
  }
}

.timeline-marker {
  position: absolute;
  left: 30px;
  top: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0f1521;
  border: 3px solid var(--gold-primary);
  box-shadow: 0 0 10px var(--gold-glow);
  z-index: 2;
  transform: translateX(-50%);
}

@media (min-width: 768px) {
  .timeline-marker {
    left: 50%;
  }
}

.timeline-card {
  margin-left: 54px;
  background: #0f1522;
  border: 1px solid #1f2a3c;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
  position: relative;
}

@media (min-width: 768px) {
  .timeline-card {
    margin-left: 0;
    width: 44%;
  }
  .timeline-entry:nth-child(odd) .timeline-card {
    margin-right: 6%;
  }
  .timeline-entry:nth-child(even) .timeline-card {
    margin-left: 6%;
  }
}

.timeline-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.2);
}

.timeline-year-badge {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 900;
  color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 3px 10px;
  display: inline-block;
  margin-bottom: 8px;
}

.timeline-quote-box {
  background: #090d14;
  border-left: 3px solid var(--gold-primary);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-top: 10px;
  font-size: 12px;
  font-style: italic;
  color: #94a3b8;
  line-height: 1.5;
}

.btn-timeline-filter {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  background: #0d121c;
  border: 1px solid #232d3d;
  color: var(--text-muted);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timeline-filter:hover {
  border-color: var(--gold-primary);
  color: #fff;
}

.btn-timeline-filter.active {
  background: var(--gold-primary);
  color: #0b0f17;
  border-color: var(--gold-primary);
  font-weight: 900;
}

/* ========================================================
   FAVORITOS DE LEYES Y ARTÍCULOS
   ======================================================== */
.btn-fav-article {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-fav-article:hover {
  border-color: #f59e0b;
  color: #fbbf24;
}

.btn-fav-article.is-fav {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
  font-weight: 800;
}

.fav-card-item {
  background: #0e1420;
  border: 1px solid #1f2a3a;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s ease;
}

.fav-card-item:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}


/* ========================================================
   SISTEMA DE SESIÓN, PIN DE 4 DÍGITOS Y TIEMPO REAL
   ======================================================== */

.user-session-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.user-session-pill:hover {
  border-color: #fbbf24;
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-1px);
}

.user-pill-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--gold-primary);
}

/* PIN Modal y Teclado Táctil */
.pin-display-container {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0 24px 0;
}

.pin-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #64748b;
  background: #0f172a;
  transition: all 0.2s ease;
}

.pin-dot.filled {
  background: #fbbf24;
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
  transform: scale(1.15);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.pin-key {
  background: #16202e;
  border: 1px solid #334155;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 800;
  height: 60px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover, .pin-key:active {
  background: #1e293b;
  border-color: var(--gold-primary);
  color: #fbbf24;
  transform: scale(0.96);
}

.pin-key.key-action {
  font-size: 18px;
  background: #0d131f;
  color: #94a3b8;
}

/* Toast de Anuncios de Partida en Vivo (Arriba-Centro) */
#live-toast-container {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 90%;
  max-width: 650px;
}

@media (min-width: 861px) {
  #live-toast-container {
    top: 18px;
    left: calc(50% + var(--sidebar-w, 98px) / 2);
  }
  body.book-fullscreen-active #live-toast-container,
  body.match-fullscreen-active #live-toast-container,
  body.tv-mode #live-toast-container {
    left: 50%;
  }
}

/* Notificaciones Generales (Abajo-Derecha) */
#corner-toast-container {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: min(390px, calc(100vw - 28px));
}

.live-toast-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(20, 29, 46, 0.98) 100%);
  border: 2px solid var(--gold-primary);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 16px 24px;
  text-align: center;
  animation: slideDownFade 0.4s cubic-bezier(0.16, 1, 0.3, 1), pulseGlow 1.8s infinite alternate;
  pointer-events: auto;
}

.corner-toast-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.97) 0%, rgba(20, 29, 46, 0.97) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.72);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72), 0 0 16px rgba(245, 158, 11, 0.22);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: left;
  width: 100%;
  animation: slideInRightFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

@keyframes slideInRightFade {
  from {
    opacity: 0;
    transform: translateX(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (max-width: 768px) {
  #corner-toast-container {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    max-width: calc(100vw - 74px);
  }
  .corner-toast-card {
    padding: 10px 13px;
  }
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulseGlow {
  from {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(245, 158, 11, 0.3);
  }
  to {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 35px rgba(245, 158, 11, 0.7);
  }
}

/* HUD Personal de Bonus del Jugador durante la partida (Compacto debajo de Jugadas Menores en PC) */
.player-mobile-live-hud {
  background: #0f1624;
  border: 1px solid rgba(245, 158, 11, 0.72);
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  width: 100%;
  box-sizing: border-box;
}

.player-hud-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #1f2a3a;
  padding-bottom: 6px;
}

.player-hud-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-hud-avatar {
  width: 24px !important;
  height: 24px !important;
  flex-shrink: 0;
}

.player-hud-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.player-hud-name {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
  line-height: 1.2;
}

.player-hud-status {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.2;
}

.player-hud-wallet {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.player-hud-wallet-label {
  font-size: 11px;
  color: var(--text-muted);
}

.player-hud-wallet-coins {
  font-size: 13.5px;
  font-weight: 900;
  color: #fbbf24;
}

.player-hud-bonus-section {
  margin-top: 6px;
}

.player-hud-bonus-notice {
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  line-height: 1.25;
}

.player-mobile-bonus-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 0;
}

.btn-mobile-bonus {
  background: #141c2b;
  border: 1px solid #334155;
  border-radius: 7px;
  padding: 6px 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
  text-align: center;
}

.btn-mobile-bonus .hud-bonus-icon {
  font-size: 14px;
  line-height: 1;
}

.btn-mobile-bonus .hud-bonus-label {
  font-size: 10.5px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.btn-mobile-bonus .hud-bonus-owned {
  font-size: 9.5px !important;
  padding: 1px 6px !important;
}

@media (max-width: 520px) {
  .player-mobile-bonus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.btn-mobile-bonus:hover, .btn-mobile-bonus:active {
  border-color: #fbbf24;
  background: #1e293b;
  transform: translateY(-2px);
}

.btn-mobile-bonus:disabled {
  opacity: 0.35;
  filter: grayscale(85%);
  cursor: not-allowed;
  transform: none !important;
  border-color: #1e293b !important;
  background: #0d131f !important;
  box-shadow: none !important;
}

/* Selector y Ordenamiento de Jugadores en Nueva Partida */
.order-player-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #273549;
  background: #111823;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.order-player-chip:hover {
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.order-player-chip.selected {
  background: rgba(245, 158, 11, 0.15);
  border-color: #fbbf24;
  color: #fbbf24;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.match-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #151d2a;
  border: 1px solid #1f2a3a;
  padding: 7px 12px;
  border-radius: 8px;
  gap: 10px;
  transition: background 0.15s ease;
}

.match-order-item:hover {
  background: #1a2436;
}

.order-badge-num {
  font-size: 12px;
  font-weight: 900;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 8px;
  border-radius: 12px;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.order-player-name-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
}

.order-player-name {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-order-arrow {
  background: #0d121a;
  border: 1px solid #273549;
  color: #94a3b8;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-order-arrow:hover:not(:disabled) {
  border-color: #fbbf24;
  color: #fbbf24;
  background: #17202e;
}

.btn-order-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-order-remove {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.btn-order-remove:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fff;
}

/* Indicador de Turno en Tablero y Bloqueo de Casilleros */
.header-player.active-turn-col {
  border-bottom: 3px solid #fbbf24 !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)) !important;
  box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.25);
}

.score-cell.can-score-cell {
  cursor: pointer;
  transition: all 0.2s ease;
}

.score-cell.can-score-cell:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.4);
}

.score-cell.locked-turn-cell {
  opacity: 0.65;
  cursor: not-allowed;
}

.score-cell.locked-turn-cell:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

.score-cell.filled {
  cursor: pointer !important;
}

.score-cell.filled:hover {
  filter: brightness(1.25);
  box-shadow: inset 0 0 6px rgba(251, 191, 36, 0.4);
}

/* Toast Épico para Generala y Jugadas Legendarias */
.live-toast-card.epic-toast-card {
  border: 2px solid #fbbf24 !important;
  background: linear-gradient(135deg, rgba(35, 26, 10, 0.98), rgba(15, 23, 42, 0.98)) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 35px rgba(245, 158, 11, 0.75) !important;
  animation: pulseGlow 1.2s infinite alternate;
  padding: 18px 24px !important;
  min-width: 340px;
}

@keyframes toastNudge {
  0% { transform: scale(1); }
  25% { transform: scale(1.04) translateX(-4px); }
  50% { transform: scale(1.04) translateX(4px); }
  75% { transform: scale(1.02) translateX(-2px); }
  100% { transform: scale(1); }
}

/* Selector táctico de Bonus para Admin */
.admin-bonus-choice-btn {
  background: #0f1624;
  border: 1px solid #1e293b;
  color: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.admin-bonus-choice-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.15);
  transform: translateY(-2px);
}

.admin-bonus-player-btn {
  background: #0f1624;
  border: 1px solid #1e293b;
  color: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.admin-bonus-player-btn:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

/* Indicador visual de elemento editado pendiente de guardar en modo Edición en Vivo */
body.live-text-edit-mode [data-edited-live="true"] {
  outline: 2px solid #10b981 !important;
  outline-offset: 2px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35) !important;
  border-radius: 4px;
}

/* Vista de Desafíos de los Zares (Adaptable al alto completo en PC igual que Torres) */
.desafios-viewport-wrapper {
  width: 100%;
  box-sizing: border-box;
}
.desafios-cards-grid {
  display: grid;
  align-items: stretch;
}
.desafio-zar-card {
  box-sizing: border-box;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.desafio-zar-card:hover {
  transform: translateY(-4px);
}
.desafio-zar-card.unlocked:hover {
  box-shadow: 0 16px 38px rgba(245, 158, 11, 0.35), 0 0 25px rgba(245, 158, 11, 0.2) !important;
  border-color: #fbbf24 !important;
}
.desafio-zar-card.locked:hover {
  border-color: #3b4d66 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6) !important;
}

@media (min-width: 861px) {
  .desafios-viewport-wrapper {
    height: calc(100dvh - 28px);
    min-height: 460px;
    padding: 4px 4px 8px;
  }
  .desafios-cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(14px, 1.4vw, 24px);
    height: 100%;
  }
  .desafio-zar-card {
    height: 100%;
    min-height: 0;
    padding: clamp(14px, 2vh, 24px) clamp(12px, 1.3vw, 20px) clamp(14px, 1.8vh, 22px);
  }
  .desafio-zar-portrait-box {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: clamp(8px, 1.2vh, 14px);
    margin-bottom: clamp(10px, 1.4vh, 16px);
  }
  .desafio-zar-title {
    flex: 0 0 auto;
    font-size: clamp(17px, 2.2vh, 22px);
    margin-bottom: clamp(6px, 0.9vh, 10px);
    min-height: 28px;
  }
  .desafio-zar-meta {
    flex: 0 0 auto;
    font-size: clamp(11px, 1.35vh, 12.5px);
    margin-bottom: clamp(10px, 1.4vh, 14px);
    min-height: 34px;
  }
  .desafio-zar-action {
    flex: 0 0 auto;
    margin-top: 0;
  }
  .desafio-zar-btn {
    padding: clamp(10px, 1.4vh, 14px) clamp(12px, 1.2vw, 18px);
    font-size: clamp(13px, 1.6vh, 15px);
  }

  /* Historial de Partidas: adaptación al alto completo de pantalla en PC */
  #tab-historial .history-card {
    height: calc(100dvh - 32px);
    min-height: 440px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }
  #tab-historial #history-scroll-container {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
  }

  /* Biblioteca Imperial: adaptación al alto completo de pantalla en PC sin scrollbar externo */
  body:not(.book-fullscreen-active) #tab-biblioteca > .card {
    height: calc(100dvh - 32px);
    min-height: 440px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca > .card > .card-header {
    flex: 0 0 auto;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca #biblio-shelf-view:not([style*="display: none"]) {
    flex: 1 1 0;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .biblio-books-shelf {
    flex: 1 1 auto;
    min-height: 0;
    flex-wrap: nowrap;
    padding: clamp(10px, 2vh, 26px) 10px;
    gap: clamp(20px, 2.8vw, 44px);
    align-items: center;
    justify-content: center;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .vintage-book-cover {
    height: clamp(290px, calc(100dvh - 190px), 470px);
    width: auto;
    aspect-ratio: 2 / 3;
    max-width: calc((100% - 64px) / 3);
  }
  body:not(.book-fullscreen-active) #tab-biblioteca #biblio-interactive-view:not([style*="display: none"]) {
    flex: 1 1 0;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    overflow: visible;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .antique-book-toolbar {
    flex: 0 0 auto;
    margin-bottom: 18px;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .antique-reader-wrapper {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .antique-book-open {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca .antique-book-spread {
    flex: 1 1 0;
    min-height: 360px;
    height: auto !important;
  }
  body:not(.book-fullscreen-active) #tab-biblioteca #biblio-timeline-view:not([style*="display: none"]),
  body:not(.book-fullscreen-active) #tab-biblioteca #biblio-favorites-view:not([style*="display: none"]),
  body:not(.book-fullscreen-active) #tab-biblioteca #biblio-editor-view:not([style*="display: none"]) {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 860px) {
  .desafios-viewport-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 12px 36px;
  }
  .desafios-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 18px;
  }
  .desafio-zar-card {
    padding: 20px 16px 18px;
  }
  .desafio-zar-portrait-box {
    aspect-ratio: 4 / 5;
    max-height: 280px;
    padding: 12px;
    margin-bottom: 14px;
  }
  .desafio-zar-title {
    font-size: 20px;
    margin-bottom: 8px;
    min-height: 28px;
  }
  .desafio-zar-meta {
    font-size: 11.5px;
    margin-bottom: 12px;
    min-height: 34px;
  }
  .desafio-zar-action {
    margin-top: auto;
  }
  .desafio-zar-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* Interruptor Toggle para Bonus en Historial */
.history-bonus-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0e131b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  height: 35px;
  box-sizing: border-box;
}

.history-bonus-toggle-wrapper:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: #141b26;
}

.bonus-toggle-label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1e293b;
  border: 1.5px solid #334155;
  transition: all 0.25s ease;
  border-radius: 999px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 1.5px;
  background-color: #94a3b8;
  transition: all 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(17px);
  background-color: #ffffff;
}

.history-bonus-toggle-wrapper:has(input:checked) {
  border-color: rgba(56, 189, 248, 0.5);
  background: #111a28;
}

.history-bonus-toggle-wrapper:has(input:checked) .bonus-toggle-label {
  color: #38bdf8;
}

/* Pestañas de Cuadro Unificado en Estadísticas */
.btn-stats-unified-tab {
  transition: all 0.2s ease;
  border-color: var(--border-color);
  color: var(--text-muted);
}
.btn-stats-unified-tab:hover {
  border-color: var(--gold-primary);
  color: #fff;
}
.btn-stats-unified-tab.active {
  background: var(--gold-primary) !important;
  color: #0b0f17 !important;
  border-color: var(--gold-primary) !important;
  font-weight: 800 !important;
}

.stats-unified-pane {
  animation: fadeIn 0.2s ease-in-out;
}

.btn-ver-partida-rec {
  transition: all 0.15s ease;
}

.btn-ver-partida-rec:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: #38bdf8 !important;
  color: #fff !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

/* ========================================================
   MODO EDICIÓN VISUAL INDIVIDUAL DE TEXTOS
   ======================================================== */
.live-text-hover-target {
  outline: 2px dashed #38bdf8 !important;
  outline-offset: 2px !important;
  cursor: pointer !important;
  background-color: rgba(56, 189, 248, 0.12) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25) !important;
  transition: outline 0.1s ease, background-color 0.1s ease !important;
}

[data-edited-live="true"] {
  outline: 2px solid #10b981 !important;
  outline-offset: 1px !important;
}

[data-inline-editing="true"] {
  outline: 2.5px solid #38bdf8 !important;
  outline-offset: 2px !important;
  background-color: rgba(56, 189, 248, 0.18) !important;
  cursor: text !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5) !important;
}

[data-deleted-text="true"] {
  display: none !important;
}

body.web-editable-active [data-deleted-text="true"] {
  display: inline-block !important;
  min-width: 24px;
  min-height: 18px;
  outline: 2px dashed #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
}

body.web-editable-active [data-deleted-text="true"]::after {
  content: ' 🗑️[Texto Eliminado]';
  font-size: 11px;
  color: #f87171;
  font-style: italic;
  font-weight: 700;
  opacity: 0.95;
  padding: 0 4px;
}

body:not(.web-editable-active) [data-deleted-text="true"]::after {
  content: '';
  display: none !important;
}

/* ========================================================
   ECONOMÍA GALEAREN EN HISTORIAL Y RESUMEN FINAL
   ======================================================== */
.hist-gal-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.35;
  letter-spacing: 0.2px;
  cursor: help;
}

.hist-gal-pill.pos,
.summary-eco-net.pos,
.summary-eco-chip.pos {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.hist-gal-pill.neg,
.summary-eco-net.neg,
.summary-eco-chip.neg {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.hist-gal-pill.zero,
.summary-eco-net.zero,
.summary-eco-chip.zero {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.summary-eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  text-align: left;
}

.summary-eco-card {
  background: #0f1624;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.summary-eco-card.is-winner {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, #0f1624 100%);
}

.summary-eco-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-eco-net {
  font-size: 12.5px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.summary-eco-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.summary-eco-chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .summary-eco-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   COMENTARIOS, FOTOS EN CASILLEROS Y BALANCE GALEAREN EN PLANILLA
   ======================================================== */
.score-ann-section {
  margin-top: 12px;
  border-top: 1px dashed #273549;
  padding-top: 10px;
}

.score-ann-toggle-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  padding: 7px 12px;
  border-color: rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.score-ann-badge {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 800;
}

.score-ann-box {
  margin-top: 10px;
  background: #0d131d;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-ann-textarea {
  width: 100%;
  padding: 8px 10px;
  background: #141b26;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.score-ann-textarea:focus {
  outline: none;
  border-color: #38bdf8;
}

.score-ann-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0b1018;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 6px 8px;
}

.score-ann-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #38bdf8;
  cursor: pointer;
}

.score-ann-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cell-ann-large-preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  border: 1px solid #38bdf8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  object-fit: contain;
  cursor: pointer;
}

.cell-with-photo,
.header-with-photo {
  box-shadow: inset 0 0 0 2px #38bdf8 !important;
  background: rgba(56, 189, 248, 0.14) !important;
}

.cell-with-note.cell-with-photo,
.header-with-note.header-with-photo {
  box-shadow: inset 0 0 0 2px #fbbf24 !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(56, 189, 248, 0.18)) !important;
}

.cell-ann-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  margin-left: 3px;
  vertical-align: middle;
}

.score-cell.calc-score-cell {
  cursor: pointer;
}

.score-cell.calc-score-cell:hover {
  background: rgba(56, 189, 248, 0.12);
}

#detail-modal-content td.detail-annotatable-cell {
  cursor: pointer;
  transition: background 0.15s ease;
}

#detail-modal-content td.detail-annotatable-cell:hover {
  background: rgba(56, 189, 248, 0.14);
}

tr.row-galearen-balance td {
  background: rgba(15, 23, 42, 0.9);
  border-top: 2px solid #273549 !important;
  font-weight: 800;
}

tr.row-galearen-balance td.cat-name {
  color: #fbbf24;
  background: #121927 !important;
}

/* ========================================================
   PERFIL > COMPRAS (CUADRO MITAD Y TOP 5 GANANCIA / PÉRDIDA)
   ======================================================== */
.profile-compras-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.profile-eco-panel {
  background: #0f1521;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  box-sizing: border-box;
}

.profile-eco-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 10px;
}

.profile-purchases-table-wrap {
  width: 100%;
  max-height: 375px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #1e2634;
}

table.scoreboard.profile-purchases-table {
  font-size: 12px;
  border-collapse: collapse;
}

table.scoreboard.profile-purchases-table th,
table.scoreboard.profile-purchases-table td {
  padding: 8px 10px;
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #1e293b;
}

table.scoreboard.profile-purchases-table thead th {
  background: #141b26;
  border-bottom: 2px solid #273549;
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
}

.profile-eco-match-link {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.profile-eco-match-link:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #fbbf24;
}

.profile-eco-tab-bar {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-eco-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #273549;
  color: #94a3b8;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-eco-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.profile-eco-tab-btn.gains.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.profile-eco-tab-btn.losses.active {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-color: #f43f5e;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.25);
}

.profile-bonus-hist-tab-btn.compras.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.profile-bonus-hist-tab-btn.usos.active {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border-color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.profile-eco-panes-wrap {
  margin-bottom: 14px;
}

.profile-eco-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-eco-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: #141b26;
  border: 1px solid #1e2838;
  border-radius: 9px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.profile-eco-match-row:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: #172030;
}

.profile-eco-match-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-eco-rank {
  font-weight: 800;
  font-size: 13px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: #cbd5e1;
}

.profile-eco-match-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-eco-match-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-eco-match-num {
  font-weight: 800;
  font-size: 13px;
  color: #fff;
}

.profile-eco-mode-tag {
  font-size: 10px;
  padding: 1px 6px;
}

.profile-eco-match-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.profile-eco-match-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.profile-eco-view-btn {
  padding: 4px 9px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
  cursor: pointer;
  white-space: nowrap;
}

.profile-eco-mode-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed #1e293b;
  flex-wrap: wrap;
}

.profile-eco-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  background: #0a0e17;
  border: 1px dashed #1e2838;
  border-radius: 10px;
}

@media (max-width: 960px) {
  .profile-compras-dual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .profile-eco-panel {
    padding: 12px;
  }
  .profile-eco-match-row {
    padding: 8px 10px;
    gap: 8px;
  }
  .profile-eco-match-actions {
    gap: 6px;
  }
}

/* ========================================================
   SISTEMA DE BONUS POR INVENTARIO, CANDADO CASILLERO EXTRA Y MARCADOR EN PARTIDA
   ======================================================== */
.match-used-bonuses-panel {
  width: 100%;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  margin: 4px 0;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
}

.used-bonus-panel-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #fbbf24;
  text-align: center;
}

.used-bonus-players-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.used-bonus-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  background: #0d131d;
  border: 1px solid #1e293b;
  border-radius: 7px;
  padding: 4px 8px;
}

.used-bonus-player-name {
  font-weight: 800;
  font-size: 11px;
}

.used-bonus-player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.used-bonus-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fef08a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.hud-bonus-owned {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.btn-mobile-bonus.has-stock .hud-bonus-owned {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.45);
}

.scoreboard td.locked-extra-cell {
  background: rgba(15, 23, 42, 0.72) !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  position: relative;
}

.locked-extra-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.75;
  filter: grayscale(0.2);
}

.store-player-wallet-bar {
  background: linear-gradient(135deg, #151f2e 0%, #0d131d 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.store-wallet-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.store-wallet-guest {
  color: #cbd5e1;
  font-size: 13px;
}

.store-wallet-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #e2e8f0;
}

.store-wallet-balance b {
  color: #fbbf24;
  font-size: 15px;
}

.store-wallet-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.store-wallet-inv-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 2px;
}

.store-inv-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #0b1018;
  border: 1px solid #1e293b;
  color: #94a3b8;
}

.store-inv-pill.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.store-bonus-owned-badge {
  display: inline-block;
  margin: 2px auto 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.store-bonus-owned-badge.has-stock {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.store-buy-bonus-btn {
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
}

/* ========================================================
   FILAS DE RÉCORDS EN ESTADÍSTICAS (MÁXIMOS TOTALES, SUBTOTALES, PÓKER, AZAR, ETC.)
   ======================================================== */
.stats-top-record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #141b26;
  border: 1px solid #1e2838;
  border-radius: 8px;
  font-size: 13px;
  box-sizing: border-box;
  width: 100%;
}

.stats-top-record-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.stats-top-record-medal {
  font-weight: 700;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.stats-top-record-player {
  font-weight: 800;
  color: #fff;
}

.stats-top-record-match,
.stats-top-record-date {
  font-size: 11px;
  color: var(--text-muted);
}

.stats-top-record-mode {
  font-size: 9px;
  padding: 1px 6px;
}

.stats-top-record-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.stats-top-record-bonus {
  font-size: 10px;
  padding: 2px 7px;
  white-space: nowrap;
}

.stats-top-record-score-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-top-record-score {
  font-weight: 900;
  font-size: 14px;
  min-width: 58px;
  text-align: right;
  white-space: nowrap;
}

.stats-top-record-row .btn-ver-partida-rec {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stats-top-record-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 9px 10px;
  }
  .stats-top-record-left {
    width: 100%;
    gap: 6px;
  }
  .stats-top-record-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
  }
  .stats-top-record-score-wrap {
    margin-left: auto;
    gap: 8px;
  }
  .stats-top-record-score {
    min-width: 0;
    font-size: 14px;
  }
}

/* ========================================================
   BARRA DE NAVEGACIÓN DE CARRUSELES EN ESTADÍSTICAS
   ======================================================== */
.stats-carousel-nav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.stats-carousel-arrow {
  width: 34px;
  height: 34px;
  font-size: 16px;
  flex-shrink: 0;
}

.stats-carousel-title-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 230px;
  max-width: 100%;
  min-width: 0;
  text-align: center;
}

.stats-carousel-title-box.stats-carousel-title-box-wide {
  width: 280px;
}

.stats-carousel-title-text {
  font-weight: 800;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--gold-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-carousel-badge {
  font-size: 11px;
  padding: 3px 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stats-carousel-nav-bar {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .stats-carousel-arrow {
    width: 30px !important;
    height: 30px !important;
    font-size: 13px !important;
  }
  .stats-carousel-title-box,
  .stats-carousel-title-box.stats-carousel-title-box-wide {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0 2px;
  }
  .stats-carousel-title-text {
    font-size: 13.5px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
  }
  .stats-carousel-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
}

/* === MODO DESAFÍO Y TESORERÍA COMPACTA EN TIENDA === */
.mode-desafio {
  background: rgba(168, 85, 247, 0.22);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.55);
}

.desafio-banner {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.32), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(192, 132, 252, 0.45);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.45s ease, max-height 0.52s ease, padding 0.52s ease, margin 0.52s ease, border-width 0.45s ease;
}

.desafio-banner.desafio-banner-fading-out {
  opacity: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-width: 0 !important;
  pointer-events: none;
}

.desafio-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.desafio-banner-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.desafio-player-card {
  flex: 1 1 200px;
  background: rgba(10, 15, 25, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11.5px;
}

.desafio-player-card.passed {
  border-color: rgba(16, 185, 129, 0.5);
}

.desafio-player-card.failed {
  border-color: rgba(239, 68, 68, 0.45);
}

.desafio-obj-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.desafio-obj-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
}

.desafio-obj-chip.passed {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.desafio-obj-chip.failed {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.desafio-obj-chip.info {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.locked-challenge-cell {
  opacity: 0.48;
  cursor: not-allowed !important;
  background: rgba(30, 41, 59, 0.55) !important;
  color: #94a3b8 !important;
}

.triple-die-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.triple-die-btn {
  padding: 8px 4px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0d131f;
  color: #cbd5e1;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.triple-die-btn.is-odd {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fbbf24;
}

.triple-die-btn.active {
  background: linear-gradient(135deg, #9333ea, #6b21a8);
  border-color: #e9d5ff;
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  transform: translateY(-1px);
}

.triple-die-btn.active.is-odd {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fde68a;
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.55);
}

.score-option-btn.locked-mult {
  opacity: 0.45;
  cursor: not-allowed !important;
  border-style: dashed;
}

.store-recaudacion-compact {
  margin-top: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(11, 19, 32, 0.98));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
}

.store-recaudacion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.store-recaudacion-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.store-rec-kpi {
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.store-rec-kpi.is-total {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.desafio-summary-verdict {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(192, 132, 252, 0.45);
  background: rgba(88, 28, 135, 0.22);
}

.desafio-summary-verdict.passed {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.12);
}

.desafio-summary-verdict.failed {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 640px) {
  .store-recaudacion-kpis {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   SELECTOR DE DADOS DE PÓKER & MEDALLERO / TÍTULOS
   ======================================================== */
.poker-dice-container {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.poker-dice-head {
  font-size: 12px;
  font-weight: 800;
  color: #e0f2fe;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.poker-dice-hint {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 700;
}

.poker-dice-sublabel {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 5px;
}

.poker-main-die-btn.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #bae6fd;
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.poker-kicker-die-btn.active {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fde68a;
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.poker-dice-preview {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
}

.poker-dice-preview.ready {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.45);
}

.poker-confirm-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 800;
}

.cartilla-claim-btn {
  width: 100%;
  font-size: 11.5px;
  font-weight: 800;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(217, 119, 6, 0.28));
  color: #fde68a;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.cartilla-claim-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.cartilla-claimed-pill {
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}

.titles-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.titles-kpi-box {
  background: #0a0e17;
  border: 1px solid #1e2838;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.titles-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.titles-medals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 265px), 1fr));
  gap: 12px;
}

.title-medal-card {
  background: linear-gradient(135deg, #131c2b 0%, #0b1019 100%);
  border: 1px solid #334155;
  border-radius: 11px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title-medal-card.tier-oro {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 3px 14px rgba(245, 158, 11, 0.14);
}

.title-medal-card.tier-plata {
  border-color: rgba(203, 213, 225, 0.55);
}

.title-medal-card.tier-bronce {
  border-color: rgba(217, 119, 6, 0.55);
}

.title-medal-card.is-vacant {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
  opacity: 0.85;
}

.title-medal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
  border-top: 1px dashed #1e293b;
  padding-top: 8px;
  margin-top: auto;
}

.btn-medal-view-match {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-medal-view-match:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.btn-kingdom-match-pill {
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-kingdom-match-pill:hover {
  border-color: #38bdf8;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
}

@media (max-width: 640px) {
  .titles-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ========================================================
   MODAL CREAR NUEVA PARTIDA (Layout Responsive PC 2 Columnas)
   ======================================================== */
#new-match-modal .new-match-modal-content {
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
}

.new-match-title {
  color: var(--gold-primary);
  font-family: var(--font-serif);
  font-size: 18px;
  margin: 0;
}

.new-match-close-btn {
  padding: 4px 10px;
}

.new-match-body-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.new-match-col-left,
.new-match-col-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.new-match-field {
  margin-bottom: 0;
}

.new-match-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.new-match-input {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  background: #0d121a;
  color: #f8fafc;
  box-sizing: border-box;
}

.new-match-input option {
  background: #0f172a;
  color: #f8fafc;
}

.new-match-date-input {
  background: #0d121a;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.new-match-desafio-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.25), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(192, 132, 252, 0.45);
}

.new-match-desafio-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #e9d5ff;
  display: block;
  margin-bottom: 6px;
}

.new-match-desafio-select {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  background: #0f172a;
  border-color: rgba(192, 132, 252, 0.45);
  color: #f8fafc;
  margin-bottom: 8px;
}

.new-match-desafio-info {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
}

.new-match-available-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.new-match-guest-wrap {
  display: flex;
  gap: 8px;
}

.new-match-guest-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: #0d121a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
}

.new-match-add-guest-btn {
  font-size: 13px;
  flex-shrink: 0;
}

.new-match-players-note {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
  line-height: 1.4;
}

.new-match-order-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.new-match-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.new-match-shuffle-btn {
  font-size: 11px;
  padding: 4px 8px;
  color: #38bdf8;
  border-color: #38bdf8;
}

.new-match-ordered-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  background: #0c1119;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-primary) #0a0f18;
}

.new-match-footer {
  margin-top: 16px;
}

.new-match-validation-msg {
  font-size: 12px;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 700;
}

.new-match-confirm-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 800;
}

@media (min-width: 860px) {
  #new-match-modal .new-match-modal-content {
    max-width: min(1020px, 94vw);
    width: 92vw;
    height: min(740px, calc(100dvh - 32px));
    max-height: calc(100dvh - 32px);
    padding: clamp(14px, 2vh, 24px) clamp(20px, 2.2vw, 30px);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  .new-match-header {
    flex: 0 0 auto;
    margin-bottom: clamp(10px, 1.5vh, 18px);
    padding-bottom: clamp(8px, 1.1vh, 12px);
    border-bottom: 1px solid rgba(251, 191, 36, 0.22);
  }

  .new-match-title {
    font-size: clamp(19px, 2.5vh, 23px);
    letter-spacing: 0.4px;
  }

  .new-match-close-btn {
    padding: 5px 12px;
    font-size: 14px;
  }

  .new-match-body-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.18fr);
    gap: clamp(14px, 1.8vw, 22px);
    align-items: stretch;
  }

  .new-match-col-left,
  .new-match-col-right {
    background: rgba(11, 16, 26, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    padding: clamp(12px, 1.7vh, 18px) clamp(14px, 1.7vw, 20px);
    gap: clamp(10px, 1.4vh, 16px);
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
  }

  .new-match-col-left {
    overflow-y: auto;
  }

  .new-match-col-right {
    overflow: hidden;
  }

  .new-match-label {
    font-size: clamp(12.5px, 1.55vh, 14px);
    margin-bottom: clamp(5px, 0.8vh, 8px);
    color: #cbd5e1;
  }

  .new-match-input {
    padding: clamp(8px, 1.2vh, 12px) 14px;
    font-size: clamp(13.5px, 1.65vh, 15px);
    border-radius: 8px;
  }

  .new-match-desafio-box {
    padding: clamp(10px, 1.4vh, 14px) 15px;
    border-radius: 12px;
  }

  .new-match-desafio-label {
    font-size: clamp(12px, 1.45vh, 13.5px);
    margin-bottom: 6px;
  }

  .new-match-desafio-select {
    padding: clamp(7px, 1vh, 10px) 12px;
    font-size: clamp(12.5px, 1.5vh, 14px);
    margin-bottom: 8px;
  }

  .new-match-desafio-info {
    font-size: clamp(11.5px, 1.35vh, 13px);
    line-height: 1.45;
  }

  .new-match-available-chips {
    gap: clamp(6px, 0.8vh, 9px);
    margin-bottom: clamp(8px, 1.1vh, 11px);
  }

  #new-match-modal .order-player-chip {
    padding: clamp(5px, 0.8vh, 8px) clamp(12px, 1.1vw, 16px);
    font-size: clamp(12.5px, 1.5vh, 14px);
  }

  .new-match-guest-input {
    padding: clamp(7px, 1vh, 10px) 12px;
    font-size: clamp(12.5px, 1.5vh, 14px);
    border-radius: 8px;
  }

  .new-match-add-guest-btn {
    padding: clamp(7px, 1vh, 10px) 14px;
    font-size: clamp(12.5px, 1.5vh, 14px);
  }

  .new-match-players-note {
    font-size: clamp(10.5px, 1.25vh, 12px);
    margin-top: clamp(4px, 0.6vh, 7px);
  }

  .new-match-order-block {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .new-match-order-header {
    flex: 0 0 auto;
    margin-bottom: clamp(5px, 0.7vh, 8px);
  }

  .new-match-shuffle-btn {
    font-size: clamp(11px, 1.35vh, 12.5px);
    padding: 5px 11px;
  }

  .new-match-ordered-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: clamp(6px, 0.9vh, 10px);
    gap: clamp(5px, 0.7vh, 8px);
    border-radius: 10px;
  }

  #new-match-modal .match-order-item {
    padding: clamp(6px, 0.9vh, 9px) 12px;
    border-radius: 9px;
  }

  #new-match-modal .order-player-name {
    font-size: clamp(13px, 1.6vh, 15px);
  }

  #new-match-modal .order-badge-num {
    font-size: clamp(11.5px, 1.4vh, 13px);
    padding: 3px 8px;
    min-width: 32px;
  }

  #new-match-modal .btn-order-arrow,
  #new-match-modal .btn-order-remove {
    width: clamp(28px, 3.4vh, 34px);
    height: clamp(28px, 3.4vh, 34px);
    font-size: 12.5px;
  }

  .new-match-footer {
    flex: 0 0 auto;
    margin-top: clamp(10px, 1.5vh, 18px);
    padding-top: clamp(10px, 1.2vh, 14px);
    border-top: 1px solid rgba(148, 163, 184, 0.16);
  }

  .new-match-validation-msg {
    font-size: clamp(12px, 1.45vh, 13.5px);
    margin-bottom: clamp(8px, 1.1vh, 12px);
  }

  .new-match-confirm-btn {
    padding: clamp(10px, 1.45vh, 14px) 24px;
    font-size: clamp(14.5px, 1.85vh, 16.5px);
    border-radius: 10px;
  }
}

/* ========================================================
   BOTÓN FLOTANTE CIRCULAR DE EDICIÓN DE TEXTOS (ABAJO-IZQ)
   ======================================================== */
.fab-live-editor-btn {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: calc(18px + env(safe-area-inset-left, 0px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  background: linear-gradient(135deg, #132035 0%, #0b1220 100%);
  color: #38bdf8;
  font-size: 21px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1200;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.7), 0 0 14px rgba(56, 189, 248, 0.32);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  user-select: none;
}

.fab-live-editor-btn:hover {
  transform: scale(1.09);
  border-color: #7dd3fc;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.8), 0 0 22px rgba(56, 189, 248, 0.55);
}

.fab-live-editor-btn.is-active {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border-color: #e0f2fe;
  color: #0b1220;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.28), 0 8px 26px rgba(2, 132, 199, 0.6);
}

@media (min-width: 861px) {
  .fab-live-editor-btn {
    left: calc(var(--sidebar-w, 98px) + 14px);
  }
}

@media (max-width: 768px) {
  .fab-live-editor-btn {
    width: 46px;
    height: 46px;
    font-size: 19px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
  }
}

/* ========================================================
   SECCIÓN EDITAR PERFIL (FOTO + CONTRASEÑA)
   ======================================================== */
.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 860px;
  margin: 0 auto 30px auto;
  align-items: stretch;
}

.profile-edit-card {
  background: linear-gradient(135deg, #131c2b 0%, #0c121d 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.profile-edit-card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 800;
  color: var(--gold-primary);
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.profile-edit-avatar-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.profile-edit-avatar-frame {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 3px solid var(--gold-primary);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.profile-edit-player-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-top: 2px;
}

.profile-edit-avatar-btn {
  margin-top: 6px;
  border-color: #38bdf8;
  color: #7dd3fc;
  font-weight: 800;
  padding: 9px 18px;
  font-size: 13.5px;
}

.profile-edit-avatar-btn:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: #7dd3fc;
  color: #fff;
}

.profile-edit-pass-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.profile-edit-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.profile-edit-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-edit-pass-wrap input {
  width: 100%;
  padding: 10px 42px 10px 13px;
  background: #0a101b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}

.profile-edit-pass-wrap input:focus {
  border-color: #38bdf8;
}

.profile-edit-eye-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-edit-eye-btn:hover {
  color: #fff;
}

.profile-edit-status {
  min-height: 18px;
  font-size: 12.5px;
  font-weight: 700;
}

.profile-edit-save-btn {
  width: 100%;
  margin-top: auto;
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 800;
}

.profile-edit-logout-wrap {
  max-width: 860px;
  margin: 0 auto 36px auto;
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.22) 0%, #0c121d 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 14px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-edit-logout-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .profile-edit-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .profile-edit-card {
    padding: 18px 16px;
  }
  .profile-edit-logout-wrap {
    padding: 14px 16px;
  }
  .profile-edit-logout-btn {
    width: 100%;
  }
}

/* ========================================================
   PERFIL EN PC: ADAPTACIÓN AL ALTO COMPLETO SIN SCROLLBAR EXTERNO
   (AMIGOS, COMPRAS, EDITAR PERFIL Y ESTADÍSTICAS)
   ======================================================== */
.profile-friends-subtabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-eco-panel-body,
.profile-matrix-card-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

@media (min-width: 861px) {
  #players-cards-grid[data-profile-subtab="editar"],
  #players-cards-grid[data-profile-subtab="compras"],
  #players-cards-grid[data-profile-subtab="amigos"],
  #players-cards-grid[data-profile-subtab="estadisticas"],
  #players-cards-grid[data-profile-subtab="rendimiento"] {
    height: calc(100dvh - 32px);
    min-height: 480px;
    gap: clamp(8px, 1.2vh, 14px) !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  #players-cards-grid[data-profile-subtab="editar"] > .profile-back-nav,
  #players-cards-grid[data-profile-subtab="compras"] > .profile-back-nav,
  #players-cards-grid[data-profile-subtab="amigos"] > .profile-back-nav,
  #players-cards-grid[data-profile-subtab="estadisticas"] > .profile-back-nav,
  #players-cards-grid[data-profile-subtab="rendimiento"] > .profile-back-nav {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
    padding-bottom: clamp(6px, 1vh, 10px) !important;
  }

  /* 1. Editar Perfil adaptable al alto */
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-shell {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(10px, 1.8vh, 22px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-grid {
    margin: 0;
    width: 100%;
    gap: clamp(14px, 1.8vw, 22px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-card {
    padding: clamp(12px, 2vh, 22px) 22px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-card-title {
    padding-bottom: 8px;
    margin-bottom: clamp(8px, 1.5vh, 16px);
    font-size: clamp(15px, 2vh, 17px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-avatar-area {
    gap: clamp(6px, 1vh, 10px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-avatar-frame {
    width: clamp(78px, 13vh, 112px);
    height: clamp(78px, 13vh, 112px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-player-name {
    font-size: clamp(17px, 2.4vh, 20px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-avatar-btn {
    margin-top: 2px;
    padding: clamp(7px, 1.1vh, 9px) 16px;
    font-size: 13px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-pass-form {
    gap: clamp(7px, 1.3vh, 14px);
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-field label {
    margin-bottom: 4px;
    font-size: 12px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-pass-wrap input {
    padding: clamp(6px, 1.1vh, 10px) 40px clamp(6px, 1.1vh, 10px) 12px;
    font-size: 13.5px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-status {
    min-height: 14px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-save-btn {
    padding: clamp(8px, 1.3vh, 12px) 16px;
    font-size: 13.5px;
  }
  #players-cards-grid[data-profile-subtab="editar"] .profile-edit-logout-wrap {
    margin: 0;
    width: 100%;
    padding: clamp(10px, 1.5vh, 16px) 20px;
  }

  /* 2. Compras adaptable al alto */
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-shell {
    flex: 1 1 0;
    min-height: 0;
    gap: clamp(10px, 1.4vh, 16px) !important;
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-hero {
    flex: 0 0 auto;
    padding: clamp(10px, 1.5vh, 16px) 18px !important;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-hero-head {
    margin-bottom: clamp(8px, 1.2vh, 14px) !important;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-kpi {
    padding: clamp(8px, 1.1vh, 12px) 14px !important;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-kpi-val {
    font-size: clamp(18px, 2.7vh, 24px) !important;
    margin-top: 2px !important;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-compras-dual-grid {
    flex: 1 1 0;
    min-height: 0;
    gap: 14px;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-panel {
    height: 100%;
    min-height: 0;
    padding: clamp(10px, 1.5vh, 16px);
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-panel-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-panel-header {
    flex: 0 0 auto;
    margin-bottom: clamp(8px, 1.1vh, 12px);
    padding-bottom: clamp(6px, 0.9vh, 10px);
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-bonus-hist-pane:not([style*="display: none"]) {
    flex: 1 1 0;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-purchases-table-wrap {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
  #players-cards-grid[data-profile-subtab="compras"] table.scoreboard.profile-purchases-table th,
  #players-cards-grid[data-profile-subtab="compras"] table.scoreboard.profile-purchases-table td {
    padding: clamp(5px, 0.9vh, 8px) 10px;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-panes-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 8px;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-list {
    gap: clamp(4px, 0.75vh, 8px);
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-match-row {
    padding: clamp(5px, 0.85vh, 9px) 11px;
  }
  #players-cards-grid[data-profile-subtab="compras"] .profile-eco-mode-bar {
    flex: 0 0 auto;
    padding-top: clamp(6px, 0.9vh, 10px);
  }

  /* 3. Estadísticas de Perfil y Estadísticas dentro de Amigos adaptables al alto */
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-detailed-card,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-detailed-card,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="estadisticas"] .profile-detailed-card {
    flex: 1 1 0;
    min-height: 0;
    padding: clamp(10px, 1.4vh, 18px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-subtab-content,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-subtab-content,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="estadisticas"] .profile-subtab-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    gap: clamp(8px, 1.25vh, 16px);
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-top-unified-grid,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-top-unified-grid,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="estadisticas"] .profile-top-unified-grid {
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(10px, 1.2vw, 14px);
    margin-bottom: 0;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-top-unified-grid .profile-mode-card,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-top-unified-grid .profile-mode-card {
    padding: clamp(10px, 1.3vh, 14px) 14px;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-dual-unified-grid,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-dual-unified-grid,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="estadisticas"] .profile-dual-unified-grid {
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 1.2vw, 14px);
    margin: 0;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] #profile-gauge-unified-card,
  #players-cards-grid[data-profile-subtab="estadisticas"] #profile-matrix-unified-card,
  #players-cards-grid[data-profile-subtab="rendimiento"] #profile-gauge-unified-card,
  #players-cards-grid[data-profile-subtab="rendimiento"] #profile-matrix-unified-card,
  #players-cards-grid[data-profile-subtab="amigos"] #profile-gauge-unified-card,
  #players-cards-grid[data-profile-subtab="amigos"] #profile-matrix-unified-card {
    height: 100%;
    min-height: 0;
    padding: clamp(10px, 1.3vh, 16px);
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-gauge-center-wrap,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-gauge-center-wrap,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-gauge-center-wrap {
    min-height: 0 !important;
    padding: clamp(4px, 1vh, 14px) 0 !important;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-matrix-card-head,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-matrix-card-head,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-matrix-card-head {
    flex: 0 0 auto;
    margin-bottom: clamp(6px, 0.9vh, 12px) !important;
    padding-bottom: clamp(5px, 0.7vh, 8px) !important;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-matrix-mode-bar,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-matrix-mode-bar,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-matrix-mode-bar {
    flex: 0 0 auto;
    margin-bottom: clamp(6px, 0.9vh, 12px) !important;
    gap: 6px !important;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-matrix-panes-wrap,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-matrix-panes-wrap,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-matrix-panes-wrap {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-matrix-table th,
  #players-cards-grid[data-profile-subtab="estadisticas"] .profile-matrix-table td,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-matrix-table th,
  #players-cards-grid[data-profile-subtab="rendimiento"] .profile-matrix-table td,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-matrix-table th,
  #players-cards-grid[data-profile-subtab="amigos"] .profile-matrix-table td {
    padding: clamp(4px, 0.8vh, 9px) 10px;
  }

  /* 4. Amigos: barra vertical a la derecha + contenido a alto completo a la izquierda */
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shell {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row-reverse;
    gap: 14px;
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card {
    flex: 0 0 212px;
    width: 212px;
    height: 100%;
    min-height: 0;
    margin-bottom: 0 !important;
    padding: 12px 10px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    box-sizing: border-box;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-head {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px !important;
    margin-bottom: 0 !important;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e293b;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-title {
    justify-content: center;
    text-align: center;
    font-size: 13px !important;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-nav-arrows {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px !important;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-nav-arrows .btn {
    padding: 4px 6px !important;
    font-size: 11px !important;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-subtabs {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-subtabs .btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .profile-avatars-shelf {
    flex: 1 1 0;
    min-height: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    padding: 2px 2px 4px 2px;
    gap: 5px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .profile-avatar-btn {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.55);
    box-sizing: border-box;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .profile-avatar-btn:hover {
    transform: translateX(-2px);
    background: rgba(255, 255, 255, 0.06);
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .profile-avatar-btn.active {
    transform: none;
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.12);
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .avatar-round-frame {
    width: 34px;
    height: 34px;
    font-size: 15px;
    flex-shrink: 0;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-shelf-card .avatar-btn-name {
    font-size: 13px;
    text-align: left;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="estadisticas"] .profile-top-unified-grid .profile-mode-card {
    padding: clamp(9px, 1.3vh, 14px) 14px;
  }
  #players-cards-grid[data-profile-subtab="estadisticas"] .tower-chip-grid,
  #players-cards-grid[data-profile-subtab="rendimiento"] .tower-chip-grid,
  #players-cards-grid[data-profile-subtab="amigos"] .tower-chip-grid {
    max-height: 86px !important;
    margin-top: 6px !important;
  }
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="medallero"],
  #players-cards-grid[data-profile-subtab="amigos"] .profile-friends-body[data-friend-subtab="titulos"] {
    overflow-y: auto;
    padding-right: 4px;
  }

  /* 5. Tienda Oficial adaptable al alto completo de pantalla en PC sin scrollbar externo */
  #tab-tienda > .card {
    height: calc(100dvh - 32px);
    min-height: 500px;
    margin-bottom: 0;
    padding: clamp(10px, 1.4vh, 18px) clamp(14px, 1.6vw, 22px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
  }
  #tab-tienda .store-hero-header {
    flex: 0 0 auto;
    padding: 0 10px clamp(6px, 1vh, 10px) 10px !important;
    margin-bottom: clamp(8px, 1.2vh, 14px) !important;
  }
  #tab-tienda .store-hero-header img {
    max-height: clamp(44px, 7.5vh, 72px) !important;
  }
  #tab-tienda .store-bonus-cards-grid {
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: clamp(10px, 1.2vw, 16px) !important;
    margin-bottom: clamp(8px, 1.2vh, 14px) !important;
    align-items: stretch;
  }
  #tab-tienda .bonus-card-container {
    height: 100%;
    min-height: 0;
    padding: clamp(8px, 1.1vh, 14px) 12px !important;
    overflow: hidden;
    box-sizing: border-box;
  }
  #tab-tienda .bonus-card-container > div:first-child {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  #tab-tienda .bonus-card-container > div:last-child {
    flex: 0 0 auto;
    width: 100%;
  }
  #tab-tienda .bonus-img-wrapper {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(3px, 0.6vh, 8px);
    padding: 2px;
  }
  #tab-tienda .bonus-card-art {
    max-height: 100%;
    max-width: min(140px, 100%);
    width: auto;
    height: auto;
    object-fit: contain;
  }
  #tab-tienda .bonus-card-container h3 {
    flex: 0 0 auto;
    font-size: clamp(14px, 2vh, 17px) !important;
    margin-bottom: 1px !important;
  }
  #tab-tienda .bonus-card-price {
    flex: 0 0 auto;
    font-size: clamp(16px, 2.3vh, 21px) !important;
    margin: 1px 0 !important;
  }
  #tab-tienda .bonus-card-container p {
    font-size: clamp(10.5px, 1.45vh, 12px) !important;
    line-height: 1.3 !important;
    margin-top: clamp(4px, 0.7vh, 8px) !important;
    margin-bottom: clamp(5px, 0.8vh, 9px) !important;
  }
  #tab-tienda #store-player-wallet-bar {
    flex: 0 0 auto;
    padding: clamp(7px, 1vh, 11px) 14px;
    margin-bottom: clamp(8px, 1.1vh, 12px) !important;
  }
  #tab-tienda #store-recaudacion-compact {
    flex: 0 0 auto;
    margin-top: 0;
    padding: clamp(7px, 1vh, 11px) 14px;
  }
  #tab-tienda .store-recaudacion-head {
    margin-bottom: clamp(4px, 0.7vh, 8px);
  }
  #tab-tienda .store-rec-kpi {
    padding: clamp(5px, 0.8vh, 8px) 10px;
  }
}








