/* Extraval — the Omarchy overlay plugin as a page overlay.
   Own art direction (gilt cards on a dark wooden table), not the site theme:
   it is a board game on top of the desktop, just as on the real desktop. */

#xv {
  --gold: #d9b45a; --gold-l: #f3dc93; --gold-d: #8a6424;
  --parch: #ead9b3; --parch-d: #c9b07e; --ink: #2a1a0e; --cream: #f2e6c9; --blood: #c0392b;
  --gilt: linear-gradient(180deg, var(--gold-l) 0%, var(--gold) 45%, var(--gold-d) 55%, var(--gold) 100%);
  --parchment: linear-gradient(180deg, var(--parch), var(--parch-d));
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "IM Fell English", Georgia, serif;
  --cw: 220px;

  position: fixed; inset: 0; z-index: 70;
  color: var(--cream); font-family: var(--serif);
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,190,110,.07), rgba(0,0,0,.65) 75%),
    repeating-linear-gradient(180deg, transparent 0 78px, rgba(0,0,0,.35) 78px 80px, rgba(255,220,160,.04) 80px 81px),
    linear-gradient(180deg, #24180e, #140d08);
  overflow: hidden;
}
#xv[hidden] { display: none; }
#xv *, #xv *::before, #xv *::after { box-sizing: border-box; }

.xv-table { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; padding: 22px 28px 18px; }

