/* ═══════════════════════════════════════
   O REI — STYLESHEET
   Medieval illuminated manuscript aesthetic
═══════════════════════════════════════ */

:root {
  --bg:        #080604;
  --bg2:       #100c08;
  --parch:     #ede0be;
  --parch2:    #d4c49a;
  --parch3:    #b8a878;
  --ink:       #1a1008;
  --gold:      #c8a040;
  --gold2:     #e8c060;
  --gold-glow: rgba(200,160,64,0.25);
  --blood:     #8b1a1a;
  --c-igreja:  #7c3aed;
  --c-povo:    #dc2626;
  --c-exercito:#1d4ed8;
  --c-tesouro: #b45309;
  --shadow:    rgba(0,0,0,0.85);
}

/* ─── Single source of truth for visibility ─── */
.hidden { display: none !important; }

/* ─── Reset & base ─── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  opacity: .4; mix-blend-mode: overlay;
}

/* ─── Screens ─── */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}



/* ════════════════════════════════════════
   TITLE SCREEN
════════════════════════════════════════ */
#screen-title {
  background: radial-gradient(ellipse 80% 70% at 50% 40%, #1c1208 0%, #080604 100%);
  gap: 0;
}

.title-ornament {
  font-size: 3.5rem; color: var(--gold); margin-bottom: .8rem;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 20px var(--gold-glow)) drop-shadow(0 0 40px var(--gold-glow));
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-12px) rotate(2deg); }
}

.title-rule {
  width: 180px; height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: .5rem auto;
}

.title-name {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(2.8rem, 10vw, 5rem);
  color: var(--gold); letter-spacing: .25em;
  text-shadow: 0 0 40px var(--gold-glow), 0 0 80px var(--gold-glow), 2px 2px 0 rgba(0,0,0,.8);
  line-height: 1;
}

.title-subtitle {
  font-family: 'Cinzel', serif; font-size: .75rem; letter-spacing: .5em;
  color: #6a5830; text-transform: uppercase; margin-top: .6rem; margin-bottom: 2.5rem;
}

.gold-divider {
  width: 160px; height: 12px; margin-bottom: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 12'%3E%3Cpath d='M0 6 L20 6 L24 2 L28 6 L80 6 L132 6 L136 2 L140 6 L160 6' stroke='%23c8a040' stroke-width='1' fill='none' opacity='.6'/%3E%3Ccircle cx='80' cy='6' r='2.5' fill='%23c8a040' opacity='.6'/%3E%3C/svg%3E");
}

.btn-primary {
  font-family: 'Cinzel', serif; font-size: .9rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold2) 50%, var(--gold) 100%);
  border: none; padding: .8rem 2.5rem; cursor: pointer;
  clip-path: polygon(10px 0%, calc(100% - 10px) 0%, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  transition: all .2s; position: relative; overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.15); opacity: 0; transition: opacity .2s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: scale(.97); }

.title-tagline {
  position: absolute; bottom: 2rem;
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .8rem; color: #4a3820; text-align: center; padding: 0 2rem;
}

.corner {
  position: absolute; font-size: 1.5rem; color: rgba(200,160,64,.2);
}
.corner.tl { top: 1.5rem; left: 1.5rem; }
.corner.tr { top: 1.5rem; right: 1.5rem; transform: scaleX(-1); }
.corner.bl { bottom: 1.5rem; left: 1.5rem; transform: scaleY(-1); }
.corner.br { bottom: 1.5rem; right: 1.5rem; transform: scale(-1,-1); }


/* ════════════════════════════════════════
   GAME SCREEN
════════════════════════════════════════ */
#screen-game {
  background: var(--bg);
  padding: 0; justify-content: flex-start; align-items: center; gap: 0;
}

/* Screen tint during drag */
#screen-game::after {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: transparent; transition: background .15s; z-index: 0;
}
#screen-game.drag-left::after  { background: rgba(140,30,30,.12); }
#screen-game.drag-right::after { background: rgba(30,100,50,.12); }

