/* Harbor Havoc — moonlit sea, painted monsters, lightning-gold accents. */
:root {
  --night:   #060C1A;   /* page: the deep water */
  --deck:    #0C162A;   /* panels */
  --deck-2:  #122038;   /* raised surfaces */
  --line:    #1F3252;
  --ink:     #EAF0FA;
  --soft:    #C3CFE2;   /* secondary text */
  --muted:   #8A9BB8;
  --moon:    #CFE0F5;
  --gold:    #F4C542;   /* lightning gold: primary actions, fame */
  --gold-hi: #FFD767;
  --gold-ink:#231800;
  --smash:   #F25C54;
  --heal:    #5ED49A;
  --spark:   #6FB4FF;
  --ivory:   #F2EEE6;   /* dice */
  --display: "Futura Condensed ExtraBold", "Futura", "Avenir Next Condensed", "Bahnschrift Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(120, 160, 230, .13), transparent 70%),
    var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: 0.01em; margin: 0; }
p { margin: 0; }
img { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { display: block; flex-shrink: 0; }

/* ---------- buttons ---------- */
.btn {
  font: 600 13px/1 var(--body);
  color: var(--ink);
  background: var(--deck-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .06s;
}
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: default; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-primary:hover:not(:disabled) { background: var(--gold-hi); border-color: var(--gold-hi); }
.btn-small { padding: 7px 11px; font-size: 12px; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover:not(:disabled) { color: var(--ink); border-color: var(--line); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 15, 30, .85);
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font: 800 19px/1 var(--display);
  color: var(--ink); background: none; border: 0; padding: 4px 2px; cursor: pointer;
}
.brand-mark { width: 28px; height: 28px; }
.topbar-title { color: var(--muted); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 4px; }

#screen { flex: 1; min-height: 0; overflow: auto; }

/* ---------- monster pictures ---------- */
.avatar {
  display: inline-block; flex-shrink: 0; overflow: hidden;
  border-radius: 24%;
  background: var(--deck-2);
  box-shadow: 0 0 0 2px var(--mc), 0 3px 10px rgba(0, 0, 0, .45);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- main menu ---------- */
.home { max-width: 1040px; margin: 0 auto; padding: 28px 28px 56px; }
.resume {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--deck-2); border: 1px solid var(--gold); border-radius: var(--r-md);
}
.resume .resume-text { flex: 1; display: flex; flex-direction: column; }
.resume-actions { display: flex; align-items: center; gap: 8px; }
.resume-confirm { color: var(--soft); font-size: 13px; font-weight: 600; margin-right: 4px; }
.btn-danger { background: var(--smash); border-color: var(--smash); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #FF7068; border-color: #FF7068; }
.resume span { color: var(--muted); font-size: 13px; }
.box {
  background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.box-art { position: relative; height: 420px; overflow: hidden; background: #0A1428; }
.box-art > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; }
.box-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(12, 22, 42, 1) 0%, rgba(12, 22, 42, .6) 26%, transparent 55%);
}
.box-title {
  position: absolute; left: 24px; bottom: 14px; z-index: 1; margin: 0;
  display: flex; align-items: center; gap: 16px;
}
.box-badge { width: 150px; height: 150px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .55)); }
.box-wordmark { height: 140px; width: auto; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .5)); }
.box-body { padding: 18px 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.box-body p { color: var(--soft); max-width: 70ch; }
.box-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.box-facts li { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.roster { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 2px 0 0; }
.roster li { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--soft); }
.box-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

/* ---------- setup ---------- */
.setup { max-width: 940px; margin: 0 auto; padding: 36px 28px 48px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.setup-head h1 { font-size: 40px; line-height: 1; }
.stepper { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.stepper strong { color: var(--ink); font-size: 17px; }
.stepper .btn { width: 34px; padding: 7px 0; font-size: 16px; }
.seats { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.seat {
  display: grid; grid-template-columns: 28px 160px auto 1fr; align-items: center; gap: 16px;
  background: var(--deck); border: 1px solid var(--line); border-left: 4px solid var(--mc);
  border-radius: var(--r-md); padding: 12px 16px;
}
.seat-num { font: 800 22px/1 var(--display); color: var(--mc); text-align: center; }
.seat-name input {
  width: 100%; font: 600 14px var(--body); color: var(--ink);
  background: var(--night); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px;
}
.seat-picks { display: flex; gap: 8px; }
.pick { background: none; border: 0; border-radius: 12px; padding: 3px; cursor: pointer; line-height: 0; }
.pick .avatar { box-shadow: 0 0 0 1px var(--line); transition: box-shadow .12s, transform .12s; }
.pick:hover:not(:disabled) .avatar { box-shadow: 0 0 0 2px var(--mc); transform: translateY(-1px); }
.pick.selected .avatar { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--mc); }
.pick:disabled { opacity: .22; cursor: default; }
.pick:disabled .avatar { filter: grayscale(.8); }
.seat-monster { display: flex; flex-direction: column; min-width: 0; }
.seat-monster strong { color: var(--mc); }
.seat-monster span { color: var(--muted); font-size: 12.5px; }
.setup-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- game table ---------- */
.hh {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 300px;
  gap: 16px; padding: 16px;
  min-height: 100%;
}
.hh-players { display: flex; flex-direction: column; gap: 10px; }
.pc {
  background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 12px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s;
}
.pc.is-current { border-color: var(--mc); box-shadow: 0 0 0 1px var(--mc), 0 8px 24px rgba(0, 0, 0, .35); }
.pc.is-out { opacity: .45; }
.pc.is-out .avatar { filter: grayscale(1); }
.pc-head { display: flex; align-items: center; gap: 11px; }
.pc-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pc-name strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-name span { font-size: 12px; color: var(--muted); }
.pc-tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.pc-tag.tag-harbor { background: rgba(244, 197, 66, .15); color: var(--gold); }
.pc-tag.tag-out { background: rgba(242, 92, 84, .14); color: var(--smash); }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; }
.stat { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 5px; row-gap: 4px; }
.stat-val { font-weight: 700; font-size: 15px; }
.stat-val small { color: var(--muted); font-weight: 500; font-size: 11px; }
.stat .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--night); overflow: hidden; }
.stat .bar span { display: block; height: 100%; border-radius: 2px; transition: width .3s; }
.stat-hp { color: var(--heal); } .stat-hp .bar span { background: var(--heal); }
.stat-fame { color: var(--gold); } .stat-fame .bar span { background: var(--gold); }
.stat-spark { color: var(--spark); grid-template-columns: auto auto; }
.stat .stat-val { color: var(--ink); }
.pc-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; font-weight: 600; color: var(--soft); background: var(--deck-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; cursor: help; }

