/* Dartitory: a war table. Dark slate, brass trim, house colours. Fonts: Cinzel (titles), Rajdhani (interface). */
@font-face { font-family: 'Rajdhani'; src: url(../fonts/rajdhani-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Rajdhani'; src: url(../fonts/rajdhani-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Cinzel'; src: url(../fonts/cinzel-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0a0d11; --bg2: #10151b; --panel: #131a22; --edge: #263241; --edge-hi: #4d6077;
  --text: #e9edf2; --dim: #8a96a4; --brass: #d8bd85; --brass-dk: #6d5a33;
  --on: #6fe0a0; --wait: #f2c14e; --off: #ff7b6b;
  --p0: #e5484d; --p1: #3e8ef7; --p2: #f0b429; --p3: #2fbf71;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 30%, #18212c 0%, var(--bg) 70%) fixed, var(--bg);
  color: var(--text); font: 500 16px/1.4 Rajdhani, system-ui, sans-serif;
}
h1, h2 { font-family: Cinzel, Georgia, serif; font-weight: 700; margin: 0; }
h2 { font-size: 15px; letter-spacing: .12em; color: var(--brass); margin-bottom: 12px; }
button, select, input { font: inherit; color: var(--text); background: #1b232d; border: 1px solid var(--edge); border-radius: 6px; padding: 7px 12px; }
button { cursor: pointer; font-weight: 700; letter-spacing: .03em; }
button:hover:not(:disabled) { border-color: var(--edge-hi); background: #222c38; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(#e2c992, #b8995c); color: #1c1407; border-color: #f0dcae; }
button.primary:hover:not(:disabled) { background: linear-gradient(#f0d9a6, #c6a76a); }
button.ghost { background: transparent; }
button.big { font-size: 22px; padding: 16px 28px; }
.small-btn { padding: 4px 10px; font-size: 14px; }
.dim { color: var(--dim); } .small { font-size: 14px; }
a { color: var(--brass); }

/* ------------------------------------------------------------------ setup */
.setup { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 20px; gap: 24px; }
.brand { text-align: center; }
.brand h1 {
  font-size: clamp(40px, 9vw, 84px); letter-spacing: .14em;
  background: linear-gradient(180deg, #fff3d6 0%, var(--brass) 55%, #8e7242 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(216, 189, 133, .25));
}
.tag { margin: 6px 0 0; color: var(--dim); font-size: 18px; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; width: min(980px, 100%); }
.panel { background: linear-gradient(180deg, rgba(25, 33, 43, .92), rgba(15, 20, 27, .92)); border: 1px solid var(--edge); border-radius: 10px; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.seats { display: grid; gap: 10px; margin-bottom: 8px; }
.seat { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(0, 0, 0, .18); }
.seat.off { opacity: .55; }
.seat .chip { width: 14px; height: 40px; border-radius: 4px; }
.seat .who { display: flex; gap: 8px; min-width: 0; flex-wrap: wrap; }
.seat input { flex: 1 1 120px; min-width: 0; }
.seat select { flex: 0 0 auto; }
.seat .kind { display: flex; }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 7px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 6px 12px; color: var(--dim); }
.seg button + button { border-left: 1px solid var(--edge); }
.seg button[aria-checked="true"] { background: #2a3442; color: var(--text); box-shadow: inset 0 -2px 0 var(--brass); }
.opt { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.opt-label { width: 70px; color: var(--dim); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.actions .primary { font-size: 20px; padding: 10px 26px; }
.status-line { margin: 16px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status { padding: 2px 10px; border-radius: 999px; font-size: 14px; border: 1px solid var(--edge); color: var(--dim); }
.status.on { color: var(--on); border-color: currentColor; } .status.wait { color: var(--wait); border-color: currentColor; } .status.off { color: var(--off); border-color: currentColor; }
.foot { text-align: center; margin-top: auto; }

/* ------------------------------------------------------------------ game */
.game { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; padding: 12px; position: relative; overflow: hidden; }
.board-col { min-height: 0; display: grid; }
.board-wrap { position: relative; display: grid; place-items: center; min-height: 0; }
#board { width: min(100%, calc(100dvh - 24px)); height: auto; aspect-ratio: 1; display: block; }
#board.sim { cursor: crosshair; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.throw-fx { position: absolute; pointer-events: none; }

.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.turn-card { border: 1px solid var(--edge); border-radius: 10px; padding: 12px 14px; background: var(--panel); border-left: 6px solid var(--pc, var(--brass)); }
.turn-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.turn-name { font-family: Cinzel, Georgia, serif; font-size: 22px; color: var(--pl, var(--text)); }
.turn-info { color: var(--dim); margin: 2px 0 8px; min-height: 1.4em; }
.visit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dart { border: 1px solid var(--edge); border-radius: 7px; padding: 6px 8px; min-height: 58px; background: rgba(0, 0, 0, .25); }
.dart b { display: block; font-size: 20px; line-height: 1.1; }
.dart span { display: block; font-size: 13px; color: var(--dim); line-height: 1.15; }
.dart.capture { border-color: var(--on); } .dart.capture span { color: var(--on); }
.dart.attack span { color: #ffb08a; }
.dart.wasted span, .dart.miss span { color: #a0a8b2; }
.dart.reinforce span, .dart.claim span { color: #bcd7ff; }
.turn-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }

.players { display: grid; gap: 6px; }
.pl { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(0, 0, 0, .2); }
.pl.active { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc) inset, 0 0 18px -6px var(--pc); }
.pl.out { opacity: .4; text-decoration: line-through; }
.pl .bar { width: 8px; height: 100%; min-height: 34px; border-radius: 3px; background: var(--pc); }
.pl .nm { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .sub { color: var(--dim); font-size: 13px; }
.pl .num { text-align: right; font-size: 13px; color: var(--dim); }
.pl .num b { font-size: 22px; color: var(--text); }
.meter { height: 6px; border-radius: 3px; background: #0c1015; overflow: hidden; display: flex; margin-top: 2px; }
.meter i { display: block; height: 100%; }

.ticker { list-style: none; margin: 0; padding: 8px 10px; border: 1px solid var(--edge); border-radius: 8px; background: rgba(0, 0, 0, .25); overflow: auto; flex: 1; min-height: 80px; font-size: 14px; }
.ticker li { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); color: #c8d0d9; }
.ticker li.big { color: var(--text); font-weight: 700; }
.ticker .who { font-weight: 700; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }

.banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none;
  font-family: Cinzel, Georgia, serif; font-size: clamp(26px, 5vw, 52px); text-align: center; padding: 14px 34px;
  background: linear-gradient(90deg, transparent, rgba(8, 10, 14, .88) 18%, rgba(8, 10, 14, .88) 82%, transparent);
  color: var(--pl, var(--text)); text-shadow: 0 2px 12px rgba(0, 0, 0, .8); animation: banner 1.8s ease forwards; white-space: nowrap;
}
.banner small { display: block; font-family: Rajdhani, sans-serif; font-size: .42em; color: var(--text); letter-spacing: .05em; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -56%); } }
.handover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 7, 10, .82); z-index: 5; }
.handover .primary { border-color: var(--pl); }

/* ------------------------------------------------------------------ dialogs */
.dialog { background: #121921; color: var(--text); border: 1px solid var(--edge-hi); border-radius: 12px; padding: 22px 24px; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 80px rgba(0, 0, 0, .6); position: relative; }
.dialog.wide { max-width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog h2 { font-size: 26px; color: var(--pl, var(--brass)); }
.dialog .close { position: absolute; top: 10px; right: 10px; font-size: 22px; line-height: 1; padding: 4px 10px; background: transparent; }
.rules-body { color: #cdd5de; font-size: 16px; max-height: 70vh; overflow: auto; }
.rules-body li { margin: 4px 0; }
.ranks { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.ranks th { text-align: left; color: var(--dim); font-weight: 500; font-size: 13px; padding: 4px 6px; }
.ranks td { padding: 6px; border-top: 1px solid var(--edge); }
.ranks td.n { text-align: right; }

@media (max-width: 860px) {
  .setup-grid { grid-template-columns: 1fr; }
  .game { height: auto; min-height: 100dvh; grid-template-columns: 1fr; overflow: visible; padding: 8px; }
  #board { width: 100%; }
  .ticker { max-height: 220px; }
  .banner { position: fixed; }
  .handover { position: fixed; }
}
@media (prefers-reduced-motion: reduce) { .banner { animation-duration: 2.4s; } }