/* ── Resource bars ── */
.resources {
  width: 100%; max-width: 500px;
  padding: 14px 20px 8px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  position: relative; z-index: 2; flex-shrink: 0;
}

.res { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.res-icon { font-size: 1rem; line-height: 1; transition: transform .3s; }
.res.pulse .res-icon { animation: res-pulse .6s ease-in-out infinite alternate; }
@keyframes res-pulse {
  from { transform: scale(1); filter: none; }
  to   { transform: scale(1.3); filter: drop-shadow(0 0 6px currentColor); }
}

.res-track {
  width: 100%; height: 5px;
  background: #1c1608; border-radius: 3px;
  border: 1px solid #2a2010;
  position: relative; overflow: visible;
}

.res-fill {
  height: 100%; border-radius: 2px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.res-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.25), transparent);
  border-radius: inherit;
}

.res-delta {
  position: absolute; right: -2px; top: -20px;
  font-family: 'Cinzel', serif; font-size: .6rem; font-weight: 700;
  opacity: 0; transition: opacity .15s; pointer-events: none; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.res-label {
  font-family: 'Cinzel', serif; font-size: .55rem; letter-spacing: .12em;
  color: #5a4820; text-transform: uppercase;
}

.res.danger .res-fill { animation: bar-danger .5s ease-in-out infinite alternate; }
@keyframes bar-danger { from { opacity: 1; } to { opacity: .4; } }

/* ── Year row ── */
.year-row {
  display: flex; align-items: center; gap: .6rem;
  padding: 2px 0 6px;
  position: relative; z-index: 2; flex-shrink: 0;
}
.year-text {
  font-family: 'Cinzel', serif; font-size: .65rem; letter-spacing: .25em;
  color: #6a5028; text-transform: uppercase;
}
.reign-badge {
  font-family: 'Cinzel', serif; font-size: .55rem; letter-spacing: .1em;
  color: #3a2810; background: #1a1208; border: 1px solid #2a2010;
  padding: 2px 8px;
}

/* ── Card area ── */
.card-area {
  flex: 1; width: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; z-index: 1;
  padding: 8px 16px;
  container-type: size;  /* enables cqh units for card */
}

/* ── The card ── */
.card {
  position: absolute;

  /* Card aspect ratio: ~310 wide × 520 tall (portrait) */
  aspect-ratio: 310 / 520;

  /*
   * Sizing strategy:
   *  - Primary: fill 88% of card-area height (cqh = container query height)
   *  - Width auto-derives from aspect-ratio
   *  - Hard caps prevent the card from going too wide or narrow
   */
  height: min(88cqh, 90%);
  width: auto;
  min-width: 260px;
  max-width: min(88vw, 520px);

  background: var(--parch);
  border: none; outline: none;
  box-shadow:
    0 0 0 1px var(--parch3),
    0 0 0 3px #8a6830,
    0 0 0 4px var(--gold),
    0 0 0 5px #8a6830,
    0 8px 40px rgba(0,0,0,.9),
    0 2px 8px rgba(0,0,0,.6);
  user-select: none; cursor: grab;
  transform-origin: center 110%;
  display: flex; flex-direction: column;
  overflow: hidden;
  container-type: inline-size;  /* enables cqw units for children */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(160,120,60,.04) 28px, rgba(160,120,60,.04) 29px),
    radial-gradient(ellipse at 20% 20%, rgba(255,240,180,.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(200,160,80,.1) 0%, transparent 50%);
}
.card:active { cursor: grabbing; }

/* Drag overlays */
.card-ol {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
.card-ol.l { background: linear-gradient(90deg,  rgba(160,30,30,.65) 0%, rgba(160,30,30,.1) 60%, transparent 100%); }
.card-ol.r { background: linear-gradient(270deg, rgba(30,110,60,.65) 0%, rgba(30,110,60,.1) 60%, transparent 100%); }

.ol-label {
  font-family: 'Cinzel', serif; font-size: clamp(.85rem, 3cqw, 1.2rem); font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.9);
  position: absolute;
}
.card-ol.l .ol-label { left: 16px; }
.card-ol.r .ol-label { right: 16px; }

/* Portrait */
.portrait {
  flex: 0 0 32%;    /* ~32% of card height — was 165px fixed */
  min-height: 130px;
  position: relative; overflow: hidden;
  background: #0e0a06;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 3px solid #8a6830;
}
.portrait-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, var(--char-bg, #1a1208) 0%, #080604 100%);
}
.portrait-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 40%, var(--char-color, rgba(200,160,64,.15)) 0%, transparent 70%);
}
.portrait-arch {
  position: absolute;
  width: 55%; height: 80%;
  border: 1px solid rgba(200,160,64,.15);
  border-radius: 50% 50% 0 0;
  bottom: 0; left: 50%; transform: translateX(-50%);
}
.char-symbol {
  position: relative; z-index: 2;
  font-size: clamp(3rem, 8cqw, 6rem);  /* scales with card width */
  line-height: 1;
  filter: drop-shadow(0 0 16px var(--char-color, rgba(200,160,64,.6)));
  transform: translateY(-8px);
}
.portrait::before, .portrait::after {
  content: '✦'; position: absolute; color: rgba(200,160,64,.2); font-size: .7rem;
}
.portrait::before { top: 6px; left: 8px; }
.portrait::after  { top: 6px; right: 8px; }
.portrait-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 45px;
  background: linear-gradient(to top, var(--parch), transparent);
  pointer-events: none; z-index: 1;
}

