/* Royal Snake Game visual system upgrade
   Additive only: no game logic, API, or bundle behavior changes. */

/* 1. Design tokens */
:root {
  --rsg-bg-0: #050302;
  --rsg-bg-1: #090604;
  --rsg-bg-2: #130c08;
  --rsg-ebony: #0b0907;
  --rsg-lacquer: #170d08;
  --rsg-oxblood: #6f2110;
  --rsg-ruby: #8d2d1a;
  --rsg-gold: #d5a33c;
  --rsg-gold-bright: #f3d278;
  --rsg-parchment: #ead9b2;
  --rsg-parchment-light: #fff1c4;
  --rsg-ink: #ead7ad;
  --rsg-ink-dark: #2a160c;
  --rsg-teal: #2f7d76;
  --rsg-emerald: #155d52;
  --rsg-danger: #dc4c2d;

  --rsg-font-ui: Georgia, "Times New Roman", serif;
  --rsg-font-display: "Cinzel", "Trajan Pro", "Palatino Linotype", Georgia, serif;
  --rsg-font-body: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;

  --rsg-shadow-deep: 0 34px 92px rgba(0, 0, 0, 0.62);
  --rsg-shadow-panel: 0 22px 56px rgba(0, 0, 0, 0.42);
  --rsg-shadow-small: 0 10px 24px rgba(0, 0, 0, 0.28);
  --rsg-border-gold: 1px solid rgba(213, 163, 60, 0.62);
  --rsg-radius: 8px;
  --rsg-radius-tight: 6px;
  --rsg-fast: 160ms ease;
  --rsg-medium: 420ms cubic-bezier(0.17, 0.84, 0.28, 1.08);
  --rsg-type-label: 12px;
  --rsg-type-small: 13px;
  --rsg-type-body: 14px;
  --rsg-type-card-title: 17px;
  --rsg-line-body: 1.55;
}

/* 2. Global layout and atmosphere */
html {
  background: var(--rsg-bg-0);
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(213, 163, 60, 0.12), transparent 34rem),
    linear-gradient(135deg, #050302, #130c08 62%, #070503);
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(243, 210, 120, 0.9);
  outline-offset: 3px;
}

.app {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  color: var(--rsg-ink);
  font-family: var(--rsg-font-ui);
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.94), rgba(5, 3, 2, 0.5) 46%, rgba(5, 3, 2, 0.88)),
    url("/media/rsg-upgrade/rsg-hero-cinematic.png") center / cover fixed,
    var(--rsg-bg-1);
}

.app::before {
  content: "";
  position: fixed;
  inset: -8%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 24% 18%, rgba(213, 163, 60, 0.18), transparent 25rem),
    radial-gradient(circle at 82% 76%, rgba(47, 125, 118, 0.13), transparent 20rem),
    linear-gradient(rgba(5, 3, 2, 0.16), rgba(5, 3, 2, 0.58));
  animation: rsgAmbientDrift 16s ease-in-out infinite alternate;
}

.main-layout {
  max-width: 1520px;
  padding-block: clamp(10px, 1.8vw, 22px);
  gap: clamp(18px, 2.6vw, 32px);
}

.board-column {
  min-height: calc(100vh - 92px);
  align-items: flex-start;
  padding-top: clamp(4px, 1.1vw, 14px);
}

body:not([data-route="play"]) .board-column {
  align-items: flex-start;
  padding-top: clamp(18px, 3vw, 38px);
}

body:not([data-route="play"]) .app {
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.93), rgba(5, 3, 2, 0.58) 48%, rgba(5, 3, 2, 0.88)),
    url("/media/rsg-upgrade/rsg-section-bg-wide.png") center top / cover fixed,
    var(--rsg-bg-1);
}

/* 3. Navigation */
.topbar {
  min-height: 66px;
  border-bottom-color: rgba(213, 163, 60, 0.42);
  background:
    linear-gradient(rgba(5, 4, 3, 0.91), rgba(5, 4, 3, 0.91)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

.brand {
  gap: 12px;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  letter-spacing: 0.12em;
}

.brand-mark {
  width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-color: rgba(243, 210, 120, 0.78);
  border-radius: var(--rsg-radius);
  background:
    radial-gradient(circle at 32% 24%, rgba(243, 210, 120, 0.26), transparent 42%),
    rgba(213, 163, 60, 0.1);
  box-shadow: inset 0 0 14px rgba(213, 163, 60, 0.14), var(--rsg-shadow-small);
}

.topbar nav {
  gap: 8px;
}

.topbar nav button {
  position: relative;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--rsg-gold);
  font-size: 12px;
  letter-spacing: 0.075em;
  transition: color var(--rsg-fast), border-color var(--rsg-fast), background var(--rsg-fast);
}

.topbar nav button:hover {
  color: var(--rsg-gold-bright);
  background: rgba(213, 163, 60, 0.09);
}

.topbar nav .nav-active {
  color: var(--rsg-gold-bright);
  border-color: rgba(243, 210, 120, 0.52);
  background: rgba(213, 163, 60, 0.14);
}

.topbar nav .nav-active::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -4px;
  left: 8px;
  height: 12px;
  background: url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") center / contain no-repeat;
  opacity: 0.62;
}

.topbar .rsg-native-nav {
  display: none !important;
}

.rsg-flow-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.rsg-nav-group {
  position: relative;
}

.rsg-nav-group::after {
  content: "";
  position: absolute;
  top: 100%;
  right: -12px;
  left: -12px;
  height: 12px;
}

.rsg-flow-nav button {
  min-height: 36px;
  border: 1px solid rgba(213, 163, 60, 0.24);
  border-radius: 999px;
  background: rgba(8, 5, 3, 0.28);
  color: var(--rsg-gold);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  text-transform: uppercase;
}

.rsg-nav-group.is-active > .rsg-nav-main,
.rsg-flow-nav button:hover,
.rsg-flow-nav button:focus-visible {
  border-color: rgba(243, 210, 120, 0.58);
  background: rgba(213, 163, 60, 0.14);
  color: var(--rsg-gold-bright);
}

.rsg-nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  display: grid;
  min-width: 176px;
  padding: 8px;
  border: 1px solid rgba(213, 163, 60, 0.44);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(180deg, rgba(18, 9, 5, 0.98), rgba(5, 3, 2, 0.98)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity var(--rsg-fast), transform var(--rsg-fast);
}

.rsg-nav-group:hover .rsg-nav-menu,
.rsg-nav-group:focus-within .rsg-nav-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.rsg-nav-menu button {
  width: 100%;
  border-radius: var(--rsg-radius-tight);
  background: transparent;
  text-align: left;
}

.account-chip {
  color: var(--rsg-ink);
}

.account-chip span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip button {
  color: var(--rsg-gold-bright);
  border-color: rgba(213, 163, 60, 0.55);
}

/* 4. Game board and match surface */
.match-stage {
  gap: 8px;
}

.player-strip {
  min-height: 58px;
  padding-block: 7px;
  border-color: rgba(213, 163, 60, 0.46);
  background:
    linear-gradient(135deg, rgba(255, 241, 196, 0.08), transparent 38%),
    rgba(9, 7, 5, 0.86);
  box-shadow: var(--rsg-shadow-small);
}

.player-active {
  border-color: rgba(243, 210, 120, 0.9);
  box-shadow: 0 0 0 2px rgba(213, 163, 60, 0.22), var(--rsg-shadow-small);
}

.player-avatar {
  background:
    radial-gradient(circle at 35% 28%, rgba(243, 210, 120, 0.28), rgba(18, 10, 6, 0.95) 68%),
    url("/media/rsg-upgrade/derived/ranks/rank-gold-serpent.png") center / 82% no-repeat;
  border-color: rgba(243, 210, 120, 0.82);
}

.player-clock {
  color: var(--rsg-gold-bright);
}

.board-status-card {
  padding-block: 8px;
  border-color: rgba(213, 163, 60, 0.82);
  background:
    linear-gradient(145deg, rgba(9, 6, 4, 0.92), rgba(34, 18, 10, 0.9)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
}

.board-shell {
  position: relative;
  isolation: isolate;
  padding: clamp(10px, 2.1vw, 24px);
  border-color: rgba(213, 163, 60, 0.72);
  background:
    linear-gradient(rgba(9, 6, 4, 0.56), rgba(9, 6, 4, 0.74)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow:
    0 36px 96px rgba(0, 0, 0, 0.72),
    inset 0 0 44px rgba(213, 163, 60, 0.1);
}

.board-shell::before {
  content: "";
  position: absolute;
  inset: -5%;
  z-index: -1;
  pointer-events: none;
  background: url("/media/rsg-upgrade/rsg-board-frame-transparent.png") center / contain no-repeat;
  filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.58));
  opacity: 0.72;
}

