/* The Daily Throne — identidad visual
   Papel marfil, tinta cálida, latón apagado y un único acento burdeos.
   Tipografías: Cormorant Garamond (titulares y frase), Manrope (interfaz), Mrs Saint Delafield (firma). */

:root {
  --paper: #f5f0e6;
  --paper-deep: #ece4d4;
  --sheet: #fbf8f1;
  --ink: #1d1b18;
  --ink-2: #48433b;
  --muted: #8a8274;
  --rule: #d6cbb6;
  --brass: #9a7a3f;
  --oxblood: #6b1e28;
  --good: #2f5d3a;
  --bad: #8c2a2a;

  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --script: 'Mrs Saint Delafield', 'Brush Script MT', cursive;

  --measure: 44rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.6 var(--sans);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brass); }
::selection { background: #e7d8b6; }

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------ Cabecera */

.masthead { text-align: center; padding-top: 4px; }
.mast-bar {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.lang { display: flex; align-items: center; gap: 6px; }
.lang button {
  font: inherit; letter-spacing: inherit; color: var(--muted);
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--ink); border-bottom: 1px solid var(--ink); }

.wordmark {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 28px 0 6px; text-decoration: none; color: var(--ink);
}
.wordmark .crown { width: 44px; height: 28px; color: var(--brass); }
.wordmark span {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(30px, 7vw, 46px); line-height: 1; letter-spacing: 0.01em;
}
.motto {
  margin: 12px auto 4px; max-width: 30rem;
  font-family: var(--serif); font-style: italic; font-size: clamp(19px, 4.6vw, 23px); color: var(--ink);
}
.submotto {
  margin: 0 auto 22px; max-width: 26rem;
  font-size: 12.5px; letter-spacing: 0.06em; color: var(--muted);
}
.double-rule { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); height: 4px; }

/* ------------------------------------------------------------------ Trono */

.throne { text-align: center; padding: 48px 0 36px; min-height: 300px; }
.eyebrow {
  margin: 0 0 28px; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--oxblood);
}
.loading { color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 20px; }

.sentence {
  margin: 0 auto; max-width: 38rem;
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(30px, 6.4vw, 50px); line-height: 1.18; letter-spacing: -0.005em;
  overflow-wrap: anywhere; hyphens: auto; text-wrap: balance;
}
.sentence::before, .sentence::after { color: var(--brass); font-style: normal; }
/* El tachón: una línea de tinta que recorre la frase línea a línea (empieza con ancho 0). */
.sentence-text {
  background: linear-gradient(var(--oxblood), var(--oxblood)) no-repeat 0 58% / 0% 0.07em;
}

/* Sello de coronación: se estampa junto a la firma unos segundos cuando alguien toma el trono
   en directo. Sin fondo, como tinta sobre el papel, para no tapar nada. */
.autograph { position: relative; }
.seal {
  position: absolute; top: 6px; left: calc(50% + 100px); z-index: 3; width: 96px; height: 96px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--oxblood); background: transparent; mix-blend-mode: multiply;
  border: 2px solid var(--oxblood); box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px var(--oxblood);
  transform: rotate(-14deg); opacity: .92; pointer-events: none;
}
.seal svg { width: 34px; height: 22px; }
.seal span { font: 700 9px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; }
.sentence::before { content: '“'; margin-right: 0.04em; }
.sentence::after { content: '”'; margin-left: 0.02em; }

.autograph { margin: 30px auto 0; display: flex; flex-direction: column; align-items: center; }
.signature { height: 96px; display: flex; align-items: center; justify-content: center; }
.signature svg { height: 96px; width: auto; max-width: 320px; transform: rotate(-3deg); }
.signature svg path { fill: none; stroke: var(--ink); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; }
.script {
  display: inline-block; font-family: var(--script); font-weight: 400;
  font-size: clamp(40px, 11vw, 58px); line-height: 1.1; color: var(--ink); transform: rotate(-4deg); padding: 0 12px;
  white-space: nowrap; max-width: 100%;
}
.attribution {
  margin: 6px 0 0; padding-top: 8px; min-width: 180px; border-top: 1px solid var(--rule);
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2);
}
.tribute { margin: 18px 0 0; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); }

