:root {
  color-scheme: dark;
  --bg: #0d0a13;
  --surface: #151022;
  --raised: #1e172b;
  --line: #362b49;
  --text: #f7f0ff;
  --muted: #bfb2ce;
  --gold: #ffcf76;
  --lilac: #cbabff;
  --display: "Barlow Condensed", Impact, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --body: Inter, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1rem; }
body { margin: 0; color: var(--text); background: var(--bg); font: 400 1rem/1.55 var(--body); }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.55rem; }
a { color: var(--gold); text-underline-offset: .2em; }
a:hover { color: var(--text); }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hdr, .main, .ftr { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.hdr { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 13px; font: 800 1.65rem/1 var(--display); color: var(--text); text-transform: uppercase; letter-spacing: .035em; text-decoration: none; white-space: nowrap; }
.sig { width: 23px; height: 23px; transform: rotate(45deg); border: 1px solid #a67949; display: grid; place-items: center; background: #271c26; }
.sig::before { content: ""; width: 9px; height: 9px; background: var(--gold); box-shadow: 0 0 12px #ffc66d9c; }
.hnav, .ftr-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; }
.hnav a, .ftr-nav a { color: var(--muted); font-size: .85rem; text-decoration: none; }
.hnav a:hover, .ftr-nav a:hover { color: var(--gold); }
.main { min-height: 54vh; }
.player-shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
.player-shell .stage { grid-column: 1 / -1; }
.stage { --game-height: 522px; position: relative; isolation: isolate; overflow: hidden; height: clamp(440px, 43vw, 565px); border: 1px solid #4e3c63; border-radius: 15px; background: var(--surface); }
.stage[data-gf-state="playing"] { height: var(--game-height); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage:not([data-gf-state="playing"]) iframe { visibility: hidden; }
.stage:fullscreen, .stage[data-gf-state="playing"]:fullscreen { width: 100%; height: 100%; border: 0; border-radius: 0; }
.cover { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 6.2%; background: linear-gradient(90deg,#0b0812 0%,#100b18b0 33%,transparent 67%), url("https://demongacha.site/_a/rift-cover.4637009799.webp") center right / cover; }
.cover::before { content: ""; position: absolute; inset: 11px; pointer-events: none; border: 1px solid #eed1fd19; border-radius: 8px; }
.cover-copy { position: relative; max-width: 440px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font: 500 .73rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.mark { font-size: .74em; }
.cover-title { font-family: var(--display); margin: 12px 0 16px; font-size: clamp(5.2rem,9vw,8.6rem); font-weight: 900; line-height: .73; letter-spacing: -.027em; text-transform: uppercase; }
.cover-title span { color: var(--gold); }
.cover-copy > p:not(.eyebrow, .cover-title) { max-width: 335px; font-size: .98rem; color: #e2d6ee; }
.primary, .secondary { min-height: 44px; padding: 8px 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 700; font-size: .86rem; transition: background-color .16s, border-color .16s, color .16s; }
.primary { color: #201421; background: var(--gold); border-color: #ffe3a9; box-shadow: 0 3px 14px #ffd37f19, inset 0 -2px #ae76372e; }
.primary:hover { background: #ffe4a9; }
.secondary { background: #241b33; border-color: #4d3b62; }
.secondary:hover:not(:disabled) { background: #322441; border-color: #8a67b0; }
.secondary:disabled { background: #191322; border-color: #362b46; color: #afa2bd; }
.cover .play { display: flex; justify-content: space-between; align-items: center; gap: 32px; margin-top: 25px; min-height: 52px; padding-inline: 19px; font-size: .95rem; }
.cover small { display: block; margin-top: 11px; color: var(--muted); font: 400 .71rem/1.4 var(--mono); }
.cover small b { margin: 0 .25rem; color: var(--gold); }
.loader { display: none; position: absolute; inset: 0; place-content: center; gap: 14px; place-items: center; color: var(--gold); background: radial-gradient(ellipse at center,#322046,var(--bg) 70%); font: 500 .83rem var(--mono); }
.stage[data-gf-state="loading"] .loader { display: grid; }
.stage[data-gf-state="loading"] .cover, .stage[data-gf-state="playing"] .cover { display: none; }
.stage-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 20px; text-align: center; background: radial-gradient(ellipse at center,#322046,var(--bg) 70%); }
.ring { display: block; width: 36px; height: 36px; border: 2px solid #664478; border-right-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-block: 12px; }
.act { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: .83rem; text-decoration: none; }
.act:hover, .act[aria-pressed="true"] { background: var(--raised); color: var(--gold); border-color: var(--line); }
.act span:first-child { color: var(--lilac); }
.expand { align-self: center; justify-self: end; }
.msg:empty { display: none; }
.msg, .cmsg { font-size: .83rem; color: var(--gold); }
.home-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 290px); gap: clamp(28px, 5vw, 70px); margin: 44px 0 56px; }
.prose { color: var(--muted); line-height: 1.75; overflow-wrap: anywhere; }
.prose h1 { font-size: clamp(2.7rem, 7vw, 5rem); margin-bottom: 26px; }
.prose h2 { margin: 1.6em 0 .55em; }
.prose h3 { margin: 1.3em 0 .55em; }
.prose h1, .prose h2, .prose h3, .prose strong { color: var(--text); }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li + li { margin-top: .35em; }
.inner { width: min(850px,100%); margin: 34px auto 64px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.prose td, .prose th, .odds-table th, .odds-table td { padding: .65rem .55rem; text-align: left; border-bottom: 1px solid var(--line); }
.prose th { color: var(--text); background: var(--surface); }
.home-links { align-self: start; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.home-links h2 { font-size: 1.7rem; margin-bottom: 12px; }
.home-links a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-block: 14px; border-top: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.home-links small { display: block; margin-top: 4px; color: var(--muted); font-size: .77rem; font-weight: 400; }
.comments { max-width: 850px; padding-top: 26px; margin: 0 0 54px; border-top: 1px solid var(--line); }
.cint, .cmsg { margin: 7px 0 14px; color: var(--muted); }
.cform { display: grid; gap: 12px; }
.field, .filters label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #59466e; border-radius: 6px; background: #100b19; }
textarea { resize: vertical; }
.submit { justify-self: start; min-height: 44px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); }
.clist[data-gf-empty]::before { content: attr(data-empty-message); display: block; padding: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; }
.comment { margin-top: 10px; padding: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.comment[data-gf-owner] { border-color: #8f6943; }
.chead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chead time, .cto, .creply { color: var(--muted); font-size: .78rem; }
.ctext { white-space: pre-wrap; overflow-wrap: anywhere; }
.owner-tag { display: none; color: var(--gold); font-size: .7rem; }
[data-gf-owner] > .chead .owner-tag { display: inline; }
.cform:not([data-gf-replying]) .replying { display: none; }
.creply, .replying button { border: 0; padding: 4px; background: transparent; }
.creplies { margin-left: 12px; }
.ftr { display: grid; gap: 18px; padding: 30px 0; border-top: 1px solid var(--line); }
.disclaim, .copy { max-width: 670px; margin-top: 9px; font-size: .78rem; color: var(--muted); }
.ftr .brand { font-size: 1.23rem; }
.ftr .sig { width: 16px; height: 16px; }
.ftr .sig::before { width: 6px; height: 6px; }

/* Game */
.em { min-width: 0; }
.gacha { color: var(--text); background: var(--surface); }
.game-header { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); background: #100c19; }
.game-nav { display: flex; gap: 3px; align-items: stretch; }
.game-nav button { min-height: 50px; padding: 9px 13px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: .85rem; font-weight: 700; }
.game-nav button:hover, .game-nav button[aria-pressed="true"] { border-bottom-color: var(--gold); color: var(--gold); background: linear-gradient(transparent,#ffd17d0b); }
.hud { display: flex; align-items: center; }
.hud > div { min-width: 74px; padding: 5px 12px; border-left: 1px solid var(--line); }
.hud dt { font: .65rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hud dd { font: 600 .93rem/1.55 var(--mono); white-space: nowrap; }
#hud-shards { color: var(--gold); }
.board { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(275px, 1fr); }
.altar { position: relative; display: grid; place-items: center; min-height: 396px; padding: 19px; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse,#38204d,#120d1e 74%); }
.altar::before { content: ""; position: absolute; z-index: -1; width: 332px; height: 332px; border: 1px solid #9f79c54d; border-radius: 50%; box-shadow: inset 0 0 0 13px #110b163b, inset 0 0 0 14px #78529339, 0 0 62px #a453f21c; }
.altar::after { content: ""; width: 245px; height: 245px; position: absolute; z-index: -1; transform: rotate(45deg); border: 1px solid #8d61924d; }
.reveal { text-align: center; width: min(215px, 100%); }
.reveal > p { margin-top: 13px; color: var(--muted); font: .73rem var(--mono); }
.card-back { width: 154px; aspect-ratio: 2/3; margin: auto; display: grid; place-items: center; border: 1px solid #b78b5e; border-radius: 9px; background: url("https://demongacha.site/_a/rift-card.28df7c5c81.webp") 51% center / cover; box-shadow: 0 15px 40px #000b; }
.card-back span { visibility: hidden; }
.prime { --tier: #ffce74; --tier-hue: 37; }
.abyss-tier { --tier: #e1a2ff; --tier-hue: 280; }
.cursed { --tier: #ff9cac; --tier-hue: 344; }
.hollow { --tier: #add4ed; --tier-hue: 201; }
.reveal-card { position: relative; isolation: isolate; display: grid; width: min(100%,195px); min-height: 262px; margin: auto; padding: 12px; align-content: space-between; text-align: left; border: 1px solid var(--tier); border-radius: 9px; overflow: hidden; background: #120d1a; box-shadow: 0 15px 30px #000a,0 0 24px hsl(var(--tier-hue) 86% 55% / .28); animation: reveal .32s ease-out both; }
.reveal-card:not(.has-artwork) { background: #120d1a url("https://demongacha.site/_a/rift-card.28df7c5c81.webp") 48% 38% / cover; }
.reveal-art { position: absolute; inset: 0; z-index: -3; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.reveal-card::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg,#110b17e8,transparent 24%,transparent 46%,#110b17c9 71%,#110b17fa 100%); }
.reveal-card::after { content: ""; position: absolute; z-index: -2; inset: 0; background: hsl(var(--tier-hue) 78% 48% / .10); mix-blend-mode: color; }
.reveal-card .card-top, .reveal-card .card-name, .reveal-card .card-power { text-shadow: 0 1px 4px #08050e; }
@keyframes reveal { from { opacity: .55; transform: translateY(6px) scale(.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font: 600 .74rem var(--mono); color: var(--tier); }
.card-name { color: var(--text); font: 800 2rem/.98 var(--display); overflow-wrap: anywhere; }
.card-power { margin-top: 5px; color: var(--tier); font: 500 .69rem var(--mono); }
.summon-panel { padding: 21px clamp(17px,4vw,38px) 18px; border-left: 1px solid var(--line); background: #171122; }
.summon-head, .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 14px; }
.summon-head h2, .panel-title h2 { font-size: clamp(1.75rem,4vw,2.45rem); }
.text-btn { min-height: 40px; padding: 4px 0; border: 0; background: transparent; color: var(--lilac); text-decoration: underline; text-underline-offset: .22em; font-size: .78rem; }
.text-btn:hover { color: var(--gold); }
.summon-option { padding: 13px 0; border-top: 1px solid var(--line); }
.summon-option p, .panel-title p { margin: 6px 0 10px; color: var(--muted); font-size: .8rem; }
.rift-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.abyss-controls { display: flex; align-items: center; gap: 9px; }
.abyss-controls button { flex: 1; }
.abyss-controls span { font: .72rem var(--mono); color: var(--gold); }
progress { display: block; width: 100%; height: 5px; margin-bottom: 10px; border: 0; border-radius: 5px; background: #322441; accent-color: var(--gold); }
progress::-webkit-progress-bar { border-radius: 5px; background: #322441; }
progress::-webkit-progress-value { border-radius: 5px; background: var(--gold); }
.game-panel { padding: 20px clamp(12px,4vw,35px); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.cards-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; padding: 0; margin: 14px 0; list-style: none; }
.catalog-card { display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 3px 5px; width: 100%; min-height: 65px; padding: 7px 9px; text-align: left; border: 1px solid var(--line); border-left: 2px solid var(--tier); border-radius: 5px; background: #1a1326; }
button.catalog-card:hover { border-color: var(--tier); background: #251932; }
.catalog-card.missing { border-left-color: #5b4b70; }
.catalog-rank, .catalog-tier { font: 500 .61rem var(--mono); color: var(--tier); }
.catalog-name { grid-column: 1 / -1; overflow-wrap: anywhere; font-size: .76rem; font-weight: 600; }
.catalog-card.missing .catalog-name { color: var(--muted); font-weight: 400; }
.collection-empty, #history-empty { padding-block: 14px; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: .73rem var(--mono); color: var(--muted); }
.game-dialog { width: min(485px,calc(100% - 24px)); max-height: calc(100% - 24px); padding: 17px; background: #1c1429; color: var(--text); border: 1px solid #79638f; border-radius: 10px; box-shadow: 0 20px 100px #0009; }
.game-dialog::backdrop { background: #0b0815c9; }
.share-url { width: 100%; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dialog-header h2 { min-width: 0; font-size: 1.9rem; overflow-wrap: anywhere; }
.dialog-header form { flex-shrink: 0; }
.close { padding: 0; min-width: 44px; font-size: 1.4rem; }
.odds-table { width: 100%; border-collapse: collapse; font-size: .79rem; }
.odds-table caption { text-align: left; color: var(--muted); margin-bottom: 7px; }
.odds-table td:first-child { color: var(--tier); font: 600 .69rem var(--mono); }
@media (max-width: 380px) {
  .dialog-header h2 { font-size: 1.25rem; hyphens: auto; }
  .odds-table { table-layout: fixed; }
  .odds-table :is(th, td) { padding-inline: .3rem; hyphens: auto; overflow-wrap: anywhere; }
  .odds-table :is(th, td):first-child, .odds-table :is(th, td):last-child { width: 30%; }
}
.result-list { display: grid; gap: 4px; list-style: none; padding: 0; margin: 9px 0 0; }
.history-list { max-height: 240px; overflow: auto; }
.result-row { display: grid; grid-template-columns: 2.7rem minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 7px 8px; border-left: 2px solid var(--tier); background: #ffffff07; font-size: .8rem; }
.result-row span:first-child, .result-row span:last-child { font: .67rem var(--mono); color: var(--tier); }
.result-row strong { overflow-wrap: anywhere; }
.batch-summary, .save-options p { color: var(--muted); font-size: .84rem; }
.save-options { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 9px; }
.save-options summary { color: var(--muted); cursor: pointer; min-height: 32px; font-size: .84rem; }
.save-options p { margin: 4px 0 8px; }
.danger { color: #ffd0d7; }
@media (max-width: 760px) {
  .hdr, .main, .ftr { width: calc(100% - 32px); }
  .home-content { grid-template-columns: 1fr; margin-top: 27px; }
  .home-links { order: -1; }
  .player-shell { grid-template-columns: minmax(0, 1fr); }
  .player-shell .expand { grid-row: 1; margin-bottom: 4px; border-color: var(--line); background: var(--surface); }
  .stage { --game-height: 745px; }
  .game-header { padding-inline: 10px; }
  .hud > div { min-width: 0; padding-inline: 8px; }
}
@media (max-width: 580px) {
  .hdr { min-height: 60px; gap: 12px; }
  .brand { font-size: 1.19rem; gap: 9px; }
  .sig { width: 17px; height: 17px; }
  .sig::before { width: 6px; height: 6px; }
  .hnav { gap: 11px; }
  .hnav a { font-size: .72rem; }
  .stage { height: 476px; }
  .cover { padding: 25px 20px 25px; align-items: end; background: linear-gradient(180deg,transparent 2%,#0e0a15a7 39%,#0e0a15 68%), url("https://demongacha.site/_a/rift-card.28df7c5c81.webp") center top / 100% auto no-repeat, #100b18; }
  .cover-title { font-size: clamp(3.4rem,12vw,5rem); line-height: .81; margin: 8px 0 10px; }
  .cover-copy > p:not(.eyebrow, .cover-title) { font-size: .86rem; }
  .cover .play { margin-top: 14px; }
  .actions { gap: 3px; }
  .act { gap: 4px; padding-inline: 7px; font-size: .72rem; }
  .game-header { flex-direction: column-reverse; gap: 0; }
  .game-nav button { flex: 1; padding: 7px 5px; min-height: 44px; font-size: .79rem; }
  .hud > div { flex: 1; padding: 6px 9px; }
  .hud > div:first-child { border-left: 0; }
  .board { grid-template-columns: 1fr; }
  .altar { min-height: 250px; padding: 12px; }
  .altar::before { width: 220px; height: 220px; }
  .altar::after { width: 165px; height: 165px; }
  .card-back { width: 116px; }
  .reveal-card { min-height: 209px; width: min(100%,154px); }
  .card-name { font-size: 1.55rem; }
  .summon-panel { border-left: 0; border-top: 1px solid var(--line); padding-block: 8px; }
  .summon-head { margin-bottom: 3px; }
  .summon-option { padding-block: 9px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 6px; }
  .filters label:first-child { grid-column: 1 / -1; }
  .cards-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .panel-title p { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.gameplay-shot { margin: 1.4rem 0 2.2rem; }
.gameplay-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.gameplay-shot figcaption { margin-top: .55rem; color: var(--muted); font-size: .82rem; }

.catalog-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 190px) auto; align-items: end; gap: .75rem; margin-block: 1.5rem 2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.catalog-filters label { display: grid; gap: .3rem; font-size: .88rem; }
.catalog-filters .catalog-count { grid-column: 1 / -1; margin: 0; font-size: .85rem; }
.catalog-tier { margin-top: 2rem; }
.catalog-tier h2 { margin-top: 0; }
.catalog-tier :is(td, th):not(:nth-child(2)) { white-space: nowrap; }
.catalog-tier tbody th { background: transparent; font-weight: 600; }
.catalog-tier td:first-child { font-family: var(--mono); }
.catalog-tier tr:target { background: var(--raised); }
@media (max-width: 580px) {
  .catalog-filters { grid-template-columns: minmax(0, 1fr) auto; }
  .catalog-filters label:first-child { grid-column: 1 / -1; }
  .catalog-tier :is(td, th) { padding-inline: .35rem; }
}

.prose .breadcrumb ol { display: flex; flex-wrap: wrap; gap: .55em; list-style: none; margin: 0 0 .8rem; padding: 0; font-size: .85rem; }
.prose .breadcrumb li { margin: 0; }
.breadcrumb [aria-hidden] { margin-right: .4em; color: var(--lilac); }

.language-menu { position: relative; color: var(--muted); font-size: .85rem; }
.language-menu summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; padding-block: 10px; }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary:hover, .language-menu[open] summary { color: var(--gold); }
.language-options { position: absolute; z-index: 10; inset-block-start: 100%; inset-inline-end: 0; min-width: 138px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg, #140e1a); box-shadow: 0 10px 30px #0008; }
.language-options a { display: block; padding: 8px 10px; font-size: .85rem; white-space: nowrap; }
.language-options a[aria-current="page"] { color: var(--gold); font-weight: 700; }
@media (max-width: 580px) {
  .hdr { flex-wrap: wrap; gap: 0 12px; padding-block: 9px; }
  .language-menu { font-size: .78rem; }
}


/* Opening and archive screens */
.pool-selector, .result-actions, .sound-options, .series-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pool-selector { margin: 10px 0; }
.pool-selector button { min-height: 40px; flex: 1 1 110px; padding: 6px 9px; font-size: .78rem; }
.pool-selector button[aria-pressed="true"], .sound-options button[aria-pressed="true"] { color: #ffe1a1; border-color: #967046; background: #352635; }
.filter-series { min-width: 0; }
.game-panel .filters { grid-template-columns: minmax(135px,1.5fr) repeat(3,minmax(90px,1fr)); }
.opening-section { margin-block: 20px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.opening-section .panel-title { align-items: center; }
.opening-section .panel-title h3, .earlier-title, .binder-heading { margin: 0; font-size: 1rem; }
.opening-list { display: grid; gap: 7px; padding: 0; margin: 10px 0 0; list-style: none; }
.collection-openings { grid-template-columns: repeat(3,minmax(0,1fr)); }
.opening-link { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: #1b1327; border: 1px solid #493453; border-left: 2px solid var(--tier); border-radius: 7px; color: var(--text); text-align: left; }
.opening-link:hover { background: #281c35; border-color: var(--tier); }
.opening-link-text { display: grid; gap: 3px; min-width: 0; }
.opening-link strong, .opening-link small { overflow-wrap: anywhere; }
.opening-link small, .opening-empty { color: var(--muted); font-size: .77rem; }
.opening-arrow { color: var(--tier); }
.earlier-title { margin-top: 19px; }
.reveal-card { aspect-ratio: 2 / 3; min-height: 0; }
.reveal-art { object-fit: contain; object-position: center; }
html:has(#opening-dialog[open]) { overflow: hidden; }
.opening-dialog {
  width: min(940px, calc(100% - 24px)); max-height: calc(100% - 24px); max-height: calc(100dvh - 24px);
  padding: 0; overflow: hidden; border-color: #765c83; border-radius: 14px;
  background: radial-gradient(ellipse at 50% -20%, #3a2648, transparent 60%), #15101e;
}
.opening-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; animation: opening-in .19s cubic-bezier(.23,1,.32,1) both; }
.opening-dialog[data-count="1"] { width: min(410px, calc(100% - 24px)); }
.opening-dialog::backdrop { background: #0b0818d4; }
@keyframes opening-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.opening-header { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 14px clamp(12px,2vw,24px); border-bottom: 1px solid var(--line); }
.opening-header h2 { margin: 0; font: 800 clamp(1.4rem,3vw,2rem)/1.08 var(--display); }
.opening-header p { margin: 5px 0 0; color: var(--muted); font: .73rem var(--mono); }
.opening-header button { min-width: 44px; min-height: 44px; font-size: 1.15rem; }
.opening-scroll { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 12px clamp(12px,2vw,24px); scroll-padding: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px 11px; margin: 0; padding: 0; list-style: none; }
.opening-dialog[data-count="1"] .result-grid { grid-template-columns: minmax(0,190px); justify-content: center; }
.result-tile { min-width: 0; perspective: 900px; }
.opening-rotor { position: relative; aspect-ratio: 2 / 3; transform-style: preserve-3d; transition: transform .28s cubic-bezier(.77,0,.175,1); }
.opening-back, .opening-front { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.opening-back {
  display: grid; place-content: center; justify-items: center; gap: 11px; padding: 6px; text-align: center;
  border: 1px solid #83658f; border-radius: 9px; color: #f4d8ae; font: 600 clamp(.67rem,1.2vw,.84rem)/1.25 var(--mono);
  background: linear-gradient(#2315287a,#120d1ce8), url("https://demongacha.site/_a/rift-card.28df7c5c81.webp") center / cover, #21132b;
  box-shadow: inset 0 0 0 4px #1d132a9c;
}
.opening-back:hover, .opening-back:focus-visible { color: #ffe6ba; border-color: #f4ce91; }
.opening-back:focus-visible { outline: 2px solid #ffdc96; outline-offset: -4px; }
.opening-back:active { scale: .985; }
.opening-emblem { display: grid; place-items: center; width: 2.15em; height: 2.15em; color: #f5ce93; border: 1px solid #ac7f5a; border-radius: 5px; background: #291c34e6; font-size: 1.08em; }
.opening-front { transform: rotateY(180deg); }
.result-tile[data-revealed="true"] .opening-rotor { transform: rotateY(180deg); }
.result-tile.flip-instant .opening-rotor { transition: none; }
.result-tile .compact-card { width: 100%; height: 100%; margin: 0; padding: 7px; animation: none; box-shadow: none; }
.compact-card .card-top { gap: 4px; }
.compact-card .card-top, .compact-card .card-power { font-size: clamp(.61rem,1.25vw,.73rem); }
.compact-card .card-name { font-size: clamp(.85rem,1.75vw,1.24rem); line-height: 1.08; overflow-wrap: anywhere; }
.result-tile-meta { display: flex; flex-wrap: wrap; gap: 3px 7px; align-items: center; min-height: 1.45rem; padding: 5px 2px 0; color: var(--muted); font-size: .7rem; }
.best-marker { color: #ffe0a5; font-weight: 700; }
.result-best .compact-card { outline: 2px solid #e7b76b; outline-offset: 1px; }
.result-actions { justify-content: flex-end; padding: 10px clamp(12px,2vw,24px); border-top: 1px solid var(--line); }
.result-actions:has(> :not([hidden])) { background: #170f20; }
.result-actions:not(:has(> :not([hidden]))) { display: none; }
.result-actions p { flex: 1 1 145px; margin: 0; color: var(--muted); font-size: .75rem; }
.result-actions button { min-height: 44px; }
.result-new { color: #ffd990; }
.atlas-card:not(.has-artwork) { background: #100d1b; }
.atlas-card .atlas-art, .mini-card-art .atlas-art { position: absolute; inset: 0; z-index: -2; overflow: hidden; background: radial-gradient(ellipse at 53% 43%,hsl(var(--atlas-hue) 59% 40%),transparent 60%),repeating-linear-gradient(var(--atlas-angle),#b8a8ff15 0 1px,transparent 1px 11px),#100d1b; }
.atlas-art::before { content: ''; position: absolute; width: 81%; aspect-ratio: 1; left: 9.5%; top: 16%; border: 1px solid #ead0fb77; border-radius: 50%; box-shadow: 0 0 0 7px #dac4ff18,0 0 0 15px #d6b3f32c,inset 0 0 24px #8e76e288; }
.atlas-art i, .atlas-art b, .atlas-art .atlas-seal { position: absolute; width: 54%; aspect-ratio: 1; left: 23%; top: 25%; transform: rotate(var(--atlas-angle)); }
.atlas-art i { background: linear-gradient(125deg,#ffe2b1,#f4acff65 38%,#332235 67%,#ffe9ca); clip-path: polygon(50% 0,61% 34%,100% 50%,63% 63%,50% 100%,37% 63%,0 50%,35% 36%); }
.atlas-art b { inset: 27% auto auto 24%; border: 1px solid #ffc890b0; transform: rotate(calc(var(--atlas-angle) + 45deg)) scale(.78); }
.atlas-art[data-pattern="1"] i { clip-path: polygon(0 30%,46% 34%,47% 0,77% 25%,100% 38%,69% 65%,70% 100%,40% 74%,1% 72%,19% 50%); }
.atlas-art[data-pattern="2"] i { clip-path: polygon(50% 0,100% 100%,52% 79%,0 100%); }
.atlas-art[data-pattern="3"] i { clip-path: polygon(50% 0,100% 29%,75% 86%,50% 100%,25% 86%,0 29%); }
.atlas-art .atlas-seal { inset: 31% auto auto 35%; width: 30%; border: 1px solid #ffddab88; border-radius: 50%; box-shadow: 0 0 14px #f1b0fa6b; }
.catalog-page .catalog-tier[data-series="extended"] h2 { border-left: 3px solid #ca94e7; padding-left: 11px; }
.catalog-source { display: inline; margin-left: .4em; font-size: .75em; }
.sound-options { margin-top: 12px; }
.sound-options .secondary { min-height: 40px; padding: 6px 9px; font-size: .76rem; }
.quick-reveal #slot .reveal-card { animation: none; }
.foil-card { border-color: #c4e8f5; outline: 1px solid #e0aed9b0; }
.foil-card .atlas-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(117deg,#5ff6f15e,transparent 28%,#ffd3ac80 48%,#aa9cfa77 58%,transparent 71%); mix-blend-mode: screen; }
.foil-label { display: inline-block; margin-top: 4px; padding: 1px 4px; border: 1px solid #b7dce5; border-radius: 3px; color: #daeff8; background: #243047; font: .61rem var(--mono); }
.foil-filter { display: inline-flex; align-items: center; min-height: 44px; gap: 7px; color: var(--muted); font-size: .83rem; }
.foil-filter input { flex: none; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: #e5b35e; }
.collection-options { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 10px; align-items: center; margin-top: 5px; }
.collection-sort { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.collection-sort select { min-height: 38px; border: 1px solid var(--line); background: #100c19; color: var(--text); border-radius: 5px; padding: 5px 6px; }
.cards-grid { gap: 10px; }
.cards-grid .catalog-card { grid-template-columns: minmax(0,1fr) auto; align-content: start; min-width: 0; }
.cards-grid .catalog-tier { margin: 0; }
.mini-card-art { position: relative; isolation: isolate; display: block; grid-column: 1/-1; aspect-ratio: 2 / 3; overflow: hidden; margin: -3px -5px 3px; border-radius: 4px; background: radial-gradient(ellipse at center,#5d407a,#1a1326 80%); }
.mini-card-art .atlas-art { z-index: 0; }
.card-detail { display: grid; gap: 12px; justify-items: center; }
.card-detail-facts { display: grid; grid-template-columns: minmax(0,1fr) auto; width: min(100%,290px); gap: 5px 10px; margin: 0; text-align: left; color: var(--muted); font-size: .86rem; }
.card-detail-facts dd { margin: 0; color: var(--text); }
.card-source { color: #edc67d; font-size: .85rem; }
.binder-list, .trial-grid { display: grid; gap: 9px; padding: 0; margin: 12px 0 0; list-style: none; }
.binder-list { grid-template-columns: repeat(3,minmax(0,1fr)); }
.binder-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 11px; border-radius: 7px; border: 1px solid #52415f; background: #1b1428; font-size: .8rem; }
.binder-item progress, .binder-details { grid-column: 1/-1; }
.binder-item progress { width: 100%; height: 7px; accent-color: #dcb371; }
.binder-count { color: #f4ce91; font: .73rem var(--mono); }
.binder-complete { border-color: #cf9f62; }
.binder-details { color: var(--muted); }
.binder-details p { margin: 6px 0 0; }
.trial-rule, .trial-theme { color: var(--muted); margin: 7px 0 0; font-size: .84rem; }
.trial-theme { color: #f3d099; }
.trial-profile { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 13px; }
.trial-profile label { display: grid; gap: 4px; color: var(--muted); font-size: .76rem; }
.trial-profile input { color: var(--text); background: #120d1a; border: 1px solid #584468; border-radius: 5px; min-height: 38px; width: min(195px,100%); padding: 6px 9px; }
.trial-profile button { min-height: 38px; }
.trial-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.trial-card { display: grid; align-content: start; gap: 4px; height: 100%; width: 100%; padding: 8px 10px; min-height: 101px; border: 1px solid #4c3b5d; border-top: 2px solid var(--tier); border-radius: 6px; background: #22172c; color: var(--text); text-align: left; }
.trial-card strong { overflow-wrap: anywhere; }
.trial-card[aria-pressed="true"] { border-color: #ffd391; background: #3c283b; }
.trial-card:disabled:not([aria-pressed="true"]) { opacity: .62; }
.trial-rank, .trial-values { color: var(--tier); font: .68rem var(--mono); }
.trial-card small { color: var(--muted); }
.trial-action { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: #1e172a; }
.trial-action div { display: grid; gap: 3px; }
.trial-action span { color: var(--muted); font-size: .77rem; }
.trial-action .primary:disabled { opacity: .55; cursor: default; }
.trial-board { width: 100%; }
.trial-board .trial-self { color: #f8d29a; background: #2c2033; }
.trial-board td:nth-child(2) { overflow-wrap: anywhere; }
.trial-board-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.trial-board-switch button { padding: 6px 12px; min-height: 38px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.trial-board-switch button[aria-pressed="true"] { color: #f8d29a; background: #392842; }
.trial-board-switch button:focus-visible { outline: 2px solid #f8d29a; outline-offset: 1px; }
.trial-board-overview { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.trial-board-overview p, #weekly-total { margin: 7px 0; color: var(--muted); font-size: .8rem; }
#daily-summary[data-ranked] { color: #f8d29a; }
#trial-locked { color: #f2cf98; margin: 7px 0 0; }
@media (min-width: 1120px) {
  .cards-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .result-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .game-panel .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .collection-openings { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .result-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .result-actions p { flex-basis: 100%; }
  .binder-list { grid-template-columns: 1fr; }
  .trial-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .game-nav button { padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .opening-dialog[open] { animation: none; }
  .opening-rotor { transition: none; }
}
.atlas-table-wrap { overflow-x: auto; }
.atlas-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0; }
.atlas-pages output { color: var(--muted); font: .8rem var(--mono); text-align: center; }
.atlas-detail { text-align: left; }
.atlas-detail .atlas-preview { min-height: 180px; width: min(140px,100%); }
.atlas-detail > button { margin-top: 12px; }
.atlas-detail .card-detail-facts { min-width: 0; }
.atlas-illustration { opacity: 0; }
.has-artwork > .atlas-illustration { opacity: 1; }
.has-artwork > .atlas-art { visibility: hidden; }
.atlas-gallery { width: min(1320px, calc(100% - 32px)); margin: 24px auto 60px; }
.atlas-gallery h1 { font: 700 clamp(2rem, 5vw, 3.4rem)/1.08 var(--display); margin: 0 0 10px; }
.atlas-gallery header p { color: var(--muted); margin: 0; }
.atlas-gallery-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 20px 0; }
.atlas-gallery-controls label { display: grid; gap: 6px; font-size: .88rem; }
.atlas-gallery-controls label:has(input) { flex: 1 1 250px; }
.atlas-gallery-controls :is(input, select) { width: 100%; min-height: 44px; }
.atlas-gallery-navigation { display: flex; align-items: center; gap: 8px; }
.atlas-gallery-navigation output { min-width: 9em; text-align: center; color: var(--muted); font-size: .85rem; }
.atlas-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: start; list-style: none; gap: 12px; margin: 0; padding: 0; }
.atlas-gallery-grid .reveal-card { width: 100%; text-decoration: none; color: var(--text); animation: none; }
.atlas-gallery-grid .card-name { font-size: clamp(.92rem, 1.65vw, 1.48rem); overflow-wrap: anywhere; }
.atlas-gallery-grid .card-power { margin-bottom: 0; }
.atlas-gallery-grid .reveal-card:hover, .atlas-gallery-grid .reveal-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 540px) {
  .atlas-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .atlas-gallery-navigation { width: 100%; justify-content: space-between; }
}


.card-detail-page { max-width: 1040px; margin: 0 auto; padding: clamp(13px,3vw,34px) 0 44px; }
.detail-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: .86rem; }
.detail-breadcrumb a, .detail-links a, .card-row-link { color: #f1c781; text-underline-offset: 3px; }
.card-row-link { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; }
.card-row-link img { display: block; flex: 0 0 auto; width: 26px; height: 39px; object-fit: contain; border-radius: 3px; }
.card-row-link span { overflow-wrap: anywhere; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 352px) minmax(0, 1fr); gap: clamp(22px,4vw,58px); align-items: start; }
.detail-portrait { margin: 0; overflow: hidden; border-radius: 14px; border: 1px solid var(--tier); background: #1b1326; box-shadow: 0 20px 39px #03020569; }
.detail-portrait img { display: block; width: 100%; height: auto; aspect-ratio: 2/3; object-fit: contain; }
.detail-portrait figcaption { padding: 9px 13px; color: var(--muted); font-size: .75rem; }
.detail-content { min-width: 0; }
.detail-series { margin: 0 0 6px; color: var(--tier); font: 600 .78rem var(--mono); }
.detail-intro h1 { margin: 0; font: 800 clamp(2.35rem,5vw,4rem)/1 var(--display); overflow-wrap: anywhere; }
.detail-identity { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; font: .8rem var(--mono); }
.detail-identity span { padding: 4px 8px; border-radius: 5px; border: 1px solid #64485f; color: #e8d9ec; }
.detail-identity span:first-child { color: var(--tier); }
.detail-description, .detail-explanation { color: var(--muted); line-height: 1.58; }
.detail-description { margin: 0 0 18px; }
.detail-section { padding: 17px 0 19px; border-top: 1px solid var(--line); }
.detail-section h2 { margin: 0 0 11px; font-size: 1.26rem; }
.detail-probabilities, .detail-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; }
.detail-probabilities div { background: #1c1429; border: 1px solid #4f3c5c; border-radius: 8px; padding: 10px; }
.detail-probabilities dt, .detail-facts dt { color: var(--muted); line-height: 1.35; font-size: .79rem; }
.detail-probabilities dd, .detail-facts dd { margin: 4px 0 0; color: #f3e4f6; font: 600 .98rem var(--mono); overflow-wrap: anywhere; }
.detail-explanation { margin: 10px 0 0; font-size: .8rem; }
.detail-facts { row-gap: 12px; }
.detail-tags, .detail-links { display: flex; flex-wrap: wrap; gap: 7px 10px; }
.detail-tags { padding: 0; margin: 12px 0; list-style: none; }
.detail-tags li { font-size: .78rem; color: #dac9e8; border-radius: 4px; background: #282036; padding: 3px 6px; }
.detail-links { margin-top: 9px; }
.detail-links a { min-height: 28px; }
.detail-play { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 14px; text-decoration: none; }
.detail-neighbors { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 27px; }
.detail-neighbors a { display: grid; flex: 1 1 220px; padding: 10px 13px; min-height: 53px; border: 1px solid var(--line); border-radius: 7px; background: #1a1325; text-decoration: none; color: var(--text); }
.detail-neighbors a:hover { border-color: var(--tier); }
.detail-neighbors span { font-size: .75rem; color: var(--muted); }
.card-name a { color: inherit; text-decoration-color: transparent; text-underline-offset: 2px; }
.card-name a:hover, .card-name a:focus-visible { text-decoration-color: currentColor; }
.card-detail .card-detail-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; }
.reveal .card-detail-link { display: inline-block; margin-top: 6px; color: #f1c781; min-height: 28px; }
@media (max-width: 690px) {
  .detail-layout { grid-template-columns: 1fr; gap: 20px; }
  .detail-portrait { width: min(100%,320px); }
}

.standings-page { padding-block: clamp(12px, 3vw, 32px) 48px; }
.hnav a[data-standings-link][aria-current="page"] { color: var(--gold); }
.standings-hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  align-items: end; gap: clamp(18px,4vw,58px); padding: clamp(19px,4vw,50px);
  border: 1px solid #513361; border-radius: 12px;
  background: #191123;
}
.standings-hero::before {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(90deg,#181021 12%,#19112344 68%,#191123bb),
    url("https://demongacha.site/_a/rift-cover.4637009799.webp") 64% 43% / cover;
}
.standings-intro { min-width: 0; }
.standings-intro h1 { margin: 0; max-width: 12ch; color: #fbf0e2; font: 900 clamp(3rem,7vw,6rem)/.9 var(--display); overflow-wrap: anywhere; }
.standings-intro p { max-width: 36ch; margin: 14px 0 17px; color: #f0ddec; font-size: .9rem; line-height: 1.5; }
.standings-play { display: inline-flex; align-items: center; gap: 8px; color: var(--gold); text-decoration: none; background: #2b1e34; }
.standings-personal { min-width: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; background: #160f22eb; border: 1px solid #6a4b77; border-radius: 8px; }
.standings-personal div { padding: clamp(9px,1.7vw,20px); min-width: 0; }
.standings-personal div + div { border-inline-start: 1px solid #50395d; }
.standings-personal dt { color: #d8c2e5; font-size: .71rem; overflow-wrap: anywhere; }
.standings-personal dd { margin: 6px 0 0; color: var(--text); font: 700 clamp(1.22rem,3vw,2.05rem)/1.08 var(--display); overflow-wrap: anywhere; }
.standings-personal .standings-personal-rank dd { color: var(--gold); }
.standings-personal progress { width: 100%; height: 4px; margin: 8px 0 0; }
.standings-toolbar { display: flex; align-items: start; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; margin: 19px 0 10px; }
.standings-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #1b1429; }
.standings-tabs button { min-height: 38px; padding: 6px 14px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 700; }
.standings-tabs button[aria-pressed="true"] { color: var(--gold); border-color: #8d6353; background: #35263a; }
.standings-tabs button:hover { color: var(--gold); }
.standings-rules { max-width: min(54ch,100%); }
.standings-rules summary { width: fit-content; margin-inline-start: auto; cursor: pointer; color: #e2b5ef; padding: 12px 0; }
.standings-rules div { margin-bottom: 3px; padding: 0 12px 1px; border-left: 1px solid #6a4b77; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.standings-rules p { margin: 0 0 7px; }
.standings-content { border-top: 1px solid var(--line); }
.standings-board-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 20px; min-height: 63px; padding: 8px 0; }
.standings-board-head p, .standings-status { margin: 0; color: var(--muted); font-size: .82rem; }
.standings-actions { display: flex; flex-wrap: wrap; gap: 7px 14px; align-items: center; }
.standings-form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; padding: 12px; margin-bottom: 11px; border: 1px solid var(--line); border-radius: 8px; background: #1b1429; }
.standings-form label { font-size: .8rem; }
.standings-form input { display: block; margin-top: 4px; max-width: 100%; }
.standings-form p { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.standings-status:not(:empty) { padding: 9px 0; }
.standings-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #171023; }
.standings-table :is(td,th) { padding: 12px clamp(7px,2vw,20px); border-bottom: 1px solid #3d2c4a; overflow-wrap: anywhere; }
.standings-table thead th { background: #21172e; color: #dcc7e8; font-size: .75rem; text-align: left; }
.standings-table :is(td,th):first-child { width: 12%; }
.standings-table :is(td,th):nth-child(n+3) { width: 22%; text-align: right; }
.standings-table tbody tr:last-child td { border-bottom: 0; }
.standings-table tbody td { color: var(--text); font-size: .85rem; }
.standings-table tbody td:nth-child(n+3) { font-family: var(--mono); }
.standings-table tbody tr[data-podium] td:first-child { box-shadow: inset 3px 0 var(--standing-accent); }
.standings-table tbody tr[data-podium="1"] {
  --standing-accent: #ffd33e;
  --rank-metal-light: #fff4b3; --rank-metal-dark: #a65c06;
  --rank-fill: linear-gradient(153deg,#fff0a1 4%,#ffd443 55%,#ca8508 100%);
  --rank-number: #281902;
  --rank-number-shadow: 0 1px 0 #fff2a9;
  --rank-outline: polygon(0 9%, 26% 16%, 50% 0, 74% 16%, 100% 9%, 89% 71%, 50% 100%, 11% 71%);
  background: #3a2e20;
}
.standings-table tbody tr[data-podium="2"] {
  --standing-accent: #c8c2ed;
  --rank-metal-light: #f5edff; --rank-metal-dark: #686684; --rank-face: #48446b;
  background: #292239;
}
.standings-table tbody tr[data-podium="3"] {
  --standing-accent: #ff8a60;
  --rank-metal-light: #ffb899; --rank-metal-dark: #85321f;
  --rank-fill: linear-gradient(153deg,#bc5436 4%,#8d3729 60%,#58221d 100%);
  --rank-number: #fff1e9;
  background: #382125;
}
.standings-rank { display: inline-grid; place-items: center; min-width: 2em; min-height: 2em; color: var(--standing-accent, #d2badf); font: .76rem var(--mono); }
[data-podium] .standings-rank {
  --rank-sigil: var(--rank-outline, polygon(50% 0, 85% 13%, 100% 43%, 92% 77%, 50% 100%, 8% 77%, 0 43%, 15% 13%));
  position: relative; isolation: isolate; vertical-align: middle;
  width: 42px; height: 46px; min-width: 0; min-height: 0;
  color: var(--rank-number,var(--rank-metal-light)); font: 800 1.55rem/1 var(--display);
  text-shadow: var(--rank-number-shadow,0 2px 2px #110b12);
  filter: drop-shadow(0 2px 3px #100914) drop-shadow(0 0 3px color-mix(in srgb,var(--standing-accent) 34%,transparent));
}
[data-podium] .standings-rank::before,
[data-podium] .standings-rank::after {
  content: ''; position: absolute; clip-path: var(--rank-sigil);
}
[data-podium] .standings-rank::before {
  inset: 0; z-index: -2;
  background: conic-gradient(from -27deg, var(--rank-metal-light), var(--standing-accent) 16%,
    var(--rank-metal-dark) 33%, var(--standing-accent) 48%, var(--rank-metal-dark) 65%,
    var(--rank-metal-light) 87%, var(--rank-metal-light));
}
[data-podium] .standings-rank::after {
  inset: 2px; z-index: -1;
  background: var(--rank-fill, linear-gradient(137deg,#fff3 0%,transparent 41%),
    radial-gradient(ellipse at 48% 10%,var(--rank-face),#211527 82%));
}
.standings-table .standings-self td { color: #ffe0a7; background-color: #422b4a; }
.standings-you { display: inline-block; margin-inline-start: .4em; color: #ffe0a7; font-size: .69rem; font-weight: 600; }
@media (max-width: 760px) {
  .standings-hero { grid-template-columns: 1fr; }
  .standings-hero::before { background-position: 69% center; }
}
@media (max-width: 450px) {
  .standings-table :is(td,th):first-child { width: max(46px,15%); padding-inline: 6px; }
  .standings-table :is(td,th):nth-child(n+3) { width: 20%; }
  [data-podium] .standings-rank { width: 32px; height: 35px; font-size: 1.13rem; }
}

.rift-arcade {
  --arcade-accent: #ffd075;
  --arcade-tint: #603b25;
  max-width: 940px;
  margin: 32px auto 72px;
}
.rift-arcade[data-mode="match"] { --arcade-accent: #e1bbff; --arcade-tint: #543871; }
.arcade-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.arcade-header h1 { font: 700 clamp(2.9rem, 7vw, 5.75rem)/.94 var(--display); margin: 0; letter-spacing: -.015em; }
.arcade-header p, .arcade-brief p { color: var(--muted, #c3afd2); margin: 10px 0 0; }
.arcade-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.arcade-modes button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 12px 16px;
  background: #1b1424;
  border: 1px solid #574065;
  border-radius: 10px;
  color: #f8edf9;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.arcade-modes button[aria-pressed="true"] { border-color: var(--arcade-accent); background: linear-gradient(105deg, var(--arcade-tint), #1b1424 68%); }
.arcade-modes strong { display: block; font-size: 1.12rem; }
.arcade-modes small { display: block; color: #dbcae8; margin-top: 3px; }
.arcade-mode-symbol { color: #ffd075; font: 1.55rem/1 var(--mono); }
[data-arcade-mode="match"] .arcade-mode-symbol { color: #e1bbff; }
.arcade-arena {
  padding: clamp(14px, 3vw, 30px);
  border: 1px solid #574065;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 0, var(--arcade-tint), #1a1423 58%);
}
.arcade-brief { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.arcade-brief h2 { font: 700 clamp(1.55rem, 4vw, 2.2rem)/1.08 var(--display); margin: 6px 0 0; }
.arcade-brief .arcade-date { margin: 0; color: var(--arcade-accent); font: .76rem var(--mono); }
.arcade-steps { display: flex; list-style: none; justify-content: center; gap: 12px; padding: 8px; margin: 8px 0 14px; }
.arcade-steps li { width: 10px; height: 10px; transform: rotate(45deg); border: 1px solid #b59bb9; }
.arcade-steps [data-current] { outline: 1px solid var(--arcade-accent); outline-offset: 3px; }
.arcade-steps [data-outcome="right"] { background: #93deb5; border-color: #93deb5; }
.arcade-steps [data-outcome="wrong"] { background: #ff9c9f; border-color: #ff9c9f; }
.arcade-choices, .arcade-tiles { display: grid; gap: 12px; margin-inline: auto; }
.arcade-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 650px; }
.arcade-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 680px; }
.arcade-card, .arcade-tile {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  min-width: 0;
  border: 1px solid #89679c;
  border-radius: 9px;
  background: #24192f;
  color: #fff6ff;
  padding: 0;
  cursor: pointer;
}
.arcade-card:not([disabled]):hover, .arcade-tile[aria-disabled="false"]:hover { border-color: var(--arcade-accent); }
.arcade-card:disabled { cursor: default; }
.arcade-card[data-outcome="right"] { outline: 2px solid #93deb5; outline-offset: -3px; }
.arcade-card[data-outcome="wrong"] { outline: 2px solid #ff9c9f; outline-offset: -3px; }
.arcade-face, .arcade-tile-back { position: absolute; inset: 0; }
.arcade-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arcade-card-name {
  position: absolute;
  inset: auto 0 0;
  min-height: 38%;
  padding: 34px 10px 9px;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: end;
  overflow-wrap: anywhere;
  background: linear-gradient(0deg, #100b17 0%, #100b17ed 45%, transparent 100%);
  font: 700 clamp(.9rem, 2.3vw, 1.45rem)/1.08 var(--display);
  text-align: left;
}
.arcade-card-rank { margin-top: 4px; color: var(--arcade-accent); font: .75em var(--mono); }
.arcade-tile { perspective: 650px; }
.arcade-tile-back {
  display: grid;
  place-items: center;
  color: var(--arcade-accent);
  font: clamp(1.5rem, 5vw, 3rem) var(--display);
  background: repeating-linear-gradient(135deg, #2d1e3a 0 9px, #241832 9px 17px);
}
.arcade-tile-back, .arcade-tile .arcade-face { backface-visibility: hidden; transition: transform .32s ease; }
.arcade-tile[data-state="closed"] .arcade-face { transform: rotateY(180deg); }
.arcade-tile:not([data-state="closed"]) .arcade-tile-back { transform: rotateY(-180deg); }
.arcade-tile[data-state="matched"] { border-color: #dcb2ff; box-shadow: inset 0 0 0 1px #dcb2ff; }
.arcade-tile[data-state="matched"] .arcade-face::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(123deg, transparent 34%, #ecceff54 50%, #8cf3ea4d 57%, transparent 68%);
}
.arcade-tile[aria-disabled="true"] { cursor: default; }
.arcade-feedback { margin: 14px 0; color: #f1e2f4; text-align: center; font-size: .92rem; }
#arcade-next { display: block; margin: 0 auto; }
.arcade-invite { margin-top: 18px; }
.arcade-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
  background: #211727;
  border: 1px solid #6a4d73;
  border-radius: 8px;
}
.arcade-result p { margin: 0 auto 0 0; font-weight: 700; color: var(--arcade-accent); }
.rift-arcade :is(button, a):focus-visible, .rift-share-dialog :is(button, a, input):focus-visible {
  outline: 2px solid #ffdc99;
  outline-offset: 3px;
}
.rift-share-dialog { width: min(480px, calc(100% - 24px)); }
.rift-share-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rift-share-heading h2 { margin: 0; }
.rift-share-heading button { min-width: 44px; min-height: 44px; }
.rift-share-text { overflow-wrap: anywhere; }
.rift-share-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin: 14px 0; }
.rift-share-targets a { text-align: center; }
.rift-share-controls { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rift-share-status { min-height: 1.3em; margin: 7px 0 0; color: #dab6ed; }
@media (max-width: 560px) {
  .rift-arcade { margin-top: 20px; }
  .arcade-modes button { gap: 8px; padding: 10px; }
  .arcade-modes strong { font-size: .95rem; }
  .arcade-choices, .arcade-tiles { gap: 7px; }
  .arcade-tile .arcade-card-name { font-size: .7rem; padding: 18px 4px 4px; }
  .arcade-result p { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .arcade-tile-back, .arcade-tile .arcade-face { transition: none; }
}