/* ── header ─────────────────────────────────────────── */
.xv-head { display: flex; align-items: center; gap: 22px; }
.xv-head h1 { margin: 0; font: 900 clamp(30px, 4.2vw, 54px)/1 var(--display); letter-spacing: .08em; color: var(--gold); text-shadow: 0 2px 0 #000; }
.xv-sub { display: grid; gap: 2px; }
.xv-sub b { font: 700 clamp(13px, 1.3vw, 19px) var(--display); color: var(--cream); }
.xv-sub i { font-size: clamp(12px, 1.05vw, 16px); color: var(--parch-d); }
.xv-status { margin-left: auto; text-align: right; display: grid; gap: 1px; font-size: 15px; }
.xv-status b { font: 700 15px var(--display); color: var(--gold-l); }
.xv-status .warn { color: #ff7a5c; }
.xv-close { width: 36px; height: 36px; border-radius: 50%; background: var(--gilt); color: var(--ink); font: 900 20px/1 var(--display); border: 1px solid #3a2a12; flex: none; }

/* ── seats ──────────────────────────────────────────── */
.xv-seats { position: relative; padding: 3px; border-radius: 3px; background: var(--gilt); }
.xv-strip { display: flex; height: 24px; overflow: hidden; background: #120c07; }
.xv-strip span { display: grid; place-items: center; overflow: hidden; white-space: nowrap; font: 700 13px var(--display); transition: width .4s ease; }
.xv-maj { position: absolute; top: -6px; bottom: -6px; left: calc(3px + (100% - 6px) * 175 / 349); width: 3px; margin-left: -1.5px; background: var(--gold-l); border: 1px solid #000; }

/* ── board ──────────────────────────────────────────── */
.xv-main { flex: 1; min-height: 0; display: flex; gap: 18px; }
.xv-board { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, var(--cw)); grid-auto-rows: calc(var(--cw) / .68); gap: 22px 14px; justify-content: center; align-content: center; padding-top: 10px; }

.xv-card { position: relative; width: var(--cw); height: calc(var(--cw) / .68); cursor: default; transition: transform .14s ease, opacity .2s ease; }
.xv-card.sel { cursor: pointer; }
.xv-card.hot { transform: scale(1.05); z-index: 5; }
.xv-card.dim { opacity: .45; }
.xv-card.speaking { z-index: 4; }
.xv-frame { position: absolute; inset: 0; border-radius: calc(var(--cw) * .04); background: var(--gilt); border: 1px solid #3a2a12; padding: calc(var(--cw) * .024); }
.xv-card.hot .xv-frame { box-shadow: 0 0 0 calc(var(--cw) * .02) var(--gold-l), 0 0 calc(var(--cw) * .12) rgba(243,220,147,.5); }
.xv-card.me .xv-frame { box-shadow: 0 0 0 calc(var(--cw) * .02) var(--c); }
.xv-card.me.hot .xv-frame { box-shadow: 0 0 0 calc(var(--cw) * .02) var(--gold-l), 0 0 calc(var(--cw) * .12) rgba(243,220,147,.5); }
.xv-card.speaking:not(.hot):not(.me) .xv-frame { box-shadow: 0 0 0 calc(var(--cw) * .015) rgba(243,220,147,.45); }
.xv-card.hit .xv-frame { animation: xv-shake .25s linear; }
@keyframes xv-shake { 20% { transform: translateX(calc(var(--cw) * -.035)); } 50% { transform: translateX(calc(var(--cw) * .035)); } 80% { transform: translateX(calc(var(--cw) * -.02)); } }

.xv-inner { position: absolute; inset: calc(var(--cw) * .024); border-radius: calc(var(--cw) * .028); background: #120c07; overflow: hidden; }
.xv-art { position: absolute; inset: calc(var(--cw) * .012); overflow: hidden; }
.xv-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .22s ease; }
.xv-art img.on { opacity: 1; }
.xv-card.out .xv-art img { filter: grayscale(1) brightness(.8); }
.xv-hurt, .xv-shine { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.xv-hurt { background: var(--blood); }
.xv-shine { background: #ffe9a8; }
.xv-card.hit .xv-hurt { animation: xv-fade-55 .7s ease-out; }
.xv-card.gain .xv-shine { animation: xv-fade-45 .8s ease-out; }
@keyframes xv-fade-55 { from { opacity: .55; } to { opacity: 0; } }
@keyframes xv-fade-45 { from { opacity: .45; } to { opacity: 0; } }

.xv-band { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: var(--parchment); border-top: max(2px, calc(var(--cw) * .012)) solid; border-image: linear-gradient(90deg, var(--gold-d), var(--gold-l), var(--gold-d)) 1; text-align: center; padding: calc(var(--cw) * .03) calc(var(--cw) * .05) 0; display: grid; align-content: start; gap: calc(var(--cw) * .006); }
.xv-band b, .xv-band span, .xv-band small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xv-band b { font: 700 calc(var(--cw) * .07 * var(--fit, 1)) var(--display); color: var(--ink); text-overflow: clip; }
.xv-band i { font-size: calc(var(--cw) * .06); color: var(--pc); }
.xv-band hr { width: 60%; margin: 0 auto; border: 0; border-top: 1px solid var(--gold-d); opacity: .6; }
.xv-band span { font-size: calc(var(--cw) * .062); color: var(--ink); }
.xv-band span.low { color: var(--blood); }
.xv-band small { font-size: calc(var(--cw) * .052); font-style: italic; color: #6b5642; }

.xv-badge { position: absolute; left: calc(var(--cw) * .035); top: calc(var(--cw) * .035); width: calc(var(--cw) * .25); aspect-ratio: 1; border-radius: 50%; background: var(--gilt); border: 1px solid #3a2a12; display: grid; place-items: center; }
.xv-badge::before { content: ""; position: absolute; inset: 9%; border-radius: 50%; background: linear-gradient(180deg, #3d2e1e, #0b0805); }
.xv-badge span { position: relative; font: 900 calc(var(--cw) * .11) var(--display); color: var(--cream); text-shadow: 0 0 2px #000, 0 0 2px #000; }
.xv-badge span.big { font-size: calc(var(--cw) * .09); }
.xv-badge span.up { color: #8df07a; }
.xv-badge span.down { color: #ff6b5a; }

.xv-crest { position: absolute; display: grid; place-items: center; font: 900 calc(var(--cw) * .06) var(--display); clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); background: var(--gold); }
.xv-crest::before { content: ""; position: absolute; inset: 9%; clip-path: inherit; background: var(--fill); }
.xv-crest b { position: relative; margin-top: -12%; color: var(--ink-c); }
.xv-card > .xv-frame > .xv-crest.faction { left: calc(var(--cw) * .077); top: calc(var(--cw) * .3); width: calc(var(--cw) * .165); height: calc(var(--cw) * .195); }
.xv-crest.pennant { right: calc(var(--cw) * .07); top: calc(var(--cw) * .055); width: calc(var(--cw) * .14); height: calc(var(--cw) * .175); font-size: calc(var(--cw) * .05); }

.xv-pips { position: absolute; left: calc(var(--cw) * .133); top: calc(var(--cw) * .53); display: grid; gap: calc(var(--cw) * .045); }
.xv-pips i { display: block; width: calc(var(--cw) * .055); aspect-ratio: 1; transform: rotate(45deg); background: #1d140c; border: max(1px, calc(var(--cw) * .01)) solid var(--gold); }
.xv-pips i.on { background: #e0402c; }

.xv-du { position: absolute; left: 50%; top: 0; transform: translate(-50%, -45%); padding: calc(var(--cw) * .01) calc(var(--cw) * .06); border-radius: 4px; background: var(--gilt); border: 1px solid #3a2a12; font: 900 calc(var(--cw) * .07) var(--display); letter-spacing: .1em; color: var(--ink); }
.xv-stamp { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) rotate(-16deg); padding: calc(var(--cw) * .015) calc(var(--cw) * .04); border: max(2px, calc(var(--cw) * .015)) solid var(--blood); font: 900 calc(var(--cw) * .12) var(--display); color: var(--blood); }

.xv-bubble { position: absolute; left: 8%; right: 8%; bottom: calc(30% + var(--cw) * .06); padding: calc(var(--cw) * .03); border-radius: calc(var(--cw) * .03); background: var(--parchment); border: max(2px, calc(var(--cw) * .01)) solid var(--gold-d); color: var(--ink); text-align: center; font-style: italic; font-size: calc(var(--cw) * .07); line-height: 1.15; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.xv-bubble::before { content: ""; position: absolute; left: 50%; top: 0; width: calc(var(--cw) * .07); aspect-ratio: 1; background: var(--parch); border: inherit; border-right: 0; border-bottom: 0; transform: translate(-50%, -55%) rotate(45deg); }

#xv [hidden] { display: none; }

/* ── chronicle ──────────────────────────────────────── */
.xv-log { width: min(430px, 28vw); flex: none; display: flex; flex-direction: column; padding: 3px; border-radius: 4px; background: var(--gilt); }
.xv-log > div { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 3px; background: var(--parchment); color: var(--ink); }
.xv-log h2 { margin: 10px 0 4px; text-align: center; font: 900 20px var(--display); letter-spacing: .12em; }
.xv-log ol { flex: 1; overflow-y: auto; margin: 0; padding: 4px 14px 12px; list-style: none; display: grid; align-content: start; gap: 7px; font-size: 16px; line-height: 1.25; scrollbar-width: thin; scrollbar-color: var(--gold-d) transparent; }
.xv-log li { position: relative; padding-left: 18px; }
.xv-log li::before { content: ""; position: absolute; left: 1px; top: 6px; width: 7px; height: 7px; transform: rotate(45deg); background: var(--dot); border: 1px solid var(--ink); }

/* ── ticker, actions ────────────────────────────────── */
.xv-ticker { height: 64px; flex: none; display: flex; align-items: center; padding: 0 16px; border-radius: 4px; background: #120c07; border: 1px solid var(--gold-d); font: 700 clamp(14px, 1.3vw, 19px)/1.25 var(--display); color: var(--gold-l); overflow: hidden; }
.xv-ticker span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xv-ticker.boom { color: #ff7a5c; }
.xv-dock { height: 126px; flex: none; }
.xv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.xv-plaque { min-width: 176px; padding: 7px 13px; border-radius: 4px; text-align: left; background: linear-gradient(180deg, #2a1d12, #140d07); border: 1px solid var(--gold-d); display: grid; gap: 1px; }
.xv-plaque b { font: 700 15px var(--display); color: var(--gold-l); }
.xv-plaque i { font-size: 14px; color: var(--parch-d); }
.xv-plaque:hover:not(:disabled), .xv-plaque.armed { border-color: var(--gold-l); background: linear-gradient(180deg, #3a2a18, #140d07); }
.xv-plaque.armed { background: linear-gradient(180deg, #4a3516, #140d07); }
.xv-plaque.nuke:not(:disabled) { border: 2px solid #e0402c; background: linear-gradient(180deg, #4a1410, #240806); }
.xv-plaque.nuke b { color: #ff7a5c; }
.xv-plaque:disabled { opacity: .4; cursor: default; }
.xv-plaque.gilt { background: var(--gilt); border-color: #3a2a12; place-items: center; }
.xv-plaque.gilt b { color: var(--ink); font-weight: 900; }
.xv-hint { font-size: 17px; font-style: italic; color: var(--parch-d); }
.xv-hint button:not(.xv-plaque) { text-decoration: underline; font-style: italic; }
.xv-next { float: right; min-width: 0; }
.xv-ticker.go { cursor: pointer; }

/* ── end screen, bomb ───────────────────────────────── */
.xv-over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); }
.xv-over[hidden] { display: none; }
.xv-over > div { width: min(780px, calc(100% - 40px)); padding: 5px; border-radius: 6px; background: var(--gilt); }
.xv-over > div > div { padding: 30px 32px; border-radius: 4px; background: var(--parchment); text-align: center; display: grid; gap: 14px; }
.xv-over h2 { margin: 0; font: 900 clamp(34px, 5vw, 54px) var(--display); color: #8e1c12; }
.xv-over h2.good { color: #6b4a10; }
.xv-over p { margin: 0; font-size: clamp(18px, 2vw, 24px); font-style: italic; color: var(--ink); }
.xv-over small { font: 700 15px var(--display); color: #7a6650; }

.xv-flash { position: absolute; inset: 0; display: grid; place-items: center; background: #fff4d6; opacity: 0; pointer-events: none; font: 900 clamp(48px, 9vw, 140px) var(--display); color: var(--blood); -webkit-text-stroke: 2px #000; }
.xv-flash.go { animation: xv-boom 1.6s ease-in; }
@keyframes xv-boom { from { opacity: .95; } to { opacity: 0; } }

/* ── small screens: two columns, chronicle under the cards ── */
@media (max-width: 900px) {
  .xv-table { padding: 12px 12px 10px; gap: 10px; overflow-y: auto; }
  .xv-head { flex-wrap: wrap; gap: 6px 14px; }
  .xv-sub i { display: none; }
  .xv-status { order: 3; width: 100%; margin: 0; text-align: left; font-size: 13px; }
  .xv-close { position: absolute; top: 12px; right: 12px; }
  .xv-main { flex-direction: column; flex: none; }
  .xv-board { grid-template-columns: repeat(2, var(--cw)); }
  .xv-log { width: 100%; height: 240px; }
  .xv-dock { height: auto; }
  .xv-plaque { min-width: 0; flex: 1 1 150px; }
  /* What to do next comes before the cards on a phone, not after the chronicle. */
  .xv-ticker { order: 1; height: auto; min-height: 52px; padding: 8px 12px; }
  .xv-dock { order: 2; }
  .xv-main { order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .xv-card, .xv-art img, .xv-strip span { transition: none; }
  .xv-card.hit .xv-frame, .xv-flash.go { animation: none; }
}