.vacant-title { margin: 0; font-family: var(--serif); font-style: italic; font-size: clamp(32px, 6vw, 46px); line-height: 1.2; }
.vacant-text { margin: 12px auto 0; max-width: 26rem; color: var(--ink-2); }

/* ------------------------------------------------------------------ Tomar el trono */

.claim { border-top: 1px solid var(--rule); padding: 28px 0 8px; text-align: center; }
.claim-grid { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; }
.claim-cell { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.claim-cell + .claim-cell { border-left: 1px solid var(--rule); }
.label { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.price { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.1; }
.countdown { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }

.reset-note { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Defensas del rey: una muralla de 8 tramos (15 min cada uno) que se vacía en 2 h. */
.siege { margin: -4px 0 22px; text-align: left; }
.siege-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.siege-state { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); text-align: right; }
.siege-track { position: relative; height: 8px; background: var(--paper-deep); border: 1px solid var(--rule); overflow: hidden; }
.siege-track::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 2px), var(--paper) calc(12.5% - 2px) 12.5%);
}
.siege-fill {
  display: block; height: 100%; width: 100%; background: var(--brass);
  transform-origin: left center; transform: scaleX(1); transition: transform 1s linear, background-color .4s ease;
}
.siege.is-low .siege-fill { background: var(--oxblood); }
.siege.is-low .siege-state, .siege.is-down .siege-state { color: var(--oxblood); }

.btn-link.is-mine {
  display: block; width: 100%; margin-top: 10px; padding: 15px 20px;
  border: 1px solid var(--ink); border-radius: 2px; text-decoration: none;
  font-weight: 600; color: var(--ink); letter-spacing: 0.18em;
}
.btn-link.is-mine:hover { background: var(--sheet); }

.btn {
  display: block; width: 100%; font: 600 13px/1 var(--sans); letter-spacing: 0.18em; text-transform: uppercase;
  border-radius: 2px; cursor: pointer; transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
.btn-primary { background: var(--ink); color: var(--sheet); border: 1px solid var(--ink); padding: 18px 20px; }
.btn-primary:hover { background: #000; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-link {
  background: none; border: 0; padding: 14px 4px; cursor: pointer;
  font: 500 12px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px;
}
.btn-link:hover { text-decoration-color: var(--brass); }
.btn-link.small { padding: 0; font-size: 10.5px; }

/* ------------------------------------------------------------------ Banner de cookies */

.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 24px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--sheet); border-top: 1px solid var(--ink);
  box-shadow: 0 -10px 30px -22px rgba(40, 30, 10, .5);
}
.consent-text {
  margin: 0; max-width: 46rem; flex: 1 1 22rem;
  font-size: 13px; line-height: 1.55; color: var(--ink-2);
}
.consent-text a { color: var(--ink); }
/* Aceptar y rechazar, exactamente igual de visibles: mismo tamaño y mismo contraste. */
.consent-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.consent-actions .btn-small { min-width: 132px; }

@media (max-width: 560px) {
  .consent { flex-direction: column; align-items: stretch; text-align: left; gap: 12px; }
  /* En columna, el flex-basis afecta a la ALTURA: hay que anularlo o el banner se come la pantalla. */
  .consent-text { flex: 0 0 auto; max-width: none; }
  .consent-actions { justify-content: stretch; }
  .consent-actions .btn-small { flex: 1; min-width: 0; }
}

/* ------------------------------------------------------------------ Denunciar */

.report { margin: 26px 0 0; text-align: center; }
.report .btn-link.small { color: var(--muted); }
.report .btn-link.small:hover { color: var(--ink-2); }
.report-panel {
  margin: 12px auto 0; max-width: 26rem; padding: 16px 18px 14px; text-align: left;
  background: var(--sheet); border: 1px solid var(--rule);
}
.report-panel .field { margin: 0; }
.report-panel .error { margin: 8px 0 0; }
.report-actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.report-actions .btn-small { width: auto; flex: none; }
.btn-small {
  background: var(--ink); color: var(--sheet); border: 1px solid var(--ink);
  padding: 11px 18px; font: 600 11px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  border-radius: 2px; cursor: pointer;
}
.btn-small:hover { background: #000; }
.btn-small:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------ Formulario (la "carta") */

.letter {
  margin: 24px 0 8px; padding: 28px 22px 22px; background: var(--sheet);
  border: 1px solid var(--rule); box-shadow: 0 1px 0 var(--rule), 0 18px 40px -28px rgba(40, 30, 10, .35);
}
.letter-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule); padding-bottom: 12px; margin-bottom: 8px; }
.letter-head h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 26px; }
.btn-close { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }

.field { display: block; margin: 18px 0 0; }
.field > span, .field-head > span { display: block; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
input, textarea {
  display: block; width: 100%; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--rule);
  background: transparent; color: var(--ink); font: 400 16px/1.4 var(--sans); border-radius: 0;
}
textarea { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.35; resize: vertical; }
input:focus, textarea:focus { outline: none; border-bottom-color: var(--ink); }
.counter { display: block; text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }
.counter.over { color: var(--bad); }

.sigpad { position: relative; border: 1px solid var(--rule); background: #fffdf8; aspect-ratio: 10 / 3; touch-action: none; }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; z-index: 2; }
.sig-line { position: absolute; left: 8%; right: 8%; bottom: 26%; border-bottom: 1px solid var(--rule); }
.sig-x { position: absolute; left: 4%; bottom: 25%; color: var(--muted); font-size: 16px; }
.sig-preview {
  position: absolute; left: 0; right: 0; bottom: 24%; text-align: center; z-index: 1; pointer-events: none;
  font-family: var(--script); font-size: clamp(34px, 9vw, 58px); line-height: 1; color: #c9bfae;
}
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--ink); }
.note { margin: 18px 0 0; padding: 12px 14px; background: var(--paper); border-left: 2px solid var(--brass); font-size: 13px; color: var(--ink-2); }
.error { color: var(--bad); font-size: 13px; min-height: 1.2em; margin: 12px 0; }
.status { margin: 16px 0 0; padding: 14px; text-align: center; font-family: var(--serif); font-size: 20px; font-style: italic; border: 1px solid var(--rule); }
.status.good { color: var(--good); border-color: #b9ccb9; }
.status.bad { color: var(--bad); border-color: #dcbcbc; }
#payment-element { margin: 20px 0 8px; }

/* ------------------------------------------------------------------ Salón de los Reyes */

.section-title { margin: 56px 0 4px; text-align: center; font-family: var(--serif); font-weight: 500; font-size: 30px; }
.section-sub { margin: 0 0 26px; text-align: center; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.tabs { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 6px 0 4px; color: var(--muted); }
.tab {
  background: none; border: 0; cursor: pointer; padding: 4px 2px; color: var(--muted);
  font: 500 11px var(--sans); letter-spacing: 0.18em; text-transform: uppercase;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom: 1px solid var(--ink); }
.hall-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.rank { font-family: var(--serif); font-size: 20px; color: var(--brass); margin-right: 10px; }
.hall-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.hall-text { margin: 0; font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.hall-sig { grid-row: span 2; align-self: center; text-align: right; }
.hall-sig svg { height: 44px; width: auto; max-width: 140px; transform: rotate(-3deg); }
.hall-sig svg path { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.hall-sig .script { font-size: 32px; padding: 0; }
.hall-meta { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hall-meta .now { color: var(--oxblood); }
.hall-empty { text-align: center; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 18px; }

/* ------------------------------------------------------------------ Guerra de Tronos */

.war {
  display: inline-flex; align-items: center; gap: 8px; margin: -12px auto 26px; padding: 7px 14px;
  border: 1px solid var(--oxblood); color: var(--oxblood); border-radius: 2px;
  font: 600 10.5px/1.35 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; text-align: left;
}
.war svg { width: 16px; height: 16px; flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .war:not([hidden]) { animation: war-pulse 2.4s ease-in-out infinite; }
  @keyframes war-pulse { 50% { background: rgba(107, 30, 40, .07); } }
}

/* El primer rey de la historia, fijo arriba en Campeones */
.hall-first { background: var(--sheet); padding-left: 14px; padding-right: 14px; border-left: 2px solid var(--brass); }

/* ------------------------------------------------------------------ Crónica de batallas */

.chronicle-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.chronicle-list li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.chron-when {
  padding-top: 4px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.chron-text { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--ink-2); }
.chron-text strong { font-weight: 600; font-style: italic; color: var(--ink); }

/* ------------------------------------------------------------------ Reglas */

.rules-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.rules-list li { display: flex; gap: 14px; }
.rules-list .num { font-family: var(--serif); font-size: 22px; color: var(--brass); min-width: 26px; line-height: 1.2; }
.rules-list p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ------------------------------------------------------------------ Pie */

.colophon { margin-top: 64px; text-align: center; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.colophon .double-rule { margin-bottom: 18px; }
.colophon p { margin: 6px 0; }
.small { font-size: 11px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--sheet); padding: 12px 18px; font-size: 13px; max-width: 90vw; border-radius: 2px;
}

/* ------------------------------------------------------------------ Páginas legales */

.legal { max-width: var(--measure); margin: 0 auto; padding: 0 20px 48px; }
.legal h1 { font-family: var(--serif); font-weight: 500; font-size: 36px; margin: 28px 0 8px; }
.legal h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 28px 0 6px; }
.legal h3 { font-family: var(--sans); font-weight: 600; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); margin: 20px 0 4px; }
.legal p, .legal li { color: var(--ink-2); }
.legal .draft { background: var(--sheet); border-left: 2px solid var(--oxblood); padding: 12px 14px; font-size: 13px; }

/* ------------------------------------------------------------------ Móvil */

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .page { padding-left: 16px; padding-right: 16px; }
  .throne { padding: 36px 0 28px; }
  .price, .countdown { font-size: 28px; }
  .field-row { grid-template-columns: 1fr; }
  .letter { padding: 22px 16px 18px; margin-left: -4px; margin-right: -4px; }
  .rules-list { grid-template-columns: 1fr; }
  .hall-item { grid-template-columns: 1fr; }
  .hall-sig { grid-row: auto; text-align: left; }
  .chronicle-list li { grid-template-columns: 1fr; gap: 2px; }
  .seal { width: 78px; height: 78px; top: 10px; left: calc(50% + 92px); }
  .seal svg { width: 28px; height: 18px; }
}

@media (prefers-reduced-motion: no-preference) {
  .throne figure:not([hidden]) { animation: rise .6s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  /* Coronación en directo: la frase vieja se tacha, línea a línea, y cae... */
  .is-falling .sentence-text { animation: strike .5s cubic-bezier(.6, 0, .4, 1) forwards; }
  .is-falling .sentence, .is-falling .autograph, .is-falling .tribute { animation: fall .45s .55s ease-in forwards; }
  @keyframes strike { to { background-size: 100% 0.07em; } }
  @keyframes fall { to { opacity: 0; transform: translateY(14px) rotate(-1.2deg); filter: blur(1px); } }

  /* ...y la nueva se estampa, con el sello. */
  .is-stamping .sentence { animation: stamp .6s cubic-bezier(.2, .9, .3, 1.15) both; }
  .is-stamping .autograph, .is-stamping .tribute { animation: rise .6s .45s ease both; }
  @keyframes stamp {
    0% { opacity: 0; transform: scale(1.12); filter: blur(3px); }
    60% { opacity: 1; transform: scale(.985); filter: blur(0); }
    100% { opacity: 1; transform: none; filter: none; }
  }
  .seal.is-on { animation: seal-in .5s .65s cubic-bezier(.3, 1.5, .5, 1) both; }
  .seal.is-off { animation: seal-out .7s ease forwards; }
  @keyframes seal-in { from { opacity: 0; transform: scale(2.2) rotate(-28deg); } to { opacity: .92; transform: scale(1) rotate(-14deg); } }
  @keyframes seal-out { from { opacity: .92; transform: scale(1) rotate(-14deg); } to { opacity: 0; transform: scale(1.04) rotate(-14deg); } }

  /* Defensas casi caídas: la muralla parpadea. */
  .siege.is-low .siege-fill { animation: siege-pulse 1.6s ease-in-out infinite; }
  @keyframes siege-pulse { 50% { opacity: .55; } }
}