/* Character identity */
.char-id {
  padding: clamp(7px, 2cqh, 14px) clamp(12px, 4cqw, 22px) clamp(4px, 1.2cqh, 8px);
  border-bottom: 1px solid var(--parch3);
  text-align: center;
  background: linear-gradient(to bottom, rgba(180,140,60,.06), transparent);
}
.char-name {
  font-family: 'Cinzel', serif; font-size: clamp(1rem, 4cqw, 1.4rem); font-weight: 700;
  color: var(--ink); letter-spacing: .05em;
}
.char-title {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: clamp(.75rem, 2.8cqw, 1rem); color: #6a4820; margin-top: 1px;
}

/* Card text */
.card-body {
  flex: 1;
  padding: clamp(10px, 5cqh, 32px) clamp(12px, 5cqw, 28px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: clamp(8px, 2cqh, 18px);
}
.card-text {
  font-family: 'IM Fell English', serif;
  /* cqw = % of card width. At 400px card: 4.8cqw = 19.2px ≈ 1.2rem */
  font-size: clamp(1rem, 4.8cqw, 1.5rem);
  line-height: 1.7; color: var(--ink);
}
/* em = the quoted speech — same darkness, italic differentiates it */
.card-text em { font-style: italic; color: #1a1008; }

/* Decorative ornament inside card body, separates portrait from text visually */
.card-ornament {
  font-size: clamp(.6rem, 1.8cqw, .85rem);
  color: var(--parch3);
  letter-spacing: .4em;
  opacity: .7;
  flex-shrink: 0;
}

/* Option hints */
.card-hints {
  display: grid; grid-template-columns: 1fr 1px 1fr;
  border-top: 1px solid var(--parch3);
  background: rgba(180,140,60,.06);
}
.hint-divider { background: var(--parch3); }
.card-hint {
  padding: clamp(6px, 2cqh, 12px) 10px;
  font-family: 'Cinzel', serif; font-size: clamp(.64rem, 2.2cqw, .85rem); letter-spacing: .07em;
  color: #5a3818; text-align: center; text-transform: uppercase; line-height: 1.3;
}
.card-hint.l::before { content: '← '; opacity: .5; }
.card-hint.r::after  { content: ' →'; opacity: .5; }

/* Loading overlay */
.load-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  background: rgba(8,6,4,.9); opacity: 0; pointer-events: none; transition: opacity .35s;
}
.load-overlay.on { opacity: 1; pointer-events: all; }
.load-sym {
  font-size: 2.8rem; color: var(--gold);
  animation: load-spin 1.8s ease-in-out infinite;
}
@keyframes load-spin {
  0%   { transform: rotate(-15deg) scale(.85); opacity: .5; }
  50%  { transform: rotate(15deg)  scale(1.1); opacity: 1; }
  100% { transform: rotate(-15deg) scale(.85); opacity: .5; }
}
.load-text {
  font-family: 'Cinzel', serif; font-size: .7rem; letter-spacing: .3em;
  color: #6a5020; text-transform: uppercase;
}

/* Result banner */
#result-banner {
  /* Inside card-area (container-type: size), overlays the portrait */
  position: absolute;
  top: min(6cqh, 6%);        /* top gap = (100% - 88% card) / 2 ≈ 6% */
  left: 50%;
  transform: translateX(-50%);

  /* Match card width: card is aspect-ratio 310/520, height 88cqh  */
  /* Width ≈ 88cqh × (310/520) — use vw as practical approximation  */
  width: min(85vw, 510px);

  /* Height ≈ portrait (32% of card) = 28cqh */
  height: min(28cqh, 28%);

  /* Dark semi-transparent overlay with bottom fade */
  background: linear-gradient(
    to bottom,
    rgba(6,4,2,.92) 55%,
    rgba(6,4,2,.6)  80%,
    transparent     100%
  );

  /* Thin gold line at top for visual anchoring */
  border-top: 1px solid rgba(200,160,64,.45);

  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(.6rem, 3cqh, 1.4rem) clamp(.8rem, 3cqw, 1.6rem);
  text-align: center;

  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(.88rem, 2.8cqw, 1.15rem);
  color: var(--parch);
  line-height: 1.55;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);

  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 20;  /* above card (no explicit z-index) and card-ol (z-index 3) */
}
#result-banner.show { opacity: 1; }

