/*
 * Piel medieval: se carga al final de cada página.
 * Solo toca aspecto (fondos, bordes, tipografía, sombras); no cambia tamaños ni layout del juego.
 */

/* ---------- Base ---------- */

body {
  font-family: var(--font-ui);
}

body:not(.host):not(.play) {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(200, 50, 31, 0.14), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(217, 180, 90, 0.08), transparent 50%),
    linear-gradient(180deg, rgba(15, 11, 8, 0.82), rgba(15, 11, 8, 0.94)),
    var(--tex-stone) 0 0 / 420px repeat,
    var(--ink);
}

a {
  color: var(--gold);
  transition: color 0.15s ease;
}

a:hover {
  color: var(--gold-hi);
}

.muted {
  color: var(--bone-dim);
}

/* ---------- Botones: placas de hierro y sellos de lacre ---------- */

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cream);
  border: 1px solid rgba(217, 180, 90, 0.5);
  background:
    radial-gradient(circle at 7px 50%, rgba(243, 213, 138, 0.55) 0 1.6px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) 50%, rgba(243, 213, 138, 0.55) 0 1.6px, transparent 2.2px),
    linear-gradient(180deg, #4a3b2d 0%, #2b2119 48%, #1b140e 100%);
  box-shadow: var(--shadow-inset), 0 6px 16px rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
  border-color: var(--gold-hi);
  filter: brightness(1.12);
  box-shadow: var(--shadow-inset), 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(217, 180, 90, 0.18);
}

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

.btn-primary {
  color: #fff3e0;
  border-color: rgba(243, 213, 138, 0.75);
  background:
    radial-gradient(circle at 7px 50%, rgba(255, 220, 160, 0.7) 0 1.6px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) 50%, rgba(255, 220, 160, 0.7) 0 1.6px, transparent 2.2px),
    linear-gradient(180deg, #b8352a 0%, #8f1d16 52%, #5c120d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 210, 180, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 8px 22px rgba(122, 30, 22, 0.45);
}

.btn-ghost {
  background: rgba(15, 11, 8, 0.35);
  border-color: rgba(217, 180, 90, 0.38);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(217, 180, 90, 0.1);
}