.board-grid {
  border-color: rgba(243, 210, 120, 0.52);
  border-radius: var(--rsg-radius-tight);
  background: #140905;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.52);
}

.square {
  border-color: rgba(20, 8, 4, 0.52);
  background-position: center;
  background-size: cover;
}

.square-light {
  background-image:
    linear-gradient(rgba(198, 83, 49, 0.08), rgba(198, 83, 49, 0.08)),
    url("/media/rsg-upgrade/derived/tiles/tile-light-lacquer.png");
}

.square-dark {
  background-image:
    linear-gradient(rgba(80, 24, 14, 0.18), rgba(80, 24, 14, 0.18)),
    url("/media/rsg-upgrade/derived/tiles/tile-dark-lacquer.png");
}

.piece {
  background-color: transparent !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  border: 0 !important;
  border-radius: 0;
  color: transparent !important;
  text-shadow: none;
  box-shadow: none;
  filter: drop-shadow(0 9px 10px rgba(0, 0, 0, 0.62));
  transition: transform var(--rsg-fast), filter var(--rsg-fast);
}

.piece:hover {
  transform: translateY(-3px) scale(1.045);
  filter:
    drop-shadow(0 13px 16px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 12px rgba(213, 163, 60, 0.22));
}

.piece-light {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-snake.png") !important;
}

.piece-dark {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-snake.png") !important;
}

.piece-light.piece-king {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-king-cobra.png") !important;
}

.piece-dark.piece-king {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-king-cobra.png") !important;
}

.piece-king {
  animation: rsgKingGlow 2.4s ease-in-out infinite;
}

.square-legal::after {
  width: 16%;
  background: rgba(243, 210, 120, 0.82);
  box-shadow: 0 0 12px rgba(243, 210, 120, 0.38);
  opacity: 0.74;
}

.square-capture::after {
  width: 34%;
  border: 1px solid rgba(255, 168, 124, 0.72);
  background: rgba(111, 22, 12, 0.16);
  box-shadow: 0 0 18px rgba(210, 64, 38, 0.3);
  opacity: 0.82;
  animation: none;
}

.square-selected {
  outline: 0;
}

.square-selected::before {
  content: "";
  position: absolute;
  inset: 10%;
  z-index: 1;
  pointer-events: none;
  background: url("/media/rsg-upgrade/derived/vfx/vfx-selected-teal.png") center / contain no-repeat;
  opacity: 0.34;
  animation: rsgTurnPulse 2.4s ease-in-out infinite;
}

.square-last-from,
.square-last-to {
  box-shadow: inset 0 0 0 2px rgba(243, 210, 120, 0.46);
}

.square-last-from::before {
  content: "";
  position: absolute;
  width: 68%;
  height: 4px;
  z-index: 1;
  pointer-events: none;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(136, 225, 199, 0.82), transparent);
  box-shadow: 0 0 18px rgba(136, 225, 199, 0.42);
  transform: rotate(-28deg);
  animation: rsgMoveTrail 740ms ease-out both;
}

.square-last-to::after {
  content: "";
  position: absolute;
  inset: 7%;
  z-index: 2;
  pointer-events: none;
  background: url("/media/rsg-upgrade/derived/vfx/vfx-turn-aura.png") center / contain no-repeat;
  opacity: 0;
  animation: rsgArrivalAura 760ms ease-out both;
}

.square-last-capture::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 3;
  pointer-events: none;
  border: 0;
  background: url("/media/rsg-upgrade/derived/vfx/vfx-capture-burst.png") center / contain no-repeat;
  animation: rsgCaptureImpact 720ms cubic-bezier(0.18, 0.84, 0.28, 1) both;
}

.promo-mark {
  border: 0;
  background: url("/media/rsg-upgrade/derived/vfx/vfx-promotion-sparkle.png") center / contain no-repeat;
  animation: rsgPromotionRise 1.2s ease-out both;
}

.piece-arrive {
  animation: rsgPieceArrive 520ms cubic-bezier(0.17, 0.84, 0.28, 1.08) both;
}

/* 5. Panels, forms, tables, and shared UI */
.panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(182, 138, 70, 0.92);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(rgba(234, 217, 178, 0.94), rgba(234, 217, 178, 0.93)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  box-shadow:
    var(--rsg-shadow-panel),
    inset 0 0 34px rgba(255, 246, 220, 0.28);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 250, 230, 0.18), transparent 34%),
    radial-gradient(circle at 8% 0%, rgba(213, 163, 60, 0.16), transparent 15rem);
  opacity: 0.72;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: #633416;
  border-bottom-color: rgba(123, 67, 31, 0.28);
  font-family: var(--rsg-font-display);
  font-size: var(--rsg-type-label);
  letter-spacing: 0.13em;
  line-height: 1.2;
}

.panel-title::before,
.panel-title::after {
  content: "";
  flex: 1 1 18px;
  max-width: 54px;
  height: 16px;
  background: url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") center / contain no-repeat;
  opacity: 0.64;
}

.button,
.panel button,
.button-row button,
.control-grid button {
  border-color: rgba(213, 163, 60, 0.62);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(180deg, rgba(111, 33, 16, 0.96), rgba(46, 14, 7, 0.98));
  color: var(--rsg-gold-bright);
  box-shadow: inset 0 1px rgba(255, 235, 180, 0.14), 0 8px 18px rgba(0, 0, 0, 0.18);
  transition: transform var(--rsg-fast), filter var(--rsg-fast), border-color var(--rsg-fast);
}

.button:hover,
.panel button:hover,
.button-row button:hover,
.control-grid button:hover {
  border-color: rgba(243, 210, 120, 0.9);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.button-primary {
  background:
    linear-gradient(180deg, rgba(255, 226, 145, 0.18), rgba(0, 0, 0, 0.12)),
    var(--rsg-oxblood);
}

.button-secondary {
  background:
    linear-gradient(180deg, rgba(255, 241, 196, 0.08), rgba(0, 0, 0, 0.16)),
    var(--rsg-ebony);
}

.field input,
.load-match-row input {
  border-color: rgba(154, 109, 50, 0.74);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(rgba(255, 246, 220, 0.92), rgba(255, 246, 220, 0.9)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  box-shadow: inset 0 2px 7px rgba(60, 28, 10, 0.12);
}

.field input:focus,
.load-match-row input:focus {
  outline: 2px solid rgba(213, 163, 60, 0.52);
  outline-offset: 2px;
}

table {
  overflow: hidden;
  border: 1px solid rgba(123, 67, 31, 0.22);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--rsg-radius);
  background: rgba(255, 246, 220, 0.48);
}

th,
td {
  padding: 10px 9px;
}

th {
  border-bottom-color: rgba(213, 163, 60, 0.42);
  background:
    linear-gradient(180deg, rgba(111, 33, 16, 0.96), rgba(46, 14, 7, 0.96));
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  letter-spacing: 0.08em;
}

td {
  color: #341c0e;
  border-bottom-color: rgba(123, 67, 31, 0.16);
}

tbody tr:nth-child(even) td {
  background: rgba(123, 67, 31, 0.06);
}

tbody tr:hover td {
  background: rgba(213, 163, 60, 0.12);
}

.status-stack,
.match-meta,
.share-link,
.queue-card,
.clock-grid,
.match-state,
.rating-row {
  border: 1px solid rgba(123, 67, 31, 0.22);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(rgba(255, 246, 220, 0.68), rgba(255, 246, 220, 0.48)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  padding: 11px;
}

.muted {
  color: #6f5731;
}

.move-list {
  padding-right: 3px;
}

.move-list li {
  align-items: center;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: var(--rsg-radius-tight);
}

.move-list li:nth-child(odd) {
  background: rgba(123, 67, 31, 0.06);
}

.move-current,
.active-control {
  background: rgba(47, 125, 118, 0.16);
  box-shadow: inset 0 0 0 1px rgba(47, 125, 118, 0.42);
}

.queue-pulse {
  background: var(--rsg-gold);
  animation: rsgQueuePulse 1.4s infinite;
}

/* 6. Route-specific views */
.work-surface {
  position: relative;
  width: min(980px, 100%);
  gap: 18px;
  margin-top: 18px;
}

.work-surface::before {
  content: "";
  position: absolute;
  inset: -18px -18px auto;
  z-index: 0;
  height: min(220px, 34vh);
  pointer-events: none;
  border: 1px solid rgba(213, 163, 60, 0.24);
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.88), rgba(5, 3, 2, 0.38) 52%, rgba(5, 3, 2, 0.82)),
    url("/media/rsg-upgrade/rsg-content-hero-strip.png") center / cover;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.46);
  opacity: 0.92;
}

