* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #0f1213; color: #e8e4da; font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a { color: #e0b15a; }
button, select, input { font: inherit; color: inherit; background: #23272c; border: 1px solid #3c444c; border-radius: 7px; padding: 8px 10px; }
button { cursor: pointer; }
button:hover { border-color: #e0b15a; }
button.primary { background: linear-gradient(#8a6722, #6d5019); border-color: #b98a32; color: #fff5dc; font-weight: 600; }
button.danger { background: #3d1c1c; border-color: #6e2c2c; }
button:disabled { opacity: .4; cursor: default; }
.dim { color: #8d8a82; }

/* ---------- front pages */
.front { max-width: 460px; margin: 7vh auto; padding: 0 16px; }
.front h1 { font: 700 44px/1 Georgia, "Times New Roman", serif; letter-spacing: .08em; text-transform: uppercase; color: #f0c060; margin: 0; text-shadow: 0 2px 18px rgba(240, 150, 60, .35); }
#lobby h1, #invite h1 { font-size: 30px; }
.tag { font: italic 18px Georgia, serif; color: #c9b089; margin: 2px 0 18px; letter-spacing: .06em; }
.sub { color: #9a978f; margin: 0 0 14px; overflow-wrap: anywhere; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; color: #9a978f; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
#code { text-transform: uppercase; letter-spacing: .2em; text-align: center; max-width: 120px; }
#seats { margin: 0 0 16px; display: grid; gap: 6px; }
.seat { background: #1b1f23; border: 1px solid #2d343a; border-radius: 7px; padding: 8px 10px; display: flex; justify-content: space-between; }
.seat .off { color: #c2695e; }
#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: #7a3030; padding: 6px 12px; text-align: center; }

/* ---------- the table */
#game { --side: clamp(244px, 21vw, 300px); display: grid; grid-template-columns: minmax(0, 1fr) var(--side); height: 100vh; height: 100dvh; }
#board {
  /* My monster size: whichever of the screen's height or width runs out first. The other sizes follow it. */
  --me: clamp(64px, min((100dvh - 340px) / 4.5, (100vw - var(--side) - 136px) / 8.1), 300px);
  --op: calc(var(--me) * .74);
  --sd: calc(var(--me) * .64);
  --hc: calc(var(--me) * .8);
  --stg: var(--me);                 /* the centre display's card size; the client fits it to the free space */
  display: grid; gap: 8px; padding: 8px 10px; overflow: auto; min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "bar bar bar" "left top right" "left centre right" "left me right" "hand hand hand";
  background: radial-gradient(ellipse at 50% 46%, #24332e 0%, #17201f 48%, #0d1011 100%);
}
#topbar { grid-area: bar; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: #a9a59b; }
#topbar .logo { font: 700 15px Georgia, serif; letter-spacing: .14em; text-transform: uppercase; color: #f0c060; }
#topbar .order { display: flex; gap: 4px; align-items: center; }
#topbar .order i { font-style: normal; padding: 2px 8px; border-radius: 999px; background: #1d2327; border: 1px solid #2f373d; }
#topbar .order i.on { border-color: #e0b15a; color: #f0c060; background: #2c2616; }
#topbar .order i.out { opacity: .45; text-decoration: line-through; }
#pl-left { grid-area: left; } #pl-top { grid-area: top; } #pl-right { grid-area: right; } #pl-me { grid-area: me; }
#pl-left, #pl-right { align-self: center; }
#pl-left:empty, #pl-right:empty, #pl-top:empty { display: none; }

.area { border-radius: 12px; padding: 6px 8px; background: rgba(10, 14, 15, .42); border: 1px solid rgba(255, 255, 255, .06); display: grid; gap: 5px; justify-content: center; }
.area.active { border-color: rgba(224, 177, 90, .75); box-shadow: 0 0 18px rgba(224, 177, 90, .16); }
.area.out { opacity: .4; filter: grayscale(.7); }
.area.ptgt { outline: 3px solid #5fb7ea; cursor: pointer; }
.ph { display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: baseline; justify-content: center; font-size: 12px; color: #a9a59b; }
.ph .pn { font-weight: 700; font-size: 14px; color: #efeadf; }
.area.active .ph .pn { color: #f0c060; }
.ph .life { position: relative; font-weight: 800; font-size: 15px; color: #ff9d8a; }
.ph .life::before { content: "♥ "; font-size: 12px; }
.ph a { color: #a9a59b; }
.ph .flag { color: #e0b15a; }
.rowc { display: grid; gap: 5px; justify-content: center; }
.area.me .rowc { grid-template-columns: repeat(5, var(--me)); }
.area.top .rowc { grid-template-columns: repeat(5, var(--op)); }
.area.side { justify-content: center; }
.area.side .ph { flex-direction: column; align-items: center; gap: 0 6px; max-width: calc(var(--sd) * 1.8); text-align: center; }
.cols { display: flex; gap: 5px; justify-content: center; }
.col { display: grid; gap: 5px; grid-auto-rows: var(--sd); }
.col.mon { width: var(--sd); } .col.sp { width: calc(var(--sd) * .62); }

/* ---------- cards */
.cd { position: relative; border-radius: 8px; overflow: hidden; background: #1a1f23; border: 1px solid #3a444c; aspect-ratio: 1; min-width: 0; user-select: none; -webkit-user-select: none; }
.rowc.sp .cd { aspect-ratio: 2 / 1; }
.col .cd { aspect-ratio: auto; height: 100%; }
.cd img.art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cd.empty { background: rgba(255, 255, 255, .025); border: 1px dashed rgba(255, 255, 255, .14); }
.cd.back { border-color: #6a5529; background:
    repeating-linear-gradient(45deg, rgba(224, 177, 90, .10) 0 5px, transparent 5px 12px),
    repeating-linear-gradient(-45deg, rgba(224, 177, 90, .10) 0 5px, transparent 5px 12px), #1c1a22; }
.cd.back::after { content: "W"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 22px Georgia, serif; color: rgba(240, 192, 96, .55); }
.col.sp .cd.back::after, .rowc.sp .cd.back::after { font-size: 15px; }
.cd.mydown img.art { opacity: .35; }
.cd.r-Rare { border-color: #5d7fb8; } .cd.r-Epic { border-color: #8e68ad; } .cd.r-Legendary, .cd.dragon { border-color: #c79a3c; }
.cd .foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 4px 3px; background: linear-gradient(transparent, rgba(0, 0, 0, .9) 48%); display: flex; flex-direction: column; align-items: stretch; gap: 1px; font-size: 11px; line-height: 1.15; }
.cd .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; text-shadow: 0 1px 2px #000; }
.cd .st { white-space: nowrap; font-size: 12px; text-align: right; }
.cd .st .a::before { content: "\2694\FE0E"; font-weight: 400; font-size: 10px; margin-right: 1px; opacity: .9; }
.cd .st .d::before { content: "\1F6E1"; font-weight: 400; font-size: 8.5px; margin-right: 1px; }
.cd .st .h::before { content: "\2665\FE0E"; font-weight: 400; font-size: 9.5px; margin-right: 1px; opacity: .9; }
.cd .st b { font-weight: 800; margin-left: 3px; text-shadow: 0 1px 2px #000; }
.cd .st .a { color: #f5b95e; } .cd .st .d { color: #8fc5f2; } .cd .st .h { color: #8fe086; } .cd .st .h.hurt { color: #ff8f7c; }
.area.top .cd .nm, .area.side .cd .nm { display: none; }
.area.top .cd .foot, .area.side .cd .foot { padding-top: 10px; }
.area.top .cd .st, .area.side .cd .st { text-align: center; font-size: 11px; }
.area.top .cd .st b::before, .area.side .cd .st b::before { content: none; }
.area.top .cd .st b, .area.side .cd .st b { margin: 0 2px; }
.cd .chips { position: absolute; top: 2px; left: 2px; right: 2px; display: flex; flex-wrap: wrap; gap: 2px; }
.cd .chips i { font-style: normal; font-size: 9.5px; line-height: 1.15; padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #cfe6f7; }
.cd .chips i.k-poison, .cd .chips i.k-pinned, .cd .chips i.k-asleep, .cd .chips i.k-entangled, .cd .chips i.k-blackout, .cd .chips i.k-overheating { color: #ffb0a0; }
.cd .chips i.k-guard { color: #f0c060; }
.area.side .cd .chips i:nth-child(n+3), .area.top .cd .chips i:nth-child(n+3) { display: none; }
.cd .attn { position: absolute; right: 2px; top: 2px; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 999px; background: #6b4a9a; color: #fff; z-index: 1; }
.cd.sp .foot { padding-top: 8px; }
.cd.can { box-shadow: inset 0 0 0 2px #c79a3c; cursor: pointer; }
.cd.sel { outline: 3px solid #f6cf6e; outline-offset: 1px; z-index: 2; }
.cd.tgt { outline: 3px solid #5fb7ea; outline-offset: 1px; cursor: pointer; animation: pulse 1.1s ease-in-out infinite; }
.cd.chosen { outline: 3px solid #f6cf6e; }
@keyframes pulse { 50% { outline-color: rgba(95, 183, 234, .35); } }
.cd.hit { animation: hit .45s; } .cd.healed { animation: healed .6s; }
@keyframes hit { 20% { transform: translate(-3px, 1px); filter: brightness(1.9) saturate(.4); } 60% { transform: translate(3px, -1px); } }
@keyframes healed { 30% { filter: brightness(1.5) hue-rotate(40deg); } }
.float { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font: 900 clamp(22px, calc(var(--me) * .26), 44px) system-ui, sans-serif; text-shadow: 0 0 5px #000, 0 2px 4px #000; pointer-events: none; z-index: 5; animation: floatup 2.2s ease-out forwards; }
.float.dmg { color: #ff6f5e; } .float.heal { color: #8fe086; }
.life .float { top: -6px; font-size: 16px; }
@keyframes floatup { 0% { transform: translate(-50%, -30%) scale(.7); } 15% { transform: translate(-50%, -50%) scale(1.15); } 70% { opacity: 1; } 100% { transform: translate(-50%, -140%); opacity: 0; } }

/* ---------- centre of the table */
#centre { grid-area: centre; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 12px; border-radius: 14px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(224, 177, 90, .18); min-height: calc(var(--me) * .9 + 125px); }
.envslot { width: clamp(110px, calc(var(--me) * 1.3), 280px); aspect-ratio: 2 / 1; position: relative; border-radius: 9px; overflow: hidden; border: 1px dashed rgba(255, 255, 255, .2); display: grid; place-items: center; color: #6f7a78; font-size: 12px; text-align: center; }
.envslot.on { border: 1px solid #c79a3c; cursor: pointer; }
.envslot.etgt { outline: 3px solid #5fb7ea; outline-offset: 1px; }
.envslot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.envslot .foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, .9) 55%); font-size: 11px; color: #e8e4da; text-align: left; }
.envslot .foot b { display: block; font-size: 12px; }
.mid { display: grid; gap: 5px; min-width: 0; }
.turnline { font-size: 15px; } .turnline b { color: #f0c060; }
.turnline .phase { margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: #2c2616; border: 1px solid #6a5529; font-size: 12px; color: #f0c060; text-transform: uppercase; letter-spacing: .06em; }
.chain { display: flex; flex-direction: column-reverse; gap: 3px; max-height: 84px; overflow: auto; }
.chain div { padding: 3px 8px; background: #23292e; border-left: 3px solid #5fb7ea; border-radius: 4px; font-size: 12.5px; }
.chain div:last-child { border-left-color: #f0c060; background: #2b2a22; }
.chain .x { text-decoration: line-through; opacity: .55; }
.envnote { color: #9cc4e4; font-size: 12px; }
.winbar { display: grid; gap: 3px; }
.bar { height: 9px; background: #2b3237; border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: #e0b15a; width: 100%; }
.bar.you i { background: #ff8f7c; }
.prim { display: grid; gap: 6px; min-width: 130px; width: clamp(130px, calc(var(--me) * 1.35), 230px); }
.prim button { padding: 12px 14px; font-size: 15px; }
.prim .wait { color: #8d8a82; text-align: center; font-size: 13px; }
.over { text-align: center; font: 700 22px Georgia, serif; color: #f0c060; }

/* ---------- my hand */
#hand { grid-area: hand; display: flex; gap: 6px; overflow-x: auto; padding: 8px 4px 6px; justify-content: safe center; align-items: flex-start; min-height: calc(var(--hc) + 44px); }
.cd.hc { flex: 0 0 var(--hc); aspect-ratio: auto; background: #20252a; transition: transform .12s; cursor: pointer; }
.cd.hc .pic { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; }
.cd.hc .pic .foot { padding-top: 12px; }
.cd.hc .pic .ty { color: #bfe0f7; font-size: 10.5px; text-align: right; text-shadow: 0 1px 2px #000; }
.cd.hc .txt { padding: 3px 4px 4px; font-size: 11px; line-height: 1.15; height: 31px; }
.cd.hc .nm { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-shadow: none; }
.cd.hc.sel { transform: translateY(-6px); }
.cd.hc.r-Rare .nm { color: #9ec0ff; } .cd.hc.r-Epic .nm { color: #d2a8ea; } .cd.hc.r-Legendary .nm { color: #f0c060; }

/* ---------- side panel */
#side { border-left: 1px solid #2a3136; background: #14181a; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; min-width: 0; }
#panel { padding: 10px; border-bottom: 1px solid #2a3136; max-height: 56vh; overflow: auto; display: grid; gap: 6px; }
#panel button { text-align: left; width: 100%; }
#panel .go { text-align: center; }
#panel h3 { margin: 4px 0 0; font-size: 13px; color: #9a978f; font-weight: 500; }
#panel label { display: flex; gap: 6px; align-items: center; color: #b9b5ab; font-size: 13px; }
.detail { background: #1b2024; border-radius: 8px; padding: 8px; font-size: 13px; }
.detail img.big { display: block; width: 100%; max-height: 180px; object-fit: contain; border-radius: 6px; margin-bottom: 6px; cursor: zoom-in; background: #101315; }
.detail .t { font-weight: 700; font-size: 15px; }
.detail .m { color: #8d8a82; font-size: 12px; }
.detail .f { color: #8d8a82; font-style: italic; font-size: 12px; margin-top: 4px; }
.menu { display: grid; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid #2a3136; }
.menu .rowb { display: flex; gap: 6px; } .menu .rowb button { text-align: center; font-size: 13px; padding: 6px; }
.glist div { padding: 2px 0; }
#log { padding: 8px 10px; overflow: auto; color: #b3afa5; font-size: 12.5px; }
#log div { padding: 1px 0; }
#log .turn { color: #e0b15a; margin-top: 6px; }
#log .me { color: #e8e4da; }
#zoom { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .9); display: grid; place-items: center; cursor: zoom-out; }
#zoom[hidden] { display: none; }
#zoom img { max-width: 96vw; max-height: 96vh; border-radius: 10px; }

@media (max-width: 820px) {
  #game { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 38vh; }
  #side { border-left: 0; border-top: 1px solid #2a3136; }
  #panel { max-height: 22vh; }
  #board { --me: clamp(54px, 15vw, 96px); grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "top" "left" "right" "centre" "me" "hand"; grid-template-rows: none; }
  .area.side .cols { flex-direction: column; } .area.side .col { grid-auto-flow: column; grid-auto-columns: var(--sd); grid-auto-rows: auto; width: auto !important; justify-content: center; }
  .area.side .col .cd { aspect-ratio: 1; height: auto; } .area.side .col.sp .cd { aspect-ratio: 2 / 1; }
}

/* ---------- my rows, with the Intercede button to the left of the monsters */
.mygrid { display: grid; grid-template-columns: calc(var(--me) * .82) auto; gap: 5px 8px; align-items: stretch; }
.icp { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; border-radius: 10px; padding: 6px 4px; font-size: clamp(11px, calc(var(--me) * .1), 15px); line-height: 1.15; border: 1px solid #3a444c; background: #171b1f; color: #6f777b; }
.icp b { font-size: 1.1em; letter-spacing: .04em; text-transform: uppercase; }
.icp small { font-size: .82em; opacity: .85; }
.icp .secs { font: 900 1.9em system-ui, sans-serif; color: #ff8f7c; }
button.icp.ready { cursor: pointer; color: #fff3d6; border: 2px solid #f0c060; background: radial-gradient(circle at 50% 40%, #8a5a1c, #4a2f10); box-shadow: 0 0 18px rgba(240, 192, 96, .55); animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 6px rgba(240, 192, 96, .25); } }
.icp.holding { color: #ffe1d6; border: 2px solid #ff8f7c; background: #3a1b17; }
.icp.other { color: #cfd6da; border-color: #5fb7ea; background: #152330; }
.icp.other .secs { color: #9fd3f5; }

/* ---------- an empty slot I can summon into: top half face up, bottom half face down */
.cd.empty.open { display: grid; grid-template-rows: 1fr 1fr; border: 2px solid #5fb7ea; cursor: pointer; animation: pulse 1.1s ease-in-out infinite; outline: none; }
.cd.empty.open .half { display: grid; place-items: center; font-size: clamp(10px, calc(var(--me) * .095), 15px); font-weight: 700; color: #cfe9fa; text-align: center; padding: 2px; }
.cd.empty.open .half.up { background: rgba(95, 183, 234, .16); border-bottom: 1px dashed rgba(95, 183, 234, .55); }
.cd.empty.open .half.dn { background: rgba(30, 40, 50, .55); color: #a9c3d3; }
.cd.empty.open .half:hover, .cd.empty.open.dropup .half.up, .cd.empty.open.dropdn .half.dn, .cd.empty.open .half.on { background: rgba(240, 192, 96, .32); color: #fff3d6; }
.cd.drophover:not(.empty), .area.drophover, .envslot.drophover { outline: 3px solid #f0c060 !important; outline-offset: 2px; }

/* ---------- dragging a card out of the hand */
#hand .cd.hc { touch-action: pan-x; }
.cd.ghost { position: fixed; z-index: 50; width: var(--hc); pointer-events: none; transform: translate(-50%, calc(-100% - 18px)) rotate(-4deg) scale(1.05); box-shadow: 0 12px 30px rgba(0, 0, 0, .7); opacity: .92; }
.cd.lifted { opacity: .35; }
.hint { font-size: 13px; color: #cfe6f7; background: #16232c; border-radius: 6px; padding: 6px 8px; }

/* ---------- the stage: the attack or spell in play, large in the centre */
.mid { align-self: stretch; align-content: center; min-width: 0; }
.envslot { flex: none; }
.stage { display: grid; justify-items: center; gap: 4px; }
.scap { font-size: clamp(13px, calc(var(--me) * .11), 18px); font-weight: 600; text-align: center; }
.srow { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, calc(var(--me) * .12), 22px); }
.sc { display: grid; justify-items: center; position: relative; }
.sc .res { position: absolute; top: calc(var(--stg) * -.06); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 3; white-space: nowrap; pointer-events: none; }
.sc .res b { font: 900 clamp(24px, calc(var(--me) * .3), 54px) system-ui, sans-serif; text-shadow: 0 0 6px #000, 0 3px 4px #000; animation: pop .35s ease-out; }
.sc .res b.dmg { color: #ff6f5e; } .sc .res b.heal { color: #8fe086; } .sc .res b.none { color: #cfd6da; font-size: clamp(14px, calc(var(--me) * .15), 26px); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.sface { position: relative; width: var(--stg); height: var(--stg); border-radius: 10px; overflow: hidden; border: 2px solid #c79a3c; background: #1a1f23; box-shadow: 0 6px 18px rgba(0, 0, 0, .55); }
.sface img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sface .foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, .9) 45%); display: flex; flex-direction: column; font-size: clamp(11px, calc(var(--me) * .1), 15px); }
.sface .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sface .st { text-align: right; } .sface .st b { margin-left: 4px; font-weight: 800; }
.sface .st .a { color: #f5b95e; } .sface .st .d { color: #8fc5f2; } .sface .st .h { color: #8fe086; } .sface .st .h.hurt { color: #ff8f7c; }
.sface.back { background: repeating-linear-gradient(45deg, rgba(224, 177, 90, .10) 0 6px, transparent 6px 14px), #1c1a22; border-color: #6a5529; }
.sface.dead img { filter: grayscale(1) brightness(.5); }
.sface .stamp { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); font: 900 clamp(13px, calc(var(--me) * .14), 22px) system-ui, sans-serif; color: #ff6f5e; border: 3px solid #ff6f5e; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; background: rgba(0, 0, 0, .55); }
.sface.player { display: grid; place-content: center; text-align: center; border-color: #e07a6a; background: radial-gradient(circle, #3a2020, #1b1214); }
.sface.player .pn { font-weight: 700; font-size: clamp(13px, calc(var(--me) * .13), 20px); }
.sface.player .life { font: 900 clamp(26px, calc(var(--me) * .34), 60px) system-ui, sans-serif; color: #ff9d8a; }
.sface.player .life::before { content: "♥ "; font-size: .5em; }
.arrow { align-self: center; font-size: clamp(28px, calc(var(--me) * .38), 64px); color: #f0c060; text-shadow: 0 0 10px rgba(240, 150, 60, .6); animation: nudge .9s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(6px); } }
.stage .banner { font-style: normal; font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: #2b2a22; color: #f0c060; }
.stage .banner.wait { background: #152330; color: #9fd3f5; }
.stage .banner.x { background: #3d1c1c; color: #ff9d8a; }
.stage.cancelled .sface { opacity: .55; }
.bar.hold i { background: #5fb7ea; }
.phase.sil { border-color: #7a3030; color: #ff9d8a; background: #2a1414; margin-left: 4px; }

.detail.small { display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: start; padding: 6px; }
.detail.small img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; }
.detail.small .t { font-size: 14px; }
.prim .danger { padding: 8px 12px; font-size: 13px; }

/* ---------- threats: something is aimed at you and you can answer */
#centre.threat { border-color: #ff5a4a; box-shadow: 0 0 0 2px rgba(255, 90, 74, .55), 0 0 34px rgba(255, 70, 50, .35); animation: threatglow 1.2s ease-in-out infinite; }
@keyframes threatglow { 50% { box-shadow: 0 0 0 2px rgba(255, 90, 74, .25), 0 0 12px rgba(255, 70, 50, .15); } }
.threatbar { background: linear-gradient(90deg, #6e1712, #a3271d, #6e1712); color: #fff; font-weight: 800; letter-spacing: .02em; text-align: center; border-radius: 8px; padding: 6px 10px; font-size: clamp(14px, calc(var(--me) * .12), 20px); text-shadow: 0 1px 2px #000; }
.winbar.threat b { color: #ffb4a8; }
.winbar.threat .bar i { background: #ff5a4a; }
.cd.threatened { outline: 4px solid #ff5a4a !important; outline-offset: 2px; animation: threatpulse .8s ease-in-out infinite; z-index: 3; }
@keyframes threatpulse { 50% { outline-color: rgba(255, 90, 74, .25); transform: scale(1.03); } }
.prim button { display: grid; justify-items: center; gap: 1px; }
.prim button small { font-size: 11px; font-weight: 500; opacity: .85; }
.prim button.alarm { background: linear-gradient(#c43a2c, #8a1f16); border-color: #ff7b6b; color: #fff; animation: glow 1s ease-in-out infinite; }

#panel { overflow-x: hidden; }
#panel label.stack { display: grid; gap: 4px; }
#panel select { width: 100%; min-width: 0; }

/* ---------- catch-up strip in the top bar: the last few actions, newest first; red when it cost you */
#topbar { flex-wrap: nowrap; overflow: hidden; }
#topbar > span:not(.recent) { flex: none; }
.recent { display: flex; gap: 5px; min-width: 0; flex: 1; overflow: hidden; margin-left: 6px; }
.rt { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; max-width: 230px; padding: 2px 8px 2px 2px; border-radius: 8px; background: #1b2024; border: 1px solid #2f373d; font-size: 12px; color: #c9c5bb; text-align: left; }
.rt img, .rt .rb { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; flex: none; }
.rt .rb { background: repeating-linear-gradient(45deg, rgba(224, 177, 90, .18) 0 4px, transparent 4px 8px), #1c1a22; }
.rt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt.hit { border-color: #ff5a4a; background: #2c1513; color: #ffd2cb; }
.rt.mine { opacity: .7; }
.rt:first-child { border-color: #6a5529; }
.rt.hit:first-child { border-color: #ff5a4a; }

/* ---------- whose turn it is, announced across the table */
#turnbanner { position: fixed; left: calc((100vw - var(--side, 290px)) / 2); top: 42%; transform: translate(-50%, -50%) scale(.9); z-index: 45; pointer-events: none; opacity: 0;
  font: 800 clamp(26px, 4.4vw, 64px) Georgia, "Times New Roman", serif; letter-spacing: .06em; color: #f0c060; padding: 10px 40px; border-radius: 14px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .85), rgba(0, 0, 0, .55) 70%, transparent); text-shadow: 0 2px 16px rgba(240, 150, 60, .6); white-space: nowrap; }
#turnbanner.you { color: #fff3d6; }
#turnbanner.show { animation: turnin 1.9s ease-out forwards; }
@keyframes turnin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.85); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

/* compact older strip entries: the two newest say what happened, the rest show just the card */
.rt:nth-child(n+3) { padding-right: 2px; }
.rt:nth-child(n+3) span { display: none; }
#turnbanner { background: rgba(10, 12, 14, .9); border: 1px solid #6a5529; box-shadow: 0 10px 50px rgba(0, 0, 0, .7); }
#turnbanner.you { border-color: #f0c060; }
#topbar .mute { flex: none; background: none; border: 1px solid #2f373d; border-radius: 8px; padding: 1px 7px; font-size: 15px; line-height: 1.4; }

/* ---------- animations: the move in the centre arrives, an attacker lunges, a hit target shakes, a destroyed one breaks up */
.stage.in .srow > .sc, .stage.in .srow > .arrow { animation: stin .45s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: var(--t); }
.stage.in .srow > .arrow { animation-name: arrowin; animation-duration: .7s; }
.stage.atk.in .srow > .sc:first-child .sface { animation: lunge .8s ease-in-out both; animation-delay: var(--t); }
.stage.struck .srow > .sc:not(:first-child) .sface:not(.player), .stage.struck.atk .srow > .sc:first-child .sface.dead { animation: struck .5s ease-out both; animation-delay: var(--d); }
.stage.struck .sface.dead { animation: shatter .9s ease-in both !important; animation-delay: var(--d) !important; }
.stage.struck .res b { animation: dmgpop .5s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: var(--d); }
@keyframes stin { from { opacity: 0; transform: translateY(-30px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes arrowin { 0%, 40% { opacity: 0; transform: translateX(-20px); } 100% { opacity: 1; transform: none; } }
@keyframes lunge { 0%, 35% { transform: none; } 60% { transform: translateX(45%) rotate(4deg) scale(1.06); } 100% { transform: none; } }
@keyframes struck { 0% { transform: none; filter: none; } 20% { transform: translateX(-9px) rotate(-2deg); filter: brightness(1.8) sepia(1) hue-rotate(-30deg) saturate(4); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; filter: none; } }
@keyframes shatter { 0% { transform: none; filter: none; opacity: 1; } 25% { transform: translateX(-6px) rotate(-3deg); filter: brightness(2) saturate(3); } 100% { transform: scale(.88) rotate(5deg) translateY(10px); filter: grayscale(1) brightness(.5); opacity: .55; } }
@keyframes dmgpop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }

.cd.arrive { animation: arrive .6s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(-24px) scale(.8); box-shadow: 0 0 0 4px rgba(240, 192, 96, .9); } to { opacity: 1; transform: none; } }
.ghostdead { animation: ghostdead 1.2s ease-in forwards; }
@keyframes ghostdead { 0% { filter: brightness(2.2) saturate(3); transform: none; opacity: 1; } 20% { transform: translateX(-5px) rotate(-3deg); } 100% { filter: grayscale(1) brightness(.3); transform: scale(.75) rotate(8deg) translateY(30px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .stage *, .cd.arrive, .ghostdead, #turnbanner.show { animation-duration: .01s !important; }
}

#topbar .mute.asleep { font-size: 12px; color: #f0c060; border-color: #6a5529; }

/* a face-down creature of yours that can be turned face up now: gold edge; tap it and a Face up button covers its top half */
.cd.canflip { box-shadow: 0 0 0 2px #f0c060, 0 0 14px rgba(240, 192, 96, .45); }
.cd .flipbtn { position: absolute; left: 6%; right: 6%; top: 8%; height: 42%; z-index: 4; border-radius: 10px; border: 2px solid #f0c060;
  background: rgba(30, 24, 10, .88); color: #ffe3a0; font: 700 clamp(12px, calc(var(--me) * .12), 22px) system-ui, sans-serif; cursor: pointer; }
.cd .flipbtn:hover { background: rgba(70, 52, 14, .95); }

/* attack phase: creatures that can still attack blink green; the chosen attacker is solid green; what it can hit blinks yellow */
.cd.ready { outline: 3px solid #4fd16a; outline-offset: 1px; animation: readyblink 1.2s ease-in-out infinite; }
.cd.ready.sel { outline: 4px solid #4fd16a; outline-offset: 2px; animation: none; box-shadow: 0 0 18px rgba(79, 209, 106, .7); }
.cd.tgt.atk { outline: 3px solid #ffd23a; animation: atkblink 1s ease-in-out infinite; }
.area.ptgt.atk { outline: 3px solid #ffd23a; animation: atkblink 1s ease-in-out infinite; }
@keyframes readyblink { 0%, 100% { outline-color: #4fd16a; box-shadow: 0 0 12px rgba(79, 209, 106, .55); } 50% { outline-color: rgba(79, 209, 106, .25); box-shadow: none; } }
@keyframes atkblink { 0%, 100% { outline-color: #ffd23a; box-shadow: 0 0 14px rgba(255, 210, 58, .55); } 50% { outline-color: rgba(255, 210, 58, .3); box-shadow: none; } }

/* defence is always shown, dimmed when it is 0 */
.cd .st .d.zero, .sface .st .d.zero { opacity: .55; }
.cd .st .d.neg, .sface .st .d.neg { color: #ff6f5e !important; opacity: 1; font-weight: 900; }

/* waiting room: players on the left, the host's game settings on the right in two columns, so it all fits
   on one screen without scrolling (17 Nov); one column again on narrow screens */
#lobby.front { max-width: 1280px; margin: 0 auto; padding-top: 2vh; padding-bottom: 2px; }
.lobbycols { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 10px; }
.gamesettings { background: #15191c; border: 1px solid #2f373d; border-radius: 12px; padding: 12px 16px 14px; display: grid; gap: 8px; }
.gamesettings h2 { margin: 0; font: 700 18px Georgia, serif; color: #f0c060; letter-spacing: .04em; }
.gamesettings > .sub { margin: -4px 0 0; font-size: 12px; }
.setgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; align-items: start; }   /* 0.12.1: three columns */
.set { display: grid; gap: 3px; min-width: 0; }
.set label { display: grid; gap: 3px; color: #9a978f; }
.set .sub { margin: 0; font-size: 12px; line-height: 1.3; }
.set label.check { display: flex; gap: 8px; align-items: center; color: #b9b5ab; padding-top: 18px; }
.set label.check.inline { padding-top: 2px; }
.set .pair { display: grid; grid-template-columns: 1fr; gap: 3px; }
.set .setlabel { color: #b9b5ab; }
#turtleBox:not([hidden]) { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-content: start; }
#turtleBox .setlabel { grid-column: 1 / -1; }
.set label.killrow { display: flex; gap: 8px; align-items: center; color: #b9b5ab; padding-top: 2px; }
.set label.killrow select { width: auto; padding: 2px 6px; }
.wg.spent { opacity: .55; }
@media (max-width: 900px) { .setgrid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .lobbycols { grid-template-columns: 1fr; } }

/* dragging a spell: places a drop would use are outlined; the one under the pointer glows */
.dropzone { outline: 2px dashed rgba(240, 192, 96, .55); outline-offset: 3px; border-radius: 10px; }
#centre.drophover, .rowc.sp.drophover { outline: 3px solid #f0c060; outline-offset: 3px; box-shadow: 0 0 22px rgba(240, 192, 96, .35); border-radius: 10px; }
[hidden] { display: none !important; }
.gamesettings label, .gamesettings select { min-width: 0; width: 100%; }
.gamesettings select { text-overflow: ellipsis; }

/* Cast: the same box as Intercede, in a cool blue so the two are told apart at a glance */
.icp.cast.ready { border-color: #5fb0ff; color: #d5ecff; box-shadow: 0 0 14px rgba(95, 176, 255, .45); }
.icp.cast.holding { border-color: #5fb0ff; }

button.armed { background: #7a1f16 !important; border-color: #ff6a55 !important; color: #fff !important; animation: armedpulse .8s ease-in-out infinite; }
@keyframes armedpulse { 50% { box-shadow: 0 0 14px rgba(255, 106, 85, .7); } }

/* effects in play, at the top of the centre: readable at a glance; the ones holding you back in red */
#centre .effects { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 6px; }
#centre .eff { font: 600 15px/1.3 system-ui, sans-serif; padding: 4px 12px; border-radius: 999px; background: #20262b; border: 1px solid #3a444b; color: #e6e1d6; }
#centre .eff.mine { background: #3a1611; border-color: #ff6a55; color: #ffd8d0; }
#panel .whynot { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #2a1f14; border: 1px solid #6a5529; color: #f3dfb5; font-size: 14px; }

#panel button.quick { font-size: 16px; padding: 10px 12px; margin: 4px 0 6px; }

/* ---------- card frames (16 Nov): frame images from client/frames/, corners kept, edges stretched; the picture sits
   whole inside the opening. Sizes are in container units (cqw = 1% of the card's width), so a frame looks the same
   on a small board card and on the big card in the side panel. */
.cd, .cd.hc .pic, .sface, .dpic { container-type: inline-size; }
.dpic { position: relative; width: min(100%, 180px); aspect-ratio: 1; margin: 0 auto 6px; }
.dpic > img.big { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; margin: 0; }
.framed { border: 0 !important; border-radius: 0 !important; overflow: visible !important; background: transparent !important; }
.framed > .frm { position: absolute; inset: 0; z-index: 1; pointer-events: none; border-style: solid; border-color: transparent;
  border-width: calc(var(--bt) * 1cqw) calc(var(--br) * 1cqw) calc(var(--bb) * 1cqw) calc(var(--bl) * 1cqw);
  border-image-source: var(--fimg); border-image-slice: var(--fsl); border-image-repeat: stretch; }
.framed > img.art { inset: auto; left: calc(var(--fl) * 1cqw - 3px); top: calc(var(--ft) * 1cqw - 3px);
  width: calc(100% - (var(--fl) + var(--fr)) * 1cqw + 6px); height: calc(100% - (var(--ft) + var(--fb)) * 1cqw + 6px);
  object-fit: contain; background: #0d1012; border-radius: 0; }
.framed > .foot { left: calc(var(--fl) * 1cqw); right: calc(var(--fr) * 1cqw); bottom: calc(var(--fb) * 1cqw); z-index: 2; padding-left: 3px; padding-right: 3px; }
.framed.band > .foot .st { position: absolute; left: 50%; top: calc(100% + var(--fb) * .5cqw); transform: translate(-50%, -50%); width: max-content;
  padding: 0 max(4px, 3cqw); border-radius: 999px; background: rgba(8, 10, 12, .86); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); white-space: nowrap; }
.framed > .chips { top: calc(max(var(--ft) * 1cqw, 11cqw) + 2px); left: calc(var(--fl) * 1cqw + 2px); right: calc(var(--fr) * 1cqw + 2px); z-index: 2; }
.framed > .attn { top: calc(max(var(--ft) * 1cqw, 11cqw) + 2px); right: calc(var(--fr) * 1cqw + 2px); z-index: 2; }
.framed > .flipbtn { z-index: 4; }
.sface.framed { box-shadow: none; }
.sface.framed .stamp { z-index: 3; }
.cd.framed.can, .cd.hc.hasframe.can { box-shadow: 0 0 0 2px #c79a3c; }
.cd.hc.hasframe { border-color: transparent; background: #171b1f; }

/* Epic frames glow faintly purple; Legendary frames shimmer gold. */
.fx-Epic > .frm { filter: drop-shadow(0 0 1.5px rgba(200, 140, 255, .95)) drop-shadow(0 0 5px rgba(170, 100, 240, .55)); }
.fx-Legendary > .frm { animation: legend 2.8s ease-in-out infinite; }
@keyframes legend {
  0%, 100% { filter: drop-shadow(0 0 1.5px rgba(255, 215, 120, .95)) drop-shadow(0 0 4px rgba(255, 190, 80, .45)); }
  50% { filter: drop-shadow(0 0 3px rgba(255, 232, 160, 1)) drop-shadow(0 0 11px rgba(255, 200, 90, .75)); } }
@media (prefers-reduced-motion: reduce) { .fx-Legendary > .frm { animation: none; filter: drop-shadow(0 0 3px rgba(255, 210, 110, .9)); } }

/* ---------- rarity gem (top left, 1 to 5 pips) and element badge (top right) */
.gem, .elb { position: absolute; z-index: 3; pointer-events: none; }
.gem { left: 3cqw; top: 3cqw; display: flex; align-items: center; gap: max(1px, .9cqw); padding: max(2px, 1.5cqw) max(3px, 2.2cqw); border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .65), 0 1px 3px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.gem b { width: max(3.5px, 3.4cqw); height: max(3.5px, 3.4cqw); border-radius: 50%; background: #fff; box-shadow: 0 0 1px rgba(0, 0, 0, .6); }
.g-Common { background: linear-gradient(#b6bdc2, #7d868c); }
.g-Uncommon { background: linear-gradient(#7fdc89, #3f9a4c); }
.g-Rare { background: linear-gradient(#78acff, #2f6cc8); }
.g-Epic { background: linear-gradient(#c99bff, #8048c0); }
.g-Legendary { background: linear-gradient(#ffe08a, #d39420); }
.g-Common b { background: #f1f3f4; } .g-Legendary b { background: #fffbe8; }
.elb { right: 3cqw; top: 3cqw; width: max(14px, 15cqw); height: max(14px, 15cqw); border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a3036, #0c0f11 75%); border: max(1px, .9cqw) solid currentColor; box-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.elb svg { width: 66%; height: 66%; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.e-Fire { color: #ff7a3d; } .e-Earth { color: #d0a36a; } .e-Water { color: #46aef7; } .e-Ice { color: #b1ecff; }
.e-Storm { color: #ffd84a; } .e-Nature { color: #74d463; } .e-Blight { color: #b4dc3c; } .e-Death { color: #e2dccd; }
.e-Light { color: #ffe9a3; } .e-Shadow { color: #a98ae6; } .e-Aether { color: #79ddd6; }
/* unframed cards: keep the keyword chips clear of the gem */
.cd:not(.framed) > .chips { top: calc(3cqw + max(8px, 7cqw) + 2px); }
.cd:not(.framed) > .attn { top: calc(3cqw + max(14px, 15cqw) + 2px); }

/* ---------- explanations after a card's ability changed your move (16 Nov): in the centre, under the turn line */
.xpbox { display: flex; flex-direction: column; gap: 4px; align-items: center; margin: 4px auto 6px; max-width: min(440px, 100%); }
.xpbox .xp { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; background: rgba(16, 20, 24, .92); border: 1px solid rgba(199, 154, 60, .7); border-radius: 8px; cursor: pointer; text-align: left; }
.xpbox.fresh .xp { animation: xpin .3s ease-out; }
.xpbox .xp img, .xpbox .xpi { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 5px; object-fit: cover; }
.xpbox .xpi { display: grid; place-items: center; background: #2a3036; color: #f0c060; font: 700 19px/1 Georgia, serif; font-style: normal; }
.xpbox .xpt { display: flex; flex-direction: column; gap: 1px; font-size: 12px; line-height: 1.25; color: #c9d0d5; }
.xpbox .xpt b { color: #f0c060; font-size: 12.5px; }
.xpbox .xpt .res { color: #fff; font-weight: 600; }
.xpbox .gotit { flex: 0 0 auto; padding: 4px 8px; border-radius: 6px; border: 1px solid #4a545c; background: #232a30; color: #d9dee2; font-size: 11px; cursor: pointer; }
@keyframes xpin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- poison applied (16 Nov): a big green POISON word pops over the card, green drips, the card flashes */
.cd.poisonfx { animation: psnflash 1.6s ease-out; }
@keyframes psnflash { 0% { box-shadow: 0 0 0 0 rgba(120, 255, 90, 0); } 15% { box-shadow: 0 0 0 4px #7dff5a, 0 0 30px 8px rgba(110, 255, 80, .8); }
  60% { box-shadow: 0 0 0 2px #5fd146, 0 0 16px 4px rgba(90, 220, 60, .5); } 100% { box-shadow: none; } }
.poisonword { position: absolute; left: 50%; top: 42%; z-index: 7; pointer-events: none; display: flex; flex-direction: column; align-items: center; line-height: .95;
  font: 900 clamp(18px, 24cqw, 46px) system-ui, sans-serif; letter-spacing: .02em; color: #9dff6a;
  -webkit-text-stroke: max(1px, .9cqw) #0b2a06; text-shadow: 0 0 10px rgba(120, 255, 80, .9), 0 3px 6px #000;
  animation: psnpop 3s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.poisonword small { font-size: .38em; -webkit-text-stroke: 0; color: #d8ffc6; text-shadow: 0 1px 3px #000; letter-spacing: 0; }
@keyframes psnpop {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-12deg); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(1.25) rotate(4deg); opacity: 1; }
  24% { transform: translate(-50%, -50%) scale(.95) rotate(-2deg); }
  34%, 40%, 46%, 52% { transform: translate(-50%, -50%) scale(1.02) rotate(1.5deg); }
  37%, 43%, 49% { transform: translate(-50%, -50%) scale(1) rotate(-1.5deg); }
  78% { transform: translate(-50%, -54%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(.9); opacity: 0; } }
.pdrip { position: absolute; top: 55%; z-index: 6; width: max(4px, 4cqw); height: max(6px, 7cqw); border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%; background: radial-gradient(circle at 40% 35%, #d6ff9a, #4fd12c 60%, #1d6a0e);
  pointer-events: none; opacity: 0; animation: pdrip 1.6s ease-in forwards; }
@keyframes pdrip { 0% { opacity: 0; transform: translateY(0) scale(.5); } 15% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(220%) scale(.8); } }
.float.psn { color: #8cf26a; }
@media (prefers-reduced-motion: reduce) { .poisonword { animation: none; transform: translate(-50%, -50%); } .pdrip { display: none; } }

/* ---------- play animations (16 Nov) */
.cd.land { animation: land .6s cubic-bezier(.3, 1.4, .5, 1) both; z-index: 3; }
@keyframes land { 0% { opacity: 0; transform: translateY(-55%) scale(1.45); filter: brightness(2.2); }
  55% { opacity: 1; transform: translateY(0) scale(.94); filter: brightness(1.4); } 75% { transform: scale(1.04); } 100% { transform: none; filter: none; } }
.cd.landdown { animation: landdown .5s cubic-bezier(.3, 1.3, .5, 1) both; z-index: 3; }
@keyframes landdown { 0% { opacity: 0; transform: translateY(-40%) scale(1.25); } 60% { opacity: 1; transform: scale(.96); } 100% { transform: none; } }
.fxring { position: absolute; left: 50%; top: 50%; width: 100%; aspect-ratio: 1; z-index: 8; pointer-events: none; border-radius: 50%;
  border: max(3px, 3cqw) solid rgba(255, 214, 120, .95); box-shadow: 0 0 18px rgba(255, 200, 90, .8), inset 0 0 12px rgba(255, 200, 90, .6);
  transform: translate(-50%, -50%) scale(.3); opacity: 0; animation: fxring .75s ease-out .18s forwards; }
.landdown > .fxring { border-color: rgba(160, 150, 210, .85); box-shadow: 0 0 14px rgba(140, 120, 220, .6); }
.fxring.gold { animation-delay: 0s; border-width: max(2px, 2cqw); }
@keyframes fxring { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); } }
.fxdust { position: absolute; bottom: 4%; z-index: 7; width: max(8px, 9cqw); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(210, 195, 170, .85), rgba(160, 145, 120, 0) 70%); opacity: 0; animation: fxdust .8s ease-out calc(.2s + var(--dl)) forwards; }
@keyframes fxdust { 0% { opacity: .9; transform: translate(0, 0) scale(.6); } 100% { opacity: 0; transform: translate(var(--dx), -40%) scale(2.2); } }
.quake { animation: quake .4s ease-out .18s; }
@keyframes quake { 0%, 100% { transform: none; } 20% { transform: translate(-3px, 2px); } 40% { transform: translate(3px, -2px); } 60% { transform: translate(-2px, 1px); } 80% { transform: translate(1px, 0); } }
.cd.setin { animation: setin .55s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes setin { 0% { opacity: 0; transform: translateY(-35%) rotateY(90deg) scale(1.2); } 60% { opacity: 1; transform: rotateY(-8deg) scale(1); } 100% { transform: none; } }
.fxsweep { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden;
  background: linear-gradient(115deg, transparent 30%, rgba(140, 200, 255, .75) 48%, rgba(255, 255, 255, .9) 50%, rgba(140, 200, 255, .75) 52%, transparent 70%) no-repeat;
  background-size: 250% 100%; background-position: 130% 0; animation: fxsweep .7s ease-out .25s forwards; }
@keyframes fxsweep { to { background-position: -130% 0; } }
.cd.spellhit, [data-life].spellhit { animation: spellhit .9s ease-out; }
@keyframes spellhit { 0% { box-shadow: 0 0 0 0 rgba(190, 140, 255, 0); } 20% { box-shadow: 0 0 0 4px #c9a0ff, 0 0 32px 10px rgba(170, 110, 255, .85); } 100% { box-shadow: 0 0 0 0 rgba(170, 110, 255, 0); } }
.fxburst { position: absolute; left: 50%; top: 50%; width: 140%; aspect-ratio: 1; z-index: 8; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .95) 0%, rgba(200, 160, 255, .8) 18%, rgba(150, 90, 255, .35) 42%, rgba(120, 60, 255, 0) 68%);
  transform: translate(-50%, -50%) scale(.2); opacity: 0; animation: fxburst .7s ease-out forwards; }
@keyframes fxburst { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.2); } 40% { opacity: .9; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }
.cd.attachfx { animation: attachfx .8s ease-out; }
@keyframes attachfx { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 110, 0); } 25% { box-shadow: 0 0 0 4px #ffd36e, 0 0 26px 8px rgba(255, 200, 90, .8); filter: brightness(1.35); } 100% { box-shadow: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { .cd.land, .cd.landdown, .cd.setin, .quake { animation-duration: .01s !important; } .fxdust { display: none; } }
.cd.land, .cd.landdown, .cd.attachfx, .cd.spellhit { overflow: visible !important; }


/* ---------- online play (0.8.0) */
#banner.update { background: #2c5a34; cursor: pointer; }
#reconnect { position: fixed; inset: 0; z-index: 35; background: rgba(6, 8, 9, .62); display: grid; place-items: center; backdrop-filter: grayscale(.6); }
#reconnect[hidden] { display: none; }
#reconnect > div { background: #1b1f23; border: 1px solid #3c444c; border-radius: 12px; padding: 18px 24px; display: grid; gap: 6px; text-align: center; max-width: 320px; }
#reconnect b { font-size: 18px; color: #f0c060; }
#reconnect span { color: #a9a59b; font-size: 13px; }
#prompt { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 37; max-width: min(520px, 92vw); }
#prompt[hidden] { display: none; }
#prompt > div { background: #1d2a33; border: 2px solid #5fb7ea; border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }
#prompt .rowb { display: flex; gap: 8px; } #prompt .rowb button { flex: 1; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 36; background: #23292e; border: 1px solid #4a545c; border-radius: 10px; padding: 8px 14px; max-width: min(520px, 92vw); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); pointer-events: none; }
#toast[hidden] { display: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; background: #5d6469; flex: none; align-self: center; }
.dot.green { background: #5fd07a; } .dot.amber { background: #e8b84a; } .dot.red { background: #e2584a; } .dot.gone { background: #3a3f43; }
.away { color: #e2847a; font-size: 11px; } .away:empty { display: none; }
.seat > span:first-child { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.invrow { align-items: center; margin: -4px 0 6px; } .invrow > button { flex: 0 0 auto; min-width: 120px; } .invrow > span { flex: 1; }
.sub.note { color: #b9ad8f; font-size: 13px; }
.sub.role { color: #cfe6f7; margin: 0; }
.sub.role:empty, #watchers:empty, #startNote:empty { display: none; }
.form label.check { display: flex; gap: 8px; align-items: center; color: #b9b5ab; }
#invSeats { display: grid; gap: 6px; margin: 0 0 14px; } #invSeats:empty { display: none; }
.claimlist { display: grid; gap: 6px; }
[data-pov] { cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, .35); text-underline-offset: 3px; }
.watchhand { align-self: center; max-width: 60ch; font-size: 13px; }
.icp.watch { color: #9fd3f5; border-color: #3e5d72; background: #142029; }
#tablebox { padding: 8px 10px; border-bottom: 1px solid #2a3136; display: grid; gap: 6px; font-size: 13px; }
#tools { display: grid; gap: 6px; } #tools:empty { display: none; }
#tools button.go { width: 100%; font-size: 13px; padding: 6px 8px; background: #1d2a33; border-color: #3e5d72; }
#tools .takes { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: #9a978f; font-size: 12.5px; }
#chatbox[hidden] { display: none; }
.emotes { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
button.mini { font-size: 11.5px; padding: 3px 7px; border-radius: 6px; }
.chatrow { display: flex; gap: 5px; } .chatrow input { flex: 1; width: 0; min-width: 0; padding: 5px 8px; font-size: 13px; } .chatrow button { padding: 5px 9px; font-size: 13px; }
#people summary { cursor: pointer; color: #9a978f; font-size: 12.5px; }
#people .prow { display: flex; align-items: center; gap: 6px; padding: 3px 0; flex-wrap: wrap; }
#people .pnm { font-weight: 600; } #people .prow button { margin-left: auto; }
#people label.check { display: flex; gap: 6px; align-items: center; margin-top: 4px; color: #b9b5ab; }
#log .chat { color: #bfe0f7; } #log .note { color: #e0b15a; font-style: italic; }
#log .new { animation: chatnew 2.5s ease-out; border-radius: 4px; }
@keyframes chatnew { from { background: rgba(95, 183, 234, .28); } to { background: transparent; } }
.bubble { position: fixed; z-index: 33; transform: translate(-50%, -100%); background: #f3ead2; color: #1a1612; font-weight: 700; border-radius: 14px; padding: 6px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); pointer-events: none; animation: bubble 3s ease-out forwards; white-space: nowrap; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #f3ead2; }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.7); } 10% { opacity: 1; transform: translate(-50%, -100%) scale(1.05); } 18% { transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -120%); } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } #log .new { animation: none; } }

/* ---------- the Wrath gauge (0.9.0) */
.wg { --wc: #e0b15a; --wf: 0%; position: relative; display: inline-flex; align-items: center; min-width: 74px; height: 16px; padding: 0 6px; border-radius: 8px;
  background: rgba(255, 255, 255, .06); border: 1px solid color-mix(in srgb, var(--wc) 55%, #2a3036); cursor: pointer; overflow: hidden; align-self: center; }
.wg i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--wf); background: linear-gradient(90deg, color-mix(in srgb, var(--wc) 55%, #000), var(--wc)); opacity: .85; transition: width .6s ease-out; }
.wg b { position: relative; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 2px #000; }
.wg.full { border-color: var(--wc); box-shadow: 0 0 8px var(--wc), 0 0 2px var(--wc) inset; animation: wgglow 1.6s ease-in-out infinite; }
@keyframes wgglow { 50% { box-shadow: 0 0 16px var(--wc), 0 0 4px var(--wc) inset; } }
.ph .wrathbtn { font: 800 12px system-ui, sans-serif; padding: 2px 10px; border-radius: 8px; border: 1px solid #f0c060; background: linear-gradient(#5a2a12, #2c140a); color: #ffe2a8; box-shadow: 0 0 10px rgba(255, 150, 60, .5); align-self: center; }
.pbadge { font-weight: 800; font-size: 11px; color: #0c1405; background: #7fd13b; border-radius: 7px; padding: 0 6px; align-self: center; box-shadow: 0 0 6px rgba(127, 209, 59, .6); }
#panel .go.cure { background: #1f3512; border-color: #7fd13b; color: #d9f7c0; }
.wrathinfo { border-left: 3px solid var(--wc); padding-left: 8px; display: grid; gap: 5px; }
#panel .wrathinfo h3 { color: var(--wc); text-transform: uppercase; letter-spacing: .06em; }
.wrathinfo .t { font-weight: 800; font-size: 16px; }
.mrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; } .mrow select { flex: 1; min-width: 0; }

/* borrowed by The Deep Claims All: a teal rim and a tag; the owner's empty slot says when it comes back */
.cd.borrowed { border-color: #14a39a; box-shadow: 0 0 0 2px #14a39a, 0 0 12px rgba(20, 163, 154, .7); }
.btag { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); z-index: 3; font: 800 9px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em;
  background: #0d5f5a; color: #d9fffb; border-radius: 6px; padding: 1px 5px; pointer-events: none; }
.cd.empty.bmark { border-color: rgba(20, 163, 154, .5); display: grid; place-items: center; text-align: center; padding: 3px; }
.cd.empty.bmark span { font-size: clamp(8px, calc(var(--me) * .085), 12px); color: #6fc9c2; line-height: 1.15; }

/* the Wrath turn: the whole table takes the faction's colour, pulsing at the edges, until the turn ends */
#board { transition: background-color 1.2s ease, box-shadow 1.2s ease; }
#board.wrathon { --wc: #e0b15a; background-color: color-mix(in srgb, var(--wc) 20%, #0f1213); box-shadow: inset 0 0 90px color-mix(in srgb, var(--wc) 55%, transparent); animation: wrathedge 2.4s ease-in-out infinite; }
@keyframes wrathedge { 50% { box-shadow: inset 0 0 150px color-mix(in srgb, var(--wc) 75%, transparent); } }
#board.wrathon #centre { border-color: color-mix(in srgb, var(--wc) 60%, transparent); }
#wrathbanner { --wc: #e0b15a; position: fixed; left: calc((100vw - var(--side, 290px)) / 2); top: 40%; transform: translate(-50%, -50%); z-index: 46; pointer-events: none; opacity: 0;
  display: grid; justify-items: center; gap: 6px; padding: 18px 46px; border-radius: 16px; max-width: min(90vw, 900px); text-align: center;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .92), rgba(0, 0, 0, .7) 70%, rgba(0, 0, 0, .4)); border: 2px solid var(--wc); box-shadow: 0 0 60px var(--wc), 0 10px 60px rgba(0, 0, 0, .8); }
#wrathbanner b { font: 900 clamp(28px, 5vw, 72px) Georgia, "Times New Roman", serif; letter-spacing: .08em; color: var(--wc); text-shadow: 0 0 24px var(--wc), 0 2px 4px #000; }
#wrathbanner .wn { font: 800 clamp(18px, 2.4vw, 32px) Georgia, serif; color: #fff4dc; }
#wrathbanner .wt { font-size: clamp(13px, 1.3vw, 17px); color: #e8e4da; max-width: 60ch; }
#wrathbanner small { color: #a9a59b; }
#wrathbanner.show { animation: wrathin 4.2s ease-out forwards; }
@keyframes wrathin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(.97); } 16% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #board.wrathon, .wg.full { animation: none; }
  #wrathbanner.show { animation: wrathstill 4.2s linear forwards; }
}
@keyframes wrathstill { 0%, 85% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -50%); } }