/* Card animations */
@keyframes card-appear {
  from { transform: translateY(50px) scale(.93); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes fly-l { to { transform: translateX(-160%) rotate(-35deg); opacity: 0; } }
@keyframes fly-r { to { transform: translateX( 160%) rotate( 35deg); opacity: 0; } }

.card.new   { animation: card-appear .45s cubic-bezier(.2,.8,.3,1) both; }
.card.bye-l { animation: fly-l .38s cubic-bezier(.55,.05,.68,.19) forwards; }
.card.bye-r { animation: fly-r .38s cubic-bezier(.55,.05,.68,.19) forwards; }


/* ════════════════════════════════════════
   DEATH SCREEN
════════════════════════════════════════ */
#screen-death {
  background: radial-gradient(ellipse 70% 60% at 50% 35%, #1e0808 0%, #080402 100%);
  gap: 1.2rem; padding: 2rem; text-align: center;
}

.death-sym  { font-size: 3rem; opacity: .7; animation: die-in .8s ease both; }
.death-rule {
  width: 200px; height: 1px;
  background: linear-gradient(to right, transparent, var(--blood), transparent);
  animation: die-in .8s .2s ease both;
}
.death-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(1.1rem, 4vw, 1.7rem);
  color: #c03030; letter-spacing: .08em;
  text-shadow: 0 0 30px rgba(180,30,30,.4);
  animation: die-in .8s .3s ease both;
}
.death-cause {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .95rem; color: var(--parch);
  max-width: 340px; line-height: 1.7;
  animation: die-in .8s .5s ease both;
}
.death-stats {
  display: flex; gap: 2.5rem; justify-content: center;
  animation: die-in .8s .7s ease both;
}
.dstat { text-align: center; }
.dstat-val {
  font-family: 'Cinzel Decorative', cursive; font-size: 2rem;
  color: var(--gold); line-height: 1;
}
.dstat-lbl {
  font-family: 'Cinzel', serif; font-size: .6rem; letter-spacing: .18em;
  color: #5a4020; text-transform: uppercase; margin-top: 3px;
}
.death-epitaph {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .82rem; color: #4a3818; max-width: 300px;
  animation: die-in .8s .9s ease both;
}
#btn-new-reign { animation: die-in .8s 1.1s ease both; }

@keyframes die-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; background: #0a0806; }
::-webkit-scrollbar-thumb { background: #3a2810; }

/* ════════════════════════════════════════
   ACESSIBILIDADE — menu na title screen
════════════════════════════════════════ */
.btn-acessibilidade {
  margin-top: 1.2rem;
  background: none;
  border: 1px solid #3a2c14;
  color: #6a5028;
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  padding: .45rem 1.2rem;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.btn-acessibilidade:hover {
  color: var(--gold);
  border-color: #6a5028;
}

.acess-panel {
  margin-top: .6rem;
  background: #0e0a06;
  border: 1px solid #2a2010;
  padding: .9rem 1.1rem;
  width: min(320px, 88vw);
  animation: panel-in .2s ease both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}


.acess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.acess-label {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  cursor: pointer;
  flex: 1;
}
.acess-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.acess-text { display: flex; flex-direction: column; gap: 2px; }
.acess-text strong {
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--parch2);
  font-weight: 600;
}
.acess-text small {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: .68rem;
  color: #5a4820;
  line-height: 1.3;
}

/* Toggle switch */
.toggle-btn {
  flex-shrink: 0;
  width: 40px; height: 22px;
  background: #1e1810;
  border: 1px solid #3a2c14;
  border-radius: 11px;
  cursor: pointer;
  position: relative;
  transition: background .25s, border-color .25s;
  padding: 0;
}
.toggle-btn[aria-checked="true"] {
  background: #4a3810;
  border-color: var(--gold);
}
.toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #5a4820;
  border-radius: 50%;
  transition: transform .25s, background .25s;
}
.toggle-btn[aria-checked="true"] .toggle-knob {
  transform: translateX(18px);
  background: var(--gold);
}

/* ════════════════════════════════════════
   NAV BUTTONS — abaixo do card
════════════════════════════════════════ */
.nav-buttons {
  width: 100%;
  max-width: 500px;
  display: flex;
  gap: .6rem;
  padding: .6rem 16px .8rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}


.nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem .5rem;
  border: 1px solid #2a2010;
  background: #0e0a06;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background .15s, border-color .15s, transform .1s;
  clip-path: polygon(6px 0%, calc(100% - 6px) 0%, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}
.nav-btn:active { transform: scale(.96); }
.nav-btn:disabled { opacity: .35; cursor: default; }

.nav-left {
  color: #c06060;
  border-color: #3a1c1c;
}
.nav-left:hover:not(:disabled) {
  background: #1c0808;
  border-color: #6a2020;
}

.nav-right {
  color: #60a060;
  border-color: #1c3a1c;
}
.nav-right:hover:not(:disabled) {
  background: #081808;
  border-color: #206a20;
}

.nav-arrow {
  font-size: 1rem;
  line-height: 1;
  opacity: .7;
}
.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

/* ════════════════════════════════════════
   SECONDARY BUTTON
════════════════════════════════════════ */
.btn-secondary {
  font-family: 'Cinzel', serif; font-size: .75rem; letter-spacing: .15em;
  text-transform: uppercase;
  color: #8a6830;
  background: transparent;
  border: 1px solid #3a2c14;
  padding: .6rem 1.6rem; cursor: pointer;
  clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  transition: color .2s, border-color .2s, background .2s;
  margin-top: .6rem;
}
.btn-secondary:hover { color: var(--gold); border-color: #6a5028; background: rgba(200,160,64,.04); }
.btn-secondary:active { transform: scale(.97); }

/* ════════════════════════════════════════
   KING NAME BADGE — game screen year row
════════════════════════════════════════ */
.king-name-badge {
  font-family: 'Cinzel', serif; font-size: .6rem; font-weight: 600;
  letter-spacing: .14em; color: var(--gold2);
  text-shadow: 0 0 12px var(--gold-glow);
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 140px;
}

/* ════════════════════════════════════════
   DEATH SCREEN — king name
════════════════════════════════════════ */
.death-king-name {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(.9rem, 3.5vw, 1.3rem);
  color: var(--gold); letter-spacing: .12em;
  text-shadow: 0 0 20px var(--gold-glow);
  animation: die-in .8s .25s ease both;
}

/* ════════════════════════════════════════
   HISTORY SCREEN
════════════════════════════════════════ */
#screen-history {
  background: radial-gradient(ellipse 80% 70% at 50% 30%, #110e06 0%, #080604 100%);
  justify-content: flex-start;
  padding: 0;
  gap: 0;
}

.hist-title-row {
  flex-shrink: 0;
  text-align: center;
  padding: 1.6rem 1rem .8rem;
  border-bottom: 1px solid #2a2010;
  width: 100%;
}
.hist-title-ornament { font-size: 1.5rem; margin-bottom: .3rem; opacity: .6; }
.hist-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: var(--gold); letter-spacing: .1em;
}
.hist-subtitle {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .75rem; color: #5a4820; margin-top: .2rem;
}

.hist-scroll-area {
  flex: 1; width: 100%; max-width: 500px;
  overflow-y: auto; padding: .8rem 1rem;
  align-self: center;
}
.hist-scroll-area::-webkit-scrollbar { width: 3px; }
.hist-scroll-area::-webkit-scrollbar-thumb { background: #3a2810; }

.hist-empty {
  text-align: center;
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .85rem; color: #4a3818; line-height: 1.8;
  margin-top: 2rem;
}

.hist-list { display: flex; flex-direction: column; gap: .5rem; }

.hist-entry {
  background: #0e0a06;
  border: 1px solid #2a2010;
  padding: .75rem 1rem;
  position: relative;
  transition: border-color .2s;
}
.hist-entry:hover { border-color: #4a3820; }

.hist-latest {
  border-color: #4a3010;
  background: #120e06;
}
.hist-latest::before {
  content: 'último reinado';
  position: absolute; top: -1px; right: 10px;
  font-family: 'Cinzel', serif; font-size: .5rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--gold); opacity: .5;
  background: #120e06; padding: 0 4px;
}

.hist-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .35rem;
}
.hist-name {
  font-family: 'Cinzel', serif; font-size: .88rem; font-weight: 700;
  color: var(--parch); letter-spacing: .04em;
}
.hist-reign-num {
  font-family: 'Cinzel', serif; font-size: .58rem; letter-spacing: .12em;
  color: #5a4020; text-transform: uppercase;
}

.hist-stats {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .3rem;
}
.hist-stat { display: flex; align-items: baseline; gap: .25rem; }
.hist-stat-val {
  font-family: 'Cinzel Decorative', cursive; font-size: 1.05rem;
  color: var(--gold); line-height: 1;
}
.hist-stat-lbl {
  font-family: 'Cinzel', serif; font-size: .55rem; letter-spacing: .1em;
  color: #5a4020; text-transform: uppercase;
}
.hist-divider { color: #3a2810; font-size: .8rem; }

.hist-cause {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .72rem; color: #7a4020;
}

.hist-footer {
  flex-shrink: 0;
  width: 100%; max-width: 500px;
  align-self: center;
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1rem 1.2rem;
  border-top: 1px solid #2a2010;
  gap: .6rem;
}

/* ════════════════════════════════════════
   MENU ICON BUTTON (hamburger)
════════════════════════════════════════ */
.btn-menu-icon {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  background: rgba(10,8,4,.75);
  border: 1px solid #3a2c14;
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
  z-index: 10;
  clip-path: polygon(4px 0%, calc(100% - 4px) 0%, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
}
.btn-menu-icon:hover { background: rgba(30,22,10,.95); border-color: var(--gold); }
.btn-menu-icon.in-game { top: 0.4rem; right: 0.4rem; width: 32px; height: 32px; font-size: .85rem; }

/* ════════════════════════════════════════
   MENU OVERLAY + DRAWER
════════════════════════════════════════ */
.menu-overlay {
  position: fixed; inset: 0; z-index: 200;
}

.menu-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,3,2,.7);
  animation: fade-in .25s ease;
}
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.menu-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 90vw);
  background: #0c0904;
  border-left: 1px solid #2a2010;
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: slide-in .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }

.menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem .8rem;
  border-bottom: 1px solid #2a2010;
  flex-shrink: 0;
}
.menu-header-title {
  font-family: 'Cinzel', serif; font-size: .82rem; letter-spacing: .18em;
  color: var(--gold); text-transform: uppercase;
}
.menu-close {
  background: none; border: none; color: #5a4020; font-size: 1rem;
  cursor: pointer; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s;
}
.menu-close:hover { color: var(--gold); }

.menu-section {
  padding: .8rem 1.1rem;
  border-bottom: 1px solid #1a1408;
}
.menu-section-label {
  font-family: 'Cinzel', serif; font-size: .6rem; letter-spacing: .2em;
  color: #4a3818; text-transform: uppercase; margin-bottom: .6rem;
}

/* Row layout inside menu */
.menu-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .3rem 0;
}
.menu-row-lbl {
  font-family: 'Cinzel', serif; font-size: .7rem; letter-spacing: .08em;
  color: var(--parch2); flex: 1;
}
.menu-row-controls {
  display: flex; align-items: center; gap: .5rem;
}

/* Volume sliders */
.vol-slider {
  -webkit-appearance: none;
  width: 90px; height: 3px;
  background: #2a2010; border-radius: 2px; outline: none; cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--gold); cursor: pointer;
  border: 1px solid #8a6030;
  transition: background .15s;
}
.vol-slider::-webkit-slider-thumb:hover { background: var(--gold2); }
.vol-slider::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--gold); cursor: pointer; border: 1px solid #8a6030;
}