.work-surface > .panel {
  margin-top: clamp(64px, 10vw, 118px);
}

.work-surface > .panel + .panel {
  margin-top: 0;
}

.prose-panel {
  max-width: 820px;
  padding: clamp(18px, 3vw, 30px);
  border-color: rgba(166, 112, 48, 0.9);
  background:
    linear-gradient(90deg, rgba(77, 38, 15, 0.1), transparent 18%, transparent 82%, rgba(77, 38, 15, 0.1)),
    linear-gradient(rgba(246, 230, 190, 0.94), rgba(236, 215, 170, 0.94)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  box-shadow:
    0 26px 64px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 250, 230, 0.42),
    inset 0 0 46px rgba(93, 42, 18, 0.12);
  font-family: var(--rsg-font-body);
  line-height: 1.78;
}

.prose-panel::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 14px;
  left: 18px;
  height: 28px;
  pointer-events: none;
  background: url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") center / contain no-repeat;
  opacity: 0.24;
}

.prose-panel .panel-title {
  color: #4a2410;
  font-size: 13px;
  letter-spacing: 0.16em;
}

.prose-panel h1 {
  color: #241106;
  font-family: var(--rsg-font-display);
  font-size: clamp(38px, 5vw, 64px);
  letter-spacing: 0.02em;
  text-shadow: 0 1px rgba(255, 250, 230, 0.68);
}

.prose-panel p {
  max-width: 68ch;
  margin: 0 0 15px;
  color: #3a2111;
  font-size: clamp(15px, 1.4vw, 17px);
}

.prose-panel p:first-of-type {
  color: #291509;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.58;
}

.prose-panel a {
  color: #5d1f0f;
  text-decoration-color: rgba(213, 163, 60, 0.72);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.prose-panel a:hover {
  color: var(--rsg-teal);
}

body[data-route="rankings"] .work-surface::before,
body[data-route="archive"] .work-surface::before,
body[data-route="lobby"] .work-surface::before {
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.92), rgba(5, 3, 2, 0.44) 52%, rgba(5, 3, 2, 0.86)),
    url("/media/rsg-upgrade/rsg-social-banner.png") center / cover;
}

body[data-route="rules"] .work-surface::before,
body[data-route="legal"] .work-surface::before,
body[data-route="about"] .work-surface::before {
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.9), rgba(5, 3, 2, 0.36) 52%, rgba(5, 3, 2, 0.82)),
    url("/media/rsg-upgrade/rsg-content-hero-strip.png") center / cover;
}

.about-duel-preview {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(210px, 310px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 30px);
  margin: 24px 0 8px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid rgba(213, 163, 60, 0.62);
  border-radius: 10px;
  background:
    linear-gradient(100deg, rgba(5, 3, 2, 0.94), rgba(32, 14, 8, 0.84) 48%, rgba(5, 3, 2, 0.9)),
    url("/media/rsg-upgrade/rsg-section-bg-wide.png") center / cover;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.52),
    inset 0 0 44px rgba(213, 163, 60, 0.08);
}

.about-duel-preview::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: -1;
  border: 1px solid rgba(243, 210, 120, 0.18);
  border-radius: 7px;
  pointer-events: none;
}

.preview-board {
  position: relative;
  width: min(310px, 100%);
  justify-self: center;
  padding: 12px;
  border: 1px solid rgba(243, 210, 120, 0.7);
  border-radius: 10px;
  background:
    linear-gradient(rgba(9, 6, 4, 0.46), rgba(9, 6, 4, 0.72)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.64),
    0 24px 46px rgba(0, 0, 0, 0.5);
}

.preview-board::before {
  content: "";
  position: absolute;
  inset: -13%;
  pointer-events: none;
  background: url("/media/rsg-upgrade/rsg-board-frame-transparent.png") center / contain no-repeat;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.52));
  opacity: 0.48;
}

.preview-cell {
  overflow: hidden;
  border-color: rgba(20, 8, 4, 0.58);
  background-position: center;
  background-size: cover;
}

.preview-cell-light {
  background-image:
    linear-gradient(rgba(198, 83, 49, 0.08), rgba(198, 83, 49, 0.08)),
    url("/media/rsg-upgrade/derived/tiles/tile-light-lacquer.png");
}

.preview-cell-dark {
  background-image:
    linear-gradient(rgba(80, 24, 14, 0.18), rgba(80, 24, 14, 0.18)),
    url("/media/rsg-upgrade/derived/tiles/tile-dark-lacquer.png");
}

.preview-piece {
  width: 76%;
  border: 0;
  border-radius: 0;
  background: center / contain no-repeat;
  box-shadow: none;
  color: transparent;
  filter:
    drop-shadow(0 9px 10px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 8px rgba(213, 163, 60, 0.18));
}

.preview-piece::before,
.preview-piece::after {
  display: none;
}

.preview-piece-light {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-snake.png");
}

.preview-piece-dark {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-snake.png");
}

.preview-piece-light.preview-piece-king {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-king-cobra.png");
}

.preview-piece-dark.preview-piece-king {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-king-cobra.png");
}

.preview-piece-king {
  animation: rsgKingGlow 2.6s ease-in-out infinite;
}

.preview-linework {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid rgba(213, 163, 60, 0.26);
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.8), rgba(5, 3, 2, 0.18) 48%, rgba(5, 3, 2, 0.74)),
    url("/media/rsg-upgrade/rsg-content-hero-strip.png") center / cover;
  box-shadow:
    inset 0 0 38px rgba(0, 0, 0, 0.5),
    0 18px 34px rgba(0, 0, 0, 0.32);
}

.preview-linework::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
  border: 1px solid rgba(243, 210, 120, 0.28);
  border-radius: 7px;
  background:
    url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") center 22% / 72% auto no-repeat,
    radial-gradient(circle at 50% 72%, rgba(213, 163, 60, 0.16), transparent 8rem);
  filter: drop-shadow(0 0 16px rgba(0, 0, 0, 0.3));
}

.preview-linework::after {
  content: "";
  position: absolute;
  right: 16%;
  bottom: 28%;
  left: 16%;
  height: 1px;
  background:
    linear-gradient(90deg, transparent, rgba(243, 210, 120, 0.62), rgba(47, 125, 118, 0.48), transparent);
  box-shadow: 0 0 18px rgba(213, 163, 60, 0.22);
}

.preview-gem {
  display: none;
}

.feature-grid {
  gap: 12px;
  margin-top: 20px;
}

.feature-grid div {
  position: relative;
  overflow: hidden;
  border-color: rgba(213, 163, 60, 0.38);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(145deg, rgba(255, 246, 220, 0.88), rgba(234, 217, 178, 0.76)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  box-shadow: inset 0 0 24px rgba(255, 246, 220, 0.32);
}

.feature-grid div::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 8px;
  left: 10px;
  height: 18px;
  background: url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") center / contain no-repeat;
  opacity: 0.34;
}

.feature-grid strong {
  color: #512914;
}

.feature-grid span {
  color: #432615;
}

.waitlist-section {
  position: relative;
  overflow: hidden;
  border-color: rgba(213, 163, 60, 0.78);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(8, 5, 3, 0.94), rgba(39, 18, 10, 0.86)),
    url("/media/rsg-upgrade/rsg-section-bg-wide.png") center / cover;
  box-shadow: inset 0 0 40px rgba(213, 163, 60, 0.08);
}

.waitlist-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 12% 20%, rgba(243, 210, 120, 0.16), transparent 16rem);
}

.waitlist-section > * {
  position: relative;
  z-index: 1;
}

.waitlist-section .panel-title {
  color: var(--rsg-gold-bright);
}

.waitlist-section p,
.waitlist-section .muted {
  color: var(--rsg-ink);
}

.waitlist-form {
  gap: 12px;
}

.auth-grid,
.button-row,
.control-grid {
  gap: 9px;
}

/* 7. Intro, feedback, and overlays */
.intro-modal,
.countdown-gate,
.ranked-result-card {
  border-color: rgba(213, 163, 60, 0.82);
  background:
    linear-gradient(145deg, rgba(9, 6, 4, 0.92), rgba(34, 18, 10, 0.9)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: var(--rsg-shadow-deep);
}

.intro-copy h1,
.ranked-result-card h2 {
  font-family: var(--rsg-font-display);
  color: var(--rsg-gold-bright);
}

.intro-video-frame,
.intro-load {
  border-color: rgba(243, 210, 120, 0.58);
}

.intro-load {
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.78), rgba(5, 3, 2, 0.22) 55%, rgba(5, 3, 2, 0.68)),
    url("/media/rsg-upgrade/rsg-social-banner.png") center / cover,
    #070503;
}

