:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #f8f0e2;
  background: #181428;
  --paper: #f8f0e2;
  --muted: #c6b9d6;
  --line: #443755;
  --surface: #241d36;
  --gold: #f8cf82;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse 490px 420px at 50% 105px, #392849, transparent 84%), #181428;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:is(button, a, input, select):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { max-width: 1020px; margin: auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 17px 19px; }
.brand { text-decoration: none; font-weight: 760; letter-spacing: .06em; font-size: .93rem; }
.brand span { color: var(--gold); margin-right: 6px; }
.edition { font-size: .72rem; color: var(--gold); border: 1px solid #6e584d; padding: 4px 8px; border-radius: 5px; }
main { max-width: 481px; padding: 0 16px; margin: auto; }
.kicker { color: var(--gold); letter-spacing: .16em; font-size: .72rem; font-weight: 700; margin: 0 0 8px; }
h1 { font-size: clamp(1.9rem, 8vw, 2.7rem); margin: 0; line-height: 1.12; letter-spacing: .05em; }
h2 { font-size: .96rem; margin: 0 0 12px; }
.room-heading > p:not(.kicker) { color: var(--muted); font-size: .88rem; margin: 11px 0 0; }
.jett { --accent: #a5edff; --accent-soft: #4c8393; --tint: #2b6478; --deep: #162b45; }
.reyna { --accent: #f5a4f5; --accent-soft: #945d97; --tint: #643768; --deep: #351c48; }
.yang { --accent: #ffe09a; --accent-soft: #908b50; --tint: #3e725f; --deep: #162d2a; }
.viper { --accent: #b0f657; --accent-soft: #639849; --tint: #376936; --deep: #162e23; }
.naiwa { --accent: #ffe478; --accent-soft: #9d873a; --tint: #67592b; --deep: #34301d; }
.entry-view { padding-top: 14px; display: grid; gap: 16px; }
.chooser { min-width: 0; }
.agent-strip { display: flex; overflow-x: auto; gap: 8px; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #765f82 transparent; padding: 4px 3px 8px; margin-bottom: 2px; }
.agent-tile { flex: 0 0 66px; display: grid; place-items: center; gap: 4px; min-height: 72px; border-radius: 10px; padding: 4px 5px; border: 1px solid var(--line); background: #241d35; color: var(--muted); font-size: .7rem; font-weight: 700; }
.agent-tile img { width: 44px; height: 44px; object-fit: contain; background: radial-gradient(var(--tint), var(--deep)); border-radius: 6px; }
.agent-tile[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--deep); }
.character-stage { position: relative; }
.figure { height: clamp(254px, 77vw, 337px); overflow: hidden; position: relative; display: grid; align-content: end; justify-items: center; border-radius: 16px; isolation: isolate; border: 1px solid var(--accent-soft); background: radial-gradient(ellipse at 50% 39%, var(--tint), var(--deep) 66%, #20172c); }
.stage-orbit { position: absolute; z-index: -1; top: 12%; height: 64%; aspect-ratio: 1; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 37%, transparent); box-shadow: 0 0 0 12px #fff1, 0 0 0 32px #fff1, inset 0 0 56px #fff1; }
.stage-floor { position: absolute; z-index: -1; top: 70%; width: 62%; height: 13%; border-radius: 50%; background: radial-gradient(ellipse, #1c1326 5%, transparent 70%), radial-gradient(ellipse, color-mix(in srgb, var(--accent) 27%, transparent), transparent 73%); }
.stage-figure { position: absolute; inset: 5% 8% 20%; display: grid; place-items: center; }
.selection-motion { position: relative; width: auto; height: 100%; max-width: 100%; aspect-ratio: 1; }
.motion-figure, .selection-motion picture, .selection-motion picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.motion-figure, .selection-motion picture img { filter: drop-shadow(0 9px 16px #110b24a8); }
.figure.jett .selection-motion.playing { animation: jett-drift 4.6s ease-in-out infinite; transform-origin: center 92%; }
.selection-dart { position: absolute; width: 9%; height: 21%; object-fit: contain; transform: rotate(var(--tilt)); filter: drop-shadow(0 0 8px #cbf7ffae); }
.dart-1 { left: 12%; top: 22%; --tilt: -19deg; --bob: -9px; --shift: -4px; animation-delay: -.25s; }
.dart-2 { left: 21%; top: 13%; --tilt: 7deg; --bob: -13px; --shift: 2px; animation-delay: -.75s; }
.dart-3 { left: 30%; top: 23%; --tilt: 28deg; --bob: -10px; --shift: 5px; animation-delay: -1.25s; }
.selection-motion.playing .selection-dart { animation-name: knife-hover; animation-duration: 2.6s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.preview-soul { position: absolute; z-index: 1; top: 18.5%; left: 68%; width: 21%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #ffd8ff43 2%, #d469ff5c 39%, #6f28dc42 59%, transparent 73%); mix-blend-mode: screen; pointer-events: none; }
.playing .preview-soul { animation: soul-glow 3.1s ease-in-out infinite; }
.figure.reyna .selection-motion.playing { animation: reyna-breathe 3.8s ease-in-out infinite; transform-origin: center bottom; }
.figure-title { text-align: center; padding-bottom: 10px; display: grid; gap: 2px; z-index: 1; }
.figure-title strong { font-size: 1.48rem; letter-spacing: .09em; line-height: 1.03; }
.figure-title span { font-size: .63rem; color: var(--accent); font-weight: 800; letter-spacing: .23em; }
.browse-agent { position: absolute; z-index: 2; top: 48%; transform: translateY(-50%); border: 1px solid #897598; border-radius: 50%; background: #211927e0; color: #fff0d6; width: 43px; height: 43px; font-size: 2.12rem; display: grid; place-content: center; line-height: 1; padding: 0 0 5px; }
.browse-agent.prev { left: 9px; }.browse-agent.next { right: 9px; }
.skill-panel { min-height: 59px; margin: 9px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #21192f; }
.skill-panel h2 { margin: 0; font-size: .78rem; color: var(--muted); }
.skill-panel p { margin: 7px 0 0; font-size: .78rem; line-height: 1.5; }
.skill-panel p strong { color: var(--gold); margin-right: .25em; }
.skill-panel .skill-hint { color: var(--accent); }
.setup { min-width: 0; }
.setup h1 { font-size: clamp(1.5rem, 6vw, 2.45rem); letter-spacing: .03em; }
.setup .kicker { margin-bottom: 5px; }
.primary [data-role-label] { display: contents; }
.chooser-compact { margin-bottom: 12px; }
.chooser-compact .figure { height: min(320px, 70vw); }
@keyframes knife-hover {
  0%, 100% { transform: translate(0, 2px) rotate(var(--tilt)); }
  50% { transform: translate(var(--shift), var(--bob)) rotate(calc(var(--tilt) + 10deg)); }
}
@keyframes jett-drift { 0%, 100% { transform: translateY(0) rotate(-.7deg); } 50% { transform: translateY(-5px) rotate(.65deg); } }
@keyframes soul-glow { 0%, 100% { opacity: .28; transform: scale(.8); } 54% { opacity: .92; transform: scale(1.38); } }
@keyframes reyna-breathe { 0%, 100% { transform: rotate(-.7deg); } 54% { transform: scale(1.018, 1.026) rotate(.9deg); } }
.form-row { display: flex; gap: 9px; margin: 15px 0 12px; }
.form-row label { flex: 1; font-size: .81rem; font-weight: 650; }
.form-row label span { color: var(--muted); font-size: .72rem; }
.form-row .capacity { flex: 0 0 108px; }
.form-row label input { min-width: 0; }
input, select { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; color: var(--paper); background: #1b152c; padding: 9px 10px; min-height: 42px; font-size: 16px; }
.form-row :is(input, select) { margin-top: 5px; }
input::placeholder { color: #a999bc; font-size: .86rem; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; border-radius: 9px; min-height: 43px; padding: 8px 13px; font-weight: 730; font-size: .87rem; text-decoration: none; }
.primary { background: linear-gradient(#ffdf9b, #eebc6a); border: 1px solid #fbd289; color: #261827; box-shadow: 0 4px 15px #130d1e55; }
.secondary { background: #2a203c; border: 1px solid #574565; color: var(--paper); }
.wide { width: 100%; }
.join-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; margin-top: 10px; }
.text-link { background: transparent; border: 0; margin: 3px auto 0; display: flex; width: fit-content; color: var(--muted); }
footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 10px; padding: 23px 12px; margin: auto; max-width: 481px; color: #b4a5c4; font-size: .66rem; }
footer a { text-underline-offset: 3px; }
.room-heading, .loading { text-align: center; padding: 32px 0 23px; }
.room-heading .secondary { margin-top: 15px; }
.room-heading h1 { letter-spacing: .11em; }
.panel, .player-row { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px; }
.lobby { padding: 16px; }
.lobby-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 7px; }
.lobby-list li { min-height: 64px; display: flex; gap: 9px; padding: 5px 9px; align-items: center; border: 1px solid var(--line); border-radius: 9px; }
.lobby-list .empty-seat { border-style: dashed; color: var(--muted); }
.empty-seat span { width: 53px; text-align: center; color: var(--gold); }
.lobby-list li strong, .player-meta strong { display: block; overflow-wrap: anywhere; font-size: .93rem; }
.lobby-list small, .player-meta small, .player-hp small { color: var(--muted); font-size: .7rem; }
.pill { margin-left: auto; color: var(--gold); font-size: .68rem; background: #453246; padding: 4px 7px; border-radius: 6px; }
.lobby .wide + .wide { margin-top: 8px; }
.waiting { text-align: center; color: var(--muted); }
.game-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 17px 0 10px; }
.game-head h1 { font-size: 1.54rem; }
.game-head .kicker { margin-bottom: 4px; }
.deck-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; gap: 5px; }
.deck-heading h2 { margin: 0; }
.deck-heading > span { color: var(--muted); font-size: .68rem; }
.spell-reference { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.spell-reference > div { text-align: center; }
.spell-reference > div > span { font-size: .63rem; color: var(--muted); }
.spell-card { width: 47px; flex: 0 0 47px; height: 51px; display: inline-grid; align-content: center; gap: 0; border-radius: 6px; border: 1px solid #ffffff30; text-align: center; background: var(--card, #6d5364); color: #171323; padding: 2px; }
.spell-card span { font-size: 1.15rem; line-height: 1.18; }
.ability-icon { display: block; width: 25px; height: 25px; object-fit: contain; }
.spell-card .ability-icon { justify-self: center; margin-bottom: 3px; }
.spell-card small { font-size: .55rem; font-weight: 750; line-height: 1.08; }
.spell-reference .spell-card { width: 100%; height: 43px; }
.spell-reference .spell-card span { font-size: .95rem; }
.spell-reference .spell-card small { font-size: .48rem; }
.spell-0 { --card: #f5cd7d; }.spell-1 { --card: #c6a6ef; }.spell-2 { --card: #f6abc0; }.spell-3 { --card: #f1d2a4; }
.spell-4 { --card: #aab9f2; }.spell-5 { --card: #a5ddeb; }.spell-6 { --card: #f7aa95; }.spell-7 { --card: #a8dec1; }
.spell-8 { --card: #266379; color: #ecfbff; }
.spell-9 { --card: #f5d0a1; }
.spell-10 { --card: #3b6131; color: #f1ffe8; }
.card-back { place-content: center; font-size: 1.2rem; border: 1px solid #786347; color: #dab788; background: radial-gradient(#725336, #3a2d36); }
.effect-message { min-height: 30px; display: grid; place-items: center; color: var(--gold); font-size: .79rem; text-align: center; }
.seats { display: grid; gap: 7px; }
.player-row { padding: 7px 8px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px; align-items: center; }
.player-row.active { border-color: #cda265; background: #30253f; }
.player-top { display: grid; grid-template-columns: 43px minmax(0,1fr); column-gap: 6px; align-items: center; min-width: 0; }
.player-top .portrait { grid-row: span 2; width: 43px; height: 43px; }
.portrait { display: inline-grid; place-items: center; width: 53px; height: 53px; flex: 0 0 53px; position: relative; z-index: 1; border-radius: 9px; border: 1px solid var(--accent-soft); background: radial-gradient(var(--tint), var(--deep)); }
.portrait img { border-radius: inherit; width: 100%; height: 100%; object-fit: cover; }
.special-count { position: absolute; top: -5px; right: -6px; border: 1px solid var(--accent-soft); border-radius: 8px; padding: 2px 4px; background: var(--deep); color: var(--accent); font-size: .61rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.player-meta { min-width: 64px; max-width: 110px; }
.player-meta strong { font-size: .76rem; line-height: 1.2; }
.player-meta small { font-size: .58rem; }
.player-hp { align-self: start; white-space: nowrap; line-height: 1; }
.player-hp small { font-size: .58rem; }
.hearts { color: #756786; font-size: .58rem; white-space: nowrap; }
.hearts .full { color: #ff859b; }
.hand { display: flex; gap: 3px; align-items: center; min-width: 0; overflow-x: auto; min-height: 51px; scrollbar-width: thin; }
.player-row .spell-card { width: clamp(29px, 9.8vw, 46px); flex-basis: clamp(29px, 9.8vw, 46px); height: 48px; }
.hand > small { color: var(--muted); font-size: .6rem; }
.secret-label { flex: 0 0 auto; padding-left: 2px; }
.defeated img { filter: grayscale(.85) brightness(.75); }
.placement { grid-column: 1 / -1; margin-top: -2px; padding-left: 4px; color: var(--gold); font-size: .7rem; }
.poison-mark { color: #bef28a; white-space: nowrap; }
.practice-hand { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 0 4px; color: var(--muted); font-size: .75rem; }
.practice-hand .secondary { min-height: 38px; padding: 4px 12px; font-size: .78rem; }
.actions, .my-secret { margin-top: 10px; }
.turn-title { font-weight: 750; text-align: center; margin-bottom: 7px; font-size: .94rem; }
.cast-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-bottom: 7px; }
.summon { display: inline-flex; align-items: center; gap: .35em; font-size: .79rem; text-align: left; color: var(--paper); border: 1px solid #5e4a6a; border-radius: 7px; min-height: 36px; background: #372947; padding: 5px 8px; }
.summon .ability-icon { width: 19px; height: 19px; }
#notice { position: fixed; z-index: 5; bottom: 16px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 10px 13px; border: 1px solid #866f5c; border-radius: 9px; background: #24192e; color: #ffdd9b; font-size: .83rem; text-align: center; }
dialog { border: 1px solid var(--line); border-radius: 15px; padding: 15px; max-width: min(88vw, 390px); background: var(--surface); color: var(--paper); }
dialog::backdrop { background: #100c19ba; }
dialog .secondary { float: right; min-height: 33px; }
.restart-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.restart-heading h2 { margin: 0; }
.spell-targets { display: grid; gap: 6px; }
.spell-targets .secondary { float: none; }
.spell-dialog-title { display: flex; align-items: center; gap: 7px; }
.detail-icon .ability-icon { width: 40px; height: 40px; margin-bottom: 7px; }
dialog p { color: var(--muted); line-height: 1.6; }
.detail-icon { font-size: 2rem; }
.portrait.hurt { animation: hit-jolt 370ms ease-out both; box-shadow: 0 0 15px #ff466d; }
.portrait.heal { animation: heal-pulse 510ms ease-out both; box-shadow: 0 0 15px #44f2ae; }
.portrait.jett.hurt img { filter: saturate(.72) brightness(1.22); }
.portrait.reyna.heal { animation-name: heal-soul; }
.portrait.yang-attack { z-index: 3; animation: coffee-cheer 540ms ease-out both; }
.portrait.yang-hit { z-index: 3; animation: coffee-spill 620ms ease-out both; }
.portrait.yang-coffee { z-index: 3; animation: coffee-offer 560ms ease-out both; }
.portrait.frog-shift::after { content: ""; position: absolute; inset: -5px; border-radius: inherit; border: 2px solid #ffe478; animation: burst-gold .75s ease-out both; pointer-events: none; }
.laugh-scene { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; background: #131121c9; }
.laugh-card { display: grid; place-items: center; width: min(100%, 370px); min-height: min(61vh, 380px); padding: 10px 12px 22px; border: 2px solid #e3bd5d; border-radius: 25px; background: radial-gradient(circle at 50% 35%, #7b632e, #30251dec 66%, #241928); box-shadow: 0 8px 92px #e6ad4277; animation: laugh-card-enter .35s ease-out both; }
.laugh-card picture, .laugh-card img { width: min(100%, 270px); height: min(49vh, 265px); object-fit: contain; }
.laugh-card p { margin: 6px 0 0; text-align: center; font-weight: 900; letter-spacing: .1em; font-size: clamp(24px, 8vw, 37px); color: #fff2b4; text-shadow: 0 3px 0 #5f3923; }
@keyframes burst-gold { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.55); opacity: 0; } }
@keyframes laugh-card-enter { from { transform: translateY(10px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.battle-line { position: absolute; z-index: 4; top: -10px; left: calc(100% - 3px); white-space: nowrap; padding: 3px 7px; border-radius: 8px 8px 8px 2px; border: 1px solid #664841; font-size: .8rem; font-weight: 800; color: #38231b; background: #ffe6a9; transform-origin: left bottom; animation: speech-pop 1.48s ease-out both; pointer-events: none; }
.yang-hit .battle-line { border-color: #78385f; color: #5b183a; background: #ffbedd; }
.yang-coffee .battle-line { border-color: #408269; color: #173d2e; background: #c9ffda; }
.portrait .impact { position: absolute; z-index: 2; top: 0; right: -7px; color: white; font-size: 1rem; font-weight: 900; border: 1px solid currentColor; border-radius: 8px; padding: 1px 4px; text-shadow: 0 1px #111; animation: float-impact 790ms ease-out both; pointer-events: none; }
.jett .impact, .yang .impact, .viper .impact { top: 8px; }
.hurt .impact, .yang-hit .impact { background: #a41140; }
.heal .impact, .yang-attack .impact, .yang-coffee .impact { background: #097b56; }
@keyframes hit-jolt { 0%, 100% { transform: translateX(0); box-shadow: none; } 20% { transform: translateX(-5px) rotate(-7deg); filter: brightness(1.5) saturate(1.6); box-shadow: 0 0 16px #ff466d; } 50% { transform: translateX(4px) rotate(4deg); } }
@keyframes heal-pulse { 0%, 100% { transform: scale(1); box-shadow: none; } 36% { transform: scale(1.12); box-shadow: 0 0 20px #5effbc; filter: brightness(1.28); } }
@keyframes heal-soul { 0%, 100% { transform: scale(1); box-shadow: none; } 42% { transform: scale(1.12); box-shadow: 0 0 13px #64facc, 0 0 25px #df7dff; filter: brightness(1.28); } }
@keyframes coffee-cheer { 0%, 100% { transform: none; } 27% { transform: translate(3px, -6px) rotate(10deg) scale(1.13); box-shadow: 0 0 16px #ffd377; } 57% { transform: translateY(2px) rotate(-5deg); } }
@keyframes coffee-spill { 0%, 100% { transform: none; } 25% { transform: translate(-4px, 4px) rotate(-16deg) scale(.89); filter: brightness(1.4); } 52% { transform: translate(2px, -3px) rotate(8deg); } 77% { transform: rotate(-4deg); } }
@keyframes coffee-offer { 0%, 100% { transform: none; box-shadow: none; } 30% { transform: translateX(6px) scale(1.12) rotate(7deg); box-shadow: 0 0 17px #99ffd2; } 60% { transform: translateX(2px) rotate(-3deg); } }
@keyframes speech-pop { 0% { opacity: 0; transform: scale(.45) rotate(-8deg); } 13% { opacity: 1; transform: scale(1.13) rotate(2deg); } 25%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-7px); } }
@keyframes float-impact { from { transform: translateY(3px); } 68% { opacity: 1; } to { transform: translateY(-18px); opacity: 0; } }
@media (min-width: 760px) {
  main.entry-page { max-width: 994px; }
  .entry-view { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; padding-top: 28px; align-items: center; }
  .entry-view .figure { height: clamp(350px, 42vw, 462px); }
  .entry-view .skill-panel { min-height: 87px; margin-top: 13px; }
  .entry-view .setup { padding: 25px 21px; border: 1px solid var(--line); border-radius: 15px; background: #241d36bf; }
  .figure-title { padding-bottom: 14px; }
  .figure-title strong { font-size: 1.85rem; }
  .browse-agent.prev { left: 17px; }.browse-agent.next { right: 17px; }
  main.game-page { max-width: 720px; }
  .player-row { grid-template-columns: 155px minmax(0, 1fr); gap: 14px; padding: 9px 13px; }
  .player-top { grid-template-columns: 53px minmax(0,1fr); gap: 3px 9px; }
  .player-top .portrait { width: 53px; height: 53px; }
  .player-meta strong { font-size: .88rem; }
  .player-row .spell-card { width: 49px; flex-basis: 49px; }
  .spell-reference { gap: 8px; }
  .spell-reference .spell-card { height: 55px; }
  .spell-reference .spell-card small { font-size: .62rem; }
  .cast-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 365px) { main { padding-inline: 10px; } .player-row { padding-inline: 6px; gap: 5px; } .player-top { grid-template-columns: 36px minmax(0,1fr); gap: 3px; } .player-top .portrait { width: 36px; height: 39px; } }
@media (prefers-reduced-motion: reduce) {
  .portrait, .portrait::after, .portrait .impact, .battle-line, .selection-motion, .selection-motion > *, .laugh-card { animation: none !important; }
  .portrait:not(:has(.impact)) { box-shadow: none; }
}
