﻿:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #181e1b; color: #f6edda; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 5vw, 4rem); border-bottom: 1px solid #536055; }
h1, h2 { font-family: Georgia, serif; margin: 0; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1rem; margin-bottom: .25rem; color: #efc883; }
p { margin: .35rem 0; line-height: 1.45; }
main { display: grid; grid-template-columns: minmax(0, 36rem) minmax(16rem, 23rem); gap: 1.5rem; max-width: 64rem; margin: auto; padding: 1.5rem 1rem; }
.room { margin-bottom: .8rem; }
.controls, #modes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
button, input { font: inherit; }
button { cursor: pointer; border: 1px solid #839282; border-radius: .4rem; background: #2d3b32; color: inherit; padding: .45rem .75rem; }
button:hover, button[aria-pressed=true] { background: #44594a; }
button:focus-visible, input:focus-visible { outline: 3px solid #f0b84b; outline-offset: 2px; z-index: 2; }
#invite-url { width: 100%; margin: .35rem 0; padding: .4rem; }
#error { color: #ffbf9f; }
#connection { color: #d7c099; font-size: .9rem; }
#match-players { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; margin-block: .6rem; }
.player-card { display: flex; flex: 1 1 8.5rem; min-width: 0; align-items: center; gap: .5rem; padding: .4rem .55rem; border: 1px solid #536055; border-radius: .45rem; background: #242e28; }
.player-card-own { border-color: #839282; }
.player-card-marker { display: grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: .35rem; background: #44594a; font-weight: 700; }
.player-card[data-side=white] .player-card-marker { color: #252b27; background: #f6edda; }
.player-card[data-side=black] .player-card-marker { color: #f6edda; background: #161b18; }
.player-card-details { display: grid; gap: .12rem; min-width: 0; overflow-wrap: anywhere; }
.player-card-rank, .player-card-you { color: #ded7c2; font-size: .8rem; }
.player-card-rank:not([hidden]) { display: flex; align-items: center; gap: .35rem; }
.player-rank-badge { display: grid; place-items: center; flex: 0 0 1.25rem; height: 1.25rem; color: var(--rank-color); }
.player-rank-emblem { display: grid; place-items: center; width: 100%; height: 100%; padding-bottom: .15rem; box-sizing: border-box;
  clip-path: polygon(50% 0, 94% 18%, 86% 73%, 50% 100%, 14% 73%, 6% 18%); background: var(--rank-color);
  color: #202721; font-size: .6rem; font-weight: 800; line-height: 1; }
.player-card-you { margin-inline-start: auto; }
#board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border: .45rem solid #536055; border-radius: .4rem; overflow: hidden; }
.square { aspect-ratio: 1; position: relative; display: grid; place-items: center; border: 0; border-radius: 0; padding: 0; color: #1a241d; background: #e9dfbf; }
.square.dark { background: #819575; }
.square:hover { background: #b4a978; }
.square.selected { box-shadow: inset 0 0 0 4px #a55c00; }
.square.path { box-shadow: inset 0 0 0 4px #32644b; }
.path-step { position: absolute; bottom: 5%; right: 8%; color: #10291b; font-weight: bold; }
.square.target::after { content: ''; width: 22%; aspect-ratio: 1; border-radius: 50%; background: #294f2d; position: absolute; bottom: 7%; right: 7%; }
.square.target:has(.copied-sprites, .movement-form)::after { bottom: auto; top: 7%; z-index: 4; }
.square.ability-target.white::after { background: #a3d0ec; box-shadow: inset 0 0 0 1px #29475e; }
.square.ability-target.black::after { background: #843f46; box-shadow: inset 0 0 0 1px #49272c; }
.square.arrested { box-shadow: inset 0 0 0 3px #6b5278; }
.coord { position: absolute; left: 5%; top: 4%; font-size: clamp(.55rem, 1.7vw, .8rem); pointer-events: none; }
.piece { font-family: 'Segoe UI Symbol', system-ui, sans-serif; font-size: clamp(1.25rem, 6vw, 3rem); line-height: 1; pointer-events: none; }
.piece.white { color: #fff6da; text-shadow: -1px -1px #202820, 1px 1px #202820, 1px -1px #202820, -1px 1px #202820; }
.piece-texture { width: 79%; height: 79%; object-fit: contain; pointer-events: none; user-select: none; }
.movement-form { position: absolute; z-index: 3; bottom: 2%; max-width: 95%; padding: .06em .27em;
  border-radius: .22em; background: #242a29; color: #fff5d6; font-size: clamp(.51rem, 1.8vw, .77rem);
  font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.square:has(.copied-sprites) .movement-form { top: 2%; bottom: auto; right: 2%; }
.square.target:has(.copied-sprites):has(.movement-form)::after {
  top: 31%;
}
#board .square > .mimic-mouth { position: absolute; z-index: 2; width: 52%; height: auto; top: 31%; left: 24%; }
.raijin-square-mark { position: absolute; z-index: 2; left: 7%; bottom: 8%; width: 19%; aspect-ratio: 1;
  border: 2px solid #675342; border-radius: 50% 0 50% 50%; background: #ffe694; pointer-events: none; transform: rotate(-38deg); }
#current-movement { margin: .45rem 0; color: #efc883; font-size: .9rem; }
.copied-sprites { position: absolute; z-index: 3; inset: auto 2% 2% auto; display: grid;
  grid-template-columns: repeat(var(--copy-columns), minmax(0, 1fr)); width: min(calc(var(--copy-columns) * 25%), 96%);
  gap: 1px; pointer-events: none; }
.dead-mimic-batch > .piece-texture { transform: translateY(-7%); }
.dead-mimic-batch .copied-sprites { inset: auto auto 3% 50%; width: min(calc(var(--copy-columns) * 32%), 94%);
  transform: translateX(-50%); }
.copied-sprites > .piece-texture { width: 100%; height: auto; aspect-ratio: 1; background: #3a3440e8;
  border: 1px solid #d5c7a7bb; border-radius: 25%; }
.neuralink-chip { position: absolute; z-index: 3; left: 4%; top: 31%; width: 25%; aspect-ratio: 1;
  border: 1px solid var(--chip-accent); border-radius: 20%; background: #172226;
  box-shadow: 0 0 0 1px #171d20; pointer-events: none; display: grid; place-items: center; }
.neuralink-chip.white { --chip-accent: #a8dfff; }
.neuralink-chip.black { --chip-accent: #ed7f88; }
.neuralink-chip::before { content: ''; position: absolute; inset: 14% -19%;
  background: repeating-linear-gradient(0deg, var(--chip-accent) 0 17%, transparent 17% 42%);
  mask: linear-gradient(90deg, #000 0 15%, transparent 15% 85%, #000 85%); }
.neuralink-chip::after { content: ''; width: 46%; aspect-ratio: 1; border-radius: 20%;
  background: var(--chip-accent); border: 1px solid var(--chip-accent); }
.neuralink-chip.pending::after { background: transparent; }
.rage-points { position: absolute; z-index: 2; right: 4%; top: 4%; padding: 0 .2em; border-radius: .25em;
  background: #231b18; color: #fff3c9; font-size: clamp(.6rem, 2.3vw, .85rem); font-weight: 700; pointer-events: none; }
.snake-direction { position: absolute; z-index: 2; top: 1%; right: 5%; color: #fff3c9;
  text-shadow: 0 0 2px #181e1b; font-size: clamp(.55rem, 2.1vw, .75rem); pointer-events: none; }
.arena-boards { position: relative; }
.arena-boards:has(#board-switcher:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; }
#board-switcher { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; }
#board-switcher button { padding-inline: .55rem; }
#board[data-layer=ghost] .square { background: #b0b2ca; }
#board[data-layer=ghost] .square.dark { background: #666e91; }
#board[data-layer=ghost] .square:hover { background: #a095b9; }
.ghost-sprites { position: absolute; inset: 8%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ghost-sprites .piece-texture { flex: 1 1 0; width: 0; height: 100%; }
.ghost-shadows { position: absolute; inset: auto 9% 7%; height: 30%; display: flex; justify-content: center; pointer-events: none; }
.ghost-shadow { position: relative; flex: 1 1 0; max-width: 82%; border-radius: 50%; background: var(--shadow); box-shadow: 0 1px 2px var(--shadow), inset 0 -2px var(--team-accent); }
.ghost-shadow.white { --team-accent: #8bc8e8; }
.ghost-shadow.black { --team-accent: #943c4b; }
.ghost-shadow.demon { --shadow: #181622; }
.ghost-shadow.demon::before { content: ''; position: absolute; inset: -42% 0 26%; background: var(--shadow); clip-path: polygon(0 0, 29% 48%, 71% 48%, 100% 0, 82% 100%, 18% 100%); }
.ghost-shadow.angel { --shadow: #b9984c; background: radial-gradient(ellipse, #ffedaa 10%, var(--shadow) 64%, transparent 76%); }
.ghost-shadow.angel::before { content: ''; position: absolute; inset: -26% 20% 42%; border: 2px solid #ffe5a3; border-radius: 50%; box-shadow: 0 0 0 1px var(--shadow); }
.ghost-preview, aside .ghost-preview { display: flex; width: 2.5rem; height: 2rem; align-items: center; justify-content: center; }
.ghost-preview > .ghost-shadow { height: 38%; }
.ghost-appearance { display: flex; align-items: center; gap: .35rem; }
.champion-stats { display: grid; gap: .2rem; margin-block: .25rem; color: #ded7c2; }
.champion-stats small { font-size: .78rem; }
.rarity-common { color: #f6edda; }
.rarity-uncommon { color: #87e68b; }
.rarity-rare { color: #ffae53; }
.rarity-epic { color: #d6a3ff; }
.rarity-legendary { color: #ff8987; }
.match-champion-art > .ghost-preview { align-self: center; justify-self: center; }
#board[data-layer=normal] .square > :is(.piece, .piece-texture, .coord) { z-index: 1; }
@media (max-width: 690px) {
  .arena-boards:has(#board-switcher:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  #board-switcher { grid-row: 1; flex-direction: row; }
}
#ghost-pieces:not([hidden]) { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
#ghost-pieces button { display: inline-flex; align-items: center; gap: .35rem; }
#ghost-pieces .piece-texture { width: 1.35rem; height: 1.35rem; }
.elemental-ability-icon { width: 1.35rem; height: 1.35rem; margin-right: .3rem; vertical-align: middle; }
#board .square .jade-shield { position: absolute; inset: 2%; width: 96%; height: 96%; z-index: 2; }
#board .square .bennet-field { position: absolute; inset: 4%; width: 92%; height: 92%; z-index: 0; }
.bennet-field.under-piece { opacity: .8; }
.mine { width: 62%; height: 62%; }
.mine.under-piece { position: absolute; bottom: 2%; left: 4%; width: 36%; height: 36%; }
.square-spawn.under-piece { position: absolute; bottom: 2%; right: 3%; width: 38%; height: 38%; }
.square-spawn.square-knight { width: 79%; height: 79%; }
.jesus-blessings { position: absolute; z-index: 2; inset: -4% auto auto 16%; height: 36%; display: flex; pointer-events: none; }
.jesus-blessings.open-square { inset: 23% 4% auto; height: 54%; justify-content: center; }
.jesus-blessings.open-square:has(img + img) { top: 28%; height: 44%; }
.jesus-blessings .piece-texture { width: auto; height: 100%; }
aside { display: grid; align-content: start; gap: .75rem; }
aside section { background: #242e28; border: 1px solid #536055; border-radius: .55rem; padding: .9rem 1rem; }
aside > section { min-width: 0; }
#chat-messages { list-style: none; padding: 0; margin: .5rem 0; max-height: 15rem; overflow-y: auto; }
#chat-messages li { padding: .35rem .15rem; overflow-wrap: anywhere; }
#chat-messages li + li { border-top: 1px solid #536055; }
#chat-messages time { color: #d7c8a9; font-size: .8rem; margin-inline-start: .5rem; }
#chat-messages p { margin: .1rem 0; white-space: pre-wrap; }
#chat-form { display: flex; gap: .4rem; }
#chat-input { flex: 1; min-width: 0; padding: .45rem; border: 1px solid #839282; border-radius: .4rem; }
#chat-error { color: #ffbf9f; }
#match-clock { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: .55rem; }
#match-clock span { padding: .35rem .6rem; border: 1px solid #839282; border-radius: .35rem; font-variant-numeric: tabular-nums; }
#match-clock .clock-running { background: #44594a; border-color: #efc883; }
#royal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-block: .7rem; }
#royal-controls p { flex-basis: 100%; }
#royal-controls label { display: inline-flex; align-items: center; gap: .35rem; margin-inline-end: .35rem; }
#copy-label { min-width: 0; margin: .65rem 0; border: 1px solid #536055; border-radius: .45rem; }
#copy-source { display: flex; flex-wrap: wrap; gap: .45rem; }
#copy-source button { display: grid; justify-items: center; gap: .25rem; min-width: 3.5rem; padding: .35rem; }
#copy-source :is(.piece, .piece-texture) { width: 2.2rem; height: 2.2rem; font-size: 2rem; }
#copy-source .piece.black { color: #171e1a; text-shadow: 0 0 2px #e0d6b9; }
aside span { display: block; color: #d7c8a9; }
aside .graveyard-pieces { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; min-height: 2rem; }
.graveyard-pieces > :is(.piece, .piece-texture) { width: 2rem; height: 2rem; text-align: center; line-height: 2rem; font-size: 1.65rem; }
.graveyard-pieces > .piece.black { color: #161b19; text-shadow: 0 0 2px #e0d6b9; }
.match-champion-list { display: grid; gap: .75rem; padding: 0; margin: .65rem 0 0; list-style: none; }
.match-champion-list li { display: flex; align-items: flex-start; gap: .65rem; }
.match-champion-list h3 { margin: 0; }
.match-champion-list p { margin-bottom: 0; }
.match-champion-art { flex: 0 0 4rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem; }
.match-champion-art img { width: 100%; height: auto; }
.match-champion-art img:only-child { grid-column: 1 / -1; width: 3rem; justify-self: center; }
ol { margin: .5rem 0 0; padding-left: 1.5rem; }
@media (max-width: 690px) { main { grid-template-columns: minmax(0, 1fr); } }

.large-knight-tile { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.large-knight-tile .piece-texture { position: absolute; width: 200%; height: 200%; max-width: none; }

#board .square .nahida-mark { position: absolute; z-index: 3; top: 3%; right: 3%; width: 31%; height: 31%; }
.hp-counter { font-size: clamp(.48rem, 1.5vw, .8rem); }

.effect-label { position: absolute; z-index: 2; left: 2%; top: 2%; max-width: 96%; padding: 0 .18em; border-radius: .2em; background: #2c2433; color: white; font-size: clamp(.42rem, 1.3vw, .72rem); pointer-events: none; }

#match-clock { align-items: center; }
#match-clock .clock-low { color: #ffbaac; border-color: #cf655a; }
#clock-sound { font-size: .85rem; }
#clock-sound[aria-pressed="false"] { opacity: .64; }
#royal-draft { background: #242e28; border: 1px solid #536055; border-radius: .55rem; padding: .8rem; margin-top: .7rem; }
#royal-draft h3 { margin: 0; }
#royal-draft-help { color: #e5ddc9; margin: .45rem 0 .7rem; }
#royal-draft-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.75rem, 1fr)); gap: .45rem; }
.royal-draft-card { display: flex; align-items: center; flex-direction: column; gap: .3rem; padding: .45rem .25rem; font-size: .85rem; overflow-wrap: anywhere; min-width: 0; }
.royal-draft-card[aria-pressed="true"] { border-color: #f1cd88; }
.royal-draft-card:disabled { opacity: .52; cursor: default; }
.royal-draft-card .piece-texture { width: 2.8rem; height: 2.8rem; touch-action: none; pointer-events: auto; user-select: none; cursor: grab; }
.royal-drag-ghost { width: 3rem; height: 3rem; position: fixed; top: 0; left: 0; z-index: 50; pointer-events: none; }
.square.royal-draft-target { box-shadow: inset 0 0 0 3px #2b6651; }
.square.royal-draft-placed { box-shadow: inset 0 0 0 3px #955409; }

.square .concealed-piece { opacity: .55; }

.deck-slots { display: flex; flex-wrap: wrap; gap: .4rem; }
.deck-slots button { min-width: 2.65rem; min-height: 2.65rem; }
.deck-slots button[aria-pressed=true] { background: #efc780; border-color: #efc780; color: #211f1a; }
#deck-slot-limit { margin-block: .55rem 0; color: #ded7c2; }
.match-deck-picker { display: inline-flex; align-items: center; gap: .4rem; }

#board { position: relative; }
.liner-cross { position: absolute; z-index: 7; transform: translate(-50%, -50%); width: 4%; height: 4%;
  padding: 0; border-radius: 50%; border: .12rem solid #e3f7ff; background: #4087a8; }
.liner-cross.liner-piece { width: 7%; height: 7%; background: #383743; }
.liner-cross.liner-selected { outline: .16rem solid #fff0ad; }
.liner-cross img { width: 100%; height: 100%; object-fit: contain; }

#board .radioactive-contamination { box-shadow: inset 0 0 0 .2rem #799637; }