.toast {
  border-color: rgba(213, 163, 60, 0.72);
  background:
    linear-gradient(135deg, rgba(111, 33, 16, 0.96), rgba(37, 16, 9, 0.94)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
}

/* 8. Responsive */
@media (max-width: 980px) {
  .main-layout {
    gap: 16px;
  }

  .sidebar {
    order: -1;
  }
}

@media (max-width: 720px) {
  .app {
    background:
      linear-gradient(180deg, rgba(5, 3, 2, 0.92), rgba(5, 3, 2, 0.46) 48%, rgba(5, 3, 2, 0.88)),
      url("/media/rsg-upgrade/rsg-mobile-hero.png") center top / cover fixed,
      var(--rsg-bg-1);
  }

  .topbar {
    min-height: 62px;
  }

  .board-column {
    min-height: auto;
    padding-top: 4px;
  }

  .board-shell::before {
    opacity: 0.42;
  }

  .work-surface {
    margin-top: 4px;
  }

  .work-surface::before {
    inset: -8px -8px auto;
    height: 150px;
  }

  .work-surface > .panel {
    margin-top: 78px;
  }

  .about-duel-preview {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .preview-board {
    max-width: 285px;
  }

  .preview-linework {
    min-height: 130px;
  }

  .preview-board::before {
    opacity: 0.3;
  }

  .feature-grid,
  .waitlist-form {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 780px) and (min-width: 981px) {
  body[data-route="play"] .topbar {
    min-height: 58px;
  }

  body[data-route="play"] .main-layout {
    padding-block: 8px;
  }

  body[data-route="play"] .player-strip {
    min-height: 52px;
    padding-block: 5px;
  }

  body[data-route="play"] .board-status-card {
    padding-block: 6px;
  }

  body[data-route="play"] .match-stage {
    gap: 6px;
  }
}

/* 9. Motion */
@media (prefers-reduced-motion: reduce) {
  .app::before,
  .piece-king,
  .preview-piece-king,
  .square-selected::before,
  .square-last-from::before,
  .square-last-to::after,
  .square-last-capture::before,
  .piece-arrive,
  .promo-mark,
  .queue-pulse {
    animation: none !important;
  }

  .piece,
  .button,
  .panel button,
  .button-row button,
  .control-grid button,
  .topbar nav button {
    transition: none;
  }
}

@keyframes rsgAmbientDrift {
  from { transform: translate3d(-1%, -0.5%, 0) scale(1.02); opacity: 0.78; }
  to { transform: translate3d(1%, 0.8%, 0) scale(1.05); opacity: 1; }
}

@keyframes rsgKingGlow {
  0%, 100% {
    filter:
      drop-shadow(0 9px 10px rgba(0, 0, 0, 0.62))
      drop-shadow(0 0 0 rgba(213, 163, 60, 0));
  }
  50% {
    filter:
      drop-shadow(0 12px 14px rgba(0, 0, 0, 0.72))
      drop-shadow(0 0 14px rgba(213, 163, 60, 0.42));
  }
}

@keyframes rsgTurnPulse {
  0%, 100% { opacity: 0.22; transform: scale(0.98); }
  50% { opacity: 0.42; transform: scale(1.035); }
}

@keyframes rsgMoveTrail {
  0% { opacity: 0; transform: rotate(-28deg) scaleX(0.18); }
  24% { opacity: 0.86; }
  100% { opacity: 0; transform: rotate(-28deg) scaleX(1.08); }
}

@keyframes rsgArrivalAura {
  0% { opacity: 0; transform: scale(0.34); }
  38% { opacity: 0.9; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.34); }
}

@keyframes rsgCaptureImpact {
  0% { opacity: 0; transform: scale(0.28) rotate(-10deg); }
  30% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 0; transform: scale(1.48) rotate(8deg); }
}

@keyframes rsgPieceArrive {
  0% {
    opacity: 0.72;
    transform: translate3d(-10%, -18%, 0) scale(0.84);
    filter:
      drop-shadow(0 14px 20px rgba(0, 0, 0, 0.78))
      drop-shadow(0 0 18px rgba(243, 210, 120, 0.36));
  }
  68% {
    opacity: 1;
    transform: translate3d(2%, 3%, 0) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes rsgPromotionRise {
  0% { opacity: 0; transform: translateY(8%) scale(0.78); }
  35% { opacity: 1; }
  100% { opacity: 0.18; transform: translateY(-16%) scale(1.12); }
}

@keyframes rsgQueuePulse {
  0% { box-shadow: 0 0 rgba(213, 163, 60, 0.62); }
  70% { box-shadow: 0 0 0 9px rgba(213, 163, 60, 0); }
  100% { box-shadow: 0 0 rgba(213, 163, 60, 0); }
}

/* 10. Final route polish and visual unification */
body[data-route="play"] .main-layout {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  min-height: calc(100vh - 66px);
  padding-top: clamp(8px, 1.5vw, 18px);
}

body[data-route="play"] .board-column {
  justify-content: flex-start;
}

body[data-route="play"] .sidebar {
  padding-top: 4px;
}

body[data-route="play"] {
  --cell: clamp(34px, min(5.85vw, calc((100vh - 258px) / 8)), 72px);
}

body[data-route="play"] .match-stage {
  width: min(690px, 100%);
  gap: clamp(8px, 1.3vw, 14px);
}

body[data-route="play"] .board-stage {
  min-height: auto;
}

body[data-route="play"] .board-shell {
  max-width: 100%;
}

body[data-route="play"] .board-grid {
  aspect-ratio: 5 / 8;
}

body[data-route="play"] .player-strip,
body[data-route="play"] .board-status-card {
  padding-block: clamp(8px, 1.1vw, 12px);
}

body[data-route="play"] .sidebar .panel {
  background:
    linear-gradient(145deg, rgba(236, 215, 170, 0.94), rgba(213, 184, 126, 0.9)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
}

body[data-route="about"] .prose-panel:first-child,
body[data-route="rules"] .prose-panel,
body[data-route="legal"] .prose-panel {
  border-top-width: 2px;
}

body[data-route="about"] .prose-panel:first-child::before,
body[data-route="rules"] .prose-panel::before,
body[data-route="legal"] .prose-panel::before {
  background:
    linear-gradient(90deg, transparent, rgba(122, 57, 22, 0.16), transparent),
    radial-gradient(circle at 50% 0%, rgba(213, 163, 60, 0.18), transparent 18rem);
}

body[data-route="about"] .prose-panel:first-child h1::after {
  content: "";
  display: block;
  width: min(340px, 72%);
  height: 28px;
  margin-top: 8px;
  background: url("/media/rsg-upgrade/rsg-ornament-divider-transparent.png") left center / contain no-repeat;
  opacity: 0.46;
}

.about-duel-preview + .feature-grid {
  border-top: 1px solid rgba(93, 42, 18, 0.14);
  padding-top: 18px;
}

.preview-linework {
  display: grid;
  align-content: end;
  padding: 22px;
}

.preview-linework > * {
  position: relative;
  z-index: 1;
}

.preview-linework span,
.preview-linework strong,
.preview-linework p {
  color: rgba(255, 241, 196, 0.86);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.68);
}

.preview-linework svg,
.preview-linework path,
.preview-linework line,
.preview-linework polyline {
  stroke: rgba(243, 210, 120, 0.76) !important;
  filter: drop-shadow(0 0 7px rgba(213, 163, 60, 0.22));
}

.preview-linework circle {
  fill: rgba(47, 125, 118, 0.28) !important;
  stroke: rgba(243, 210, 120, 0.7) !important;
}

body[data-route="lobby"] .work-surface,
body[data-route="rankings"] .work-surface,
body[data-route="archive"] .work-surface {
  width: min(1040px, 100%);
}

body[data-route="lobby"] .panel,
body[data-route="rankings"] .panel,
body[data-route="archive"] .panel {
  background:
    linear-gradient(145deg, rgba(236, 215, 170, 0.92), rgba(205, 169, 105, 0.9)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
}

body[data-route="lobby"] .panel-title,
body[data-route="rankings"] .panel-title,
body[data-route="archive"] .panel-title {
  min-height: 38px;
  margin: -2px -2px 16px;
  padding: 10px 12px;
  border: 1px solid rgba(213, 163, 60, 0.38);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(180deg, rgba(42, 19, 10, 0.96), rgba(12, 8, 6, 0.98)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  color: var(--rsg-gold-bright);
  box-shadow: inset 0 0 22px rgba(213, 163, 60, 0.08);
}

body[data-route="lobby"] .status-stack {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  color: #321909;
}

.status-stack strong,
.queue-card strong,
.match-meta strong,
.rating-row strong {
  color: #2c1508;
  font-family: var(--rsg-font-display);
  letter-spacing: 0.04em;
}

.status-stack span,
.queue-card span,
.match-meta,
.rating-row {
  color: #5d3f22;
}

.queue-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  border-color: rgba(47, 125, 118, 0.48);
  background:
    linear-gradient(135deg, rgba(232, 219, 176, 0.92), rgba(197, 157, 86, 0.82)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
}

.queue-card-found {
  border-color: rgba(213, 163, 60, 0.7);
  box-shadow:
    0 0 0 1px rgba(213, 163, 60, 0.2),
    0 14px 30px rgba(47, 125, 118, 0.16);
}

.queue-time {
  color: #2d1710;
  font-family: var(--rsg-font-display);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.load-match-row {
  gap: 10px;
}

body[data-route="rankings"] tbody td:first-child,
body[data-route="archive"] tbody td:first-child {
  position: relative;
  color: #241106;
  font-family: var(--rsg-font-display);
  font-weight: 700;
}

body[data-route="rankings"] tbody tr:nth-child(1) td:first-child::before,
body[data-route="rankings"] tbody tr:nth-child(2) td:first-child::before,
body[data-route="rankings"] tbody tr:nth-child(3) td:first-child::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

body[data-route="rankings"] tbody tr:nth-child(1) td:first-child::before {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-gold-serpent.png");
}

body[data-route="rankings"] tbody tr:nth-child(2) td:first-child::before {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-silver-serpent.png");
}

body[data-route="rankings"] tbody tr:nth-child(3) td:first-child::before {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-bronze-serpent.png");
}

body[data-route="rankings"] table,
body[data-route="archive"] table {
  box-shadow:
    0 18px 42px rgba(44, 21, 8, 0.18),
    inset 0 0 0 1px rgba(255, 246, 220, 0.3);
}

body[data-route="rankings"] td:nth-child(3),
body[data-route="archive"] td:nth-child(4) {
  color: #5a210f;
  font-family: var(--rsg-font-display);
  font-weight: 700;
}

.sidebar {
  gap: 12px;
}

.sidebar .panel {
  padding: 14px;
}

.sidebar .panel-title {
  font-size: var(--rsg-type-label);
}

.status-main {
  color: #271206;
  font-family: var(--rsg-font-display);
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.25;
}

.clock-grid {
  grid-template-columns: 1fr auto;
}

.clock-grid strong {
  color: #421c0c;
  font-family: var(--rsg-font-display);
}

.control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-grid button,
.button-row button,
.load-match-row button {
  min-height: 38px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--rsg-type-label);
}

body[data-route="rules"] .prose-panel p,
body[data-route="legal"] .prose-panel p {
  padding-left: 18px;
  border-left: 2px solid rgba(111, 33, 16, 0.18);
}

body[data-route="rules"] .prose-panel p:first-of-type,
body[data-route="legal"] .prose-panel p:first-of-type {
  border-left-color: rgba(213, 163, 60, 0.5);
}

.intro-modal {
  overflow: hidden;
}

.intro-overlay {
  z-index: 90;
}

.intro-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 0%, rgba(243, 210, 120, 0.14), transparent 18rem),
    linear-gradient(90deg, rgba(5, 3, 2, 0.12), transparent 42%, rgba(5, 3, 2, 0.26));
}

.intro-modal > * {
  position: relative;
  z-index: 1;
}

.toast-secondary {
  border-color: rgba(47, 125, 118, 0.66);
}

@media (max-width: 1180px) {
  body[data-route="play"] .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-route="play"] .sidebar {
    order: 2;
    width: min(820px, 100%);
    justify-self: center;
  }
}

@media (max-width: 980px) {
  .topbar {
    gap: 10px;
  }

  .rsg-flow-nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .rsg-nav-menu {
    position: fixed;
    top: auto;
    right: 12px;
    left: 12px;
    transform: translateY(-4px);
  }

  .rsg-nav-group:hover .rsg-nav-menu,
  .rsg-nav-group:focus-within .rsg-nav-menu {
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  body[data-route="lobby"] .status-stack,
  .queue-card {
    grid-template-columns: 1fr;
  }

  .control-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .prose-panel h1 {
    font-size: clamp(32px, 12vw, 44px);
  }

  .preview-linework {
    padding: 14px;
  }
}

@media (max-height: 700px) and (min-width: 981px) {
  body[data-route="play"] {
    --cell: clamp(32px, min(5.2vw, calc((100vh - 214px) / 8)), 58px);
  }

  body[data-route="play"] .board-shell {
    padding: 9px;
  }

  body[data-route="play"] .player-strip {
    min-height: 46px;
  }

  body[data-route="play"] .player-avatar {
    width: 34px;
    height: 34px;
  }

  body[data-route="play"] .sidebar .panel {
    padding: 10px;
  }

  body[data-route="play"] .move-list {
    max-height: 132px;
  }
}

@media (max-width: 620px) {
  body[data-route="play"] {
    --cell: clamp(42px, calc((100vw - 58px) / 5), 64px);
  }

  body[data-route="play"] .main-layout {
    padding-inline: 10px;
  }

  body[data-route="play"] .board-column {
    width: 100%;
  }

  body[data-route="play"] .board-shell {
    padding: 7px;
  }

  body[data-route="play"] .board-grid {
    padding: 5px;
  }

  body[data-route="play"] .sidebar {
    width: 100%;
  }

  body[data-route="play"] .sidebar .panel {
    padding: 12px;
  }

  .rsg-flow-nav button,
  .rsg-replay-controls button,
  .rsg-friend-row button,
  .rsg-invite-link button {
    min-height: 44px;
  }
}

/* 11. Expanded content layer */
.rsg-content {
  position: relative;
  z-index: 2;
}

.rsg-content h2,
.rsg-content h3 {
  margin: 0;
  color: #251207;
  font-family: var(--rsg-font-display);
  letter-spacing: 0.02em;
}

.rsg-content p {
  color: #3a2111;
}

.rsg-play-guide {
  border-color: rgba(47, 125, 118, 0.48);
}

.rsg-guide-list {
  display: grid;
  gap: 9px;
}

.rsg-guide-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(123, 67, 31, 0.18);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(135deg, rgba(255, 246, 220, 0.62), rgba(213, 184, 126, 0.25)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
}

.rsg-guide-item strong,
.rsg-guide-item span {
  display: block;
}

.rsg-guide-item strong {
  color: #2c1508;
  font-family: var(--rsg-font-display);
  font-size: var(--rsg-type-small);
}

.rsg-guide-item span {
  color: #5d3f22;
  font-family: var(--rsg-font-body);
  font-size: var(--rsg-type-small);
  line-height: 1.35;
}

.rsg-rule-icon,
.rsg-plaque-art,
.rsg-rule-visual,
.rsg-action-card > span {
  display: grid;
  place-items: center;
  border: 1px solid rgba(213, 163, 60, 0.42);
  border-radius: var(--rsg-radius-tight);
  background:
    radial-gradient(circle at 50% 38%, rgba(47, 125, 118, 0.18), transparent 58%),
    linear-gradient(145deg, rgba(18, 9, 5, 0.96), rgba(71, 28, 15, 0.9));
  box-shadow: inset 0 0 18px rgba(213, 163, 60, 0.08), 0 8px 18px rgba(0, 0, 0, 0.16);
}

.rsg-rule-icon {
  width: 42px;
  height: 42px;
}

.rsg-rule-icon svg,
.rsg-plaque-art svg,
.rsg-rule-visual svg,
.rsg-action-card svg {
  width: 78%;
  height: 78%;
  overflow: visible;
}

.rsg-rule-icon path,
.rsg-rule-icon circle,
.rsg-rule-visual path,
.rsg-rule-visual circle,
.rsg-plaque-art path,
.rsg-plaque-art circle,
.rsg-action-card path,
.rsg-action-card circle,
.rsg-action-card rect {
  fill: none;
  stroke: rgba(243, 210, 120, 0.82);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rsg-rule-icon circle,
.rsg-rule-visual circle,
.rsg-plaque-art circle,
.rsg-action-card circle {
  fill: rgba(47, 125, 118, 0.28);
}

.rsg-hero-banner {
  min-height: clamp(230px, 28vw, 360px);
  display: grid;
  align-items: end;
  margin: 18px 0 22px;
  padding: clamp(18px, 4vw, 34px);
  overflow: hidden;
  border: 1px solid rgba(213, 163, 60, 0.52);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.92), rgba(5, 3, 2, 0.34) 48%, rgba(5, 3, 2, 0.78)),
    url("/media/rsg-upgrade/rsg-content-hero-strip.png") center / cover;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42), inset 0 0 44px rgba(213, 163, 60, 0.1);
}

.rsg-hero-banner span {
  display: block;
  margin-bottom: 6px;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rsg-hero-banner h2 {
  max-width: 720px;
  color: #fff1c4;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.04;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.72);
}

.rsg-editorial-grid,
.rsg-piece-cards,
.rsg-action-grid,
.rsg-rule-grid {
  display: grid;
  gap: 14px;
}

.rsg-editorial-grid,
.rsg-piece-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rsg-editorial-grid article,
.rsg-piece-cards article,
.rsg-action-card,
.rsg-rule-card {
  border: 1px solid rgba(123, 67, 31, 0.18);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(145deg, rgba(255, 246, 220, 0.66), rgba(213, 184, 126, 0.22)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
  box-shadow: inset 0 0 24px rgba(255, 246, 220, 0.24);
}

.rsg-editorial-grid article,
.rsg-piece-cards article {
  padding: 16px;
}

.rsg-editorial-grid h3,
.rsg-piece-cards h3,
.rsg-rule-plaque h3 {
  margin-bottom: 7px;
  font-size: var(--rsg-type-card-title);
}

.rsg-editorial-grid p,
.rsg-piece-cards p,
.rsg-rule-plaque p,
.rsg-rule-card p,
.rsg-action-card p {
  margin: 0;
  font-family: var(--rsg-font-body);
  font-size: var(--rsg-type-body);
  line-height: var(--rsg-line-body);
}

.rsg-anatomy {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 26px);
  margin: 24px 0;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid rgba(213, 163, 60, 0.48);
  border-radius: 10px;
  background:
    linear-gradient(110deg, rgba(5, 3, 2, 0.94), rgba(39, 18, 10, 0.84)),
    url("/media/rsg-upgrade/rsg-section-bg-wide.png") center / cover;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.44);
}

.rsg-mini-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(330px, 100%);
  aspect-ratio: 5 / 8;
  align-self: center;
  justify-self: center;
  padding: 9px;
  border: 1px solid rgba(243, 210, 120, 0.7);
  border-radius: 10px;
  background:
    linear-gradient(rgba(9, 6, 4, 0.42), rgba(9, 6, 4, 0.7)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.58), 0 18px 38px rgba(0, 0, 0, 0.46);
}

