@font-face {
  font-family: "Fredoka";
  src: url("../../assets/fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #060b0d;
  --bg-2: #0a1112;
  --cream: #f4e8d0;
  --muted: #a99e8c;
  --dim: #6f6c61;
  --gold: #d8b477;
  --gold-hi: #f1d49b;
  --gold-soft: rgba(216, 180, 119, .18);
  --jade: #78d8bb;
  --violet: #9b8dff;
  --moon: #1b2638;
  --line: rgba(232, 204, 154, .13);
  --line-strong: rgba(232, 204, 154, .26);
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Fredoka", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-width: 320px; min-height: 100svh;
  color: var(--cream); background: var(--bg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--gold); color: #17100b; }

.scene-bg {
  position: fixed; inset: 0; z-index: -3;
  background:
    linear-gradient(180deg, rgba(5, 10, 11, .3), rgba(5, 10, 11, .78) 60%, #060b0d 100%),
    radial-gradient(60% 70% at 50% 20%, rgba(120, 216, 187, .07), transparent 65%),
    url("../assets/gomoku-bg.webp") center / cover no-repeat;
  filter: saturate(.9) contrast(1.04);
  transform: scale(1.02);
}
.scene-vignette {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(80% 70% at 50% 42%, transparent 35%, rgba(2, 6, 8, .72) 100%),
    linear-gradient(90deg, rgba(3, 8, 9, .82), transparent 24%, transparent 76%, rgba(3, 8, 9, .82));
}
.starfield { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; opacity: .65; }
.grain {
  position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.gs-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  width: min(1500px, calc(100% - 52px)); height: 82px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.back-link { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.back-link span { color: var(--gold); font-size: 17px; }
.back-link:hover { color: var(--cream); }
.gs-brand { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 11px; }
.gs-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid rgba(240, 210, 153, .55); border-radius: 9px;
  color: var(--gold-hi); font-family: "Songti SC", serif; font-size: 19px;
  background: linear-gradient(145deg, rgba(216,180,119,.22), rgba(10,20,17,.7));
  box-shadow: inset 0 1px 0 rgba(255, 241, 207, .25), 0 8px 25px rgba(0,0,0,.3);
}
.gs-brand-copy { display: flex; flex-direction: column; gap: 2px; }
.gs-brand-copy strong { font-family: var(--font-display); font-size: 15px; letter-spacing: .14em; font-weight: 500; }
.gs-brand-copy strong em { font-style: normal; color: var(--gold); font-size: 10px; letter-spacing: .2em; margin-left: 5px; }
.gs-brand-copy small { color: var(--muted); font-size: 8px; letter-spacing: .28em; }
.gs-actions { display: flex; align-items: center; gap: 8px; }
.text-btn, .outline-btn, .icon-btn { color: var(--muted); border: 1px solid var(--line); transition: .2s ease; }
.text-btn { padding: 8px 10px; border-color: transparent; font-size: 10px; }
.text-btn:hover { color: var(--cream); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.03); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn svg .wave { fill: none; }
.icon-btn.is-muted .wave { display: none; }
.icon-btn:hover, .outline-btn:hover { color: var(--cream); border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.outline-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px; border-radius: 8px; font-size: 9px; letter-spacing: .08em; background: rgba(255,255,255,.025); }

.gs-layout {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 244px minmax(420px, 1fr) 280px;
  gap: 22px; align-items: center;
  width: min(1500px, calc(100% - 52px)); min-height: calc(100svh - 82px);
  margin: 0 auto; padding: 22px 0 30px;
}
.left-rail, .right-rail { display: flex; flex-direction: column; gap: 12px; }
.duelist-card, .arcana-panel, .match-panel, .oracle-card, .history-panel, .rule-hint {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(18, 29, 27, .78), rgba(7, 13, 14, .78));
  border-radius: 16px;
  box-shadow: 0 24px 50px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.025);
  backdrop-filter: blur(14px);
}
.duelist-card { padding: 16px; }
.duelist-head { display: flex; align-items: center; gap: 11px; }
.sun-sigil {
  position: relative; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid rgba(255, 225, 168, .65);
  background: radial-gradient(circle at 35% 30%, #fff4d5, #e5bd77 55%, #8e5f2e);
  box-shadow: 0 0 22px rgba(228, 183, 108, .25), inset 0 0 0 4px rgba(69, 39, 17, .2);
}
.sun-sigil i { position: absolute; inset: 9px; border-radius: 50%; border: 1px solid rgba(98, 58, 25, .45); }
.duelist-head > div:nth-child(2) { min-width: 0; flex: 1; }
.role { color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.duelist-head strong { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 500; margin-top: 2px; }
.duelist-head small { display: block; color: var(--gold); font-size: 8px; letter-spacing: .14em; margin-top: 2px; }
.turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); transition: .3s ease; }
.turn-dot.is-active { background: var(--gold); box-shadow: 0 0 14px var(--gold); animation: pulse 1.8s ease-in-out infinite; }
.duelist-stats { display: flex; gap: 18px; margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }
.duelist-stats b { color: var(--cream); font-family: var(--font-display); font-size: 14px; font-weight: 500; margin-left: 4px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.rail-head b { color: var(--dim); font-weight: 500; letter-spacing: .06em; }
.arcana-panel { padding: 14px; }
.arcana-panel .rail-head { margin-bottom: 9px; }
.arcana-card {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 55px; padding: 8px 8px;
  margin: 5px 0; text-align: left; border-radius: 10px;
  border: 1px solid transparent; background: rgba(255,255,255,.025);
  transition: border-color .2s ease, background .2s ease, transform .2s var(--ease), opacity .2s ease;
}
.arcana-card:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(216,180,119,.06); transform: translateX(2px); }
.arcana-card.is-active { border-color: rgba(216, 180, 119, .65); background: rgba(216, 180, 119, .11); box-shadow: 0 0 20px rgba(216,180,119,.08); }
.arcana-card:disabled { opacity: .38; cursor: default; }
.arcana-icon { position: relative; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--line); }
.icon-sunburst { background: radial-gradient(circle at 35% 30%, #fff2ce, #c89650); }
.icon-sunburst i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #18120d; }
.icon-sunburst i:first-child { left: 6px; top: 9px; }
.icon-sunburst i:last-child { right: 6px; bottom: 7px; }
.icon-eclipse { background: #11162a; overflow: hidden; }
.icon-eclipse i { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #e8d39f; left: 5px; top: 5px; box-shadow: 6px 0 0 #11162a; }
.icon-gravity { background: linear-gradient(145deg, #172d2a, #0b1412); }
.icon-gravity i { position: absolute; width: 9px; height: 9px; border-radius: 50%; left: 6px; top: 9px; background: var(--jade); }
.icon-gravity b { position: absolute; width: 9px; height: 9px; border-radius: 50%; right: 5px; top: 5px; border: 1px solid var(--gold); }
.arcana-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.arcana-copy strong { font-size: 11px; font-weight: 500; }
.arcana-copy em { color: var(--gold); font-style: normal; font-size: 7px; letter-spacing: .13em; }
.arcana-copy small { color: var(--dim); font-size: 8px; margin-top: 2px; }
.arcana-state { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--gold); font-family: var(--font-display); font-size: 9px; }
.arcana-card:disabled .arcana-state { color: var(--dim); }
.arcana-note { margin: 9px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: var(--dim); font-size: 8px; line-height: 1.6; }
.match-panel { padding: 14px; }
.match-row { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.055); color: var(--dim); font-size: 9px; }
.match-row b { color: var(--cream-soft, var(--cream)); font-weight: 500; }
.match-tip { margin: 11px 0 0; color: var(--dim); font-size: 8px; line-height: 1.7; }

.board-stage { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.turn-ribbon {
  display: inline-flex; align-items: center; gap: 8px; min-height: 29px; padding: 0 13px;
  margin-bottom: 10px; border: 1px solid var(--line); border-radius: 99px;
  color: var(--muted); font-size: 8px; letter-spacing: .16em;
  background: rgba(8, 15, 15, .55); backdrop-filter: blur(10px);
  transition: .3s ease;
}
.turn-ribbon i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px var(--gold); }
.turn-ribbon em { font-style: normal; color: var(--dim); letter-spacing: .06em; }
.turn-ribbon.ai-turn i { background: var(--violet); box-shadow: 0 0 9px var(--violet); }
.board-frame {
  position: relative; width: min(100%, calc(100svh - 196px), 690px);
  aspect-ratio: 1 / 1; min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(222, 190, 133, .28);
  background: #11100c;
  box-shadow: 0 36px 80px rgba(0,0,0,.46), 0 0 80px rgba(216,180,119,.06), inset 0 0 0 1px rgba(255,255,255,.035);
  overflow: hidden;
}
#gomoku-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.board-corner { position: absolute; z-index: 2; width: 16px; height: 16px; pointer-events: none; border-color: rgba(233, 201, 143, .65); }
.corner-tl { left: 8px; top: 8px; border-left: 1px solid; border-top: 1px solid; }
.corner-tr { right: 8px; top: 8px; border-right: 1px solid; border-top: 1px solid; }
.corner-bl { left: 8px; bottom: 8px; border-left: 1px solid; border-bottom: 1px solid; }
.corner-br { right: 8px; bottom: 8px; border-right: 1px solid; border-bottom: 1px solid; }
.board-foot { display: flex; justify-content: space-between; gap: 14px; width: min(100%, calc(100svh - 196px), 690px); padding-top: 10px; color: var(--dim); font-size: 8px; letter-spacing: .04em; }
.board-foot span:last-child { color: var(--muted); }
.cover {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background: radial-gradient(65% 70% at 50% 45%, rgba(4, 10, 10, .52), rgba(4, 8, 9, .88));
  backdrop-filter: blur(7px);
}
.cover[hidden] { display: none; }
.cover-card {
  width: min(438px, 100%); padding: 30px 30px 24px; text-align: center;
  border: 1px solid rgba(225, 193, 135, .24); border-radius: 20px;
  background: linear-gradient(160deg, rgba(17, 31, 27, .92), rgba(5, 11, 12, .94));
  box-shadow: 0 30px 70px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
}
.cover-kicker { color: var(--gold); font-size: 8px; letter-spacing: .23em; }
.cover-card h1 { margin: 15px 0 9px; font-family: var(--font-display); font-size: clamp(46px, 6vw, 68px); line-height: .86; letter-spacing: -.05em; font-weight: 500; }
.cover-card h1 span { color: var(--gold); }
.cover-sub { margin: 0 auto; max-width: 310px; color: var(--muted); font-size: 10px; line-height: 1.85; }
.cover-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; text-align: left; }
.option-label { color: var(--dim); font-size: 8px; letter-spacing: .12em; }
.segmented { display: flex; gap: 5px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.16); }
.segmented button { min-height: 25px; padding: 0 8px; border-radius: 5px; color: var(--dim); font-size: 8px; transition: .2s ease; }
.segmented button.is-active { color: #1d140c; background: var(--gold-hi); }
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 46px; margin-top: 20px; padding: 0 18px; border-radius: 99px;
  color: #21160c; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  background: linear-gradient(110deg, #f8e0ae, #d9b576 58%, #b8925d);
  box-shadow: 0 14px 32px rgba(216,180,119,.18), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .2s var(--ease), box-shadow .2s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 36px rgba(216,180,119,.24); }
.primary-btn span { font-size: 15px; }
.cover-foot { display: block; margin-top: 12px; color: var(--dim); font-size: 8px; letter-spacing: .08em; }
.result-card { padding-top: 24px; }
.result-rank {
  width: 70px; height: 70px; margin: 16px auto 6px; display: grid; place-items: center;
  color: var(--gold-hi); font-family: var(--font-display); font-size: 36px; font-weight: 500;
  border: 1px solid rgba(220, 185, 123, .5); border-radius: 50%;
  background: radial-gradient(circle, rgba(216,180,119,.18), transparent 68%);
  box-shadow: 0 0 30px rgba(216,180,119,.12);
}
.result-card h1 { font-size: clamp(38px, 5vw, 54px); margin-top: 2px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 0; }
.result-stats div { padding: 9px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-stats span { display: block; color: var(--dim); font-size: 8px; }
.result-stats b { display: block; margin-top: 4px; color: var(--cream); font-family: var(--font-display); font-size: 17px; font-weight: 500; }
.result-actions { display: flex; flex-direction: column; gap: 7px; margin-top: 13px; }
.result-actions .primary-btn { margin-top: 0; }
.result-actions .outline-btn { width: 100%; min-height: 38px; }
.oracle-card { position: relative; padding: 17px 16px 14px; overflow: hidden; }
.oracle-portrait { position: relative; z-index: 1; width: 66px; height: 66px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(216,180,119,.45); box-shadow: 0 0 26px rgba(155,141,255,.14); }
.oracle-portrait img { width: 100%; height: 100%; object-fit: cover; }
.oracle-rings { position: absolute; left: 50%; top: 17px; width: 144px; height: 144px; transform: translateX(-50%); pointer-events: none; opacity: .3; }
.oracle-rings i { position: absolute; inset: 0; border: 1px solid rgba(216,180,119,.28); border-radius: 50%; }
.oracle-rings i:last-child { inset: 14px; border-color: rgba(155,141,255,.24); border-style: dashed; animation: orbit 18s linear infinite; }
.oracle-card .role { text-align: center; display: block; }
.oracle-card h2 { margin: 4px 0 10px; text-align: center; font-family: var(--font-display); font-size: 23px; line-height: 1; font-weight: 500; }
.oracle-card h2 em { display: block; font-style: normal; color: var(--violet); font-size: 8px; letter-spacing: .2em; margin-top: 4px; }
.oracle-taunt { min-height: 40px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.7; text-align: center; }
.oracle-status { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--dim); font-size: 8px; }
.oracle-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.oracle-status i.is-thinking { animation: pulse 1s ease-in-out infinite; }
.oracle-counts { display: flex; justify-content: center; gap: 20px; margin-top: 7px; color: var(--dim); font-size: 8px; }
.oracle-counts b { color: var(--cream); font-family: var(--font-display); font-size: 12px; font-weight: 500; margin-left: 3px; }
.history-panel { padding: 13px 14px; }
.move-history { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; max-height: 150px; overflow: hidden; }
.move-history li { display: flex; gap: 7px; color: var(--muted); font-size: 8px; }
.move-history li span { color: var(--dim); min-width: 20px; font-variant-numeric: tabular-nums; }
.move-history li b { color: var(--gold); font-weight: 500; }
.move-history li.is-ai b { color: var(--violet); }
.move-history .empty-log { color: var(--dim); }
.rule-hint { padding: 13px 14px; }
.rule-hint p { margin: 7px 0 0; color: var(--dim); font-size: 8px; line-height: 1.7; }
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 22px; background: rgba(2,6,7,.74); backdrop-filter: blur(9px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(420px, 100%); max-height: 90vh; overflow-y: auto; padding: 27px; border: 1px solid var(--line-strong); border-radius: 18px; background: #0b1413; }
.modal-close { position: absolute; right: 14px; top: 12px; color: var(--muted); font-size: 22px; line-height: 1; }
.modal-card h2 { margin: 9px 0 16px; font-family: var(--font-display); font-size: 32px; font-weight: 500; }
.modal-card ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.modal-card li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.modal-card li b { color: var(--gold); font-weight: 500; }
.modal-card .primary-btn { margin-top: 22px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 300; transform: translate(-50%, 10px); padding: 10px 15px; border: 1px solid var(--line-strong); border-radius: 99px; background: rgba(8,15,14,.94); color: var(--cream); font-size: 10px; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
@keyframes orbit { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .gs-header, .gs-layout { width: calc(100% - 34px); }
  .gs-layout { grid-template-columns: 216px minmax(380px, 1fr) 250px; gap: 14px; }
  .oracle-portrait { width: 54px; height: 54px; }
}
@media (max-width: 980px) {
  .gs-header { height: 68px; }
  .gs-brand { position: static; transform: none; margin-right: auto; }
  .gs-layout { display: flex; flex-direction: column; align-items: stretch; min-height: auto; gap: 10px; padding: 12px 0 26px; }
  .left-rail { display: grid; grid-template-columns: 1fr 1.3fr; order: 2; }
  .right-rail { display: grid; grid-template-columns: 1.2fr 1fr; order: 3; }
  .board-stage { order: 1; }
  .board-frame { width: min(100%, 620px); }
  .board-foot { width: min(100%, 620px); }
  .match-panel, .rule-hint { display: none; }
  .arcana-panel { padding: 10px; }
  .arcana-card { min-height: 50px; }
  .oracle-card { padding: 13px; }
  .oracle-rings { display: none; }
  .oracle-portrait { position: absolute; right: 13px; top: 13px; width: 46px; height: 46px; margin: 0; }
  .oracle-card .role, .oracle-card h2, .oracle-taunt { text-align: left; }
  .oracle-card h2 { margin-top: 3px; }
  .oracle-taunt { min-height: 0; padding-right: 55px; }
  .oracle-status { justify-content: flex-start; }
  .oracle-counts { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .gs-header { width: calc(100% - 24px); gap: 7px; }
  .back-link { font-size: 0; }
  .back-link span { font-size: 19px; }
  .gs-brand { gap: 7px; }
  .gs-mark { width: 30px; height: 30px; font-size: 16px; }
  .gs-brand-copy strong { font-size: 12px; letter-spacing: .09em; }
  .gs-brand-copy small { font-size: 7px; letter-spacing: .18em; }
  .gs-actions .text-btn { display: none; }
  .gs-actions .outline-btn { display: none; }
  .gs-layout { width: calc(100% - 20px); padding-top: 8px; }
  .turn-ribbon { margin-bottom: 7px; }
  .board-frame { border-radius: 12px; }
  .cover { padding: 11px; }
  .cover-card { padding: 20px 17px 17px; border-radius: 14px; }
  .cover-kicker { font-size: 7px; letter-spacing: .15em; }
  .cover-card h1 { font-size: 42px; }
  .cover-sub { font-size: 9px; }
  .cover-option { display: block; margin-top: 13px; }
  .segmented { margin-top: 6px; width: 100%; }
  .segmented button { flex: 1; }
  .primary-btn { min-height: 42px; margin-top: 14px; }
  .board-foot { padding-top: 7px; font-size: 7px; }
  .left-rail, .right-rail { display: flex; flex-direction: column; }
  .duelist-card { padding: 11px 12px; }
  .duelist-head strong { font-size: 17px; }
  .duelist-stats { margin-top: 9px; padding-top: 8px; }
  .arcana-panel { padding: 10px; }
  .arcana-panel .rail-head { margin-bottom: 4px; }
  .arcana-card { min-height: 47px; margin: 4px 0; padding: 6px 7px; }
  .arcana-note { margin-top: 5px; padding-top: 6px; }
  .oracle-card { min-height: 128px; }
  .history-panel { order: 4; }
  .result-rank { width: 58px; height: 58px; margin: 10px auto 4px; font-size: 29px; }
  .result-stats { margin-top: 11px; }
  .result-stats b { font-size: 14px; }
  .result-actions { margin-top: 9px; }
  .modal-card { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
/* keep the Aster scene visible above the root background */
html { background: #060b0d; }
body { background: transparent; }
.scene-bg { z-index: 0; }
.scene-vignette { z-index: 1; }
.starfield { z-index: 2; }
.gs-header { z-index: 10; }
.gs-layout { z-index: 3; }
.grain { z-index: 90; }
/* ---------------- online PvP room ---------------- */
.online-room {
  margin-top: 14px; padding: 12px;
  border: 1px solid rgba(216,180,119,.22); border-radius: 11px;
  background: rgba(0,0,0,.18); text-align: left;
}
.online-room[hidden] { display: none; }
.online-actions { display: flex; gap: 7px; }
.online-btn {
  flex: 1; min-height: 33px; border: 1px solid var(--line);
  border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.03);
  font-size: 9px; letter-spacing: .05em; transition: .2s ease;
}
.online-btn:hover { color: var(--cream); border-color: var(--line-strong); }
.online-btn-gold { color: #24170e; border-color: rgba(238,208,153,.55); background: linear-gradient(110deg,#f7dfae,#d7b171); }
.online-join { display: flex; gap: 7px; margin-top: 8px; }
.online-join input {
  min-width: 0; flex: 1; min-height: 31px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 7px;
  background: rgba(0,0,0,.2); color: var(--cream); font: 11px var(--font-display);
  letter-spacing: .16em; outline: none; text-transform: uppercase;
}
.online-join input::placeholder { color: var(--dim); letter-spacing: .04em; font: 9px var(--font-body); text-transform: none; }
.online-join input:focus { border-color: rgba(216,180,119,.55); }
.online-join button {
  flex: 0 0 auto; min-height: 31px; padding: 0 12px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--gold-hi); background: rgba(216,180,119,.07);
  font-size: 9px;
}
.online-wait {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px;
  margin-top: 8px; padding: 9px 10px; border: 1px dashed rgba(120,216,187,.32);
  border-radius: 8px; background: rgba(120,216,187,.04);
}
.online-wait[hidden] { display: none; }
.online-wait span { color: var(--dim); font-size: 7px; letter-spacing: .14em; }
.online-wait b { color: var(--jade); font-family: var(--font-display); font-size: 18px; letter-spacing: .2em; }
.online-wait button { color: var(--jade); font-size: 8px; border-bottom: 1px solid rgba(120,216,187,.4); padding: 0 0 1px; }
.online-wait small { grid-column: 2 / 4; color: var(--dim); font-size: 8px; letter-spacing: .03em; }
.online-cancel { display: block; margin: 8px auto 0; color: var(--dim); font-size: 8px; border-bottom: 1px solid var(--line); padding: 0 0 1px; }
.online-cancel[hidden] { display: none; }
.sun-sigil.is-moon {
  border-color: rgba(155,141,255,.65);
  background: radial-gradient(circle at 35% 30%, #e8e9ff, #6e79aa 44%, #151b2d 78%);
  box-shadow: 0 0 22px rgba(155,141,255,.25), inset 0 0 0 4px rgba(8,11,22,.28);
}
.sun-sigil.is-moon i { border-color: rgba(200,206,255,.28); }
.rival-mark {
  display: none; width: 100%; height: 100%; place-items: center;
  color: var(--gold-hi); font-family: "Songti SC", serif; font-size: 27px;
  background: radial-gradient(circle at 35% 30%, #293551, #141a28 60%, #070b12);
}
.oracle-card.is-online .oracle-portrait img { display: none; }
.oracle-card.is-online .rival-mark { display: grid; }
.oracle-card.is-online .oracle-portrait { border-color: rgba(155,141,255,.6); box-shadow: 0 0 26px rgba(155,141,255,.2); }
.oracle-card.is-online .oracle-rings i { border-color: rgba(155,141,255,.28); }
@media (max-width: 640px) {
  .online-room { margin-top: 10px; padding: 9px; }
  .online-wait b { font-size: 15px; }
}
[hidden] { display: none !important; }
.online-btn.is-selected {
  color: #24170e;
  border-color: rgba(238,208,153,.6);
  background: linear-gradient(110deg,#f7dfae,#d7b171);
}
.online-btn:disabled { opacity: .65; }
.online-btn.is-selected:disabled { opacity: .85; }