.hh-center { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }

/* The Harbor shows the holder's painting, or the moonlit bay when it's empty. */
.harbor {
  position: relative; width: 100%; max-width: 580px; height: 270px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; background: #0A1428;
  box-shadow: 0 0 0 1px var(--mc, transparent), 0 16px 44px -12px var(--mc, rgba(0, 0, 0, .5));
}
.harbor.is-empty { box-shadow: 0 16px 40px rgba(0, 0, 0, .4); }
.harbor-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.harbor.is-empty .harbor-art { filter: saturate(.55) brightness(.7); }
.harbor::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6, 12, 26, .95) 0%, rgba(6, 12, 26, .4) 34%, transparent 60%);
}
.harbor-caption {
  position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 1;
  display: flex; align-items: center; gap: 12px;
}
.harbor-caption div { display: flex; flex-direction: column; }
.harbor-caption strong { font: 800 26px/1 var(--display); color: var(--mc, var(--moon)); }
.harbor-caption span { color: var(--soft); font-size: 13px; }
.harbor.is-empty .harbor-caption { justify-content: center; text-align: center; }

.turn { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 580px; }
.turn div { display: flex; flex-direction: column; }
.turn strong { font: 800 22px/1.05 var(--display); color: var(--mc); }
.turn span { color: var(--soft); font-size: 13px; }