.rsg-mini-board span {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(20, 8, 4, 0.42);
  background-position: center;
  background-size: cover;
}

.rsg-mini-board .light {
  background-image: url("/media/rsg-upgrade/derived/tiles/tile-light-lacquer.png");
}

.rsg-mini-board .dark {
  background-image: url("/media/rsg-upgrade/derived/tiles/tile-dark-lacquer.png");
}

.rsg-board-piece {
  width: 74%;
  aspect-ratio: 1;
  border: 0 !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  filter: drop-shadow(0 7px 8px rgba(0, 0, 0, 0.62));
}

.rsg-board-piece-light {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-snake.png") !important;
}

.rsg-board-piece-dark {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-snake.png") !important;
}

.rsg-board-piece-cobra {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-king-cobra.png") !important;
}

.rsg-plaque-stack {
  display: grid;
  gap: 12px;
}

.rsg-rule-plaque {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 116px;
  padding: 14px;
  border: 1px solid rgba(213, 163, 60, 0.36);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(135deg, rgba(255, 241, 196, 0.09), transparent),
    rgba(9, 6, 4, 0.72);
}

.rsg-rule-plaque h3,
.rsg-rule-plaque p {
  color: var(--rsg-ink);
}

.rsg-rule-plaque p {
  color: rgba(234, 215, 170, 0.86);
}

