:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #eef2ef;
  background: #0b1018;
  color-scheme: dark;
  --bg: #0b1018;
  --panel: #111a26;
  --panel-deep: #0e1621;
  --border: #283647;
  --border-bright: #3b5861;
  --muted: #a4b3bf;
  --mint: #a5ebd3;
  --gold: #e3c58b;
  --red: #ffada3;
  --serif: Georgia, "Times New Roman", serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100dvh; background: radial-gradient(ellipse at 68% 0, #14202d 0, transparent 42rem), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
a { color: var(--mint); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: clamp(2.3rem, 5.4vw, 4.6rem); line-height: 1.01; letter-spacing: -.053em; }
h2 { font-size: 1.56rem; letter-spacing: -.025em; }
h3 { font-size: .99rem; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; color: var(--gold); }
.eyebrow::before { content: ""; width: .48rem; height: .48rem; transform: rotate(45deg); border: 1px solid currentColor; }
.shell { width: min(1232px, calc(100% - 64px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 5; top: .6rem; left: .6rem; padding: .7rem; background: var(--bg); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid #273443; background: #0c131cf5; }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2rem; min-height: 72px; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 0; color: #eef2ef; background: none; border: 0; text-align: left; justify-self: start; }
.brand svg { width: 35px; flex: none; fill: #132e2c; stroke: #a5ebd3; stroke-width: 1; }
.brand .brand-line { fill: #a5ebd3; stroke: none; }
.brand span { white-space: nowrap; font-family: var(--serif); font-size: 1.25rem; }
.brand small { display: block; margin-top: .16rem; color: var(--muted); font: 700 .52rem/1.2 system-ui, sans-serif; letter-spacing: .13em; }
.main-nav { display: flex; align-items: stretch; align-self: stretch; gap: 1.25rem; }
.main-nav button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: .6rem .65rem; font-size: .88rem; font-weight: 650; white-space: nowrap; }
.main-nav button:hover, .main-nav button[aria-current="page"] { color: var(--mint); }
.main-nav button[aria-current="page"] { border-bottom-color: var(--mint); }
.account { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; }
.user { display: flex; align-items: center; gap: .52rem; min-width: 0; }
.user > span:last-child { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid #3b665b; color: var(--mint); background: #1b3937; font-size: .76rem; font-weight: 800; }
.main { padding-block: 2.65rem 3.3rem; min-height: calc(100dvh - 137px); }
.site-footer { display: flex; justify-content: space-between; padding-block: 1.1rem 1.6rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .73rem; gap: .7rem; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: .55rem; min-height: 2.55rem; padding: .6rem .92rem; border: 1px solid var(--border-bright); border-radius: 6px; color: #edf4ef; background: #172430; font-size: .85rem; font-weight: 700; line-height: 1.25; text-decoration: none; }
.button:hover:not(:disabled) { border-color: var(--mint); background: #20343c; }
.button.primary { color: #102723; background: var(--mint); border-color: var(--mint); }
.button.primary:hover:not(:disabled) { background: #c3f8e4; }
.button.ghost { background: transparent; border-color: var(--border); }
.button.danger { color: var(--red); border-color: #623f43; }
.button.compact { min-height: 2.08rem; padding: .38rem .58rem; font-size: .76rem; }
.button.icon { padding-inline: .55rem; min-width: 2.1rem; }
.button.full { width: 100%; }
.text-button { display: inline; padding: 0; border: 0; background: none; color: var(--mint); text-align: left; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.between { justify-content: space-between; }
.stack { display: grid; gap: .9rem; }
.stack.tight { gap: .5rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.page-head h1 { font-size: clamp(2.3rem, 5vw, 3.7rem); margin-block: .35rem .45rem; }
.page-head p { max-width: 60ch; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 340px; display: flex; align-items: center; padding: clamp(1.55rem, 5vw, 4.2rem); background: #0c1420; border: 1px solid #334748; border-radius: 11px; }
.hero::before { position: absolute; z-index: -2; inset: 0 0 0 16%; content: ""; background: url('/rift.svg') center right / cover no-repeat; }
.hero::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, #0c1420 3%, #0c1420eb 33%, #0c14206a 55%, transparent 78%); }
.hero-content { max-width: 34rem; display: grid; gap: 1.05rem; }
.hero h1 em { color: var(--mint); font-weight: 400; }
.hero p { max-width: 37ch; color: #c0d1d6; }
.hero .row { margin-top: .25rem; }
.dashboard { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.panel { min-width: 0; padding: 1.2rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.panel > * + * { margin-top: .9rem; }
.panel-title { display: flex; align-items: center; gap: .62rem; }
.panel-mark { display: inline-grid; place-items: center; flex: none; width: 1.95rem; height: 1.95rem; border: 1px solid #35575a; border-radius: 5px; color: var(--mint); background: #162c33; font-size: 1rem; }
.lobby-list, .deck-list, .log-list { list-style: none; margin: 0; padding: 0; }
.lobby-list li, .log-list li { padding: .57rem 0; border-bottom: 1px solid var(--border); }
.lobby-list li:last-child, .log-list li:last-child { border-bottom: 0; }
.label { display: grid; gap: .35rem; color: #dde6eb; font-size: .84rem; font-weight: 650; }
input:not([type="checkbox"]), select { width: 100%; min-height: 2.55rem; padding: .53rem .65rem; border: 1px solid var(--border-bright); border-radius: 5px; background: #0b141e; color: #eef2ef; }
input::placeholder { color: #96a9b6; opacity: 1; }
input[type="checkbox"] { accent-color: var(--mint); }
.field { min-width: 10rem; }
.filters { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.filters .search { flex: 1 1 15rem; }
.filters .field { flex: 0 1 auto; }
.catalog-filters { margin-top: .7rem; }
.check-label { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.55rem; font-size: .79rem; color: #c8d5db; cursor: pointer; }
.notice, .error { padding: .74rem .8rem; border: 1px solid #43534b; border-radius: 5px; background: #182723; color: #d4efdd; font-size: .84rem; }
.error { border-color: #70464a; background: #321d26; color: var(--red); }
.validation-list { margin: .45rem 0 0; padding-left: 1.1rem; line-height: 1.5; }
.badge { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border); border-radius: 99px; padding: .18rem .42rem; color: #bdc9d3; background: #111b26; font-size: .65rem; font-weight: 750; line-height: 1.3; }
.badge.live { color: var(--mint); border-color: #3a6259; background: #173130; }
.badge.gold { color: var(--gold); border-color: #6b5b43; background: #28241f; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: .8rem; }
.deck-tile { background: linear-gradient(135deg, #152433, #111925 85%); }
.deck-tile .row { align-items: baseline; }
.starter-section { display: grid; gap: .6rem; margin-top: 1.8rem; }
.empty { display: grid; justify-items: start; gap: .6rem; padding: 1.2rem; border: 1px dashed var(--border-bright); border-radius: 7px; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr)); gap: .75rem; margin-top: 1rem; }
.result-count { margin-block: .85rem .45rem; }
.card-tile { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); }
.card-tile:hover, .card-tile:focus-within { border-color: var(--border-bright); }
.card-visual { position: relative; display: grid; place-items: center; width: 100%; min-height: 7.5rem; aspect-ratio: 1.37; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid var(--border); background: radial-gradient(ellipse, var(--domain-dark, #274251), #152332 72%); color: var(--domain-light, #a6c7c7); }
.card-sigil { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border: 1px solid currentColor; border-radius: 50%; font: 2.2rem/1 var(--serif); opacity: .84; box-shadow: 0 0 0 .4rem #ffffff0e, 0 0 0 .46rem #ffffff14; }
[data-domain="fury"] { --domain-dark: #543036; --domain-light: #f2a88f; }
[data-domain="calm"] { --domain-dark: #334939; --domain-light: #afdeb4; }
[data-domain="mind"] { --domain-dark: #294357; --domain-light: #98d2f5; }
[data-domain="body"] { --domain-dark: #5b402b; --domain-light: #f5c68a; }
[data-domain="chaos"] { --domain-dark: #453456; --domain-light: #d7b0f5; }
[data-domain="order"] { --domain-dark: #4d4730; --domain-light: #f2df8b; }
.card-visual img { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #101722; }
.card-visual img[hidden] { display: none; }
.card-body { display: grid; flex: 1; align-content: start; gap: .35rem; min-width: 0; padding: .65rem; }
.card-body h3 { font-size: .86rem; overflow-wrap: anywhere; }
.card-body .small { font-size: .71rem; }
.card-body .row { gap: .25rem; align-self: end; }
.card-body .badge { justify-self: start; }
.card-body .button { align-self: end; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: .65rem; margin-top: 1rem; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 1rem; align-items: start; }
.editor-card-list { min-width: 0; }
.deck-editor { position: sticky; top: .8rem; max-height: calc(100dvh - 1.6rem); overflow: auto; }
.deck-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.15rem; padding-block: .23rem; }
.deck-list li + li { border-top: 1px solid #202e3c; }
.deck-editor details { padding-block: .35rem; border-top: 1px solid var(--border); }
.deck-editor details + details { margin-top: .15rem; }
summary { color: #dce9e8; cursor: pointer; font-weight: 650; }
.room-head { margin-bottom: 1rem; }
.room-head h1 { font-size: clamp(1.75rem, 3.5vw, 2.8rem); }
.mode-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding: .65rem .8rem; margin-bottom: .8rem; border: 1px solid var(--border-bright); border-radius: 7px; background: var(--panel-deep); }
.mode-bar > .button { flex: none; }
.code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .13em; color: var(--mint); }
.room-code { font-size: clamp(1.75rem, 6vw, 2.8rem); overflow-wrap: anywhere; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 305px); gap: .85rem; align-items: start; }
.board { min-width: 0; display: grid; gap: .6rem; }
.board .panel { padding: .8rem; }
.player-board { background: linear-gradient(135deg, #162c33, #111b29 85%); }
.player-board.enemy { background: linear-gradient(135deg, #242333, #141c2a 85%); }
.score { display: flex; align-items: baseline; gap: .22rem; color: var(--gold); font-family: var(--serif); }
.score b { font-size: 1.7rem; line-height: 1; }
.score span { font-size: .85rem; }
.board-section { display: grid; gap: .35rem; padding-top: .43rem; border-top: 1px solid var(--border); }
.board-section h3, .board-section h4, .board-label { color: #b6c5ce; font-size: .66rem; text-transform: uppercase; letter-spacing: .11em; }
.battlefields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: .6rem; }
.battlefield { min-height: 135px; display: flex; flex-direction: column; justify-content: space-between; gap: .45rem; position: relative; isolation: isolate; background: radial-gradient(ellipse at 90% 20%, #253f49 0, #172636 70%); border: 1px solid var(--border-bright); border-radius: 7px; padding: .72rem; }
.battlefield.own { border-color: #548d7d; }
.battlefield.enemy { border-color: #80647a; }
.battlefield h3 { font-family: var(--serif); font-size: 1.02rem; }
.battlefield-name { color: #e8f4ef; font: inherit; }
.hidden-card { width: fit-content; padding: .24rem .42rem; border: 1px solid #665a73; border-radius: 4px; background: #242333; color: #d7c4de; }
.room-offline { margin-bottom: .7rem; }
.chips { display: flex; gap: .34rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .28rem; min-height: 1.65rem; max-width: 100%; padding: .28rem .39rem; border: 1px solid #3b5563; border-radius: 5px; color: #e8f4f2; background: #111d29; font-size: .69rem; font-weight: 650; text-align: left; }
.chip.own { border-color: #4d776d; }
.chip.enemy { border-color: #7c5e74; }
.chip:hover { border-color: var(--mint); }
.chip > span:first-child { overflow-wrap: anywhere; }
.chip.exhausted { opacity: .71; }
.chip .damage { color: var(--red); }
.board-keyword { color: var(--gold); font-size: .65rem; }
.chip .board-keyword { border-left: 1px solid var(--border-bright); padding-left: .29rem; }
.field-gear .chip { border-style: dashed; }
.base-gear { display: grid; gap: .34rem; margin-top: .22rem; }
.board-card-group { display: grid; justify-items: start; gap: .24rem; min-width: 0; max-width: 100%; }
.equipped-items { display: flex; flex-wrap: wrap; gap: .26rem; margin-left: .42rem; padding-left: .33rem; border-left: 1px solid #7c6b4a; }
.chip.attached-chip { border-style: dashed; }
.equipment-bonus { color: var(--mint); font-size: .64rem; }
.token-label { color: #d5b7f3; font-size: .63rem; }
.token-chip .token-label { border-left: 1px solid var(--border-bright); padding-left: .29rem; }
.hand { display: flex; gap: .5rem; align-items: stretch; overflow-x: auto; padding: .2rem .14rem .45rem; }
.hand-card { flex: 0 0 110px; display: grid; align-content: start; gap: .38rem; min-height: 8.1rem; padding: .35rem; border: 1px solid var(--border-bright); border-radius: 6px; color: #eaf3ee; background: #101a26; text-align: left; }
.hand-card img { width: 100%; height: 4.9rem; object-fit: contain; border-radius: 3px; background: #0c1520; }
.hand-card .hand-art { display: grid; place-items: center; height: 4.9rem; border-radius: 3px; background: linear-gradient(135deg, var(--domain-dark, #18323b), #151d29); color: var(--domain-light, var(--mint)); font-size: 1.65rem; }
.hand-card .hand-art[hidden] { display: none; }
.hand-card.playable { border-color: #7bd8bc; }
.hand-card:hover { border-color: var(--mint); background: #1b2b36; }
.hand-card b { font-size: .72rem; overflow-wrap: anywhere; }
.hand-card span { font-size: .66rem; }
.action-panel { position: sticky; top: .8rem; }
.action-panel .button { width: 100%; text-align: left; justify-content: flex-start; }
.action-list { display: grid; gap: .4rem; max-height: min(55dvh, 31rem); overflow: auto; padding: .2rem; }
.action-list + .action-list { margin-top: .3rem; }
.manual-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .38rem; }
.manual-form[data-manual-command="token"], .manual-form[data-manual-command="attach"] { grid-template-columns: minmax(0, 1fr); }
.manual-form > .label { min-width: 0; font-size: .76rem; }
.manual-form input:not([type="hidden"]), .manual-form select { min-height: 2.08rem; padding: .32rem .4rem; font-size: .79rem; }
.action-panel .manual-form > .button { width: auto; justify-content: center; }
.manual-card-controls { border-top: 1px solid var(--border); padding-top: .68rem; }
.manual-buttons { gap: .4rem; }
.manual-controls details, .manual-card-controls details { border: 1px solid var(--border); border-radius: 5px; padding: .42rem .52rem; }
.manual-detail { padding-top: .55rem; }
.choice-list { display: grid; gap: .3rem; margin: .55rem 0; }
.choice-list label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: #e1efed; }
.choice-order { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.choice-order .button { width: 100%; justify-content: flex-start; }
.choice-order .button[aria-pressed="true"] { color: var(--mint); border-color: var(--mint); }
.log-list { max-height: 13rem; overflow: auto; color: #c3cdd6; font-size: .77rem; line-height: 1.4; }
.log-list li { overflow-wrap: anywhere; }
dialog { width: min(530px, calc(100% - 2rem)); max-height: 88dvh; overflow: auto; padding: 1.35rem; border: 1px solid #3c5961; border-radius: 9px; background: #121d29; color: #eef2ef; box-shadow: 0 18px 90px #0009; }
dialog::backdrop { background: #05080cbd; backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: .65rem; margin-bottom: 1rem; }
.card-detail { display: grid; grid-template-columns: minmax(105px, .8fr) minmax(0, 1fr); align-items: start; gap: 1rem; }
.card-detail img { width: 100%; max-height: 17rem; object-fit: contain; border-radius: 7px; background: #0c151f; }
.card-detail.no-image { grid-template-columns: 1fr; }
.card-rules { white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 4; bottom: 1.15rem; right: 1.15rem; max-width: min(385px, calc(100% - 2.3rem)); padding: .78rem 1rem; border: 1px solid #466866; border-radius: 6px; background: #182b31; color: #dcf4ec; box-shadow: 0 8px 24px #0006; font-size: .85rem; }
.toast.error { border-color: #75484b; background: #3a2129; color: var(--red); }
.loading { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 45vh; color: var(--muted); }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--border-bright); border-top-color: var(--mint); border-radius: 50%; animation: rotate .8s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }
@media (max-width: 850px) {
  .shell { width: min(100% - 36px, 1232px); }
  .header-inner { gap: .7rem; }
  .main-nav { gap: .3rem; }
  .main-nav button { padding-inline: .42rem; }
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard > :last-child { grid-column: 1 / -1; }
  .editor { grid-template-columns: minmax(0, 1fr) minmax(225px, 265px); }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 26px); }
  .header-inner { grid-template-columns: 1fr 1fr; min-height: 0; gap: 0 .5rem; padding-top: .65rem; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
  .account { grid-column: 2; grid-row: 1; }
  .brand span { font-size: 1.05rem; }
  .brand svg { width: 28px; }
  .user > span:last-child { display: none; }
  .main { padding-top: 1.4rem; }
  .hero { min-height: 300px; }
  .hero::before { inset-inline-start: 0; background-position: 62% center; opacity: .82; }
  .hero::after { background: linear-gradient(90deg, #0c1420 5%, #0c1420b8 68%, #0c142050); }
  .dashboard, .room-grid, .editor { grid-template-columns: 1fr; }
  .room-grid { display: flex; flex-direction: column-reverse; }
  .room-grid > * { width: 100%; }
  .editor { display: flex; flex-direction: column-reverse; }
  .editor > * { width: 100%; }
  .action-panel, .deck-editor { position: static; max-height: none; }
  .action-list { max-height: 14rem; }
  .page-head { align-items: start; flex-direction: column; }
  .site-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }
