.duel-tile { --tile: #b8a6ef; background: #e5dafa; }
.duel-tile .primary { background: var(--tile); border-color: #8468b3; }
.duel-lobby { display: grid; width: 100%; gap: 14px; justify-items: start; }
.duel-lobby-cover { width: 100%; height: auto; object-fit: cover; }
.duel-score, .duel-fields, .duel-hand { width: 100%; }
.duel-fields, .duel-hand { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.duel-hand { grid-template-columns: repeat(var(--hand-count,3),minmax(0,1fr)); }
.duel-field { min-width: 0; }
.duel-field h3 { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.duel-cells { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.duel-cell { display: grid; place-items: center; min-width: 0; position: relative; overflow: visible; color: var(--ink); }
.duel-cell > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.duel-cell.moving-token { z-index: 5; }
.duel-slot, .duel-cell small, .duel-delta { position: absolute; }
.duel-choice { display: grid; justify-items: center; align-content: start; color: var(--ink); }
.duel-choice img { height: auto; }
.duel-effect { margin: 0; }
.duel-hidden-count { font-size: .7rem; margin: 0 0 6px; }
.duel-notes, .duel-history { font-size: .77rem; color: var(--muted); }
.duel-notes summary { cursor: pointer; }
.duel-history { margin: 0; padding: 0; list-style: none; display: flex; gap: 8px; flex-wrap: wrap; }
.duel-formats { width: 100%; display: grid; }
.duel-effects ul { display: grid; margin: 0; padding: 0; list-style: none; }
.duel-effects li, .duel-event { display: flex; align-items: start; gap: 8px; }
.effect-icon { display: block; flex: none; }
.duel-event { width: 100%; }
.room-side { min-width: 0; display: grid; gap: 13px; }
.room-games { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.room-game { color: var(--ink); background: var(--surface); padding: 0 0 10px; border: 0; border-radius: 13px; overflow: hidden; text-align: left; }
.room-game img { width: 100%; height: auto; aspect-ratio: 1.8; object-fit: cover; }
.room-game strong, .room-game small { display: block; padding: 3px 10px; }
.standard-table { width: 100%; display: grid; grid-template-columns: repeat(auto-fit,minmax(112px,1fr)); gap: 9px; }
.standard-player { min-width: 0; background: #332a40; padding: 8px; border-radius: 13px; text-align: center; }
.standard-player > div { display: flex; align-items: center; gap: 4px; }
.standard-player > div > img { flex: none; border-radius: 50%; }
.standard-player strong { font-size: .73rem; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standard-player b { color: #dbbaff; }
.standard-player small, .standard-masked { display: block; color: var(--muted); font-size: .74rem; margin-top: 7px; }
.standard-token { width: 72px; height: 72px; margin: 6px auto 0; display: block; border-radius: 10px; mix-blend-mode: lighten; }
.standard-reveal .standard-token { animation: standard-flip .65s both; }
.standard-winner { background: #58406e; }
@keyframes standard-flip { from { opacity: 0; transform: rotateY(90deg) scale(.7); } to { opacity: 1; transform: none; } }
.duel-room { --panel: #272032; --surface: #32293f; --line: #7565814d; --accent: #dac5ff; }
.duel-room .room-head { padding: 0 0 15px; background: none; border: 0; border-radius: 0; }
.duel-room .room-title > img { width: 43px; height: 43px; border-radius: 10px; }
.duel-room .room-title h1 { font-size: clamp(1rem,2.5vw,1.5rem); }
.duel-room .panel.stage { border: 0; background: #251e30dd; border-radius: 20px; padding: clamp(15px,2.5vw,26px); }
.duel-room .room-grid { grid-template-columns: minmax(0,1fr) minmax(245px,.42fr); gap: 25px; }
.duel-room .roster { border: 0; border-radius: 0; padding: 7px 0 13px; background: none; }
.duel-room .roster li:not(:first-child) { border-color: #8672932b; }
.duel-room .roster li { background: none; }
.duel-room .room-side { gap: 15px; }
.duel-stage { --duel-action: #d4b8ff; }
.duel-score { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.duel-score > span { display: flex; gap: 7px; align-items: center; flex: 1; min-width: 0; padding: 0; border: 0; background: none; }
.duel-score b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.duel-score img { flex: none; }
.duel-score > span:last-child { justify-content: end; }
.duel-score img { width: 35px; height: 35px; border-radius: 50%; }
.duel-score strong { margin-left: 3px; min-width: 28px; text-align: center; color: #f5e9ff; background: #574269; border-radius: 9px; }
.duel-instruction { font-size: .87rem; font-weight: 600; }
.duel-fields { gap: clamp(10px,2vw,23px); }
.duel-field, .duel-field.own-field {
  background: none; padding: 0; border: 0; border-radius: 0; box-shadow: none;
}
.duel-field h3 { font-size: .76rem; margin-bottom: 10px; }
.duel-field h3 span { font-size: .66rem; opacity: .8; }
.duel-cells { gap: clamp(5px,1.1vw,10px); }
.duel-cell {
  background: #332a40; border: 0; border-radius: 13px; padding: 7px; aspect-ratio: 1; box-shadow: inset 0 -3px #160e201f;
}
.duel-cell:not(:disabled) { border: 0; background: #40314f; box-shadow: inset 0 0 0 2px #ac88d3; }
.duel-cell:not(:disabled):hover { background: #514062; box-shadow: inset 0 0 0 2px #e3beff; }
.duel-cell .duel-board-token { border-radius: 10px; mix-blend-mode: lighten; }
.duel-cell .duel-slot { background: none; color: #d5bfdc; top: 4px; left: 5px; padding: 0; font-size: .62rem; }
.duel-cell small { display: flex; gap: 3px; align-items: center; bottom: 3px; right: 3px; background: #211a2bee; padding: 1px 3px; border-radius: 6px; max-width: 95%; font-size: .66rem; }
.duel-cell small span { min-width: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.duel-cell small .effect-icon { width: 18px; height: 18px; }
.duel-empty { border: 0; background: #56435f52; width: 28%; transform: none; border-radius: 50%; }
.duel-cell.won { border: 0; box-shadow: inset 0 -3px #bb97eb; }
.duel-cell.lost { border: 0; box-shadow: none; background: #2b2435; }
.duel-cell.tied { border: 0; }
.duel-cell.lost .duel-board-token { filter: saturate(.5); opacity: .7; }
.duel-cell .duel-delta { top: 3px; right: 3px; background: #69527d; color: #fff1ff; border-radius: 6px; }
.duel-hand { padding: 11px 0 0; gap: clamp(7px,1.8vw,15px); }
.duel-choice {
  min-width: 0; background: none; border: 0; border-radius: 14px; padding: 8px 4px; gap: 5px; box-shadow: none;
  transition: transform .22s cubic-bezier(.2,.8,.25,1.4), background .22s;
}
.duel-choice img:not(.effect-icon) { width: min(100%,125px); border-radius: 12px; mix-blend-mode: lighten; }
.duel-choice .effect-icon { width: 19px; height: 19px; border-radius: 5px; }
.duel-choice strong { font-size: .88rem; font-weight: 800; }
.duel-choice small { font-size: .69rem; display: flex; align-items: center; gap: 4px; color: #d7c0e5; }
.duel-choice:hover, .duel-choice:focus-visible { background: #513c615f; transform: translateY(-6px); }
.duel-choice[aria-pressed=true] { transform: translateY(-7px); border: 0; background: #503c65; box-shadow: 0 7px 0 #1c1427; }
.duel-effect { padding: 4px 0; font-size: .77rem; min-height: 32px; }
.duel-effects { padding: 0; border: 0; background: none; border-radius: 0; }
.duel-effects h2 { font-size: .86rem; margin: 0 7px 8px; }
.duel-effects ul { gap: 3px; }
.duel-effects li { padding: 9px 7px; border-radius: 10px; transition: background .2s, transform .2s; }
.duel-effects li + li { border: 0; }
.duel-effects .effect-icon { width: 31px; height: 31px; border-radius: 8px; }
.duel-effects strong { font-size: .78rem; }
.duel-effects p { font-size: .71rem; color: #bba9c8; line-height: 1.45; }
.duel-effects li.effect-highlight { background: #654c80; transform: translateX(-4px); }
.duel-effects li.effect-highlight p { color: #f5e6ff; }
.duel-event { padding: 10px 12px; border: 0; background: #493457; border-radius: 10px; }
.duel-event .effect-icon { width: 39px; height: 39px; }
.duel-summary { padding: 5px 0; }
.duel-summary h2 { font-size: clamp(1.4rem,3.9vw,2rem); letter-spacing: -.04em; }
.duel-lobby-cover { border-radius: 16px; aspect-ratio: 2.9; }
.duel-formats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.duel-format { padding: 12px; border: 0; background: #332a42; border-radius: 11px; color: var(--ink); text-align: left; }
.duel-format[aria-pressed=true] { background: #61457d; box-shadow: none; }
.duel-format small { display: block; margin-top: 4px; }
.duel-format:disabled { opacity: .6; }
.rounds-hint { font-size: .69rem; margin: 1px 6px 4px; }

@media (max-width: 820px) {
  .duel-room .room-grid { grid-template-columns: minmax(0,1fr) minmax(202px,.42fr); gap: 18px; }
}
@media (max-width: 630px) {
  .duel-room .room-grid { grid-template-columns: minmax(0,1fr); gap: 23px; }
  .duel-effects ul { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .duel-room .room-title h1 { font-size: .98rem; }
  .duel-room .panel.stage { padding: 14px; }
  .duel-cell small span { display: none; }
  .duel-field h3 span { display: none; }
}
[data-theme="light"] .duel-room { --panel: #e6dcee; --surface: #d9cce4; --ink: #261c2c; }

.duel-fields { position: relative; isolation: isolate; }
.duel-instruction { height: 88px; min-height: 88px; max-height: 88px; overflow: auto; width: 100%; display: block; padding-top: 14px; margin: 0; }
.duel-round-bar { width: 100%; display: flex; align-items: center; justify-content: center; gap: 13px; padding: 9px 14px; border-radius: 12px; background: #392b47; }
.duel-round-bar span { color: #d9c6e4; font-size: .75rem; }
.duel-round-bar strong { font-size: 1.35rem; letter-spacing: .12em; font-variant-numeric: tabular-nums; min-width: 80px; text-align: center; }
.duel-cell.dueling { background: #574065; z-index: 6; }
.board-fighter { position: absolute; z-index: 12; object-fit: contain; border-radius: 10px; pointer-events: none; }
.figure-fragment { z-index: 13; }
.board-impact { position: absolute; z-index: 15; width: 48px; height: 48px; background: #ffe7a3; pointer-events: none; clip-path: polygon(50% 0,60% 35%,95% 10%,75% 45%,100% 55%,65% 65%,85% 100%,50% 78%,15% 100%,30% 65%,0 50%,35% 40%,15% 5%,43% 30%); }
.duel-cell.lost .duel-board-token { filter: grayscale(1); opacity: .35; }
.duel-cell.won { background: #4d385e; }
.duel-choice { touch-action: none; user-select: none; }
.duel-drag-ghost { position: fixed; left: 0; top: 0; width: 90px; height: 90px; z-index: 1000; pointer-events: none; border-radius: 12px; }
.dragging-piece { cursor: grabbing; user-select: none; }
.dragging-piece .duel-stage button { cursor:inherit; }
.duel-cell.drop-target { background: #78608d; box-shadow: inset 0 0 0 3px #e8cfff; }
.board-fighter, .duel-drag-ghost { mix-blend-mode: lighten; }
.duel-stage { overflow-anchor: none; }
.duel-result-actions { min-height: 48px; }

/* Keep focus on the current duel, including when earlier cells contain winners. */
.duel-cell.duel-muted { opacity: .28; transition: opacity .25s ease; }
.dragging-piece .duel-choice,
.dragging-piece .duel-choice:hover,
.dragging-piece .duel-choice:focus-visible,
.dragging-piece .duel-choice[aria-pressed=true] {
  transform: none; background: none; box-shadow: none; outline: none; transition: none;
}
/* Round events share the board's soft plum surfaces and generated game artwork. */
.round-events,.round-records { width:100%; }
.round-events-heading { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.round-events h3,.round-records h3 { font-size:.88rem; font-weight:800; }
.round-events-heading > span { font-size:.68rem; color:#d5bee7; background:#483454; border-radius:7px; min-width:22px; text-align:center; }
.round-events ol { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; list-style:none; margin:0; padding:0; }
.round-event-wrap { position:relative; min-width:0; }
.round-event { width:100%; height:100%; display:flex; flex-direction:column; gap:12px; color:var(--ink); text-align:left; padding:13px; background:#382b43; border:0; border-radius:14px; box-shadow:none; transition:background .18s ease; }
.round-event:hover,.round-event:focus-visible,.round-event.is-playing { background:#503b62; }
.event-player { display:flex; align-items:center; gap:7px; width:100%; font-size:.7rem; color:#d6c6df; }
.event-player > img { border-radius:50%; flex:none; }
.event-player > span:not(.event-cell) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.event-cell { margin-left:auto; flex:none; font-size:.66rem; font-weight:800; color:#efddff; background:#5b456d; padding:2px 7px; border-radius:6px; }
.event-main { display:flex; gap:9px; align-items:center; width:100%; }
.event-main > .effect-icon { width:34px; height:34px; border-radius:8px; }
.event-main > span { min-width:0; }
.event-main strong { display:block; font-size:.84rem; }
.event-action { display:block; margin-top:3px; font-size:.73rem; color:#e0c8ef; line-height:1.45; }
.event-transformation { display:flex; align-items:center; gap:1px; margin-left:auto; flex:none; }
.event-transformation img { width:27px; height:27px; object-fit:contain; border-radius:5px; mix-blend-mode:lighten; }
.event-transformation > span { font-size:.65rem; color:#d7bbed; }
.event-hint { margin-top:auto; display:flex; justify-content:space-between; color:#bfa6d1; font-size:.63rem; width:100%; }
.is-playing .event-hint { color:#fff2ca; }
.event-detail { position:absolute; z-index:30; bottom:calc(100% + 8px); left:0; width:max-content; max-width:min(340px,calc(100vw - 54px)); padding:12px 14px; border-radius:12px; background:#eee0f8; color:#30213a; font-size:.76rem; line-height:1.6; box-shadow:0 12px 25px #10091750; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(4px); transition:opacity .15s,transform .15s; }
.round-event-wrap:hover > .event-detail,.round-event-wrap:has(> .round-event:focus-visible) > .event-detail { opacity:1; visibility:visible; transform:none; }
.round-event-wrap:nth-child(even) > .event-detail { left:auto; right:0; }
.duel-cell.event-cell-focus { box-shadow:inset 0 0 0 2px #d1a7ec; }
.round-records { margin-top:3px; }
.round-records > ol { display:flex; flex-wrap:wrap; gap:9px; list-style:none; padding:0; margin:10px 0 0; }
.round-record { display:flex; align-items:center; gap:12px; padding:9px 12px; background:#302539; border-radius:12px; }
.round-record.current-round { background:#44314f; }
.round-number { display:grid; justify-items:center; min-width:31px; }
.round-number small { font-size:.5rem; letter-spacing:.08em; color:#bfa4cf; }
.round-number b { font-size:1.1rem; line-height:1.3; }
.round-record-scores { display:flex; gap:8px; }
.round-record-player { display:flex; align-items:center; gap:5px; color:#aa96b8; font-variant-numeric:tabular-nums; }
.round-record-player img { border-radius:50%; opacity:.7; }
.round-record-player strong { font-size:1.15rem; }
.round-record-winner { color:#f6e4ff; }
.round-record-winner img { opacity:1; }
.live-round-event { display:flex; align-items:center; gap:9px; width:100%; padding:9px 11px; border-radius:12px; background:#3d2c4b; }
.live-round-event > .effect-icon { width:29px; height:29px; border-radius:7px; }
.live-event-avatar { width:27px; height:27px; border-radius:50%; flex:none; }
.live-round-event > div { min-width:0; }
.live-round-event strong { font-size:.71rem; display:block; }
.live-round-event p { font-size:.72rem; margin-top:2px; line-height:1.4; color:#e1cceb; }
img[data-shape="rock"] { filter:brightness(1.15) saturate(1.05); }
.duel-cell.lost img[data-shape="rock"] { filter:grayscale(1); }
.duel-drag-ghost { will-change:transform; }
@media(max-width:630px) {
 .round-events ol { grid-template-columns:minmax(0,1fr); }
 .round-event { gap:9px; }
 .event-detail { max-width:calc(100vw - 70px); }
 .round-event-wrap:nth-child(even) > .event-detail { right:auto; left:0; }
}
.duel-deck-status { display:flex; flex-wrap:wrap; gap:6px; width:100%; font-size:.7rem; color:#c9b7d6; }
.duel-deck-status > span { display:flex; align-items:center; gap:5px; background:#32283d; border-radius:8px; padding:5px 9px; }
.duel-deck-status b { color:#f2e2ff; font-variant-numeric:tabular-nums; }
.duel-deck-status small { opacity:.7; }
.duel-hand-limited { font-size:.75rem; color:#ffe0ad; margin:0; }
.cleansed-special { filter:grayscale(1); opacity:.65; }

.duel-cell.tied { background:#414154; box-shadow:inset 0 -3px #a6a7c5; }
.duel-cell.tied .duel-board-token { opacity:.72; }
.duel-cell.skipped { background:#2c2633; box-shadow:inset 0 -3px #655a72; }
.duel-cell.skipped .duel-board-token { opacity:.3; }
.duel-outcome-tag { position:absolute; top:4px; right:4px; font-size:.58rem; line-height:1.35; padding:2px 5px; border-radius:5px; background:#211a2bd9; color:#e0d8ef; }

:is(.duel-cell .duel-board-token, .duel-choice img, .standard-token, .board-fighter,
.duel-drag-ghost, .event-transformation img)[data-shape]:not([data-shape="shepherd"]) { mix-blend-mode:normal; }
/* Compact duel table: the playing area stays above the fold. */
.duel-room .top { min-height:40px; padding-block:5px; }
.duel-room .brand { font-size:1rem; }
.duel-room.in-room main { padding-top:8px; }
.duel-room .room-head { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding-bottom:9px; }
.duel-room .room-title { justify-content:center; }
.duel-room .room-title > img { display:none; }
.duel-room .room-title h1 { font-size:clamp(.9rem,1.8vw,1.25rem); }
.duel-room .room-head .actions { gap:5px; margin:0; flex-wrap:wrap; }
.duel-room .room-head button { min-height:32px; padding:5px 10px; font-size:.72rem; }
.duel-room .room-head .soft-icon { padding:4px; }
.code-visibility { background:none; border:0; color:var(--muted); font-size:.65rem; padding:4px; }
.duel-room .panel.stage { padding:12px 16px; gap:8px; }
.duel-room .room-grid { gap:20px; grid-template-columns:minmax(0,1fr) minmax(275px,.48fr); }
.duel-room .roster { padding:0 0 6px; }
.duel-room .roster li { padding-block:6px; }
.duel-room .roster .avatar { width:32px; height:32px; }
.duel-room .room-side { gap:8px; align-content:start; }
.duel-matchbar { display:flex; align-items:center; gap:8px; width:100%; min-height:46px; }
.match-player { flex:1; min-width:0; display:flex; align-items:center; gap:6px; }
.match-player:last-child { flex-direction:row-reverse; text-align:right; }
.match-player img { border-radius:50%; flex:none; }
.match-player b { font-size:.76rem; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.match-player strong { color:#f5e5ff; background:#513d62; border-radius:9px; padding:3px 7px; font-size:.85rem; }
.match-center { display:flex; align-items:center; gap:8px; flex:none; }
.match-center > strong { font-size:1.4rem; font-variant-numeric:tabular-nums; letter-spacing:.07em; color:#f6e5ff; }
.deck-counter { position:relative; display:inline-grid; place-items:center; width:43px; height:43px; flex:none; }
.deck-counter img { position:absolute; width:100%; height:100%; }
.deck-counter b { position:relative; color:#392640; font-size:1rem; padding-top:2px; font-variant-numeric:tabular-nums; }
.duel-instruction { height:57px; min-height:57px; max-height:57px; padding-top:0; display:flex; align-items:center; font-size:.78rem; }
.duel-fields { --cell: min(135px,calc((100dvh - 335px)/var(--board-rows))); max-width:calc(var(--cell)*var(--board-cols)*2 + 42px); margin-inline:auto; gap:18px; }
.duel-fields[data-size="12"] { --cell:min(106px,calc((100dvh - 335px)/4)); }
.duel-cells { grid-template-columns:repeat(var(--board-cols,2),minmax(0,1fr)); gap:6px; }
.duel-field h3 { margin-bottom:5px; font-size:.68rem; }
.duel-cell { padding:5px; min-height:44px; }
.duel-fields[data-size="12"] .duel-cell small span { display:none; }
.duel-hand { padding-top:2px; gap:7px; max-width:420px; margin-inline:auto; }
.duel-choice { padding:4px; gap:2px; }
.duel-choice img:not(.effect-icon) { width:min(100%,80px); }
.duel-choice strong { font-size:.76rem; }
.duel-choice small { font-size:.64rem; }
.duel-effects ul { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; max-height:calc(100dvh - 250px); overflow:auto; scrollbar-width:thin; padding:2px; align-content:start; }
.duel-effects li { padding:6px; gap:5px; align-items:start; }
.duel-effects .effect-icon { width:26px; height:26px; }
.duel-effects strong { font-size:.68rem; }
.duel-effects p { font-size:.64rem; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.duel-effects li.effect-highlight { grid-column:1/-1; transform:none; background:#5a4273; }
.duel-effects li.effect-highlight p { display:block; overflow:visible; }
.duel-effects h2 { margin-bottom:4px; }
.duel-cell .duel-delta { display:flex; align-items:center; gap:1px; padding:2px 5px 2px 1px; border-radius:9px; background:#fff1c9; color:#624018; box-shadow:0 3px 9px #130b2466; font-size:.9rem; top:4px; right:4px; z-index:8; }
.duel-delta img { width:21px; height:21px; object-fit:contain; }
.duel-cell .duel-delta.award-negative { background:#ffd4e0; color:#8e3050; }
.award-pop { animation:award-pop .4s cubic-bezier(.2,.8,.3,1.3); }
@keyframes award-pop { from{opacity:0;transform:translateY(10px) scale(.6)}to{opacity:1;transform:none} }
.live-round-event, .duel-event { position:relative; display:flex; align-items:center; gap:7px; padding:6px 9px; background:#3b2c49; border-radius:10px; min-height:51px; }
.live-round-event > div, .duel-event > div { flex:1; min-width:0; padding-right:95px; }
.live-round-event strong, .duel-event strong { font-size:.68rem; }
.live-round-event p, .duel-event p { font-size:.64rem; margin:2px 0 0; line-height:1.3; }
.live-event-actor { position:absolute; top:5px; right:7px; max-width:95px; display:flex; align-items:center; gap:4px; font-size:.6rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.live-event-avatar { width:20px; height:20px; border-radius:50%; flex:none; }
.speed-switch { display:flex; gap:3px; }
.speed-switch button { padding:4px 9px; border:0; background:#33263e; color:#d1bde3; border-radius:7px; }
.speed-switch button[aria-pressed=true] { background:#ceb0f4; color:#2b1c3a; }
.replay-round { display:flex; align-items:center; gap:5px; }
.duel-lobby { gap:10px; }
.duel-formats { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.duel-format { position:relative; min-width:0; padding:10px; border:0; border-radius:15px; background:linear-gradient(145deg,#49335b,#30243e); text-align:left; color:#f5e5ff; overflow:visible; }
.duel-format[aria-pressed=true] { background:linear-gradient(145deg,#775098,#4b3164); box-shadow:inset 0 -4px #ba8fe7; }
.duel-format strong { display:block; font-size:.78rem; }
.duel-format small { font-size:.63rem; color:#d5bcdf; }
.format-visual { height:85px; display:flex; align-items:center; justify-content:center; position:relative; gap:8px; }
.format-visual > img:not(.effect-icon) { width:70px; height:70px; object-fit:contain; transform:rotate(-12deg); }
.format-visual > .effect-icon { position:absolute; width:30px; height:30px; bottom:4px; right:8px; }
.format-mini { display:grid; grid-template-columns:repeat(var(--mini-cols),1fr); gap:3px; width:42px; transform:rotate(10deg); }
.format-mini i { aspect-ratio:1; background:#c1a3df; border-radius:3px; opacity:.7; }
.format-hidden .format-mini i { background:#827393; }
.format-hyper { background:linear-gradient(145deg,#5b3950,#34263e); }
.format-info { position:absolute; top:6px; right:7px; z-index:10; width:20px; height:20px; border-radius:50%; background:#ffffff20; text-align:center; font:italic bold 13px/20px Georgia,serif; cursor:help; }
.format-tooltip { display:none; position:absolute; top:25px; right:-3px; width:255px; max-width:70vw; padding:12px; background:#f1e6fa; color:#35243e; border-radius:10px; box-shadow:0 8px 28px #160b3299; font:normal .73rem/1.5 system-ui; text-align:left; }
.format-info:hover .format-tooltip, .format-info:focus .format-tooltip { display:block; }
.duel-format:has(.format-info:hover), .duel-format:has(.format-info:focus) { z-index:12; }
@media(max-width:950px){
 .duel-room .room-grid { grid-template-columns:minmax(0,1fr) 260px; gap:12px; }
 .duel-room .panel.stage { padding:10px; }
 .duel-formats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:720px){
 .duel-room .room-grid { grid-template-columns:minmax(0,1fr); }
 .duel-room .room-head { grid-template-columns:1fr; gap:6px; }
 .duel-room .room-head .actions { justify-content:center; }
 .duel-room .top nav { font-size:.65rem; }
 .duel-fields { --cell:min(125px,calc((100dvh - 350px)/var(--board-rows))); }
 .duel-fields[data-size="12"] { --cell:min(95px,calc((100dvh - 350px)/4)); }
 .duel-effects ul { max-height:360px; }
 .match-player b { max-width:90px; font-size:.67rem; }
 .match-player img { width:24px; height:24px; }
 .match-center { gap:2px; }
 .match-center > strong { font-size:1.15rem; }
 .duel-instruction { height:64px; min-height:64px; max-height:64px; }
 .live-round-event > div,.duel-event > div { padding-right:0; padding-top:16px; }
 .live-event-actor { top:2px; }
}
.duel-fields[data-size="4"] { --board-cols:2; --board-rows:2; }
.duel-fields[data-size="6"] { --board-cols:2; --board-rows:3; }
.duel-fields[data-size="12"] { --board-cols:3; --board-rows:4; }
.format-mini { --mini-cols:2; }
.format-hyper .format-mini { --mini-cols:3; }
.duel-hand[data-hand-count="1"] { --hand-count:1; }
.duel-hand[data-hand-count="2"] { --hand-count:2; }
.duel-hand[data-hand-count="3"] { --hand-count:3; }
.duel-fields { --cell:min(135px,calc((100dvh - 445px)/var(--board-rows))); }
.duel-fields[data-size="12"] { --cell:min(106px,calc((100dvh - 445px)/4)); }
.duel-room .room-head { margin-bottom:5px; }
@media(max-width:720px){.duel-cell .duel-delta{font-size:.7rem;padding:1px 3px 1px 0;top:3px;right:2px;border-radius:6px}.duel-delta img{width:16px;height:16px}}
/* New 3x3 game and functional playback controls. */
.duel-fields[data-size="9"] { --board-cols:3; --board-rows:3; }
.duel-fields[data-size="9"] .duel-cell small span { display:none; }
.format-madness .format-mini { --mini-cols:3; }
.format-madness { background:linear-gradient(145deg,#365654,#33273f); }
.duel-trap-marker { position:absolute; left:3px; bottom:3px; display:grid; place-items:center; width:26px; height:26px; border-radius:7px; background:#fece8a; box-shadow:0 0 0 1px #f2a955; }
.duel-trap-marker .effect-icon { width:24px; height:24px; }
.swap-waiting { position:absolute; left:3px; top:19px; font-size:.51rem; color:#c7fbec; padding:2px 4px; border-radius:5px; background:#123c3cdd; }
.duel-cell .duel-delta { padding:2px 7px 2px 1px; gap:2px; border-radius:999px; background:#22162eef; color:#fff6d5; box-shadow:0 2px 8px #0c061c80,inset 0 0 0 1px #ffd57b55; font-size:1.02rem; line-height:1.15; font-weight:900; font-variant-numeric:tabular-nums; text-shadow:0 1px 2px #140723; }
.duel-delta img { width:25px; height:25px; }
.duel-cell .duel-delta.award-negative { background:#321a35ef; color:#ffc7e0; box-shadow:0 2px 8px #0c061c80,inset 0 0 0 1px #df8dc855; }
.replay-round, .skip-round { display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:9px 13px; border-radius:13px; color:#f1ddff; background:#513b65; border:0; box-shadow:0 3px 0 #21162e; font-weight:750; }
.replay-round img, .skip-round img { width:25px; height:25px; object-fit:contain; }
.skip-round { background:#392b49; font-size:.77rem; padding:6px 10px; box-shadow:none; }
.replay-round:hover, .skip-round:hover { background:#654b7c; }
.event-preview-controls { width:100%; display:flex; justify-content:center; }
@media(max-width:720px){.duel-cell .duel-delta { font-size:.79rem; padding:1px 4px 1px 0;gap:0 }.duel-delta img{width:18px;height:18px}.duel-trap-marker{width:20px;height:20px}.duel-trap-marker .effect-icon{width:18px;height:18px}.swap-waiting{font-size:.45rem;top:15px}}
/* Effect details stay closed until the relevant item is hovered or focused. */
.duel-effects li { align-items:center; min-height:37px; position:relative; }
.duel-effects .effect-description { display:none; }
.duel-effects li:hover, .duel-effects li:focus-within, .duel-effects li.effect-highlight { grid-column:1/-1; background:#57416c; align-items:flex-start; }
.duel-effects li:hover .effect-description, .duel-effects li:focus-within .effect-description, .duel-effects li.effect-highlight .effect-description { display:block; overflow:visible; -webkit-line-clamp:unset; font-size:.72rem; line-height:1.5; margin-top:4px; color:#f2e5fa; }
.duel-effects li:focus-visible { outline:2px solid #c6a6e7; outline-offset:1px; }
.wide-rating { padding:9px; border-radius:11px; background:#30263d; color:#e8d7f3; }
.wide-rating > summary { cursor:pointer; font-size:.75rem; font-weight:750; }
.wide-rating > summary > strong { float:right; color:#f2d796; font-variant-numeric:tabular-nums; }
.wide-rating [data-wide-rating-content] { padding-top:10px; }
.rating-own { display:grid; gap:4px; font-size:.8rem; }
.rating-own small, .rating-rules { font-size:.66rem; line-height:1.5; color:#c5b2d2; }
.rating-rules { margin:8px 0; }
.wide-rating h3 { font-size:.75rem; margin:10px 0 5px; }
.rating-leaders { list-style:none; padding:0; margin:0; display:grid; gap:3px; max-height:260px; overflow:auto; scrollbar-width:thin; }
.rating-leaders li { display:flex; gap:6px; align-items:center; padding:5px; border-radius:7px; font-size:.7rem; }
.rating-leaders li > span { width:18px; color:#b6a3c4; font-variant-numeric:tabular-nums; }
.rating-leaders img { border-radius:50%; }
.rating-leaders strong { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rating-leaders b { color:#f1d69b; }
.rating-me { background:#51405f; }
.rating-empty, .rating-pending { font-size:.73rem; }
.rating-result { display:flex; gap:8px; width:100%; flex-wrap:wrap; }
.rating-result > div { flex:1; display:flex; align-items:center; gap:7px; padding:8px; background:#392b45; border-radius:10px; min-width:0; font-size:.75rem; }
.rating-result span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rating-result b { margin-left:auto; white-space:nowrap; }
.rating-up { color:#a8edcf; }.rating-down { color:#ffb6cf; }
.duel-effects ul { overflow:visible; max-height:none; }
.duel-effects li:hover, .duel-effects li:focus-within, .duel-effects li.effect-highlight { grid-column:auto; align-items:center; }
.duel-effects .effect-description { position:absolute; bottom:calc(100% + 6px); left:0; width:270px; max-width:calc(100vw - 60px); padding:11px 12px; margin:0; border-radius:10px; background:#eee1fa; color:#30203e; box-shadow:0 7px 24px #160a2c80; z-index:40; pointer-events:auto; }
.duel-effects li:nth-child(even) .effect-description { right:0; left:auto; }
.duel-effects li:hover .effect-description, .duel-effects li:focus-within .effect-description, .duel-effects li.effect-highlight .effect-description { color:#30203e; margin:0; }
.duel-cell.opponent-last-move::after { content:""; position:absolute; inset:2px; border:2px solid #f3cf8c; border-radius:inherit; box-shadow:0 0 9px #f0b96755,inset 0 0 7px #f0b96722; pointer-events:none; z-index:4; }
.duel-cell.opponent-last-move .duel-slot { color:#ffe0a5; font-weight:900; }
.match-person { display:grid; gap:1px; min-width:0; flex:1; }
.match-person > b { display:block; }
.duel-player-clock { display:flex; align-items:center; gap:5px; width:max-content; border-radius:6px; padding:1px 5px; background:#2d2438; color:#c4b5d0; font:800 1rem/1.25 ui-monospace,monospace; font-variant-numeric:tabular-nums; }
.match-player:last-child .duel-player-clock { justify-self:end; }
.duel-player-clock small { font:600 .55rem/1.1 ui-monospace,monospace; white-space:nowrap; }
.duel-player-clock.clock-running { color:#ffe0a3; background:#5a4431; box-shadow:inset 0 0 0 1px #d5ac6155; }
.duel-player-clock.clock-low { color:#ffb6c4; }
.duel-player-clock.clock-paused { opacity:.55; }
.clock-pause { background:#41334e; color:#e5d4ee; border:0; border-radius:7px; padding:4px 7px; font-size:.62rem; }
.clock-settings { border-top:1px solid #ac88c133; padding-top:7px; margin-top:3px; display:grid; gap:5px; }
.clock-settings > strong { font-size:.76rem; }
.clock-presets { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
.clock-presets button { border:0; border-radius:7px; padding:6px; color:#d9c5e7; background:#372941; font-size:.65rem; }
.clock-presets button[aria-pressed=true] { background:#c9abe6; color:#2c1f37; }
#settings .clock-settings label { display:flex; align-items:center; justify-content:space-between; gap:7px; margin:0; font-size:.69rem; }
.clock-settings input { width:75px; padding:4px 6px; height:28px; font-size:.75rem; }
.clock-settings > small { font-size:.62rem; color:var(--muted); line-height:1.4; }
.clock-settings > button { font-size:.68rem; padding:5px; }
@media(max-width:720px){.duel-player-clock{font-size:.83rem;gap:2px;padding:1px 3px}.duel-player-clock small{font-size:.47rem}.match-center:has(.clock-pause){display:grid;grid-template-columns:auto auto;gap:1px}.clock-pause{grid-column:1/-1;padding:2px;font-size:.57rem}.match-person{max-width:95px}}
#settings { overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; }
#settings .settings-head { position:sticky; top:-10px; z-index:2; padding:5px 0; background:var(--panel); }
.clock-mode-hint { font-size:.72rem; }
.duel-player-clock.clock-flagged { background:#652a40; color:#ffd0dc; box-shadow:inset 0 0 0 1px #ef91af88; }
.duel-queues { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:6px 0 18px; }
.duel-queues button { display:flex;align-items:center;gap:10px;text-align:left;border:0;border-radius:18px;padding:14px;background:#382c47;color:#f7eaff;transition:transform .18s,background .18s; }
.duel-queues button:hover:not(:disabled) { transform:translateY(-3px);background:#493656; }
.duel-queues button[aria-pressed=true] { background:#594268;box-shadow:inset 0 -3px #d1a4e6; }
.duel-queues button[data-value=rated][aria-pressed=true] { background:#58413f;box-shadow:inset 0 -3px #e6c385; }
.duel-queues img { width:65px;height:65px;object-fit:contain;filter:drop-shadow(0 4px 4px #150d2780); }
.duel-queues span { display:grid;gap:5px;min-width:0; }.duel-queues strong { font-size:1.1rem; }.duel-queues small { font-size:.7rem;line-height:1.4;color:#d2bfdc; }
.queue-entry { padding:22px 8px; }.queue-entry h2 { margin:0 0 20px; }.queue-entry .duel-queues { margin-bottom:8px; }
.ranked-format { display:grid;grid-template-columns:150px 1fr;align-items:center;gap:16px;padding:15px 0 24px; }
.ranked-format-art { display:grid;grid-template-columns:1fr 1fr;transform:rotate(-7deg); }.ranked-format-art img { width:90px;height:90px;object-fit:contain;filter:drop-shadow(0 7px 5px #120a2655); }.ranked-format-art img:last-child { grid-column:1/-1;justify-self:center;margin-top:-22px; }
.ranked-eyebrow { display:block;color:#e6c385;font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase; }
.ranked-format h2 { font-size:1.6rem;margin:6px 0 14px; }.ranked-format h2 span { white-space:nowrap;color:#d7b6e6; }
.ranked-terms { display:flex;flex-wrap:wrap;gap:6px; }.ranked-terms span { padding:6px 9px;background:#42324e;border-radius:8px;color:#f3dcb6;font-size:.75rem;font-weight:750; }
.ranked-format p { font-size:.82rem;line-height:1.5;margin:14px 0 8px; }.ranked-format small { font-size:.71rem;line-height:1.5;color:#c6b5cf; }
.ranked-toss { max-width:580px;margin:auto;text-align:center;padding:12px 4px; }.ranked-toss h2 { font-size:1.65rem;margin:10px 0; }.ranked-toss > p { color:#ccb8d8;font-size:.8rem;line-height:1.5; }
.toss-versus { display:grid;grid-template-columns:1fr 30px 1fr;align-items:center;gap:10px;margin:24px 0 12px; }.toss-player { display:grid;justify-items:center;gap:7px;padding:15px 10px;background:#35283f;border-radius:20px;min-width:0; }.toss-avatar { border-radius:50%; }.toss-player > strong { max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.85rem; }.toss-player > small { font-size:.7rem;color:#c8b6d1; }.toss-gesture { height:100px;display:grid;place-items:center; }.toss-gesture img { width:100px;height:100px;object-fit:contain;animation:toss-reveal .4s ease-out; }.toss-gesture > span { font-weight:850;font-size:2.5rem;color:#8d719f; }.toss-gesture > span:has(+*) { font-size:.8rem; }.toss-winner { background:#504035;box-shadow:inset 0 -3px #e6c385; }.toss-vs { font-size:1.5rem;color:#b390cd; }.toss-hand { padding-top:7px; }.toss-hand .duel-choice { max-width:135px; }.toss-order { display:flex;justify-content:center;gap:10px;margin:22px 0; }.toss-draw { font-size:.8rem;color:#f1d499;padding:7px; }
.ranked-next { display:flex;align-items:center;gap:12px;background:#44334f;padding:8px 14px;border-radius:12px;min-height:44px; }.ranked-next span { font-size:.75rem;color:#d4c1e0; }.ranked-next b { font:800 1.2rem ui-monospace,monospace;color:#f3d392; }.ranked-next b:not(:is(:empty)) { min-width:16px; }
.ranked-reconnect { display:grid;gap:5px;padding:9px 12px;margin:9px 0;background:#594032;border-radius:9px;font-size:.75rem;color:#ffe0ac; }.ranked-reconnect b { display:inline-block;min-width:2ch;text-align:right;font-variant-numeric:tabular-nums; }
@keyframes toss-reveal { from { transform:translateY(10px) scale(.7);opacity:0 } to { transform:none;opacity:1 } }
@media(max-width:720px){.duel-queues{gap:7px}.duel-queues button{padding:11px 8px;gap:4px;border-radius:13px}.duel-queues img{width:40px;height:48px}.duel-queues strong{font-size:.85rem}.duel-queues small{font-size:.6rem}.ranked-format{grid-template-columns:1fr;padding:0 0 20px;gap:4px}.ranked-format-art{display:flex;justify-content:center;transform:none}.ranked-format-art img{width:72px;height:72px}.ranked-format-art img:last-child{margin:0}.ranked-format h2{font-size:1.4rem}.ranked-terms span{font-size:.66rem;padding:5px 7px}.ranked-toss h2{font-size:1.3rem}.toss-versus{gap:5px;grid-template-columns:1fr 20px 1fr;margin-top:16px}.toss-player{padding:12px 8px}.toss-gesture{height:85px}.toss-gesture img{width:85px;height:85px}.toss-gesture > span{font-size:1rem}.toss-order{flex-wrap:wrap}.ranked-next{margin:auto}}
@media(prefers-reduced-motion:reduce){.toss-gesture img{animation:none}.duel-queues button{transition:none}}
@media(max-width:720px){
 .duel-matchbar:has(.duel-player-clock) .match-player { position:relative; min-height:49px; align-items:flex-start; }
 .duel-matchbar:has(.duel-player-clock) .match-person { max-width:none; }
 .duel-matchbar .duel-player-clock { position:absolute; top:27px; left:0; right:auto; width:100%; justify-content:center; font-size:.8rem; padding:1px 2px; }
 .duel-matchbar .match-player:last-child .duel-player-clock { left:0; right:auto; }
}
.toss-versus { position:relative; isolation:isolate; }
.toss-gesture { position:relative; width:100px; }
.toss-gesture > img { position:relative; z-index:3; }
.toss-gesture .toss-fragment { position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:5;animation:none; }
.toss-loser .toss-gesture > img:not(.toss-fragment) { filter:grayscale(1) brightness(.5);opacity:.6; }
.toss-impact::after { content:'';position:absolute;left:50%;top:58%;width:80px;height:80px;background:radial-gradient(circle,#fff2bd 0,#ffd36a80 20%,transparent 68%);border-radius:50%;z-index:2;pointer-events:none;animation:toss-flash .65s ease-out forwards; }
[data-toss-status] { min-height:38px; }
.postgame-actions { display:flex;align-items:center;gap:8px;flex-wrap:wrap;width:100%; }
.postgame-actions button { padding:10px 13px;font-size:.8rem;border-radius:12px; }
.rematch-message { width:100%;margin:0;color:#efd7a6;font-size:.8rem; }
.match-search { display:flex;align-items:center;gap:12px;min-height:52px;width:100%;background:#3d304b;border-radius:13px;padding:10px 14px; }
.match-search i { width:24px;height:24px;border:3px solid #795e90;border-top-color:#f0cc85;border-radius:50%;animation:match-search-spin 1s linear infinite; }
.match-search span { display:grid;gap:4px;font-weight:800;font-size:.85rem; }.match-search small { font-size:.7rem;font-weight:500;color:#c3adcf; }
@keyframes toss-flash { from{transform:translate(-50%,-50%) scale(.3);opacity:1} to{transform:translate(-50%,-50%) scale(2.8);opacity:0} }
@keyframes match-search-spin { to{transform:rotate(360deg)} }
@media(max-width:720px){.toss-gesture{width:85px}.postgame-actions button:first-of-type{flex-basis:100%}.postgame-actions button{flex:1}.postgame-actions{justify-content:center}.toss-gesture>span{font-size:.85rem}}
.toss-clock { display:inline-flex;align-items:baseline;gap:6px;padding:5px 11px;border-radius:9px;background:#3f304b;color:#d3bddf;font-size:.76rem; }
.toss-clock b { color:#f4d49b;font:800 1.15rem ui-monospace,monospace;min-width:2ch;text-align:right;font-variant-numeric:tabular-nums; }
.toss-clock-low b { color:#ff9eb3; }