.dice { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Dice: dark carved stone with glowing symbols in the color of the resource they give. */
.die {
  position: relative; width: 70px; height: 70px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 28% 18%, #2A4268 0%, #16263F 46%, #0A1426 100%);
  color: var(--gold);
  border: 1px solid rgba(160, 190, 235, .2); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -5px 0 rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .55);
  cursor: pointer; transition: transform .12s, box-shadow .15s;
}
.die::before {
  content: ""; position: absolute; inset: 5px; border-radius: 10px;
  border: 1px solid rgba(160, 190, 235, .08); pointer-events: none;
}
.die:disabled { cursor: default; }
.die:not(:disabled):hover { transform: translateY(-2px); }
.die-blank { width: 24px; height: 24px; border-radius: 50%; border: 2px dashed rgba(160, 190, 235, .3); }
.die-num {
  font: 800 40px/1 var(--display); color: var(--gold);
  text-shadow: 0 0 10px rgba(244, 197, 66, .55), 0 2px 0 rgba(0, 0, 0, .5);
}
.die-icon { filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 2px 0 rgba(0, 0, 0, .45)); }
.die.face-smash { color: #FF5A4E; }
.die.face-heal { color: #4FE39A; }
.die.face-spark { color: #6FB8FF; }
.die.kept {
  transform: translateY(-8px);
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -5px 0 rgba(0, 0, 0, .4), 0 0 0 1px var(--gold), 0 0 22px rgba(244, 197, 66, .4), 0 12px 22px rgba(0, 0, 0, .55);
}
.die-kept {
  position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; color: var(--gold);
}
.die.launch { animation: die-launch .32s ease-out; }
.die.fizzle { animation: die-fizzle .5s ease-out; }
@keyframes die-launch { 40% { transform: scale(1.12); box-shadow: 0 0 26px currentColor; } }
@keyframes die-fizzle { 20% { transform: translateX(-3px); opacity: .5; } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); opacity: .6; } }

/* Dice roll: a quick spin and drop while the faces shuffle. */
@keyframes tumble {
  0%   { transform: translateY(-26px) rotate(-200deg) scale(.84); }
  55%  { transform: translateY(5px) rotate(12deg) scale(1.05); }
  78%  { transform: translateY(-3px) rotate(-4deg) scale(.99); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
.die.tumbling { animation: tumble 440ms cubic-bezier(.2, .75, .25, 1) both; }
.hh.is-busy { pointer-events: none; }
.hh.is-busy .preview { opacity: 0; }

.preview { opacity: 0; }

.preview { min-height: 20px; margin-top: 8px; color: var(--muted); font-size: 13px; text-align: center; transition: opacity .18s; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.actions .btn { padding: 12px 20px; font-size: 14px; }

.hh-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.panel { background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 19px; }
.panel-note { color: var(--muted); font-size: 12px; margin: 2px 0 10px; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  background: var(--deck-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 10px;
}
.card.affordable { border-color: rgba(111, 180, 255, .55); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; grid-column: 1 / -1; }
.card-name { font-weight: 700; }
.cost { display: inline-flex; align-items: center; gap: 3px; color: var(--spark); font-weight: 700; }
.cost s { color: var(--muted); font-weight: 500; }
.card-type { grid-column: 1 / -1; font-size: 11px; color: var(--muted); font-weight: 600; }
.card-text { font-size: 12.5px; color: var(--soft); }
.card-empty { color: var(--muted); font-size: 12px; display: block; text-align: center; }
.panel-log { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.log { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; max-height: 300px; flex: 1; font-size: 12.5px; }
.log li { padding: 5px 0; border-bottom: 1px solid rgba(31, 50, 82, .7); color: var(--soft); }
.log li:first-child { color: var(--ink); font-weight: 600; }
.log .log-turn { color: var(--muted); }
.log .log-smash { color: #FF9C96; }
.log .log-ko { color: var(--smash); font-weight: 700; }
.log .log-win { color: var(--gold); font-weight: 700; }
.log .log-evolve { color: #D6C2FF; }

/* ---------- evolutions ---------- */
.chip-evo { border-color: var(--mc); color: var(--ink); }
.chip-hand { background: transparent; border-style: dashed; color: var(--muted); cursor: default; }
.hand {
  width: 100%; max-width: 620px; margin-top: 6px;
  border-top: 1px solid var(--line); padding-top: 14px;
}
.hand-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hand-head h2 { font-size: 19px; color: var(--mc); }
.hand-head span { font-size: 12px; color: var(--muted); }
.hand-empty { color: var(--muted); font-size: 13px; margin-top: 6px; }
.evos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.evo {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--deck); border: 1px solid var(--line); border-top: 3px solid var(--mc);
  border-radius: var(--r-sm); padding: 9px 10px;
}
.evo .btn { align-self: flex-start; margin-top: auto; }
.evo-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.evo-name { font-weight: 700; }
.evo-type { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.evo-text { font-size: 12.5px; color: var(--soft); }
.evo-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.evo-list li { background: var(--deck-2); border: 1px solid var(--line); border-top: 3px solid var(--mc); border-radius: var(--r-sm); padding: 9px 10px; }
.evo-list p { font-size: 12.5px; margin-top: 4px; }
.link-btn {
  align-self: flex-start; background: none; border: 0; padding: 2px 0; margin-top: 2px;
  font: 600 12.5px var(--body); color: var(--mc); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.toggle {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
  background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative; flex-shrink: 0; width: 40px; height: 22px; border-radius: 11px;
  background: var(--night); border: 1px solid var(--line); transition: background .15s;
}
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.toggle input:checked + .toggle-track { background: rgba(244, 197, 66, .22); border-color: var(--gold); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: var(--gold); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--gold); outline-offset: 2px; }
.toggle strong { display: block; }
.toggle > span:last-child { color: var(--muted); font-size: 13px; }
.toggle > span:last-child strong { color: var(--ink); font-size: 14px; }

/* ---------- resource flights and pop-up numbers ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.fx-token {
  position: absolute; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 15, 30, .85); border: 1px solid currentColor;
  box-shadow: 0 0 16px currentColor;
}
.fx-token .icon { filter: drop-shadow(0 0 4px currentColor); }
.fx-fame { color: var(--gold); }
.fx-heal { color: var(--heal); }
.fx-spark { color: var(--spark); }
.fx-smash { color: #FF5A4E; }
.fx-evo { color: #D6C2FF; border-radius: 8px; width: 34px; height: 42px; }
.fx-float {
  position: absolute; font: 800 22px/1 var(--display); white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 12px currentColor;
}
.fx-float.fx-fame { color: var(--gold); }
.fx-float.fx-heal { color: var(--heal); }
.fx-float.fx-spark { color: var(--spark); }
.fx-float.fx-dmg { color: #FF5A4E; font-size: 26px; }
.fx-float.fx-spent { color: var(--muted); }
.fx-pulse { animation: stat-pulse .42s ease-out; }
@keyframes stat-pulse { 35% { transform: scale(1.25); filter: brightness(1.6); } }
.pc.fx-hit { animation: card-hit .46s ease-out; }
@keyframes card-hit {
  0% { box-shadow: 0 0 0 2px #FF5A4E, 0 0 30px rgba(255, 90, 78, .6); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  100% { transform: none; }
}

.pc.ko-pending .tag-out { visibility: hidden; }
.pc.just-out { animation: card-fall .6s ease-out; }
@keyframes card-fall { from { opacity: 1; filter: none; } }
.harbor.harbor-enter { animation: harbor-enter .5s ease-out; }
@keyframes harbor-enter { from { opacity: 0; transform: scale(.98); } }

/* ---------- knockout scenes ---------- */
.ko-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(3, 7, 16, .86);
  animation: ko-in .22s ease-out both; cursor: pointer;
}
.ko-overlay.ko-out { animation: ko-fade .28s ease-in both; }
@keyframes ko-in { from { opacity: 0; } }
@keyframes ko-fade { to { opacity: 0; } }
.ko-stage { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ko-frame { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ko-art {
  position: relative; width: 340px; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--r-lg); border: 1px solid var(--mc);
  background: #000;
  animation: ko-frame-glow 2.1s ease-out both;
}
.ko-group .ko-art { width: 190px; }
@keyframes ko-frame-glow {
  0% { box-shadow: 0 0 60px -6px var(--mc); }
  100% { box-shadow: 0 0 0 0 transparent; border-color: var(--line); }
}
.ko-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ko-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ko-fx::before, .ko-fx::after { content: ""; position: absolute; inset: 0; opacity: 0; }
.ko-fx .p { position: absolute; display: block; border-radius: 50%; }
.ko-name { display: flex; flex-direction: column; align-items: center; }
.ko-name strong { font: 800 26px/1 var(--display); color: var(--mc); }
.ko-group .ko-name strong { font-size: 18px; }
.ko-name span { color: var(--muted); font-size: 12px; }
.ko-caption { color: var(--soft); font-size: 16px; }
.ko-caption strong { color: var(--ink); }

/* Brinewyrm sinks beneath the waves. */
.ko-brinewyrm .ko-img { animation: bw-sink 2s cubic-bezier(.5, 0, .75, .4) both; }
@keyframes bw-sink {
  0% { transform: none; }
  22% { transform: translateY(-3%) rotate(-1.5deg); }
  100% { transform: translateY(58%) rotate(3deg); filter: blur(3px) brightness(.45) saturate(.6); }
}
.ko-brinewyrm .ko-fx::before {
  opacity: 1; inset: auto 0 0 0; height: 0;
  background: linear-gradient(to top, rgba(4, 18, 40, .98) 55%, rgba(24, 80, 120, .7) 88%, rgba(150, 210, 240, .55));
  animation: bw-water 2s cubic-bezier(.55, 0, .7, .5) both;
}
@keyframes bw-water { 0% { height: 0; } 30% { height: 14%; } 100% { height: 100%; } }
.ko-brinewyrm .p {
  left: var(--x); bottom: 0; width: var(--s); height: var(--s);
  border: 1.5px solid rgba(200, 235, 255, .75);
  animation: bw-bubble 1.1s var(--d) ease-out both;
}
@keyframes bw-bubble { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-300px); opacity: 0; } }

/* Voltjaw shorts out: violent flicker, then dark. */
.ko-voltjaw .ko-img { animation: vj-short 2s linear both; }
@keyframes vj-short {
  0% { filter: none; transform: none; }
  6% { filter: brightness(2.4) contrast(1.4); transform: translateX(-4px); }
  10% { filter: brightness(.3); transform: translateX(4px); }
  16% { filter: brightness(2) contrast(1.3); transform: translateX(-3px); }
  21% { filter: brightness(.25); transform: none; }
  30% { filter: brightness(1.7) saturate(1.4); transform: translateX(2px); }
  36% { filter: brightness(.2) grayscale(.5); transform: none; }
  48% { filter: brightness(1.1) grayscale(.4); }
  56% { filter: brightness(.18) grayscale(.9); }
  100% { filter: brightness(.22) grayscale(1); transform: translateY(6%) rotate(4deg); }
}
.ko-voltjaw .ko-fx::before {
  background: radial-gradient(circle at 60% 40%, rgba(255, 245, 170, .85), rgba(255, 220, 60, .25) 55%, transparent 75%);
  mix-blend-mode: screen; animation: vj-flash 2s linear both;
}
@keyframes vj-flash {
  0%, 4% { opacity: 0; } 6% { opacity: 1; } 9% { opacity: 0; } 15% { opacity: .9; } 18% { opacity: 0; }
  29% { opacity: .7; } 32% { opacity: 0; } 47% { opacity: .35; } 50%, 100% { opacity: 0; }
}
.ko-voltjaw .p {
  left: var(--x); top: var(--y); width: 3px; height: 28px; border-radius: 2px;
  background: #FFE66B; box-shadow: 0 0 10px #FFD23A;
  transform: rotate(var(--r)); opacity: 0;
  animation: vj-spark .18s var(--d) steps(2) 2 both;
}
@keyframes vj-spark { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Mossback turns to stone, cracks, and crumbles. */
.ko-mossback .ko-img { animation: mb-stone 2s ease-in both; }
@keyframes mb-stone {
  0% { filter: none; }
  40% { filter: grayscale(1) sepia(.25) contrast(1.25) brightness(.85); transform: none; }
  70% { filter: grayscale(1) sepia(.25) contrast(1.3) brightness(.75); transform: translateX(-2px); }
  74% { transform: translateX(2px); }
  100% { filter: grayscale(1) contrast(1.3) brightness(.4); transform: translateY(9%) scale(.97); }
}
.ko-mossback .cracks { position: absolute; inset: 0; width: 100%; height: 100%; }
.ko-mossback .cracks path {
  fill: none; stroke: rgba(235, 235, 225, .85); stroke-width: .8; vector-effect: non-scaling-stroke;
  stroke-dasharray: 200; stroke-dashoffset: 200;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, .9));
  animation: mb-crack .6s .75s ease-out forwards;
}
@keyframes mb-crack { to { stroke-dashoffset: 0; } }
.ko-mossback .p {
  left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 2px;
  background: #8B8D80; opacity: 0;
  animation: mb-dust 1s var(--d) ease-in both;
}
@keyframes mb-dust { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(220px) rotate(160deg); } }

/* Cinderhorn flares, then cools to ash as embers drift away. */
.ko-cinderhorn .ko-img { animation: ch-cool 2s ease-out both; }
@keyframes ch-cool {
  0% { filter: none; }
  16% { filter: brightness(1.7) saturate(1.8); transform: scale(1.02); }
  45% { filter: brightness(1.05) saturate(1.1); transform: scale(1.01); }
  100% { filter: grayscale(1) brightness(.4) contrast(1.15); transform: translateY(5%) scale(.98); }
}
.ko-cinderhorn .ko-fx::before {
  background: linear-gradient(to top, rgba(90, 90, 95, .5), rgba(60, 60, 65, .15));
  animation: ch-ash 2s ease-in both;
}
@keyframes ch-ash { 0%, 35% { opacity: 0; } 100% { opacity: 1; } }
.ko-cinderhorn .p {
  left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  background: #FFB054; box-shadow: 0 0 8px #FF7A2E, 0 0 16px #FF5A1A; opacity: 0;
  animation: ch-ember 1.3s var(--d) ease-out both;
}
@keyframes ch-ember { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--tx), -240px); background: #777; box-shadow: none; } }

/* Gearhulk seizes up, throws sparks, and topples. */
.ko-gearhulk .ko-img { animation: gh-break 2s ease-in both; }
@keyframes gh-break {
  0% { transform: none; filter: none; }
  5% { transform: translate(-3px, 1px); } 10% { transform: translate(3px, -1px); }
  15% { transform: translate(-2px, 2px); } 20% { transform: translate(3px, 0); }
  25% { transform: translate(-3px, -1px); filter: brightness(1.3); }
  35% { transform: translate(1px, 1px); filter: brightness(1); }
  55% { transform: rotate(-2deg); filter: grayscale(.4) brightness(.85); }
  100% { transform: rotate(9deg) translateY(16%); filter: grayscale(.9) brightness(.35); }
}
.ko-gearhulk .p {
  left: 43%; top: 34%; width: var(--s); height: var(--s);
  background: #FFD28A; box-shadow: 0 0 8px #FFB347; opacity: 0;
  animation: gh-spark .7s var(--d) ease-out both;
}
@keyframes gh-spark { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(var(--tx), var(--ty)); } }

/* Nebulox swells, blurs, and scatters into stars. */
.ko-nebulox .ko-img { animation: nx-scatter 2s ease-in both; }
@keyframes nx-scatter {
  0% { transform: none; filter: none; opacity: 1; }
  28% { transform: scale(1.04); filter: brightness(1.35) saturate(1.3); opacity: 1; }
  100% { transform: scale(1.3); filter: blur(12px) brightness(1.4); opacity: 0; }
}
.ko-nebulox .p {
  left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  background: #F1E8FF; box-shadow: 0 0 8px #B58CFF, 0 0 14px #8F5CFF; opacity: 0;
  animation: nx-star 1.4s var(--d) ease-out both;
}
@keyframes nx-star { 0% { opacity: 0; transform: none; } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(.6); } }

/* ---------- themed evolutions: options, Heat ---------- */
.evo-choice { gap: 8px; }
.evo-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.evo-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--deck-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 8px;
}
.evo-opt div { display: flex; flex-direction: column; min-width: 0; }
.evo-opt strong { font-size: 12.5px; color: var(--mc); }
.evo-opt span { font-size: 12px; color: var(--soft); }
.evo-opt.is-off strong, .evo-opt.is-off span { opacity: .55; }
.chip-heat { display: inline-flex; align-items: center; gap: 6px; border-color: #FF7A2E; color: #FFB27A; cursor: help; }
.heat-pips { display: inline-flex; gap: 3px; }
.heat-pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 122, 46, .2); border: 1px solid rgba(255, 122, 46, .6); }
.heat-pips i.on { background: #FF7A2E; box-shadow: 0 0 6px #FF7A2E; }
.log .log-heat { color: #FFB27A; }
.deck-style { color: var(--soft); font-size: 13px; }
.deck-opts, .gd-opts { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--soft); }
.deck-opts strong, .gd-opts strong { color: var(--mc, var(--ink)); }
.gd-opts { font-size: 12.5px; }
.evo-list .deck-opts li { background: none; border: 0; border-radius: 0; padding: 0; }
@media (max-width: 820px) { .evos .evo-choice { grid-column: auto; } }

/* ---------- hidden evolutions: face-down cards that flip ---------- */
.hand-head > div { display: flex; flex-direction: column; gap: 2px; }
.evos .evo-card.evo-wide, .peek-evos .evo-wide { grid-column: span 2; }
.evo-card { perspective: 1000px; min-height: 132px; }
.evo-inner {
  display: grid; height: 100%;
  transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.3, .7, .3, 1);
}
.evo-card.face-up .evo-inner { transform: rotateY(180deg); }
.evo-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.evo-front { transform: rotateY(180deg); position: relative; }
.evo-card:not(.face-up) .evo-front,
.evo-card.face-up .evo-back { pointer-events: none; }
.evo-back {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 132px; padding: 14px; cursor: pointer; font: inherit; color: var(--ink);
  border: 1px solid var(--mc); border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--mc) 9%, transparent) 0 6px, transparent 6px 14px),
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--mc) 22%, #0C162A), #0A1426 75%);
  box-shadow: inset 0 0 0 3px rgba(6, 12, 26, .6), inset 0 0 0 4px color-mix(in srgb, var(--mc) 35%, transparent);
  transition: transform .15s, box-shadow .15s;
}
.evo-back:hover { transform: translateY(-2px); }
.evo-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.evo-back-title { font: 800 18px/1 var(--display); color: var(--mc); }
.evo-back-hint { font-size: 11.5px; color: var(--muted); }
.evo-hide {
  position: absolute; top: 8px; right: 8px;
  font: 600 11px var(--body); color: var(--muted); background: var(--deck-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; cursor: pointer;
}
.evo-hide:hover { color: var(--ink); border-color: var(--mc); }
.evo-front .evo-top { padding-right: 46px; }
.chip-peek { cursor: pointer; font-family: var(--body); }
.chip-peek:hover { color: var(--ink); border-color: var(--mc); border-style: solid; }
.modal-peek { max-width: 460px; }
.modal-peek-open { max-width: 640px; }
.modal-peek h2 { color: var(--mc); }
.peek-evos { width: 100%; }
@media (max-width: 820px) { .evos .evo-card.evo-wide, .peek-evos .evo-wide { grid-column: auto; } }

/* ---------- Card Guide ---------- */
.modal.modal-guide {
  max-width: 980px; height: calc(100vh - 40px); padding: 0; gap: 0;
  border-top-color: var(--gold); overflow: hidden;
}
.gd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; width: 100%; padding: 22px 24px 12px; }
.gd-head h2 { font-size: 34px; }
.gd-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.gd-tabs { display: flex; gap: 4px; width: 100%; padding: 0 24px; border-bottom: 1px solid var(--line); }
.gd-tab {
  font: 700 14px var(--body); color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 10px 12px; margin-bottom: -1px; cursor: pointer;
}
.gd-tab:hover { color: var(--ink); }
.gd-tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.gd-controls { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 14px 24px 10px; }
.gd-search {
  display: flex; align-items: center; gap: 8px; color: var(--muted);
  background: var(--night); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px;
}
.gd-search:focus-within { border-color: var(--gold); }
.gd-search input { flex: 1; font: 500 14px var(--body); color: var(--ink); background: none; border: 0; outline: none; padding: 10px 0; }
.gd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-chip {
  font: 600 12px var(--body); color: var(--soft); background: var(--deck-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer;
}
.gd-chip:hover { border-color: var(--gold); }
.gd-chip.on { background: rgba(244, 197, 66, .16); border-color: var(--gold); color: var(--gold); }
.gd-sort { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.gd-sort select {
  font: 600 12px var(--body); color: var(--ink); background: var(--night);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px 8px;
}
.gd-results { flex: 1; min-height: 0; width: 100%; overflow-y: auto; padding: 4px 24px 24px; }
.gd-count { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.gd-empty { color: var(--muted); padding: 30px 0; text-align: center; }
.gd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.gd-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--deck-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
}
.gd-card.gd-evo { border-top: 3px solid var(--mc); }
.gd-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.gd-top h3 { font-size: 20px; line-height: 1.05; }
.gd-cost {
  display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0;
  font: 800 18px/1 var(--display); color: var(--spark);
  background: rgba(111, 180, 255, .1); border: 1px solid rgba(111, 180, 255, .35); border-radius: 999px; padding: 3px 9px 3px 7px;
}
.gd-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.gd-type { font-weight: 700; border-radius: 4px; padding: 2px 7px; }
.gd-type-keep { color: var(--moon); background: rgba(207, 224, 245, .1); }
.gd-type-now { color: #FFB38A; background: rgba(255, 140, 90, .12); }
.gd-copies { color: var(--muted); }
.gd-text { color: var(--soft); font-size: 13px; }
.gd-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.gd-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.gd-status { display: flex; flex-wrap: wrap; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.gd-st { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.gd-st.st-market { color: var(--gold); background: rgba(244, 197, 66, .14); }
.gd-st.st-owned { color: var(--pc); background: rgba(255, 255, 255, .06); background: color-mix(in srgb, var(--pc) 16%, transparent); }
.gd-st.st-used { color: var(--muted); background: rgba(138, 155, 184, .12); }
.gd-st.st-deck { color: var(--soft); background: rgba(195, 207, 226, .08); }
.gd-discount { font-size: 11px; font-weight: 700; color: var(--spark); padding: 2px 4px; }

/* ---------- modals ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3, 7, 16, .75);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--deck); border: 1px solid var(--line); border-top: 4px solid var(--mc, var(--gold));
  border-radius: var(--r-lg); padding: 24px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  animation: rise .18s ease-out;
}
.modal h2 { font-size: 28px; line-height: 1.05; }
.modal p { color: var(--soft); }
.modal-actions { display: flex; gap: 8px; margin-top: 6px; }
.modal-rules { max-width: 580px; }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--soft); }
.rules strong { color: var(--ink); }

/* Modals headed by a monster's painting. */
.modal-art { padding: 0; gap: 0; max-width: 460px; }
.modal-hero { position: relative; width: 100%; height: 230px; flex-shrink: 0; overflow: hidden; }
.modal-hero-img { width: 100%; height: 100%; object-fit: cover; }
.modal-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--deck) 0%, rgba(12, 22, 42, .3) 40%, transparent 70%);
}
.modal-body { position: relative; width: 100%; padding: 0 24px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: -18px; }
.modal-art h2 { color: var(--mc); }
.modal-win { max-width: 480px; }
.modal-win .modal-hero { height: 320px; }
.modal-win .modal-body { align-items: center; text-align: center; }
.modal-win h2 { font-size: 44px; }
.modal-deck { max-width: 640px; }
.modal-deck .modal-hero { height: 240px; }
.modal-hero-title { position: absolute; left: 24px; right: 24px; bottom: 18px; z-index: 1; }
.modal-hero-title h2 { font-size: 40px; }
.modal-hero-title p { font-size: 13px; }
.modal-deck .modal-body { margin-top: 0; padding-top: 6px; }
.deck-head { font-size: 17px; color: var(--soft); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--deck-2); border: 1px solid var(--smash); color: var(--ink);
  padding: 10px 16px; border-radius: var(--r-sm); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- narrower windows ---------- */
@media (max-width: 1180px) {
  .hh { grid-template-columns: 240px minmax(0, 1fr); }
  .hh-side { grid-column: 1 / -1; flex-direction: row; }
  .hh-side .panel { flex: 1; }
}
@media (max-width: 820px) {
  .hh { grid-template-columns: 1fr; padding: 12px 16px; }
  .hh-side { flex-direction: column; }
  .home { padding: 12px 12px 40px; }
  .box-art { height: 280px; }
  .box-title { left: 14px; right: 14px; bottom: 10px; gap: 10px; }
  .box-badge { width: 76px; height: 76px; }
  .box-wordmark { height: auto; width: min(260px, calc(100% - 86px)); }
  .box-body { padding: 14px 16px 22px; }
  .resume { flex-wrap: wrap; }
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar-title { display: none; }
  .seat { grid-template-columns: 28px 1fr; }
  .seat-picks, .seat-monster { grid-column: 1 / -1; }
  .die { width: 56px; height: 56px; }
  .evo-list { grid-template-columns: 1fr; }
  .gd-grid { grid-template-columns: 1fr; }
}
/* phones: the dice and the Harbor come first, and everything fits across */
@media (max-width: 820px) {
  .hh-center { order: -1; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .topbar-right { gap: 0; }
  .topbar-right .btn { padding: 8px 8px; font-size: 12px; white-space: nowrap; }
  .hh { padding: 10px 12px; gap: 12px; }
  .dice { gap: 6px; }
  .die { width: 50px; height: 50px; border-radius: 12px; }
  .die-num { font-size: 32px; }
  .die-icon { width: 26px; height: 26px; }
  .seat { padding: 10px 12px; gap: 10px; }
  .seat-picks { flex-wrap: wrap; gap: 4px; }
  .setup, .home { padding-left: 12px; padding-right: 12px; }
  .setup-head h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.modal-peek .evo-opt.is-off strong, .modal-peek .evo-opt.is-off span { opacity: 1; }

/* ======================================================================
   Online play (js/online.js): host lobby, host TV table, phone screens
   ====================================================================== */
.room-code { font-family: var(--display); color: var(--gold); letter-spacing: .12em; font-size: 18px; }
.net-pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.net-pill::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--smash); margin-right: 6px; vertical-align: 0; }
.net-pill.is-on { color: var(--heal); }
.net-pill.is-on::before { background: var(--heal); }

/* host lobby */
.lobby { max-width: 1100px; margin: 0 auto; padding: 28px; display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 28px; }
.lobby-join { background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lobby-join h1 { font-size: 30px; }
.qr { background: #fff; border-radius: var(--r-md); padding: 10px; width: min(300px, 100%); }
.qr svg { display: block; width: 100%; height: auto; }
.lobby-url { color: var(--soft); word-break: break-all; font-size: 15px; }
.lobby-code-label { color: var(--muted); font-size: 13px; }
.lobby-code { font-family: var(--display); font-size: 64px; line-height: 1; letter-spacing: .14em; color: var(--gold); }
.lobby-players { display: flex; flex-direction: column; gap: 16px; }
.lobby-players h2 { font-size: 30px; }
.lobby-players h2 span { color: var(--muted); font-size: 20px; }
.lobby-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lobby-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: var(--r-md); background: var(--deck); border: 1px solid var(--line); border-left: 4px solid var(--mc, var(--line)); }
.lobby-row > div { flex: 1; display: flex; flex-direction: column; }
.lobby-row strong { font-size: 20px; }
.lobby-row span { color: var(--muted); }
.lobby-row.is-off { opacity: .55; }
.lobby-row.is-empty { color: var(--muted); border-style: dashed; justify-content: center; min-height: 70px; }

/* host table: a connection strip above the usual table, bigger on a TV */
.net-strip { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 8px 22px 0; font-size: 13px; }
.net-who { display: inline-flex; align-items: center; gap: 6px; }
.net-who em { font-style: normal; color: var(--heal); font-size: 11px; }
.net-who.is-off { opacity: .6; }
.net-who.is-off em { color: var(--smash); font-weight: 700; }
.net-join { margin-left: auto; color: var(--muted); }
@media (min-width: 1600px) {
  body.online-host { font-size: 17px; }
  body.online-host .die { width: 92px; height: 92px; }
  body.online-host .hh { max-width: none; }
}

/* phone */
.phone { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; display: flex; flex-direction: column; gap: 12px; }
.phone h1 { font-size: 32px; }
.phone h2 { font-size: 22px; }
.phone-note { color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field input { font: 600 20px var(--body); padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--deck-2); color: var(--ink); }
#joinCode { letter-spacing: .2em; text-transform: uppercase; font-family: var(--display); font-size: 28px; }
.btn-big { padding: 16px 18px; font-size: 17px; min-height: 52px; width: 100%; }
.phone-wait { text-align: center; padding: 60px 10px; color: var(--soft); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: hh-spin 1s linear infinite; }
@keyframes hh-spin { to { transform: rotate(360deg); } }
.phone-me { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--deck); border: 1px solid var(--line); border-left: 4px solid var(--mc); }
.phone-me > div:not(.phone-stats) { display: flex; flex-direction: column; }
.phone-me span { color: var(--muted); font-size: 13px; }
.phone-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.st { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 15px; }
.phone-me .st { font-size: 18px; color: var(--ink); }
.st-hp { color: var(--heal); } .st-fame { color: var(--gold); } .st-spark { color: var(--spark); } .st-heat { color: var(--smash); }
.phone-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-big { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.2; color: var(--ink); padding: 8px 4px; border: 1px solid var(--line); background: var(--deck); }
.pick-big.selected { border-color: var(--mc); background: var(--deck-2); }
.pick-big span { font-size: 12px; font-weight: 600; }
.phone-lobby, .phone-players, .phone-log, .phone-market, .phone-evos, .phone-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.phone-lobby li { display: flex; align-items: center; gap: 8px; }
.phone-banner { text-align: center; font: 800 20px var(--display); padding: 12px; border-radius: var(--r-md); background: var(--deck-2); border: 1px solid var(--line); }
.phone-banner.is-mine { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.phone-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.phone-tabs button { font: 700 15px var(--body); padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--deck); color: var(--muted); }
.phone-tabs button.on { color: var(--ink); border-color: var(--mc); background: var(--deck-2); }
.phone-dice { justify-content: center; flex-wrap: wrap; gap: 6px; }
.phone-dice .die { width: 50px; height: 50px; border-radius: 12px; }
.phone-name { font: 800 18px var(--display); width: 100%; }
.phone-dice.is-small .die { width: 40px; height: 40px; border-radius: 10px; }
.phone-dice.is-small .die-num { font-size: 24px; }
.phone-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phone-actions .btn-primary { grid-column: 1 / -1; }
.phone-yield { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-md); border: 2px solid var(--smash); background: var(--deck); }
.phone-panel { background: var(--deck); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.phone-panel h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.phone-panel h3 span { color: var(--muted); font: 400 12px var(--body); }
.phone-panel h3 .btn { margin-left: auto; }
.phone-card, .phone-evo { padding: 10px; border-radius: var(--r-sm); background: var(--deck-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.phone-card > div, .phone-evo > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.phone-card.affordable { border-color: var(--gold); }
.phone-card em, .phone-evo span { color: var(--muted); font-size: 12px; font-style: normal; }
.phone-card p, .phone-evo p { color: var(--soft); font-size: 13px; }
.phone-card .btn { align-self: flex-start; min-width: 90px; min-height: 40px; }
.phone-evo-btns { display: flex; flex-direction: column; gap: 6px; }
.phone-evo-btns .btn { text-align: left; min-height: 40px; line-height: 1.3; }
.phone-players li { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); border-left: 3px solid var(--mc); }
.phone-players li.is-current { background: var(--deck-2); }
.phone-players li.is-out { opacity: .5; }
.phone-players .off { color: var(--smash); font-size: 11px; font-style: normal; }
.phone-log li { color: var(--soft); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.phone-cards li { font-size: 13px; color: var(--soft); }
@media (max-width: 820px) {
  .lobby { grid-template-columns: 1fr; padding: 14px; }
  .net-join { display: none; }
}

/* ---------- online: play-on-this-device + TV display additions ---------- */
#joinCode { letter-spacing: .3em; }
.phone-host-note { font-size: 12px; color: var(--gold); text-align: center; }
.phone-paused { background: var(--smash); color: #fff; font-weight: 700; text-align: center; padding: 10px; border-radius: var(--r-md); }
.phone-split .pane { display: none; flex-direction: column; gap: 12px; }
.phone-split.show-me .pane-me, .phone-split.show-table .pane-table { display: flex; }
.modal-invite { max-width: 720px; max-height: 92vh; overflow: auto; }
.invite-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 14px 0; }
.invite-col { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.invite-col .qr { width: min(240px, 100%); }
@media (max-width: 600px) { .invite-cols { grid-template-columns: 1fr; } }
/* laptop width: your controls and the table side by side, no tabs */
@media (min-width: 900px) {
  body.online-phone .phone { max-width: 1240px; }
  body.online-phone .phone-tabs { display: none; }
  .phone-split { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.1fr); gap: 16px; align-items: start; }
  .phone-split .pane { display: flex; }
}
body.online-tv .toast { font-size: 22px; padding: 16px 26px; border-color: var(--gold); }
.undo-btn { font-size: 18px; padding: 6px 10px; }
.sound-btn { font-size: 16px; padding: 6px 8px; }
.phone-hostmsg { background: var(--spark); color: #021022; font-weight: 700; text-align: center; padding: 10px; border-radius: var(--r-md); }
.handoff-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.tap-sound em { color: var(--gold) !important; }
.avatar-none { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 2px dashed var(--muted); color: var(--muted); font: 800 20px var(--display); flex-shrink: 0; }
.lobby-row.is-unpicked span, .phone-me.is-unpicked span { color: var(--gold); }
.phone-lobby li[data-picked="false"] span { color: var(--gold); }

/* ---------- online player screen: the board + a private "My panel" ---------- */
.pgame { display: flex; flex-direction: column; min-height: 100%; }
.pgame-top { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 0; }
.pgame-top:empty { display: none; }
.pturn { align-self: center; font: 700 13px var(--body); color: var(--soft); background: var(--deck-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px; }
.pboard { flex: 1; padding-bottom: 96px; }            /* room for the collapsed panel */
.pgame.panel-open .pboard { padding-bottom: 62vh; }
.pboard .hh { padding-top: 10px; }
.mypanel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--deck); border-top: 2px solid var(--mc); border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .5);
  max-height: 60vh; display: flex; flex-direction: column;
  transition: transform .25s ease-out;
}
.mypanel-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; background: none; border: 0; color: var(--ink); text-align: left; cursor: pointer; }
.mypanel-sum { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mypanel-sum .phone-name { font: 800 15px var(--display); }
.mypanel-sum .st { font-size: 14px; }
.mypanel-chev { color: var(--gold); font-weight: 700; font-size: 13px; white-space: nowrap; }
.mypanel .phone-banner { margin: 0 12px 8px; padding: 8px; font-size: 17px; }
.mypanel:not(.open) .phone-banner:not(.is-mine) { display: none; }
.mypanel-body { display: none; overflow-y: auto; padding: 0 12px 16px; flex-direction: column; gap: 10px; }
.mypanel.open .mypanel-body { display: flex; }
.pgame.my-turn .mypanel { border-top-width: 3px; box-shadow: 0 -10px 40px rgba(244, 197, 66, .25); animation: panel-up .3s ease-out; }
@keyframes panel-up { from { transform: translateY(40%); } to { transform: none; } }
/* laptops: board on the left, My panel as a column on the right */
@media (min-width: 900px) {
  .pgame { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto 1fr; align-items: start; }
  .pgame-top { grid-column: 1 / -1; }
  .pboard, .pgame.panel-open .pboard { padding-bottom: 20px; }
  .mypanel { position: sticky; top: 8px; margin: 10px 12px 0 0; border: 1px solid var(--line); border-top: 3px solid var(--mc); border-radius: var(--r-lg); max-height: calc(100vh - 80px); animation: none !important; }
  .mypanel-body { display: flex; }
  .mypanel-chev { display: none; }
  .mypanel:not(.open) .phone-banner { display: block; }
}

/* Gentle "your decision" banner shown above an open overlay (How to play, Card Guide, Invite). */
.hh-decide {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 70;
  display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 24px);
  background: var(--deck-2); border: 2px solid var(--smash); color: var(--ink);
  padding: 8px 12px; border-radius: var(--r-sm); box-shadow: 0 6px 24px rgba(0,0,0,.45);
}

/* The online top bar carries more buttons; let them wrap on narrow phones. */
@media (max-width: 600px) {
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
}