/* Mute button */
.mute-btn {
  background: none; border: 1px solid #2a2010;
  color: #6a5020; font-size: .8rem;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .2s, border-color .2s;
}
.mute-btn:hover { color: var(--gold); border-color: #5a4020; }
.mute-btn.muted { color: #3a2810; border-color: #1e1608; }

/* Menu action buttons */
.menu-action-btn {
  width: 100%;
  background: none;
  border: 1px solid #2a2010;
  color: #8a6830;
  font-family: 'Cinzel', serif; font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; text-align: left;
  padding: .6rem .8rem; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.menu-action-btn:hover { color: var(--gold); border-color: #5a4020; background: rgba(200,160,64,.04); }
.menu-action-btn.danger { color: #8a3020; border-color: #3a1810; }
.menu-action-btn.danger:hover { color: #c05030; border-color: #8a2010; background: rgba(140,30,20,.06); }

/* ════════════════════════════════════════
   REIGN LOG — decision entries
════════════════════════════════════════ */
.log-texto {
  font-family: 'IM Fell English', serif; font-style: italic;
  font-size: .74rem; color: #8a7050;
  margin: .25rem 0 .2rem; line-height: 1.4;
}
.log-escolha {
  font-family: 'Cinzel', serif; font-size: .68rem; letter-spacing: .06em;
  color: var(--parch2); margin-bottom: .2rem;
}
.log-efeitos {
  font-family: 'Cinzel', serif; font-size: .62rem; letter-spacing: .05em;
  line-height: 1.8;
}

/* ── Timeline period in history entries ── */
.hist-period {
  font-family: 'Cinzel', serif; font-size: .58rem; letter-spacing: .12em;
  color: var(--gold); opacity: .6; margin-bottom: .2rem; text-transform: uppercase;
}