.rsg-plaque-art {
  width: 82px;
  height: 82px;
}

.rsg-piece-cards article {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.rsg-piece-cards h3 {
  grid-column: 2;
}

.rsg-piece-cards p {
  grid-column: 2;
}

.rsg-piece-image {
  grid-row: 1 / span 2;
  width: 82px;
  aspect-ratio: 1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.44));
}

.rsg-piece-regular {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-snake.png");
}

.rsg-piece-cobra {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-king-cobra.png");
}

.rsg-match-strip {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(47, 125, 118, 0.38);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(90deg, rgba(5, 3, 2, 0.88), rgba(21, 93, 82, 0.42)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  color: var(--rsg-ink);
}

.rsg-match-strip strong {
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
}

.rsg-match-strip span {
  color: rgba(234, 215, 170, 0.88);
}

.rsg-rulebook {
  max-width: 980px;
}

.rsg-rulebook .rsg-lead {
  max-width: 72ch;
  color: #291509;
  font-size: clamp(17px, 1.8vw, 21px);
}

.rsg-rule-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.rsg-rule-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.rsg-rule-card h2 {
  align-self: end;
  font-size: var(--rsg-type-card-title);
}

.rsg-rule-card p {
  grid-column: 2;
  align-self: start;
}

.rsg-rule-visual {
  grid-row: 1 / span 2;
  width: 92px;
  height: 92px;
}

.rsg-route-intro {
  padding: clamp(18px, 3vw, 26px);
}

.rsg-route-intro h2 {
  max-width: 760px;
  margin-bottom: 8px;
  color: #231106;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
}

.rsg-route-intro > p {
  max-width: 66ch;
  margin: 0;
  color: #3a2111;
  font-family: var(--rsg-font-body);
  font-size: var(--rsg-type-body);
  line-height: var(--rsg-line-body);
}

.rsg-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.rsg-action-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.rsg-action-card > span {
  width: 58px;
  height: 58px;
}

.rsg-action-card strong {
  color: #2c1508;
  font-family: var(--rsg-font-display);
  font-size: var(--rsg-type-card-title);
  line-height: 1.18;
}

.rsg-rank-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.rsg-rank-emblem {
  width: 58px;
  aspect-ratio: 1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.28));
}

.rsg-rank-gold {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-gold-serpent.png");
}

.rsg-rank-silver {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-silver-serpent.png");
}

.rsg-rank-bronze {
  background-image: url("/media/rsg-upgrade/derived/ranks/rank-bronze-serpent.png");
}

.rsg-legal-intro {
  max-width: 820px;
}

body[data-route="about"] .rsg-expanded-about {
  margin-top: 0;
}

body[data-route="about"] .prose-panel:not(.rsg-expanded-about) .about-duel-preview {
  display: none;
}

body[data-route="rules"] .rsg-rulebook {
  margin-top: 0;
}

body[data-route="rules"] .work-surface > .prose-panel:not(.rsg-rulebook) {
  display: none;
}

body[data-route="lobby"] .rsg-chamber,
body[data-route="rankings"] .rsg-ledger,
body[data-route="archive"] .rsg-ledger {
  margin-top: clamp(64px, 10vw, 118px);
}

body[data-route="lobby"] .rsg-chamber + .panel,
body[data-route="rankings"] .rsg-ledger + .panel,
body[data-route="archive"] .rsg-ledger + .panel {
  margin-top: 0;
}