.btn-teal {
  color: #f1fbe9;
  border-color: rgba(185, 214, 168, 0.55);
  background: linear-gradient(180deg, #5f8f6c 0%, #3d6249 55%, #26402f 100%);
}

.btn:disabled,
.btn[disabled] {
  filter: grayscale(0.5) brightness(0.8);
}

/* Botones compactos del móvil: sin remaches para no tapar el texto */
body.play .btn {
  background: linear-gradient(180deg, #4a3b2d 0%, #2b2119 48%, #1b140e 100%);
}

body.play .btn-primary {
  background: linear-gradient(180deg, #b8352a 0%, #8f1d16 52%, #5c120d 100%);
}

body.play .btn-ghost {
  background: rgba(15, 11, 8, 0.35);
}

body.play .btn-teal {
  background: linear-gradient(180deg, #5f8f6c 0%, #3d6249 55%, #26402f 100%);
}

.play .cmd-board .btn,
.play .attack-list .btn,
.play .inventory-list .btn,
.play .attack-opt,
.play .inv-opt {
  font-family: var(--font-ui);
  letter-spacing: 0.02em;
}

/* ---------- Paneles: madera oscura con marco tallado ---------- */

.panel,
.card-step,
.setup-card,
.settings-card,
.auth-card,
.closed-session-card,
.inspect-panel,
.narrative-panel,
.heroes-panel,
.side-panel {
  background:
    url('../assets/theme/corner.svg') top 3px left 3px / var(--corner-size, 22px) no-repeat,
    url('../assets/theme/corner-tr.svg') top 3px right 3px / var(--corner-size, 22px) no-repeat,
    url('../assets/theme/corner-bl.svg') bottom 3px left 3px / var(--corner-size, 22px) no-repeat,
    url('../assets/theme/corner-br.svg') bottom 3px right 3px / var(--corner-size, 22px) no-repeat,
    linear-gradient(180deg, rgba(40, 29, 19, 0.96), rgba(20, 14, 9, 0.97)),
    var(--tex-stone) 0 0 / 360px repeat;
  border: 1px solid rgba(217, 180, 90, 0.42);
  box-shadow:
    inset 0 0 0 3px rgba(10, 7, 5, 0.65),
    inset 0 0 0 4px rgba(217, 180, 90, 0.16),
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    var(--shadow);
}

.section-title,
.host-brand {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.setup-card h2,
.settings-card h2,
.auth-card h2 {
  font-family: var(--font-display);
  color: var(--gold-hi);
  letter-spacing: 0.04em;
}

.tag {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, rgba(143, 29, 22, 0.55), rgba(92, 18, 13, 0.55));
  border-color: rgba(217, 180, 90, 0.45);
  color: var(--gold-hi);
}

.page-kicker,
.poke-hint {
  color: var(--gold);
}

/* ---------- Campos: grabados en cuero ---------- */

.field {
  color: var(--bone-dim);
  font-family: var(--font-ui);
}

.field input,
.field select,
.field textarea,
input[type='text'],
input[type='email'],
input[type='password'],
textarea,
select {
  background: linear-gradient(180deg, rgba(8, 5, 3, 0.65), rgba(24, 17, 11, 0.65));
  border: 1px solid rgba(217, 180, 90, 0.35);
  color: var(--bone);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(217, 180, 90, 0.55);
  outline-offset: 1px;
  border-color: var(--gold);
}

/* ---------- Barras de vida ---------- */

.hp-bar {
  background: linear-gradient(180deg, #120c08, #24180f);
  border: 1px solid rgba(217, 180, 90, 0.45);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.hp-bar > span {
  background: linear-gradient(180deg, #e0573f 0%, #a0261b 55%, #6e140e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 190, 160, 0.4);
}

/* ---------- Navegación y pie del sitio ---------- */

.site-nav {
  background:
    linear-gradient(180deg, rgba(36, 25, 16, 0.97), rgba(18, 12, 8, 0.95)),
    var(--tex-stone) 0 0 / 360px repeat;
  border-bottom: 1px solid rgba(217, 180, 90, 0.35);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.35);
}

.site-nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 14px;
  background: var(--divider) center / 420px 28px no-repeat;
  pointer-events: none;
  opacity: 0.85;
}

.site-nav-brand {
  font-family: var(--font-deco);
  color: var(--gold-hi);
  letter-spacing: 0.04em;
}

.site-nav-brand img,
.site-footer-brand img {
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 2px rgba(10, 7, 5, 0.8), 0 4px 14px rgba(0, 0, 0, 0.5);
}

.site-nav-links a {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-dim);
  padding: 0.35rem 0.15rem;
  border-bottom: 1px solid transparent;
}

.site-nav-links a:hover,
.site-nav-links a.is-active {
  color: var(--gold-hi);
  border-bottom-color: var(--gold);
}

.site-account-login {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  border-color: rgba(217, 180, 90, 0.55);
  background: linear-gradient(180deg, rgba(143, 29, 22, 0.55), rgba(92, 18, 13, 0.55));
  color: var(--gold-hi);
}

.site-account-login:hover {
  border-color: var(--gold-hi);
  color: #fff3e0;
}

.site-account-menu.is-open .site-account-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(217, 180, 90, 0.35);
}

.site-nav-toggle {
  font-family: var(--font-display);
  border-color: rgba(217, 180, 90, 0.45);
  color: var(--gold-hi);
}

.site-footer {
  position: relative;
  background:
    url('../assets/theme/crest.svg') right 6% top 2.2rem / 70px no-repeat,
    linear-gradient(180deg, rgba(24, 17, 11, 0.92), rgba(10, 7, 5, 0.98)),
    var(--tex-stone) 0 0 / 360px repeat;
  border-top: 1px solid rgba(217, 180, 90, 0.35);
}

@media (max-width: 1240px) {
  .site-footer {
    background:
      linear-gradient(180deg, rgba(24, 17, 11, 0.92), rgba(10, 7, 5, 0.98)),
      var(--tex-stone) 0 0 / 360px repeat;
  }
}

.site-footer::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 28px;
  background: var(--divider) center / 420px 28px no-repeat;
}

.site-footer h3 {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--gold);
}

.site-footer a:hover {
  color: var(--gold-hi);
}

.cookie-banner {
  background:
    linear-gradient(180deg, rgba(40, 29, 19, 0.98), rgba(18, 12, 8, 0.98));
  border-top: 2px solid rgba(217, 180, 90, 0.45);
}

/* ---------- Páginas de contenido: pergamino ---------- */

.content-page .page-shell,
.legal-page .page-shell {
  position: relative;
  max-width: 900px;
  margin: 2.5rem auto 3rem;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.35rem, 5vw, 3.75rem);
  color: var(--sepia);
  background:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(110, 75, 30, 0.35) 100%),
    var(--tex-parchment) 0 0 / 512px repeat,
    var(--parchment);
  border: 1px solid #b89a63;
  box-shadow:
    inset 0 0 0 6px rgba(233, 220, 192, 0.6),
    inset 0 0 0 7px rgba(138, 100, 32, 0.45),
    0 24px 60px rgba(0, 0, 0, 0.6);
}

