/* Regicide table layout (same family look as Tonk and Gin). Tokens come from shared/theme.css. */
.app { max-width: 1280px; margin: 0 auto; padding: 12px 16px 24px; display: grid; gap: 12px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.back-link { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 18px; color: var(--text); }
.title { flex: 1; min-width: 0; }
.title h1 { font-size: 22px; margin: 0; }
.meta { font-size: 13px; }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.small { padding: 5px 10px; font-size: 13px; }

/* ---------- Castle progress ---------- */
.castle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rank-row { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-row .rname { font-weight: 700; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot { width: 28px; height: 32px; overflow: hidden; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none;
  background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.slot svg { width: 100%; height: 100%; display: block; }
.slot.done { background: var(--card-face); border: 1px solid rgba(0, 0, 0, .15); opacity: .5; filter: grayscale(.6); position: relative; }
.slot.done::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 46%, rgba(200, 50, 60, .85) 47% 53%, transparent 54%); }
.slot.captured { filter: none; }
.slot.captured::after { background: none; }
.slot.captured { opacity: 1; box-shadow: 0 0 0 2px var(--gold); }
.slot.now { background: var(--card-face); border: 0; box-shadow: 0 0 0 2px var(--accent), 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 12px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.play { display: grid; gap: 12px; min-width: 0; }

.felt {
  background: radial-gradient(ellipse at 50% 30%, var(--felt) 0%, var(--felt-2) 100%);
  border-radius: 20px; padding: 14px; display: grid; gap: 14px; min-width: 0;
  box-shadow: inset 0 0 0 1px var(--felt-line), inset 0 0 60px rgba(0, 0, 0, .25);
  color: #f4efe6;
}
.zone-label { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: rgba(244, 239, 230, .75); margin-bottom: 6px; }
.zone-label .muted { color: rgba(244, 239, 230, .55); text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ---------- The enemy ---------- */
.fight { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.enemy-card { --card-w: 120px; position: relative; }
.enemy-card .pcard.beaten { filter: grayscale(.8) brightness(.8); transform: rotate(-8deg); }
.enemy-card .pcard.falling { position: absolute; left: 0; top: 0; z-index: 2; animation: topple 1.3s ease-in forwards; }
@keyframes topple { 0% { transform: none; opacity: 1; } 35% { transform: rotate(-6deg); } 100% { transform: translate(-30px, 60px) rotate(-70deg); opacity: 0; } }
.stamp { position: absolute; z-index: 3; left: 50%; top: 74%; transform: translate(-50%, -50%) rotate(-12deg); padding: 4px 10px; border-radius: 8px;
  font-weight: 900; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; color: #fff; background: var(--bad);
  border: 3px solid #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); animation: stamp 1.5s ease-out forwards; pointer-events: none; }
.stamp.captured { background: linear-gradient(135deg, #f2c14e, #d08a12); color: #3a2400; }
@keyframes stamp { 0% { transform: translate(-50%, -50%) rotate(-12deg) scale(2.2); opacity: 0; } 18% { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Floating effect numbers */
.float { position: absolute; z-index: 4; left: 50%; top: 30%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-weight: 900; font-size: 26px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 12px rgba(0, 0, 0, .5); animation: rise 1.5s ease-out forwards; }
.float.dmg { color: #ffd2cc; }
.float.club { font-size: 18px; color: #b8f5c8; top: 55%; }
.float.shield { font-size: 15px; color: #cfe0ff; top: -6px; left: 70%; }
.float.heal { font-size: 16px; color: #ffc1cb; top: 10%; }
.float.draw { font-size: 16px; color: #ffe2a8; top: 10%; }
.float.jest { font-size: 16px; color: #e8d4ff; }
.hand-bar .float { left: auto; right: 10px; top: -4px; font-size: 16px; transform: none; }
@keyframes rise { 0% { opacity: 0; translate: 0 10px; scale: .7; } 15% { opacity: 1; translate: 0 0; scale: 1.1; } 70% { opacity: 1; } 100% { opacity: 0; translate: 0 -34px; scale: 1; } }
#attackStat, #tavern, .hand-bar { position: relative; }
.me.struck { animation: struck .5s; }
@keyframes struck { 0%, 100% { box-shadow: 0 -6px 24px rgba(0, 0, 0, .35); } 25% { box-shadow: 0 0 0 3px var(--bad), 0 0 30px var(--bad); transform: translateX(-5px); } 50% { transform: translateX(4px); } }
.enemy-card .pcard { box-shadow: 0 0 0 3px rgba(0, 0, 0, .25), 0 10px 26px rgba(0, 0, 0, .45); }
.enemy-card .pcard.hurt { animation: hurt .45s; }
@keyframes hurt { 30% { transform: translateX(-6px) rotate(-3deg); filter: brightness(1.3) saturate(1.4); } 60% { transform: translateX(5px) rotate(2deg); } }
.enemy-info { display: grid; gap: 10px; min-width: 0; }
.enemy-name { font-size: 20px; font-weight: 800; }
.enemy-name .sub { font-size: 13px; font-weight: 500; color: rgba(244, 239, 230, .7); margin-left: 6px; }
.stat-head { display: flex; justify-content: space-between; font-size: 13px; color: rgba(244, 239, 230, .8); margin-bottom: 4px; }
.stat-head b { color: #fff; font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .35); overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; transition: width .4s; }
.bar.health i { background: linear-gradient(90deg, #e05656, #f08a4b); }
.bar.health i.ghost { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .55) 0 4px, rgba(255, 255, 255, .25) 4px 8px); transition: none; }
.bar.attack i { background: #f4c95d; }
.immune { font-size: 13px; color: rgba(244, 239, 230, .85); }
.immune b { color: #fff; }
.immune .off { color: var(--good); font-weight: 700; }

.piles { display: flex; gap: 14px; align-items: flex-start; }
.pile { display: grid; justify-items: center; gap: 4px; }
.pile .zone-label { margin: 0; white-space: nowrap; }
.stack { --card-w: 52px; position: relative; width: 58px; height: 78px; }
.stack .pcard { position: absolute; left: 0; top: 0; }
.stack.empty { border: 2px dashed rgba(255, 255, 255, .25); border-radius: 8px; }
.stack .count { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.tokens { display: flex; gap: 6px; height: 78px; align-items: center; }
.token { width: 40px; height: 54px; border-radius: 7px; overflow: hidden; background: var(--card-face); border: 2px solid #c53d7d; box-shadow: var(--shadow); }
.token svg { width: 100%; height: 100%; display: block; }
.token.used { background: rgba(0, 0, 0, .3); opacity: .45; filter: grayscale(1); }

/* ---------- Played cards ---------- */
.played { display: flex; flex-wrap: wrap; gap: 10px; min-height: 64px; }
.played .empty-note { color: rgba(244, 239, 230, .55); font-size: 14px; align-self: center; }
.play-group { --card-w: 42px; position: relative; display: flex; padding: 10px 8px 6px; border-radius: 12px; background: rgba(0, 0, 0, .2); }
.play-group .pcard + .pcard { margin-left: -14px; }
.play-group .pcard .corner.br, .play-group .pcard .pip { display: none; }
.play-group .pcard .corner { font-size: 13px; left: 5px; }
.play-group .pcard .corner .s { font-size: 12px; }
.play-group .who { position: absolute; top: -8px; left: 8px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--pc); background: var(--felt-2); padding: 0 5px; border-radius: 5px; }
.play-group .dmg { align-self: center; margin-left: 8px; font-weight: 800; font-size: 13px; color: #fff; }

/* ---------- Jester and card values ---------- */
.pcard.jester { color: #7c4dcc; }
/* Portrait cards: the picture fills a framed window; the rank and suit sit in the top-left corner. */
.pcard.art .portrait { position: absolute; inset: 7% 7% 7% 7%; border-radius: calc(var(--w) * 0.07); overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .18); background: #fbf6ea; }
.pcard.art .portrait svg { width: 100%; height: 100%; display: block; }
.pcard.art .pip, .pcard.art .corner.br { display: none; }
.pcard.art .corner { z-index: 1; top: 3%; left: 4%; padding: 1px 2px 2px; border-radius: 4px; background: var(--card-face); font-size: calc(var(--w) * 0.2); }
.pcard.art .corner .s { font-size: calc(var(--w) * 0.17); }
.pcard.art .val { z-index: 1; background: var(--card-face); box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); top: auto; bottom: 3%; right: 4%; }
.pcard .val { position: absolute; right: 6%; top: 5%; font-size: calc(var(--w) * 0.15); font-weight: 800; padding: 0 4px; border-radius: 5px; background: rgba(0, 0, 0, .08); color: inherit; }

/* ---------- Banner ---------- */
.banner {
  min-height: 44px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 8px 14px; font-weight: 600;
}
.banner.error { background: color-mix(in srgb, var(--bad) 45%, rgba(0, 0, 0, .4)); }
.banner.you { box-shadow: inset 3px 0 0 var(--p0); }
.banner.danger { box-shadow: inset 3px 0 0 var(--bad); }
.banner .btn { padding: 6px 12px; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.shake { animation: shake .35s; }

/* ---------- Teammates ---------- */
.opponents { display: flex; gap: 10px; flex-wrap: wrap; }
.opponents:empty { display: none; }
.seat {
  --pc: var(--p1);
  flex: 1 1 200px; min-width: 0; background: rgba(0, 0, 0, .22); border: 1px solid var(--felt-line); border-radius: 14px; padding: 10px 12px;
  transition: box-shadow .2s, border-color .2s;
}
.seat.turn { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 22px color-mix(in srgb, var(--pc) 30%, transparent); }
.seat-head { display: flex; align-items: center; gap: 8px; }
.seat-head .name { font-weight: 700; color: var(--pc); }
.seat-head .count { margin-left: auto; font-size: 13px; color: rgba(244, 239, 230, .7); }
.seat .backs { position: relative; height: 46px; margin-top: 8px; }
.seat .backs .pcard { --card-w: 32px; position: absolute; top: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.seat .status { font-size: 12px; color: rgba(244, 239, 230, .75); margin-top: 4px; min-height: 16px; }
.seat .status.yielded { color: var(--gold); }
.thinking { font-size: 12px; color: var(--pc); font-weight: 700; }
.thinking::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ---------- Your hand ---------- */
.me { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px 14px; }
.me.turn { border-color: var(--p0); }
@media (min-height: 760px) {
  .me { position: sticky; bottom: 8px; z-index: 5; box-shadow: 0 -6px 24px rgba(0, 0, 0, .35); }
}
.hand-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hand-title { flex: 1; }
.hand { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; min-height: 136px; padding-top: 18px; --card-w: 78px; }
.hand .pcard { cursor: pointer; }
.hand .empty-note { color: var(--muted); align-self: center; }
.hand .pcard:hover { transform: translateY(-6px); }
.hand .pcard.selected { transform: translateY(-18px); box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(0, 0, 0, .35); }
.hand .pcard.hinted { box-shadow: 0 0 0 3px var(--good), var(--shadow); }
.hand .pcard.new { box-shadow: 0 0 0 2px var(--p1), var(--shadow); }
.hand.waiting .pcard { cursor: default; }
.hand.waiting .pcard:hover { transform: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.sel-info { font-size: 14px; color: var(--muted); flex: 1 1 260px; }
.sel-info.ok { color: var(--good); font-weight: 650; }
.sel-info.bad { color: var(--bad); font-weight: 650; }
.sel-info .pw { display: inline-block; margin-right: 8px; }
.sel-info .off { text-decoration: line-through; opacity: .7; }

@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--gold), 0 0 26px var(--gold); } 100% { box-shadow: var(--shadow); } }
.pcard.flash { animation: flash 1.1s ease-out; }

/* ---------- Side log ---------- */
.side { position: sticky; top: 12px; }
.log-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.log-box summary { font-weight: 700; cursor: pointer; }
.log { list-style: none; margin: 8px 0 0; padding: 0; max-height: 560px; overflow: auto; font-size: 13.5px; display: grid; gap: 4px; }
.log li { padding: 4px 8px; border-radius: 8px; border-left: 3px solid var(--pc, var(--line)); background: var(--surface-2); }
.log li.sys { background: transparent; border-left-color: transparent; color: var(--muted); font-weight: 700; text-align: center; }
@media (max-width: 960px) { .side { position: static; } .log { max-height: 220px; } }

/* ---------- Dialogs ---------- */
.dlg { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); padding: 22px; width: min(520px, calc(100vw - 32px)); }
.dlg.wide { width: min(640px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 10, 20, .6); backdrop-filter: blur(2px); }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin: 12px 0; }
.field .input { width: 100%; color: var(--text); font-size: 15px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.rules ol { padding-left: 20px; display: grid; gap: 8px; }
.rules ul { padding-left: 18px; margin: 6px 0; display: grid; gap: 4px; }
.small-print { font-size: 12px; }
.end-royals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; --card-w: 44px; }
.end-royals .pcard .corner.br, .end-royals .pcard .pip, .end-royals .pcard .val { display: none; }
.end-royals .pcard.left { filter: grayscale(1); }
.end-royals .pcard.left { opacity: .3; }
.end-royals .pcard.cap { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.medal { font-size: 44px; line-height: 1; margin-bottom: 4px; }
#endDlg { position: relative; overflow: hidden; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 3s linear forwards; }
@keyframes fall { to { transform: translate(var(--drift), 640px) rotate(720deg); } }

/* The status line repeated in the hand panel, for phones where the felt scrolls under the hand. */
.turn-note { display: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .app { padding: 10px 12px 20px; gap: 10px; }
  .topbar { gap: 8px; flex-wrap: wrap; }
  .back-link { width: 34px; height: 34px; }
  .title h1 { font-size: 18px; white-space: nowrap; }
  .meta { font-size: 12px; white-space: nowrap; }
  .top-actions { gap: 4px; flex-wrap: nowrap; flex: 1 1 100%; justify-content: flex-end; }
  .top-actions .btn { padding: 6px 9px; font-size: 13px; }
  .castle { gap: 6px; }
  .rank-row { padding: 6px; gap: 4px; flex-wrap: wrap; justify-content: center; }
  .rank-row .rname { flex-basis: 100%; text-align: center; font-size: 12px; }
  .slot { width: 18px; height: 24px; font-size: 12px; border-radius: 4px; }
  .felt { padding: 10px; border-radius: 16px; gap: 10px; }
  .fight { grid-template-columns: auto 1fr; gap: 12px; }
  .enemy-card { --card-w: 78px; }
  .enemy-name { font-size: 17px; }
  .piles { grid-column: 1 / -1; justify-content: space-around; }
  .stack { --card-w: 40px; width: 46px; height: 60px; }
  .tokens { height: 60px; }
  .token { width: 30px; height: 42px; font-size: 18px; }
  .me { padding: 10px 12px 12px; }
  .hand { --card-w: 38px; gap: 4px; flex-wrap: nowrap; min-height: 72px; padding-top: 14px; }
  .hand .pcard.selected { transform: translateY(-12px); }
  .actions { gap: 6px; }
  .actions .btn { padding: 7px 12px; font-size: 14px; }
  .sel-info { flex-basis: 100%; font-size: 13px; }
  .turn-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 8px; padding: 6px 10px; border-radius: 10px;
    background: var(--surface-2); font-size: 13px; font-weight: 650; }
  .turn-note.error { background: color-mix(in srgb, var(--bad) 35%, var(--surface-2)); }
  .turn-note.danger { box-shadow: inset 3px 0 0 var(--bad); }
  .turn-note.you { box-shadow: inset 3px 0 0 var(--p0); }
  .turn-note .btn { padding: 4px 10px; font-size: 13px; }
  .float { font-size: 20px; }
  .stamp { font-size: 14px; }
  .seat { flex-basis: 100px; padding: 6px 8px; }
  .seat .backs { height: 34px; margin-top: 4px; }
  .seat .backs .pcard { --card-w: 22px; }
}