@media (max-width: 900px) {
  .rsg-editorial-grid,
  .rsg-piece-cards,
  .rsg-anatomy,
  .rsg-rule-grid,
  .rsg-action-grid {
    grid-template-columns: 1fr;
  }

  .rsg-piece-cards article,
  .rsg-rule-card {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .rsg-piece-image,
  .rsg-rule-visual {
    width: 74px;
    height: 74px;
  }
}

@media (max-width: 560px) {
  .rsg-hero-banner {
    min-height: 220px;
    padding: 16px;
  }

  .rsg-hero-banner h2 {
    font-size: 30px;
  }

  .rsg-rule-plaque {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .rsg-plaque-art {
    width: 58px;
    height: 58px;
  }

  .rsg-rule-card p,
  .rsg-piece-cards p {
    grid-column: 1 / -1;
  }
}

/* 12. Premium archive replay */
.rsg-replay-intro {
  margin-top: clamp(64px, 10vw, 118px);
  padding: clamp(18px, 3vw, 28px);
  border-color: rgba(47, 125, 118, 0.46);
  background:
    linear-gradient(105deg, rgba(236, 215, 170, 0.94), rgba(205, 169, 105, 0.88)),
    url("/media/rsg-upgrade/rsg-parchment-panel.png") center / cover;
}

.rsg-archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.rsg-archive-actions span {
  color: #4c321a;
  font-size: 13px;
}

.rsg-replay-intro + .rsg-ledger,
.rsg-replay-intro + .rsg-route-intro {
  margin-top: 0;
}

.rsg-replay-intro h2 {
  max-width: 760px;
  margin: 0 0 8px;
  color: #231106;
  font-family: var(--rsg-font-display);
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
}

.rsg-replay-intro p {
  max-width: 70ch;
  margin: 0 0 16px;
  color: #3a2111;
  font-family: var(--rsg-font-body);
  font-size: 17px;
  line-height: 1.62;
}

.rsg-watch-replay,
.rsg-watch-latest {
  white-space: nowrap;
}

/* 12b. Invites and friends */
.rsg-social-panel {
  position: relative;
  overflow: hidden;
}

.rsg-social-panel h2 {
  margin: 0 0 12px;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  font-size: var(--rsg-type-card-title);
  line-height: 1.18;
}

.rsg-social-panel p {
  margin: 0;
  color: rgba(234, 215, 170, 0.82);
  font-family: var(--rsg-font-body);
  font-size: var(--rsg-type-body);
  line-height: var(--rsg-line-body);
}

.rsg-social-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.rsg-invite-card,
.rsg-friends-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(213, 163, 60, 0.28);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(145deg, rgba(255, 241, 196, 0.08), rgba(5, 3, 2, 0.28)),
    rgba(8, 5, 3, 0.52);
}

.rsg-invite-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rsg-invite-link input {
  min-width: 0;
  border: 1px solid rgba(213, 163, 60, 0.32);
  border-radius: var(--rsg-radius-tight);
  background: rgba(5, 3, 2, 0.58);
  color: var(--rsg-ink);
  cursor: text;
  padding: 10px;
  font-size: var(--rsg-type-small);
  user-select: text;
  -webkit-user-select: text;
}

.rsg-invite-link button,
.rsg-friend-row button,
.rsg-challenge-list button {
  border: 1px solid rgba(213, 163, 60, 0.5);
  border-radius: var(--rsg-radius-tight);
  background: linear-gradient(180deg, rgba(111, 33, 16, 0.96), rgba(46, 14, 7, 0.98));
  color: var(--rsg-gold-bright);
  font-size: var(--rsg-type-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rsg-friend-row button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.rsg-invite-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rsg-invite-stats span {
  padding: 10px;
  border: 1px solid rgba(47, 125, 118, 0.28);
  border-radius: var(--rsg-radius-tight);
  background: rgba(47, 125, 118, 0.11);
  color: rgba(234, 215, 170, 0.78);
  font-size: var(--rsg-type-small);
}

.rsg-invite-stats strong {
  display: block;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  font-size: 22px;
}

.rsg-invite-registered {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: rgba(234, 215, 170, 0.76);
  font-size: var(--rsg-type-small);
}

.rsg-invite-registered strong {
  flex-basis: 100%;
  color: var(--rsg-gold);
  font-size: var(--rsg-type-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rsg-invite-registered span,
.rsg-invite-registered em {
  padding: 5px 8px;
  border: 1px solid rgba(213, 163, 60, 0.22);
  border-radius: 999px;
  background: rgba(255, 241, 196, 0.06);
  font-style: normal;
}

.rsg-friend-list,
.rsg-challenge-list {
  display: grid;
  gap: 8px;
}

.rsg-challenge-list {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(213, 163, 60, 0.16);
}

.rsg-challenge-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  text-align: left;
}

.rsg-challenge-list span {
  color: rgba(184, 245, 226, 0.92);
}

.rsg-friend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(213, 163, 60, 0.18);
  border-radius: var(--rsg-radius-tight);
  background: rgba(255, 241, 196, 0.05);
}

.rsg-friend-row > span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(124, 112, 94, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 112, 94, 0.12);
}

.rsg-friend-row > span.online {
  background: #61d6b4;
  box-shadow: 0 0 0 3px rgba(97, 214, 180, 0.16), 0 0 18px rgba(97, 214, 180, 0.35);
}

.rsg-friend-row strong,
.rsg-friend-row em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsg-friend-row strong {
  color: var(--rsg-ink);
}

.rsg-friend-row em {
  color: rgba(234, 215, 170, 0.68);
  font-size: var(--rsg-type-small);
  font-style: normal;
}

.rsg-social-message {
  margin-top: 12px !important;
  color: rgba(184, 245, 226, 0.92) !important;
  font-size: 13px;
}

@media (max-width: 840px) {
  .rsg-social-grid,
  .rsg-invite-link {
    grid-template-columns: 1fr;
  }
}

.rsg-replay-lock {
  overflow: hidden;
}

.rsg-replay-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2vw, 28px);
  background:
    radial-gradient(circle at 50% 24%, rgba(213, 163, 60, 0.13), transparent 28rem),
    rgba(4, 3, 2, 0.88);
  backdrop-filter: blur(8px);
}

.rsg-replay-overlay.rsg-replay-open {
  display: flex;
}

.rsg-replay-modal {
  position: relative;
  width: min(1180px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  border: 1px solid rgba(213, 163, 60, 0.78);
  border-radius: 10px;
  background:
    linear-gradient(140deg, rgba(7, 4, 3, 0.96), rgba(34, 16, 9, 0.96)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  color: var(--rsg-ink);
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.76), inset 0 0 52px rgba(213, 163, 60, 0.08);
  padding: clamp(16px, 3vw, 28px);
}

.rsg-replay-modal::before {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border: 1px solid rgba(243, 210, 120, 0.16);
  border-radius: 7px;
}

.rsg-replay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  border: 1px solid rgba(213, 163, 60, 0.64);
  border-radius: var(--rsg-radius-tight);
  background: rgba(8, 5, 3, 0.86);
  color: var(--rsg-gold-bright);
  padding: 8px 10px;
}

.rsg-replay-header {
  position: relative;
  padding-right: 86px;
  margin-bottom: 18px;
}

.rsg-replay-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--rsg-gold);
  font-family: var(--rsg-font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rsg-replay-header h2 {
  margin: 0;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
}

.rsg-replay-subtitle {
  max-width: 680px;
  margin: 8px 0 0;
  color: rgba(234, 215, 170, 0.84);
  font-family: var(--rsg-font-body);
  font-size: 16px;
}

.rsg-replay-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 560px) minmax(280px, 1fr);
  gap: clamp(16px, 3vw, 28px);
  align-items: start;
}

.rsg-replay-board-wrap,
.rsg-replay-panel {
  border: 1px solid rgba(213, 163, 60, 0.36);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(145deg, rgba(255, 241, 196, 0.08), rgba(5, 3, 2, 0.28)),
    rgba(8, 5, 3, 0.64);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.34);
}

.rsg-replay-board-wrap {
  padding: clamp(12px, 2vw, 18px);
}

.rsg-replay-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.rsg-replay-players div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(213, 163, 60, 0.24);
  border-radius: var(--rsg-radius-tight);
  background: rgba(255, 241, 196, 0.06);
}

.rsg-replay-players span,
.rsg-replay-current span {
  display: block;
  color: rgba(213, 163, 60, 0.78);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rsg-replay-players strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--rsg-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsg-replay-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(470px, 100%);
  max-height: min(58vh, 600px);
  aspect-ratio: 5 / 8;
  margin: 0 auto;
  padding: clamp(7px, 1.4vw, 12px);
  border: 1px solid rgba(243, 210, 120, 0.62);
  border-radius: 10px;
  background:
    linear-gradient(rgba(9, 6, 4, 0.48), rgba(9, 6, 4, 0.72)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.52), inset 0 0 28px rgba(0, 0, 0, 0.56);
  contain: layout paint;
}

.rsg-replay-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(20, 8, 4, 0.5);
  background-position: center;
  background-size: cover;
}

.rsg-replay-cell.light {
  background-image:
    linear-gradient(rgba(198, 83, 49, 0.08), rgba(198, 83, 49, 0.08)),
    url("/media/rsg-upgrade/derived/tiles/tile-light-lacquer.png");
}

.rsg-replay-cell.dark {
  background-image:
    linear-gradient(rgba(80, 24, 14, 0.18), rgba(80, 24, 14, 0.18)),
    url("/media/rsg-upgrade/derived/tiles/tile-dark-lacquer.png");
}

.rsg-replay-cell.from {
  box-shadow: inset 0 0 0 3px rgba(47, 125, 118, 0.84), inset 0 0 18px rgba(47, 125, 118, 0.22);
}