.content-page .page-shell::before,
.content-page .page-shell::after,
.legal-page .page-shell::before,
.legal-page .page-shell::after {
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  height: 18px;
  background: linear-gradient(180deg, #9a7a46, #6b4f26 60%, #4a3418);
  border-radius: 9px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.content-page .page-shell::before,
.legal-page .page-shell::before {
  top: -9px;
}

.content-page .page-shell::after,
.legal-page .page-shell::after {
  bottom: -9px;
}

.content-page .page-shell h1,
.legal-page .page-shell h1 {
  font-family: var(--font-deco);
  color: var(--crimson);
  text-shadow: none;
}

.content-page .page-shell h2,
.legal-page .page-shell h2 {
  font-family: var(--font-display);
  color: var(--sepia);
  padding-bottom: 0.45rem;
  background: linear-gradient(90deg, rgba(138, 100, 32, 0.55), transparent) bottom left / 100% 1px no-repeat;
}

.content-page .page-shell p,
.content-page .page-shell li,
.legal-page .page-shell p,
.legal-page .page-shell li {
  color: var(--sepia);
  font-size: 1.08rem;
}

.content-page .page-shell a:not(.btn),
.legal-page .page-shell a:not(.btn) {
  color: var(--crimson);
  text-decoration: underline;
  text-decoration-color: rgba(143, 29, 22, 0.35);
  text-underline-offset: 3px;
}

.content-page .page-shell .muted,
.legal-page .page-shell .muted {
  color: var(--sepia-soft);
  opacity: 1;
}

.content-page .page-shell .page-kicker,
.legal-page .page-shell .page-kicker {
  color: var(--gold-deep);
}

.content-page .page-shell .faq-item {
  background: rgba(255, 248, 230, 0.35);
  border: 1px solid rgba(138, 100, 32, 0.4);
}

.content-page .page-shell .faq-item h3 {
  color: var(--crimson);
}

.content-page .page-shell .faq-item p {
  color: var(--sepia);
}

.content-page .page-shell img,
.legal-page .page-shell img {
  border: 3px solid #7a5a2c !important;
  box-shadow: 0 8px 20px rgba(59, 42, 26, 0.35);
}

.content-page .page-shell .btn-ghost,
.legal-page .page-shell .btn-ghost {
  color: var(--sepia);
  background: rgba(255, 248, 230, 0.35);
  border-color: rgba(122, 90, 44, 0.6);
  text-shadow: none;
}

/* ---------- Mesa (TV) ---------- */

.host-top {
  background:
    linear-gradient(180deg, rgba(36, 25, 16, 0.96), rgba(18, 12, 8, 0.9));
  border-bottom: 1px solid rgba(217, 180, 90, 0.35);
}

.narrative-box,
.texto-narrador {
  font-family: var(--font-story);
}

.code-huge {
  font-family: var(--font-display);
  color: var(--gold-hi);
  text-shadow: 0 0 24px rgba(217, 180, 90, 0.35), 0 3px 0 rgba(0, 0, 0, 0.6);
}

.enemy-card {
  border-color: rgba(217, 180, 90, 0.35);
}

/* ---------- Héroe (móvil) ---------- */

body.play {
  --corner-size: 14px;
}

.play-top {
  background: linear-gradient(180deg, rgba(36, 25, 16, 0.94), rgba(18, 12, 8, 0.82));
  border-bottom: 1px solid rgba(217, 180, 90, 0.3);
}

.status-pill {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

.poke-frame,
.save-popup .devour-box,
.trap-overlay .devour-box {
  border-color: rgba(217, 180, 90, 0.5);
  box-shadow: inset 0 0 0 2px rgba(10, 7, 5, 0.6), inset 0 0 0 3px rgba(217, 180, 90, 0.14), 0 10px 30px rgba(0, 0, 0, 0.45);
}

.poke-cmd {
  background:
    linear-gradient(180deg, rgba(58, 42, 28, 0.95), rgba(26, 18, 12, 0.95));
  border-color: rgba(217, 180, 90, 0.55);
  color: var(--gold-hi);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
  box-shadow: var(--shadow-inset);
}

.poke-cmd:active {
  background: linear-gradient(180deg, rgba(143, 29, 22, 0.8), rgba(92, 18, 13, 0.9));
}

.turn-alert.is-mine {
  border-color: var(--gold);
}

/* ---------- Cartógrafo y cuenta ---------- */

.builder-top,
.account-top {
  background: linear-gradient(180deg, rgba(36, 25, 16, 0.96), rgba(18, 12, 8, 0.9));
  border-bottom: 1px solid rgba(217, 180, 90, 0.35);
}

.flow-stage {
  background-color: #120d09;
}

.account-sidebar {
  background: linear-gradient(180deg, rgba(36, 25, 16, 0.85), rgba(18, 12, 8, 0.85));
}

/* ---------- Modales, botín y cartógrafo ---------- */

.settings-panel,
.ceremony-panel,
.closed-session-card,
.builder-modal-card {
  border-color: rgba(217, 180, 90, 0.45);
}

.loot-podium,
.play-rank-list,
.dungeon-card {
  border: 1px solid rgba(217, 180, 90, 0.32);
  background: linear-gradient(180deg, rgba(40, 29, 19, 0.9), rgba(18, 12, 8, 0.92));
}

.flow-node {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(217, 180, 90, 0.2);
}

.site-nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-nav-toggle,
.btn {
  min-height: 44px;
}

body.host .btn,
body.play .btn {
  min-height: 0;
}

@media (pointer: coarse) {
  body.play .poke-cmd,
  body.play .cmd-board .btn,
  body.play .attack-opt,
  body.play .inv-opt {
    min-height: 44px;
  }
}