.rsg-replay-cell.to {
  box-shadow: inset 0 0 0 3px rgba(243, 210, 120, 0.96), inset 0 0 18px rgba(243, 210, 120, 0.26);
}

.rsg-replay-cell.to::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(243, 210, 120, 0.36);
  border-radius: 999px;
  opacity: 0.62;
  animation: rsgArrivalAura 900ms ease-out both;
}

.rsg-replay-cell.from::before {
  content: "FROM";
  position: absolute;
  left: 6px;
  top: 5px;
  z-index: 3;
  color: rgba(136, 231, 207, 0.92);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.rsg-replay-cell.to::before {
  content: "TO";
  position: absolute;
  left: 6px;
  top: 5px;
  z-index: 3;
  color: rgba(255, 232, 151, 0.96);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.rsg-replay-promo {
  position: absolute;
  inset: 12%;
  background: url("/media/rsg-upgrade/derived/vfx/vfx-promotion-sparkle.png") center / contain no-repeat;
  opacity: 0.14;
}

.rsg-replay-piece {
  width: 74%;
  aspect-ratio: 1;
  z-index: 2;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.66));
}

.rsg-replay-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, auto);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(213, 163, 60, 0.38);
  border-radius: var(--rsg-radius);
  background:
    linear-gradient(180deg, rgba(18, 9, 5, 0.96), rgba(5, 3, 2, 0.98)),
    url("/media/rsg-upgrade/rsg-ui-material-texture.png") center / cover;
  box-shadow: 0 -14px 30px rgba(0, 0, 0, 0.24), inset 0 0 22px rgba(213, 163, 60, 0.07);
}

.rsg-replay-piece.light.snake {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-snake.png");
}

.rsg-replay-piece.dark.snake {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-snake.png");
}

.rsg-replay-piece.light.cobra {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-light-king-cobra.png");
}

.rsg-replay-piece.dark.cobra {
  background-image: url("/media/rsg-upgrade/derived/pieces/piece-dark-king-cobra.png");
}

.rsg-replay-scrub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.rsg-replay-scrub input {
  accent-color: var(--rsg-gold);
}

.rsg-replay-scrub span {
  color: rgba(234, 215, 170, 0.86);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.rsg-replay-controls {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.rsg-replay-controls button {
  min-height: 38px;
  border: 1px solid rgba(213, 163, 60, 0.55);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(180deg, rgba(111, 33, 16, 0.96), rgba(46, 14, 7, 0.98));
  color: var(--rsg-gold-bright);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rsg-replay-controls button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.rsg-replay-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
  padding: 14px;
}

.rsg-replay-result {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(47, 125, 118, 0.42);
  border-radius: var(--rsg-radius-tight);
  background: rgba(47, 125, 118, 0.12);
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
}

.rsg-replay-current {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(213, 163, 60, 0.2);
}

.rsg-replay-current strong {
  display: block;
  margin-top: 3px;
  color: var(--rsg-ink);
}

.rsg-replay-analysis {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(213, 163, 60, 0.28);
  border-radius: var(--rsg-radius-tight);
  background:
    linear-gradient(145deg, rgba(15, 8, 5, 0.78), rgba(73, 18, 11, 0.26)),
    rgba(255, 241, 196, 0.05);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.28);
}

.rsg-analysis-empty,
.rsg-analysis-loading,
.rsg-analysis-error,
.rsg-analysis-summary,
.rsg-analysis-current,
.rsg-analysis-moments {
  display: grid;
  gap: 6px;
}

.rsg-analysis-empty strong,
.rsg-analysis-loading strong,
.rsg-analysis-error strong,
.rsg-analysis-summary strong,
.rsg-analysis-current strong {
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
  font-size: 15px;
}

.rsg-analysis-empty span,
.rsg-analysis-loading span,
.rsg-analysis-error span,
.rsg-analysis-summary span,
.rsg-analysis-current p,
.rsg-analysis-muted {
  margin: 0;
  color: rgba(234, 215, 170, 0.78);
  font-family: var(--rsg-font-body);
  font-size: 13px;
  line-height: 1.45;
}

.rsg-analysis-summary meter {
  width: 100%;
  height: 8px;
  accent-color: var(--rsg-emerald);
}

.rsg-analysis-summary em {
  color: rgba(213, 163, 60, 0.82);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rsg-analysis-current {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(213, 163, 60, 0.18);
}

.rsg-analysis-current span,
.rsg-analysis-moments > span {
  color: rgba(213, 163, 60, 0.78);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rsg-analysis-moments {
  margin-top: 12px;
}

.rsg-analysis-moment {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(213, 163, 60, 0.24);
  border-radius: var(--rsg-radius-tight);
  background: rgba(255, 241, 196, 0.06);
  color: rgba(234, 215, 170, 0.86);
  text-align: left;
}

.rsg-analysis-moment:hover,
.rsg-analysis-moment:focus-visible {
  border-color: rgba(243, 210, 120, 0.64);
  background: rgba(213, 163, 60, 0.13);
}

.rsg-analysis-moment span {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(47, 125, 118, 0.28);
  color: var(--rsg-gold-bright);
  font-size: 11px;
}

.rsg-analysis-moment strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rsg-gold-bright);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsg-analysis-moment em {
  min-width: 0;
  overflow: hidden;
  color: rgba(234, 215, 170, 0.72);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsg-replay-moves {
  min-height: 0;
  max-height: min(52vh, 520px);
  overflow: auto;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
}

.rsg-replay-moves button {
  width: 100%;
  display: grid;
  grid-template-columns: 38px 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(213, 163, 60, 0.18);
  border-radius: var(--rsg-radius-tight);
  background: rgba(255, 241, 196, 0.06);
  color: rgba(234, 215, 170, 0.86);
  text-align: left;
}

.rsg-replay-moves li.active button {
  border-color: rgba(243, 210, 120, 0.68);
  background: rgba(213, 163, 60, 0.14);
  color: var(--rsg-gold-bright);
}

.rsg-replay-moves span,
.rsg-replay-moves strong {
  font-variant-numeric: tabular-nums;
}

.rsg-replay-moves em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsg-analysis-badge {
  max-width: 140px;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid rgba(47, 125, 118, 0.44);
  border-radius: 999px;
  background: rgba(47, 125, 118, 0.14);
  color: rgba(184, 245, 226, 0.92);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.rsg-replay-error {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: var(--rsg-gold-bright);
  text-align: center;
}

.rsg-replay-loading .rsg-replay-board::before {
  content: "Loading replay...";
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: var(--rsg-gold-bright);
  font-family: var(--rsg-font-display);
}

@media (max-width: 920px) {
  .rsg-replay-stage {
    grid-template-columns: 1fr;
  }

  .rsg-replay-board {
    width: min(430px, calc(100vw - 62px));
    max-height: 56vh;
  }

  .rsg-replay-footer {
    position: static;
    grid-template-columns: 1fr;
  }

  .rsg-replay-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rsg-replay-panel {
    max-height: none;
  }
}

@media (max-height: 780px) and (min-width: 921px) {
  .rsg-replay-modal {
    max-height: 96vh;
    padding: 14px;
  }

  .rsg-replay-header {
    margin-bottom: 10px;
  }

  .rsg-replay-header h2 {
    font-size: clamp(28px, 4vw, 40px);
  }

  .rsg-replay-board {
    width: min(390px, 100%);
    max-height: 54vh;
  }

  .rsg-replay-stage {
    grid-template-columns: minmax(280px, 430px) minmax(280px, 1fr);
  }
}

@media (max-width: 560px) {
  .rsg-replay-overlay {
    padding: 0;
  }

  .rsg-replay-modal {
    max-height: 100vh;
    border-radius: 0;
  }

  .rsg-replay-header {
    padding-right: 74px;
  }

  .rsg-replay-players,
  .rsg-replay-scrub,
  .rsg-replay-controls {
    grid-template-columns: 1fr;
  }

  .rsg-replay-board {
    width: min(340px, calc(100vw - 32px));
    max-height: 52vh;
  }
}

.rsg-utility-footer {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 34px) 24px;
  text-align: right;
}

.rsg-utility-footer button {
  border: 0;
  background: transparent;
  color: rgba(234, 215, 170, 0.68);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rights-panel p {
  margin: 0;
  color: #4a2b16;
  font-family: var(--rsg-font-body);
  font-size: var(--rsg-type-body);
  line-height: var(--rsg-line-body);
}

.rights-panel-compact {
  box-shadow: var(--rsg-shadow-panel), inset 0 0 34px rgba(255, 246, 220, 0.28);
}
