:root {
  --bg: #14110f;
  --bg-soft: #201b18;
  --panel: rgba(32, 27, 24, 0.9);
  --panel-strong: rgba(22, 18, 16, 0.95);
  --line: rgba(255, 240, 219, 0.16);
  --text: #fff5e8;
  --muted: #d7c7b3;
  --accent: #ff5b2e;
  --accent-2: #f7c14b;
  --tool-accent: #8fb8c9;
  --tool-accent-strong: #6fa5ba;
  --good: #4ec78f;
  --danger: #ff6e5e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 91, 46, 0.22), transparent 24rem),
    radial-gradient(circle at top right, rgba(247, 193, 75, 0.12), transparent 30rem),
    linear-gradient(180deg, #1d1715 0%, #100d0c 100%);
  color: var(--text);
  font-family: "Trebuchet MS", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
}

body {
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 100%);
  mask-image: radial-gradient(circle at center, black 35%, transparent 100%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-actions,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 28px 30px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -8% -55% 50%;
  height: 240px;
  background: linear-gradient(90deg, rgba(255, 91, 46, 0.32), rgba(247, 193, 75, 0.08));
  transform: rotate(-7deg);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent-2);
  font-size: 0.74rem;
}

.eyebrow-help {
  display: inline-block;
  margin-left: 0.6rem;
  color: rgba(255, 245, 232, 0.84);
  font-family: "Trebuchet MS", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: none;
}

h1,
h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.4rem, 4vw, 4.6rem);
  line-height: 0.96;
  max-width: 14ch;
}

.hero-text,
.panel-header p,
.status-card p,
.hint {
  color: var(--muted);
}

.hero-text {
  margin: 16px 0 0;
  max-width: 60ch;
  line-height: 1.6;
}

.hero-actions {
  min-width: 132px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 12px;
}

.seo-summary {
  margin-top: 24px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 17, 15, 0.78);
  box-shadow: var(--shadow);
  color: var(--muted);
  line-height: 1.6;
}

.seo-summary h2 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: 0.03em;
}

.seo-summary p {
  max-width: 76ch;
  margin: 0 0 10px;
}

.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.seo-links a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 16px;
  border: 1px solid rgba(247, 193, 75, 0.35);
  border-radius: 999px;
  color: #ffe0a0;
  text-decoration: none;
  background: rgba(247, 193, 75, 0.08);
}

body.app-game-screen .seo-summary {
  display: none;
}

.language-switch {
  display: inline-flex;
  gap: 8px;
  align-self: flex-end;
}

.audio-control {
  width: 100%;
  max-width: 220px;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.audio-dual-control {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.audio-channel-control {
  --level: 0.5;
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(143, 184, 201, 0.34);
  border-radius: 9px;
  color: var(--tool-accent-strong);
  background:
    linear-gradient(90deg, rgba(111, 165, 186, 0.12) 0 50%, rgba(255, 93, 61, 0.08) 50% 100%),
    rgba(8, 7, 7, 0.48);
  box-shadow: inset 0 0 0 1px rgba(255, 245, 232, 0.03);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
  user-select: none;
}

.audio-channel-control::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 50%;
  width: 1px;
  background: rgba(255, 245, 232, 0.14);
  pointer-events: none;
}

.audio-channel-control svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.audio-channel-control.is-muted {
  color: rgba(255, 100, 76, 0.9);
}

.audio-channel-control.is-muted::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  z-index: 2;
  width: 22px;
  height: 19px;
  background:
    linear-gradient(45deg, transparent 45%, rgba(255, 100, 76, 0.98) 47%, rgba(255, 100, 76, 0.98) 54%, transparent 56%),
    linear-gradient(-45deg, transparent 45%, rgba(255, 100, 76, 0.98) 47%, rgba(255, 100, 76, 0.98) 54%, transparent 56%);
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.86));
  pointer-events: none;
}

.audio-meter {
  position: relative;
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 245, 232, 0.2);
  pointer-events: none;
}

.audio-meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--level) * 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tool-accent-strong), var(--accent));
}

.audio-channel-control:hover {
  border-color: rgba(143, 184, 201, 0.52);
  background:
    linear-gradient(90deg, rgba(111, 165, 186, 0.18) 0 50%, rgba(255, 93, 61, 0.12) 50% 100%),
    rgba(8, 7, 7, 0.52);
}

.audio-channel-control:active {
  transform: translateY(1px);
  filter: brightness(1.12);
}

.audio-control .audio-channel-control {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 14px;
  justify-items: center;
  align-items: center;
  height: 58px;
  padding: 8px 11px 9px;
  gap: 6px;
}

.audio-control .audio-channel-control::before {
  display: none;
}

.audio-control .audio-channel-control svg {
  width: 23px;
  height: 23px;
}

.audio-control .audio-meter {
  width: 100%;
  height: 14px;
  overflow: visible;
  background: transparent;
}

.audio-control .audio-meter::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border: 1px solid rgba(143, 184, 201, 0.42);
  border-radius: 999px;
  background: rgba(255, 245, 232, 0.12);
}

.audio-control .audio-meter span {
  top: 50%;
  bottom: auto;
  height: 4px;
  transform: translateY(-50%);
}

.audio-control .audio-meter span::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow:
    0 0 0 2px rgba(255, 245, 232, 0.13),
    0 0 11px rgba(255, 93, 61, 0.45);
  transform: translate(50%, -50%);
}

.audio-mute-toggle {
  display: none !important;
  min-width: 128px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

body.app-ipad-runtime .audio-mute-toggle,
body.app-touch-audio-toggle .audio-mute-toggle {
  display: inline-flex !important;
}

body.app-ipad-runtime .hero-actions .audio-mute-toggle,
body.app-touch-audio-toggle .hero-actions .audio-mute-toggle {
  width: 100%;
  max-width: 220px;
  align-self: flex-end;
}

.audio-mute-toggle.is-muted {
  color: #fff3ed;
  border-color: rgba(255, 109, 58, 0.58);
  background: rgba(126, 34, 24, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 109, 58, 0.2);
}

.audio-control-label {
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.audio-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.audio-control input[type="range"] {
  width: 100%;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.audio-control output {
  min-width: 40px;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.lang-btn,
.primary-btn,
.secondary-btn,
.ghost-btn,
input,
select,
textarea {
  border-radius: 14px;
  border: 1px solid var(--line);
}

.lang-btn,
.primary-btn,
.secondary-btn,
.ghost-btn {
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.lang-btn {
  min-width: 54px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.lang-btn.is-active,
.lang-btn:hover {
  background: rgba(255, 91, 46, 0.18);
  border-color: rgba(255, 91, 46, 0.55);
}

.status-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #61e0a5, #1a7f56);
  box-shadow: 0 0 16px rgba(78, 199, 143, 0.6);
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 24px;
}

.panel {
  padding: 22px;
  animation: rise 480ms ease both;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  animation-delay: 50ms;
}

.canvas-panel {
  animation-delay: 120ms;
  display: flex;
  flex-direction: column;
  min-height: 780px;
}

.info-panel {
  animation-delay: 190ms;
}

.info-panel[hidden] {
  display: none;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header-with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-actions {
  display: none;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.panel-volume-control {
  display: grid;
  gap: 4px;
  min-width: 220px;
  padding: 8px 12px 9px;
  border-radius: 18px;
  border: 1px solid rgba(255, 245, 232, 0.14);
  background: rgba(8, 7, 7, 0.42);
}

.panel-audio-control {
  min-width: 220px;
  padding: 8px 10px;
  gap: 8px;
}

.panel-audio-control .audio-channel-control {
  height: 34px;
  border-radius: 999px;
}

.lap-control {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 8px 12px 9px;
  border-radius: 18px;
  border: 1px solid rgba(255, 245, 232, 0.14);
  background: rgba(8, 7, 7, 0.42);
}

.replay-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.replay-stack {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.replay-btn {
  flex-shrink: 0;
}

.replay-pause-btn {
  min-width: 104px;
}

.replay-step-btn {
  min-width: 84px;
}

.replay-speed-control {
  min-width: 154px;
}

.turn-order-btn {
  min-width: 84px;
  white-space: nowrap;
}

.turn-magnifier-btn {
  min-width: 90px;
  white-space: nowrap;
}

#demoBtn,
#turnOrderBtn,
#turnMagnifierBtn {
  color: var(--tool-accent);
  border-color: rgba(143, 184, 201, 0.26);
  background: rgba(111, 165, 186, 0.08);
}

#demoBtn[hidden] {
  display: none !important;
}

#demoBtn:hover,
#turnOrderBtn:hover,
#turnMagnifierBtn:hover {
  border-color: rgba(143, 184, 201, 0.46);
  background: rgba(111, 165, 186, 0.14);
}

#demoBtn.is-active,
#turnOrderBtn.is-active,
#turnMagnifierBtn.is-active {
  background: rgba(111, 165, 186, 0.18);
  border-color: rgba(143, 184, 201, 0.52);
  color: #eef7fb;
}

#lapControl,
.panel-actions > .panel-volume-control,
.panel-actions > .audio-mute-toggle {
  border-color: rgba(143, 184, 201, 0.2);
  background: rgba(57, 78, 88, 0.26);
}

#lapControl .panel-volume-label,
.panel-actions > .panel-volume-control .panel-volume-label {
  color: var(--tool-accent);
}

#lapControl .lap-count-value,
.panel-actions > .panel-volume-control output {
  color: #eef7fb;
}

#lapControl .lap-step-btn {
  color: var(--tool-accent);
  border-color: rgba(143, 184, 201, 0.24);
  background: rgba(111, 165, 186, 0.08);
}

#lapControl .lap-step-btn:hover {
  border-color: rgba(143, 184, 201, 0.42);
  background: rgba(111, 165, 186, 0.14);
}

.panel-actions > .panel-volume-control input[type="range"] {
  accent-color: var(--tool-accent-strong);
}

.panel-volume-label {
  color: rgba(247, 193, 75, 0.92);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lap-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lap-step-btn {
  min-width: 40px;
  height: 38px;
  padding: 0 12px;
  font-size: 1.05rem;
}

.lap-count-value {
  min-width: 44px;
  color: #fff5e8;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.panel-volume-control input[type="range"] {
  min-width: 120px;
  padding: 0;
  background: transparent;
}

.panel-volume-control output {
  min-width: 46px;
  color: #fff5e8;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: right;
}

.renderer-badge {
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(247, 193, 75, 0.3);
  background: rgba(247, 193, 75, 0.1);
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.panel-header h2 {
  font-size: 1.46rem;
  margin-bottom: 8px;
}

.panel-header p {
  margin: 0;
  line-height: 1.5;
}

.controls-editor-entry {
  margin-bottom: 18px;
}

.controls-editor-btn {
  position: relative;
  width: 100%;
  min-height: 58px;
  border-color: rgba(247, 193, 75, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(247, 193, 75, 0.18),
    0 0 0 rgba(247, 193, 75, 0);
  font-size: 1.05rem;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.controls-editor-btn:hover,
.controls-editor-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(247, 193, 75, 0.98);
  background:
    linear-gradient(180deg, rgba(247, 193, 75, 0.22), rgba(255, 91, 46, 0.12)),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(247, 193, 75, 0.34),
    0 0 0 3px rgba(247, 193, 75, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.32);
  color: #fff8ed;
}

.controls-editor-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 50%;
  width: min(310px, 90vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(247, 193, 75, 0.5);
  background: rgba(24, 21, 19, 0.96);
  color: rgba(255, 245, 232, 0.96);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.controls-editor-btn::before {
  content: "";
  position: absolute;
  z-index: 21;
  top: calc(100% + 5px);
  left: 50%;
  width: 10px;
  height: 10px;
  border-left: 1px solid rgba(247, 193, 75, 0.5);
  border-top: 1px solid rgba(247, 193, 75, 0.5);
  background: rgba(24, 21, 19, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px) rotate(45deg);
  transition: opacity 160ms ease, transform 160ms ease;
}

.controls-editor-btn:hover::after,
.controls-editor-btn:focus-visible::after,
.controls-editor-btn:hover::before,
.controls-editor-btn:focus-visible::before {
  opacity: 1;
}

.controls-editor-btn:hover::after,
.controls-editor-btn:focus-visible::after {
  transform: translate(-50%, 0);
}

.controls-editor-btn:hover::before,
.controls-editor-btn:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

.control-row,
.textarea-label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
}

select,
input,
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
}

select {
  margin-bottom: 14px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.action-grid {
  margin-bottom: 10px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.file-label {
  min-height: 48px;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(180deg, #ff6e36, #ff4f21);
  color: #fff;
  border: 0;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.ghost-btn {
  background: transparent;
  color: var(--accent-2);
}

.ghost-btn.is-active {
  background: rgba(247, 193, 75, 0.14);
  border-color: rgba(247, 193, 75, 0.38);
  color: #fff5e8;
}

.ghost-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.file-label:hover {
  transform: translateY(-1px);
}

textarea {
  min-height: 380px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.35;
}

.control-divider {
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 219, 0.28), transparent);
}

.panel-subheader {
  margin-bottom: 14px;
}

.panel-subheader.compact {
  margin-bottom: 12px;
}

.panel-subheader h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-subheader p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.name-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 0;
}

.field-label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.field-label span {
  font-size: 0.95rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.setup-stack {
  display: grid;
  gap: 18px;
  flex: 1 1 auto;
}

.controls-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 4px;
}

.initial-version-badge,
.initial-copyright-badge {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.initial-version-badge {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.04em;
  color: rgba(122, 173, 220, 0.94);
}

.initial-copyright-badge {
  color: rgba(242, 197, 95, 0.92);
}

.initial-copyright-badge a,
.game-copyright-badge a {
  color: inherit;
  text-decoration: none;
}

.initial-copyright-badge a:hover,
.game-copyright-badge a:hover {
  color: #ffd77c;
}

.setup-block {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(13, 10, 9, 0.72);
}

.setup-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.setup-block-head h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-block-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.selection-badge {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-badge.is-ready {
  color: #ffd7c4;
}

.preview-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-headline h2 {
  text-transform: none;
}

.preview-canvas-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 34px;
  padding: 0 10px 2px;
}

.game-track-author-badge {
  display: none;
  pointer-events: none;
}

.game-track-author-badge[hidden] {
  display: none !important;
}

.preview-canvas-track-name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 0.96;
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(255, 245, 232, 0.96);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-canvas-record {
  flex: 0 1 min(68%, 760px);
  max-width: min(68%, 760px);
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 232, 188, 0.96);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  text-shadow:
    0 2px 5px rgba(0, 0, 0, 0.82),
    0 0 10px rgba(0, 0, 0, 0.62);
}

.preview-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.track-browser {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 10px 14px;
  align-items: stretch;
}

.track-scroll-btn {
  width: 56px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(18, 14, 12, 0.88);
  color: var(--accent-2);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.track-scroll-btn:hover:not([disabled]) {
  transform: translateY(-1px);
  border-color: rgba(255, 91, 46, 0.5);
}

.track-scroll-btn[disabled] {
  opacity: 0.36;
  cursor: not-allowed;
}

.track-scroll-btn:first-child {
  grid-column: 1;
  grid-row: 1;
}

.track-scroll-btn:last-child {
  grid-column: 1;
  grid-row: 2;
}

.track-list-frame {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 240, 219, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(11, 9, 8, 0.86);
  overflow: hidden;
}

.track-list {
  display: grid;
  gap: 8px;
  min-height: calc(42px * 13 + 8px * 12);
  align-content: start;
}

.track-list-total {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: end;
  padding-right: 10px;
  color: rgba(247, 193, 75, 0.96);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}

.track-list-item {
  position: relative;
  width: 100%;
  min-height: 42px;
  padding: 10px 36px 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 240, 219, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.track-list-item:hover,
.track-list-item:focus-visible,
.track-list-item.is-preview {
  transform: translateX(2px);
  border-color: rgba(247, 193, 75, 0.32);
  background: rgba(247, 193, 75, 0.1);
  outline: none;
}

.track-list-item.is-selected {
  border-color: rgba(196, 55, 42, 0.8);
  background:
    linear-gradient(90deg, rgba(101, 28, 22, 0.9), rgba(58, 17, 14, 0.7)),
    rgba(255, 255, 255, 0.04);
  color: #fff8f1;
  box-shadow: inset 0 0 0 1px rgba(255, 185, 150, 0.08);
}

.track-list-item.is-selected::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd060;
  box-shadow: 0 0 0 3px rgba(255, 91, 46, 0.18), 0 0 10px rgba(255, 208, 96, 0.55);
  transform: translateY(-50%);
}

.enter-game-btn {
  min-width: 180px;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instructions-btn {
  min-width: 156px;
}

.enter-game-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.setup-toolbar {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 240, 219, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(14, 11, 10, 0.82);
  display: grid;
  grid-template-columns: minmax(160px, 190px) minmax(180px, 220px) minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 16px;
  align-items: flex-start;
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .setup-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .online-lobby-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .online-available-btn {
    width: 100%;
  }

  .machine-buttons {
    flex-wrap: wrap;
  }
}

@media (hover: hover) and (pointer: fine) {
  body.app-game-screen.app-game-screen-fallback .canvas-layout {
    box-sizing: border-box;
    padding-bottom: 70px !important;
  }

  body.app-game-screen.app-game-screen-fallback .canvas-stage {
    height: calc(100% - 70px) !important;
    max-height: calc(100% - 70px) !important;
  }

  body.app-game-screen.app-game-screen-fallback .game-status-rail {
    bottom: 82px !important;
  }

  body.app-game-screen.app-game-screen-fallback.app-online-chat-active .canvas-layout {
    padding-bottom: 18px !important;
  }

  body.app-game-screen.app-game-screen-fallback.app-online-chat-active .canvas-stage {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  body.app-game-screen.app-game-screen-fallback.app-online-chat-active canvas {
    width: auto !important;
    height: calc(100% - 48px) !important;
    max-width: 100% !important;
    max-height: calc(100% - 48px) !important;
  }

  body.app-game-screen.app-game-screen-fallback.app-online-chat-active .game-status-rail {
    bottom: 52px !important;
  }
}

.toolbar-field {
  min-width: 0;
}

.toolbar-field .field-label {
  margin: 0;
}

.toolbar-field .field-label span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent-2);
}

.toolbar-field select,
.toolbar-field input {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.toolbar-field-player.is-online-name-committed input,
.toolbar-field-player input.is-online-name-committed {
  background: rgba(255, 255, 255, 0.96);
  color: #111111;
  border-color: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 24px rgba(0, 0, 0, 0.16);
}

.toolbar-field-player.is-online-name-committed input::placeholder,
.toolbar-field-player input.is-online-name-committed::placeholder {
  color: rgba(17, 17, 17, 0.55);
}

.player-count-toggle {
  margin-top: 8px;
  display: inline-flex;
  gap: 10px;
}

.player-count-caption {
  display: block;
  width: 122px;
  margin-top: 7px;
  color: rgba(234, 223, 210, 0.82) !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.1em !important;
  line-height: 1;
  text-align: center;
}

.count-choice-btn {
  min-width: 56px;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 240, 219, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.count-choice-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(247, 193, 75, 0.32);
}

.count-choice-btn.is-active {
  border-color: rgba(255, 91, 46, 0.56);
  background: rgba(255, 91, 46, 0.18);
  color: #fff6ee;
}

.online-lobby-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.online-toggle-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex: 0 0 42px;
  padding: 0;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 1px solid rgba(143, 184, 201, 0.3);
  background: rgba(111, 165, 186, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.online-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(143, 184, 201, 0.54);
  background: rgba(111, 165, 186, 0.18);
}

.online-toggle-btn.is-active {
  border-color: rgba(87, 182, 255, 0.76);
  background: radial-gradient(circle at 35% 35%, rgba(191, 235, 255, 0.95), rgba(45, 145, 255, 0.92));
  box-shadow:
    0 0 0 4px rgba(22, 141, 255, 0.14),
    0 0 18px rgba(22, 141, 255, 0.28);
}

.online-toggle-btn[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(255, 240, 219, 0.12);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.online-available-btn {
  flex: 0 1 176px;
  min-width: 0;
  max-width: 176px;
  min-height: 42px;
  padding: 10px 11px;
  border-color: rgba(247, 193, 75, 0.58);
  background:
    linear-gradient(180deg, rgba(247, 193, 75, 0.16), rgba(247, 193, 75, 0.06)),
    rgba(255, 255, 255, 0.05);
  color: #fff3c7;
  box-shadow:
    0 0 0 1px rgba(247, 193, 75, 0.08),
    0 0 16px rgba(247, 193, 75, 0.12);
  font-size: 0.88rem;
  line-height: 1.08;
}

.online-available-btn:hover {
  border-color: rgba(247, 193, 75, 0.9);
  background:
    linear-gradient(180deg, rgba(247, 193, 75, 0.24), rgba(247, 193, 75, 0.1)),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 1px rgba(247, 193, 75, 0.14),
    0 0 20px rgba(247, 193, 75, 0.18);
}

.online-available-btn[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(255, 240, 219, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 245, 232, 0.4);
  box-shadow: none;
}

.online-lobby-hint {
  margin: 10px 0 0;
  color: rgba(255, 245, 232, 0.72);
  font-size: 0.9rem;
  line-height: 1.45;
}

.toolbar-field[hidden] {
  display: none;
}

.machine-presets {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.machine-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.machine-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.machine-btn {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
}

.machine-btn.is-active {
  border-color: rgba(255, 91, 46, 0.56);
  background: rgba(255, 91, 46, 0.18);
  color: #fff7ee;
}

.hint {
  min-height: 2.6em;
  margin: 14px 0 0;
  line-height: 1.5;
}

.online-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(7, 6, 6, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.online-modal[hidden] {
  display: none;
}

.online-modal-card {
  width: min(560px, 100%);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 240, 219, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(14, 11, 10, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.online-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.online-modal-head h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.online-modal-head p {
  margin: 0;
  color: rgba(255, 245, 232, 0.72);
  line-height: 1.5;
}

.online-modal-close {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 1.5rem;
}

.online-available-list {
  display: grid;
  gap: 10px;
}

.online-player-item {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 240, 219, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.online-player-item:hover {
  transform: translateY(-1px);
  border-color: rgba(87, 182, 255, 0.44);
  background: rgba(87, 182, 255, 0.08);
}

.online-player-item > * {
  pointer-events: none;
}

.online-player-name {
  font-weight: 700;
}

.online-player-action {
  color: var(--tool-accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.online-player-empty {
  margin: 0;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 240, 219, 0.14);
  color: rgba(255, 245, 232, 0.72);
  text-align: center;
}

.compact-hint {
  min-height: 2.2em;
  margin-top: 6px;
}

.canvas-frame {
  flex: 1;
  min-height: 680px;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    linear-gradient(180deg, #090807 0%, #171311 100%);
  border: 1px solid var(--line);
}

.canvas-layout {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 640px;
  display: grid;
  align-content: start;
  gap: 8px;
  touch-action: pan-y;
}

body:not(.app-game-screen) .canvas-stage,
body:not(.app-game-screen) canvas {
  pointer-events: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  cursor: default;
  touch-action: pan-y;
}

.race-hud {
  position: absolute;
  inset: 16px;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.game-sidebar {
  display: none;
}

.game-status-rail {
  display: none;
}

.game-sidebar-players {
  display: grid;
  gap: 12px;
}

.status-rail-card {
  flex: 0 0 auto;
  padding: 14px 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 245, 232, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.015)),
    rgba(14, 10, 9, 0.82);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    transform 220ms ease,
    background 220ms ease;
}

.status-rail-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--rail-accent), transparent 86%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--rail-accent) 84%, white 16%), transparent 86%);
  opacity: 0.62;
  transition: opacity 220ms ease, box-shadow 220ms ease;
}

.status-rail-card.is-active {
  border-color: var(--rail-accent);
  border-color: color-mix(in srgb, var(--rail-accent) 38%, rgba(255, 245, 232, 0.12));
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.26),
    0 0 0 1px color-mix(in srgb, var(--rail-accent) 20%, transparent);
  transform: translateY(-1px);
}

.status-rail-card.is-active::after,
.status-rail-card.is-winner::after {
  opacity: 0.96;
  box-shadow: 0 0 22px color-mix(in srgb, var(--rail-accent) 84%, transparent);
}

.status-rail-card.is-finished {
  border-color: rgba(255, 245, 232, 0.16);
}

.status-rail-card.is-winner {
  border-color: var(--rail-accent);
  border-color: color-mix(in srgb, var(--rail-accent) 46%, rgba(255, 245, 232, 0.14));
}

.status-rail-card.is-retired {
  filter: saturate(0.86);
}

.status-rail-card.is-runoff {
  border-color: rgba(255, 143, 112, 0.22);
}

.status-rail-card.is-high-speed-runoff {
  border-color: rgba(255, 210, 112, 0.48);
  box-shadow:
    0 22px 34px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(255, 210, 112, 0.16),
    0 0 24px rgba(255, 196, 72, 0.14);
}

.status-rail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 10px;
  min-height: 32px;
}

.status-rail-heading {
  display: grid;
  gap: 4px;
}

.status-rail-name-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.status-rail-name {
  display: block;
  min-width: 0;
  flex: 0 1 auto;
  color: #fff5e8;
  font-size: 0.98rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: start;
  letter-spacing: 0.01em;
}

.status-rail-name-meta {
  flex: 0 0 auto;
  color: rgba(255, 245, 232, 0.72);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-rail-chip-detail {
  display: block;
  min-height: 0.78rem;
  color: rgba(255, 245, 232, 0.66);
  font-size: 0.61rem;
  line-height: 1.1;
  letter-spacing: 0.09em;
  white-space: nowrap;
  text-transform: uppercase;
}

.status-rail-chip-detail.is-empty {
  visibility: hidden;
}

.status-rail-card.is-replay-view .status-rail-chip-detail.is-empty {
  display: none;
}

.status-rail-pilot-light {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  margin-top: 3px;
  background: var(--rail-accent);
  background: color-mix(in srgb, var(--rail-accent) 88%, white 12%);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.08),
    0 0 18px var(--rail-accent),
    0 0 0 4px color-mix(in srgb, var(--rail-accent) 16%, transparent),
    0 0 18px color-mix(in srgb, var(--rail-accent) 64%, transparent);
}

.status-rail-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.status-rail-pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 245, 232, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 245, 232, 0.84);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  transition: background 220ms ease, border-color 220ms ease, color 220ms ease, box-shadow 220ms ease;
}

.status-rail-pill.is-state {
  color: var(--rail-accent);
  border-color: rgba(255, 245, 232, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: color-mix(in srgb, var(--rail-accent) 78%, white 22%);
  border-color: color-mix(in srgb, var(--rail-accent) 26%, rgba(255, 245, 232, 0.12));
  background: color-mix(in srgb, var(--rail-accent) 12%, rgba(255, 255, 255, 0.03));
}

.status-rail-pill.is-turn {
  color: var(--pill-accent, #fff8ec);
  border-color: var(--pill-accent, rgba(255, 214, 132, 0.3));
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 245, 232, 0.16);
}

.status-rail-pill.is-lap {
  color: rgba(255, 245, 232, 0.8);
}

.status-rail-gauge-shell {
  width: min(100%, 196px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  align-self: center;
  padding: 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 245, 232, 0.08);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 52%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0) 64%),
    rgba(10, 8, 7, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 14px 26px rgba(0, 0, 0, 0.22);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.status-rail-card.is-active .status-rail-gauge-shell {
  transform: translateY(-1px) scale(1.01);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 18px 30px rgba(0, 0, 0, 0.25),
    0 0 0 1px color-mix(in srgb, var(--rail-accent) 18%, transparent);
}

.status-rail-card.is-replay-view {
  gap: 10px;
}

.status-rail-gauge-shell.is-replay-view {
  width: min(100%, 232px);
  padding: 11px;
}

.status-rail-gauge-shell.is-compact {
  width: min(100%, 92px);
  padding: 4px;
}

.status-rail-gauge-shell.is-compact.is-replay-view {
  width: min(100%, 100px);
  padding: 4px;
}

.status-rail-gauge-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
}

.status-rail-magnifier-shell {
  width: 100%;
  aspect-ratio: 1 / 1;
  justify-self: stretch;
  display: grid;
  pointer-events: auto;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(255, 245, 232, 0.08);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 56%),
    rgba(10, 8, 7, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 16px 28px rgba(0, 0, 0, 0.2);
}

.status-rail-magnifier-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 16px;
  background: #090706;
  pointer-events: auto;
  cursor: crosshair;
}

.status-rail-body {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 245, 232, 0.08);
}

.status-rail-body.is-empty {
  display: none;
}

.status-rail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-top: 2px;
}

.status-rail-meta-item {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 7px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 245, 232, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 245, 232, 0.92);
  transition: border-color 220ms ease, background 220ms ease, transform 220ms ease;
}

.status-rail-card.is-active .status-rail-meta-item {
  border-color: rgba(255, 245, 232, 0.16);
  background: rgba(255, 255, 255, 0.04);
  border-color: color-mix(in srgb, var(--rail-accent) 16%, rgba(255, 245, 232, 0.1));
  background: color-mix(in srgb, var(--rail-accent) 8%, rgba(255, 255, 255, 0.03));
}

.status-rail-meta-item small {
  color: rgba(255, 245, 232, 0.5);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.status-rail-meta-item strong {
  color: rgba(255, 245, 232, 0.96);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-rail-meta-item.is-high-speed-runoff-speed {
  border-color: rgba(255, 214, 112, 0.68);
  background: rgba(255, 175, 54, 0.18);
  animation: highSpeedRunoffPulse 720ms ease-in-out infinite;
}

.status-rail-meta-item.is-high-speed-runoff-speed small,
.status-rail-meta-item.is-high-speed-runoff-speed strong,
.status-rail-speed-readout.is-high-speed-runoff-alert {
  color: #ffe59a;
  fill: #ffe59a;
  text-shadow: 0 0 12px rgba(255, 196, 72, 0.72);
  animation: highSpeedRunoffTextPulse 720ms ease-in-out infinite;
}

.status-rail-gauge-svg.is-high-speed-runoff-alert {
  filter: drop-shadow(0 0 14px rgba(255, 190, 64, 0.42));
}

@keyframes highSpeedRunoffPulse {
  0%,
  100% {
    border-color: rgba(255, 214, 112, 0.42);
    background: rgba(255, 175, 54, 0.11);
  }
  50% {
    border-color: rgba(255, 236, 170, 0.95);
    background: rgba(255, 196, 72, 0.28);
  }
}

@keyframes highSpeedRunoffTextPulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

.status-rail-line {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 245, 232, 0.86);
  font-size: 0.66rem;
  line-height: 1.2;
  text-align: left;
  letter-spacing: 0.03em;
}

.game-sidebar .hud-card,
.game-sidebar .player-card {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(14, 10, 9, 0.82);
  border-color: rgba(255, 245, 232, 0.12);
  box-shadow: 0 20px 32px rgba(0, 0, 0, 0.26);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.game-sidebar .player-card.is-compact {
  padding: 14px 16px;
}

.game-sidebar .player-card.is-compact header {
  margin-bottom: 10px;
}

.game-sidebar .player-card.is-compact .player-meta {
  gap: 8px 18px;
  font-size: 0.86rem;
}

.game-sidebar .player-card.is-compact .player-meta span {
  white-space: nowrap;
}

.game-event-card .hud-value {
  font-size: clamp(1.1rem, 1.4vw, 1.65rem);
}

.race-hud-top,
.race-hud-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.race-hud-bottom {
  align-items: flex-end;
}

.hud-chip {
  max-width: min(34ch, 46%);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 245, 232, 0.12);
  background: rgba(8, 7, 7, 0.58);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
  color: #f8ebdb;
  font-size: 0.8rem;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.hud-chip strong,
.hud-label {
  display: block;
  margin-bottom: 4px;
  color: rgba(247, 193, 75, 0.95);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hud-chip span,
.hud-card p {
  color: #fff5e8;
}

.hud-card {
  min-width: min(340px, calc(100% - 24px));
  max-width: 420px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 245, 232, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(8, 7, 7, 0.64);
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.hud-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 22px 0 0 22px;
  background: var(--hud-accent, var(--accent));
  box-shadow: 0 0 18px var(--hud-accent, var(--accent));
}

.hud-card.is-secondary::before {
  background: rgba(247, 193, 75, 0.78);
  box-shadow: 0 0 14px rgba(247, 193, 75, 0.44);
}

.hud-value {
  display: block;
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.3rem, 1.6vw, 2rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hud-card p {
  margin: 6px 0 0;
  line-height: 1.45;
  color: rgba(255, 245, 232, 0.78);
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.hud-metric {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hud-metric strong {
  display: block;
  margin-bottom: 4px;
  color: rgba(247, 193, 75, 0.88);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hud-metric span {
  color: #fff5e8;
  font-weight: 700;
  font-size: 0.95rem;
}

.fullscreen-btn {
  min-width: 104px;
}

.start-race-top-btn,
.reset-race-top-btn {
  min-width: 154px;
}

.replay-btn {
  min-width: 138px;
}

.fullscreen-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.fullscreen-install-callout {
  align-items: center;
  background: rgba(24, 21, 19, 0.97);
  border: 1px solid rgba(247, 193, 75, 0.72);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  color: #fff5e8;
  display: flex;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 10px;
  line-height: 1.35;
  max-width: min(430px, calc(100vw - 20px));
  padding: 10px 12px;
  pointer-events: auto;
  position: fixed;
  text-align: left;
  z-index: 4200;
}

.fullscreen-install-callout.is-centered {
  width: min(430px, calc(100vw - 20px));
}

.fullscreen-install-callout-text {
  min-width: 0;
}

.fullscreen-install-share-icon {
  align-items: center;
  color: #f7c14b;
  display: inline-flex;
  height: 1.12em;
  justify-content: center;
  margin: 0 0.14em;
  position: relative;
  top: 0.16em;
  vertical-align: baseline;
  width: 1.12em;
}

.fullscreen-install-share-icon svg {
  display: block;
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
  width: 100%;
}

.fullscreen-install-callout-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(247, 193, 75, 0.58);
  border-radius: 7px;
  color: #f7c14b;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  line-height: 1;
  margin-left: 4px;
  padding: 0;
  text-transform: uppercase;
  width: 26px;
}

.fullscreen-install-callout-close:hover,
.fullscreen-install-callout-close:focus-visible {
  background: rgba(247, 193, 75, 0.16);
  outline: none;
}

.phone-landscape-prompt {
  align-items: center;
  animation: phoneLandscapePromptIn 0.22s ease-out both, phoneLandscapePromptOut 0.42s ease-in 2.75s forwards;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: grid;
  justify-items: center;
  left: 50%;
  padding: 0;
  pointer-events: none;
  position: fixed;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5200;
}

.phone-landscape-prompt strong {
  color: #f7c14b;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.phone-landscape-prompt span:not(.phone-landscape-prompt-icon) {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.phone-landscape-prompt-icon {
  border-radius: 18px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.48);
  display: block;
  height: auto;
  max-width: calc(100vw - 48px);
  width: min(280px, 72vw);
}

.phone-landscape-prompt-icon svg {
  display: block;
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  width: 100%;
}

@keyframes phoneLandscapePromptIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes phoneLandscapePromptOut {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
}

.turn-banner {
  display: none;
  margin-top: 12px;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 91, 46, 0.14), transparent 26%),
    var(--panel-strong);
  border: 1px solid rgba(255, 240, 219, 0.14);
  color: #f2dcc8;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  font-size: 1.18rem;
  margin-bottom: 6px;
}

.stat-card span {
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.95rem;
}

.json-preview {
  margin: 0;
  padding: 16px;
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 7, 0.9);
  color: #ffd7bb;
  font-size: 0.9rem;
  line-height: 1.45;
  font-family: Consolas, "Courier New", monospace;
}

.race-summary,
.players-board,
.log-card,
.json-details {
  margin-bottom: 16px;
}

.race-summary {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 91, 46, 0.12), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
}

.race-summary strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.race-summary span {
  color: var(--muted);
  line-height: 1.5;
}

.players-board {
  display: grid;
  gap: 10px;
}

.player-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.player-card.is-active {
  border-color: rgba(255, 91, 46, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 91, 46, 0.24);
}

.player-card.is-finished {
  border-color: rgba(78, 199, 143, 0.55);
}

.player-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.player-card strong {
  font-size: 1rem;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.player-chip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
}

.player-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.log-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.event-log {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.event-log li::marker {
  color: var(--accent-2);
}

.json-details {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 7, 0.34);
  overflow: hidden;
}

.json-details summary {
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
}

.json-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.game-version-badge {
  display: none;
  pointer-events: none;
}

.game-record-notice {
  display: none;
  pointer-events: none;
}

.game-track-record-badge {
  display: none;
  pointer-events: none;
}

.game-track-record-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-track-record-badge.is-online-chat {
  pointer-events: auto;
}

body.app-game-screen .game-track-record-badge.is-online-chat,
.canvas-panel:fullscreen .game-track-record-badge.is-online-chat,
.canvas-panel.is-fullscreen .game-track-record-badge.is-online-chat {
  padding: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.online-chat-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  pointer-events: auto;
}

.online-chat-bar[hidden] {
  display: none !important;
}

.online-chat-status {
  flex: 0 0 auto;
  max-width: 20ch;
  color: rgba(143, 184, 201, 0.96);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-chat-status.is-alert {
  color: #fff1dc;
  animation: online-chat-alert 0.9s ease-in-out infinite alternate;
}

.online-chat-message {
  flex: 1 1 auto;
  min-width: 0;
  color: rgba(255, 239, 214, 0.98);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-chat-message.is-alert {
  color: #fff1dc;
  animation: online-chat-alert 0.9s ease-in-out infinite alternate;
}

.online-chat-input {
  flex: 0 0 190px;
  min-width: 124px;
  max-width: 220px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 214, 156, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(12, 11, 10, 0.92);
  color: #fff6eb;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: none;
}

.online-chat-input::placeholder {
  color: rgba(255, 239, 214, 0.58);
}

.online-chat-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

body.app-game-screen {
  overflow: hidden;
}

body.app-game-screen .page-shell {
  min-height: 100vh;
  width: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.app-game-screen .hero,
body.app-game-screen .controls-panel,
body.app-game-screen .info-panel {
  display: none !important;
}

body.app-game-screen .layout {
  display: block;
  gap: 0;
  min-height: 100vh;
}

body.app-game-screen .canvas-panel {
  position: fixed;
  inset: 0;
  z-index: 2500;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  padding: 10px 12px 12px;
  border-radius: 0;
  box-shadow: none;
  background:
    radial-gradient(circle at top left, rgba(255, 91, 46, 0.18), transparent 20rem),
    radial-gradient(circle at top right, rgba(247, 193, 75, 0.12), transparent 24rem),
    rgba(8, 7, 7, 0.98);
}

body.app-game-screen .panel-header {
  margin-bottom: 8px;
}

body.app-game-screen .panel-header-with-actions {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

body.app-game-screen .preview-headline,
body.app-game-screen .preview-canvas-meta,
body.app-game-screen .setup-toolbar,
body.app-game-screen .preview-header-actions {
  display: none !important;
}

body.app-game-screen .panel-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 100%;
  gap: 6px;
  overflow: visible;
}

body.app-game-screen .panel-actions > * {
  flex-shrink: 0;
}

body.app-game-screen .canvas-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

body.app-game-screen .canvas-layout {
  box-sizing: border-box;
  height: 100%;
  padding-left: clamp(286px, 22vw, 378px);
  padding-right: 0;
}

body.app-game-screen .canvas-stage {
  min-height: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}

body.app-game-screen canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
}

body.app-game-screen canvas.is-touch-zoomed {
  will-change: transform;
}

body.app-game-screen.app-phone-landscape-emulated {
  overflow: hidden;
  touch-action: none;
}

body.app-game-screen.app-phone-landscape-emulated .canvas-panel {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  width: 100dvh !important;
  height: 100dvw !important;
  min-width: 100dvh !important;
  min-height: 100dvw !important;
  max-width: none !important;
  max-height: none !important;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 4px)
    8px
    calc(env(safe-area-inset-bottom, 0px) + 6px);
}

body.app-game-screen.app-phone-landscape-emulated .panel-header {
  margin-bottom: 4px;
}

body.app-game-screen.app-phone-landscape-emulated .panel-header-with-actions {
  gap: 4px;
  align-items: flex-start;
}

body.app-game-screen.app-phone-landscape-emulated .panel-actions {
  flex-wrap: nowrap;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 1px;
}

body.app-game-screen.app-phone-landscape-emulated .panel-actions::-webkit-scrollbar {
  display: none;
}

body.app-game-screen.app-phone-landscape-emulated .primary-btn,
body.app-game-screen.app-phone-landscape-emulated .secondary-btn,
body.app-game-screen.app-phone-landscape-emulated .ghost-btn {
  min-height: 26px;
  padding: 4px 6px;
  font-size: 0.68rem;
}

body.app-game-screen.app-phone-landscape-emulated .canvas-layout {
  box-sizing: border-box;
  padding-left: clamp(132px, 18dvh, 176px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
}

body.app-game-screen.app-phone-landscape-emulated .canvas-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.app-game-screen.app-phone-landscape-emulated .game-status-rail {
  top: 2px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  width: clamp(126px, 17dvh, 168px);
  gap: 4px;
}

body.app-game-screen.app-phone-landscape-emulated .status-rail-card {
  padding: 7px 7px 6px;
  border-radius: 12px;
}

body.app-game-screen.app-phone-landscape-emulated .status-rail-name {
  font-size: 0.82rem;
}

body.app-game-screen.app-phone-landscape-emulated .status-rail-meta {
  grid-template-columns: 1fr;
  gap: 4px;
}

body.app-game-screen.app-phone-landscape-emulated .game-version-badge,
body.app-game-screen.app-phone-landscape-emulated .game-track-record-badge {
  font-size: 0.68rem;
}

body.app-game-screen .game-status-rail {
  position: absolute;
  top: 6px;
  left: 10px;
  bottom: 64px;
  width: clamp(276px, 22vw, 368px);
  display: flex !important;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.app-game-screen .game-status-rail::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body.app-game-screen .game-status-rail * {
  touch-action: pan-y;
}

body.app-game-screen .game-version-badge,
body.app-game-screen .game-track-record-badge,
body.app-game-screen .game-record-notice {
  display: flex;
}

body.app-game-screen .game-track-author-badge,
.canvas-panel:fullscreen .game-track-author-badge,
.canvas-panel.is-fullscreen .game-track-author-badge {
  display: flex;
  align-items: center;
  position: absolute;
  top: var(--game-track-author-badge-top, 12px);
  left: var(--game-track-author-badge-left, 16px);
  z-index: 7;
  max-width: var(--game-track-author-badge-max-width, min(34vw, 460px));
  min-height: 0;
  padding: 4px 10px 5px;
  border: 1px solid rgba(247, 193, 75, 0.2);
  border-top-color: rgba(247, 193, 75, 0.34);
  border-radius: 0 0 11px 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(18, 12, 10, 0.86);
  color: rgba(255, 231, 184, 0.96);
  font-size: clamp(0.72rem, 0.85vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    0 2px 5px rgba(0, 0, 0, 0.85),
    0 0 12px rgba(0, 0, 0, 0.72);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(0, 0, 0, 0.28);
}

body.app-game-screen .game-copyright-badge {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 6;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid rgba(247, 193, 75, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(20, 14, 12, 0.9);
  color: rgba(247, 193, 75, 0.96);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  pointer-events: auto;
}

body.app-game-screen .game-version-badge {
  align-items: center;
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 6;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid rgba(122, 173, 220, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(12, 16, 20, 0.9);
  color: rgba(182, 219, 255, 0.96);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body.app-game-screen .game-track-record-badge {
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 6;
  transform: translateX(-50%);
  max-width: min(52vw, 840px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 239, 214, 0.98);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.88);
  box-shadow: none;
}

body.app-game-screen .game-track-record-badge.is-online-chat {
  left: calc(10px + clamp(276px, 22vw, 368px) + 12px);
  right: 134px;
  transform: none;
  align-items: center;
  justify-content: stretch;
  max-width: none;
  min-height: 30px;
  padding: 1px 8px;
  border-radius: 10px;
}

body.app-game-screen .game-record-notice {
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  bottom: 50px;
  z-index: 6;
  transform: translateX(-50%);
  max-width: min(64vw, 920px);
  padding: 10px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 228, 182, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(32, 17, 10, 0.95);
  color: #fff6e6;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(0.95rem, 1.15vw, 1.28rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 240, 224, 0.18);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(255, 184, 92, 0.18);
  animation: record-notice-pulse 1.25s ease-in-out infinite alternate;
}

body.app-game-screen .game-record-notice:empty {
  display: none !important;
}

body.app-game-screen .game-record-notice.is-record-new {
  border-color: rgba(255, 205, 111, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 184, 92, 0.16), rgba(255, 110, 52, 0.06)),
    rgba(38, 18, 10, 0.96);
  color: #fff8e2;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(255, 168, 68, 0.22);
}

body.app-game-screen .game-record-notice.is-record-tied {
  border-color: rgba(143, 196, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(112, 168, 255, 0.16), rgba(255, 215, 138, 0.05)),
    rgba(14, 22, 34, 0.96);
  color: #eef7ff;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(118, 174, 255, 0.2);
}


body.app-game-screen .race-hud,
body.app-game-screen .game-sidebar,
body.app-game-screen .turn-banner {
  display: none;
}

body.app-game-screen .replay-stack {
  gap: 6px;
}

body.app-game-screen .fullscreen-btn {
  margin-left: 0;
}

body.app-game-screen .exit-game-btn {
  border-color: rgba(255, 91, 46, 0.52);
  background: linear-gradient(180deg, rgba(255, 116, 74, 0.28), rgba(255, 78, 39, 0.18));
  color: #fff4ec;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 232, 0.14),
    0 10px 20px rgba(0, 0, 0, 0.18);
}

body.app-game-screen .selection-badge {
  max-width: min(22ch, 28vw);
  font-size: 0.72rem;
}

body.app-game-screen .primary-btn,
body.app-game-screen .secondary-btn,
body.app-game-screen .ghost-btn {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

body.app-game-screen .panel-volume-control {
  min-width: 160px;
  padding: 5px 9px 6px;
}

body.app-game-screen .panel-audio-control {
  min-width: 172px;
  padding: 5px 7px;
  gap: 6px;
}

body.app-game-screen .panel-audio-control .audio-channel-control {
  grid-template-columns: 20px minmax(0, 1fr);
  height: 30px;
  padding: 0 8px;
}

body.app-game-screen .panel-audio-control .audio-channel-control svg {
  width: 18px;
  height: 18px;
}

body.app-game-screen .lap-control {
  min-width: 116px;
  padding: 5px 9px 6px;
}

body.app-game-screen .replay-speed-control {
  min-width: 126px;
}

body.app-game-screen .turn-magnifier-btn {
  min-width: 78px;
  padding-inline: 8px;
}

body.app-game-screen .turn-order-btn {
  min-width: 70px;
  padding-inline: 8px;
}

body.app-game-screen .reset-race-top-btn {
  min-width: 104px;
}

body.app-game-screen .replay-btn {
  min-width: 72px;
}

body.app-game-screen .panel-volume-label {
  font-size: 0.66rem;
}

body.app-game-screen .panel-volume-control output {
  min-width: 34px;
  font-size: 0.8rem;
}

body.app-game-screen .panel-volume-control input[type="range"] {
  min-width: 90px;
}

body.app-game-screen .lap-step-btn {
  min-width: 30px;
  height: 30px;
}

body.app-game-screen .replay-pause-btn {
  min-width: 82px;
}

body.app-game-screen .replay-step-btn {
  min-width: 62px;
}

body.app-game-screen .lap-count-value {
  min-width: 30px;
  font-size: 0.86rem;
}

body.app-game-screen .status-rail-card {
  padding: 12px 14px 11px;
  gap: 7px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(18, 13, 12, 0.92);
}

body.app-game-screen .status-rail-card.is-replay-view {
  gap: 5px;
  padding: 10px 12px 9px;
}

body.app-game-screen .status-rail-name {
  font-size: 0.92rem;
}

body.app-game-screen .status-rail-name-meta {
  font-size: 0.6rem;
}

body.app-game-screen .status-rail-card.is-replay-view .status-rail-header {
  min-height: 26px;
  gap: 8px;
}

body.app-game-screen .status-rail-card.is-replay-view .status-rail-heading {
  gap: 2px;
}

body.app-game-screen .status-rail-card.is-replay-view .status-rail-name {
  font-size: 0.86rem;
}

body.app-game-screen .status-rail-card.is-replay-view .status-rail-indicators {
  gap: 4px;
}

body.app-game-screen .status-rail-card.is-replay-view .status-rail-pill {
  min-height: 18px;
  padding: 0 6px;
  font-size: 0.56rem;
}

body.app-game-screen .status-rail-gauge-shell {
  width: min(100%, 164px);
  padding: 7px;
}

body.app-game-screen .status-rail-gauge-shell.is-replay-view {
  width: min(100%, 150px);
  padding: 6px;
}

body.app-game-screen .status-rail-gauge-shell.is-compact {
  width: min(100%, 104px);
  padding: 5px;
}

body.app-game-screen .status-rail-gauge-shell.is-compact.is-replay-view {
  width: min(100%, 108px);
  padding: 5px;
}

body.app-game-screen .status-rail-magnifier-shell {
  padding: 7px;
  border-radius: 18px;
}

body.app-game-screen .status-rail-body {
  gap: 5px;
  padding-top: 5px;
}

body.app-game-screen .status-rail-meta {
  gap: 6px;
}

body.app-game-screen .status-rail-meta-item {
  min-height: 42px;
  padding: 6px 7px;
  border-radius: 12px;
  border-color: rgba(255, 245, 232, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    rgba(28, 22, 20, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

body.app-game-screen .status-rail-meta-item small {
  font-size: 0.52rem;
}

body.app-game-screen .status-rail-meta-item strong {
  font-size: 0.78rem;
}

body.app-game-screen .status-rail-line {
  font-size: 0.63rem;
}

body.app-game-screen .status-rail-chip {
  font-size: 0.8rem;
}

body.app-game-screen .status-rail-chip-detail {
  font-size: 0.58rem;
}

@keyframes record-notice-pulse {
  0% {
    transform: translateX(-50%) translateY(0) scale(0.985);
    box-shadow:
      0 18px 32px rgba(0, 0, 0, 0.28),
      0 0 0 rgba(255, 186, 64, 0);
  }

  100% {
    transform: translateX(-50%) translateY(-1px) scale(1.015);
    box-shadow:
      0 22px 38px rgba(0, 0, 0, 0.34),
      0 0 28px rgba(255, 186, 64, 0.24);
  }
}

@keyframes online-chat-alert {
  0% {
    opacity: 0.55;
    text-shadow: 0 0 0 rgba(255, 196, 122, 0);
  }

  100% {
    opacity: 1;
    text-shadow: 0 0 18px rgba(255, 196, 122, 0.28);
  }
}

.canvas-panel:fullscreen,
.canvas-panel.is-fullscreen {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: none;
  margin: 0;
  padding: 10px 12px 12px;
  border-radius: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 91, 46, 0.18), transparent 20rem),
    radial-gradient(circle at top right, rgba(247, 193, 75, 0.12), transparent 24rem),
    rgba(8, 7, 7, 0.98);
}

.canvas-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2500;
  box-shadow: none;
}

.canvas-panel:fullscreen .game-copyright-badge,
.canvas-panel.is-fullscreen .game-copyright-badge {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid rgba(247, 193, 75, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(20, 14, 12, 0.9);
  color: rgba(247, 193, 75, 0.96);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.canvas-panel:fullscreen .game-version-badge,
.canvas-panel.is-fullscreen .game-version-badge {
  display: flex;
  align-items: center;
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid rgba(122, 173, 220, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(12, 16, 20, 0.9);
  color: rgba(182, 219, 255, 0.96);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.canvas-panel:fullscreen .game-track-record-badge,
.canvas-panel.is-fullscreen .game-track-record-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: min(52vw, 840px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 239, 214, 0.98);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.88);
  box-shadow: none;
}

.canvas-panel:fullscreen .game-track-record-badge.is-online-chat,
.canvas-panel.is-fullscreen .game-track-record-badge.is-online-chat {
  left: calc(10px + clamp(276px, 22vw, 368px) + 12px);
  right: 134px;
  transform: none;
  justify-content: stretch;
  max-width: none;
  padding: 7px 12px;
}

.canvas-panel:fullscreen .game-record-notice,
.canvas-panel.is-fullscreen .game-record-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  max-width: min(64vw, 920px);
  padding: 10px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 228, 182, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(32, 17, 10, 0.95);
  color: #fff6e6;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(0.95rem, 1.15vw, 1.28rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 240, 224, 0.18);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(255, 184, 92, 0.18);
  animation: record-notice-pulse 1.25s ease-in-out infinite alternate;
}

.canvas-panel:fullscreen .game-record-notice:empty,
.canvas-panel.is-fullscreen .game-record-notice:empty {
  display: none !important;
}

.canvas-panel:fullscreen .game-record-notice.is-record-new,
.canvas-panel.is-fullscreen .game-record-notice.is-record-new {
  border-color: rgba(255, 205, 111, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 184, 92, 0.16), rgba(255, 110, 52, 0.06)),
    rgba(38, 18, 10, 0.96);
  color: #fff8e2;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(255, 168, 68, 0.22);
}

.canvas-panel:fullscreen .game-record-notice.is-record-tied,
.canvas-panel.is-fullscreen .game-record-notice.is-record-tied {
  border-color: rgba(143, 196, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(112, 168, 255, 0.16), rgba(255, 215, 138, 0.05)),
    rgba(14, 22, 34, 0.96);
  color: #eef7ff;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(118, 174, 255, 0.2);
}

.canvas-panel:fullscreen .panel-header,
.canvas-panel.is-fullscreen .panel-header {
  margin-bottom: 8px;
}

.canvas-panel:fullscreen .preview-headline,
.canvas-panel.is-fullscreen .preview-headline {
  display: none;
}

.canvas-panel:fullscreen .preview-canvas-meta,
.canvas-panel.is-fullscreen .preview-canvas-meta {
  display: none;
}

.canvas-panel:fullscreen .panel-header-with-actions,
.canvas-panel.is-fullscreen .panel-header-with-actions {
  justify-content: flex-start;
  gap: 0;
}

.canvas-panel:fullscreen .setup-toolbar,
.canvas-panel.is-fullscreen .setup-toolbar,
.canvas-panel:fullscreen .preview-header-actions,
.canvas-panel.is-fullscreen .preview-header-actions {
  display: none;
}

.canvas-panel:fullscreen .canvas-frame,
.canvas-panel.is-fullscreen .canvas-frame {
  min-height: 0;
}

.canvas-panel:fullscreen .canvas-layout,
.canvas-panel.is-fullscreen .canvas-layout {
  padding-left: clamp(286px, 22vw, 378px);
  padding-right: 0;
}

.canvas-panel:fullscreen .canvas-stage,
.canvas-panel.is-fullscreen .canvas-stage {
  min-height: 0;
  width: 100%;
}

.canvas-panel:fullscreen canvas,
.canvas-panel.is-fullscreen canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
}

.canvas-panel:fullscreen .turn-banner,
.canvas-panel.is-fullscreen .turn-banner {
  margin-top: 14px;
}

.canvas-panel:fullscreen .race-hud,
.canvas-panel.is-fullscreen .race-hud {
  display: none;
}

.canvas-panel:fullscreen .game-sidebar,
.canvas-panel.is-fullscreen .game-sidebar {
  display: none;
}

.canvas-panel:fullscreen .game-status-rail,
.canvas-panel.is-fullscreen .game-status-rail {
  position: absolute;
  top: 6px;
  left: 10px;
  width: clamp(276px, 22vw, 368px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.canvas-panel:fullscreen .game-status-rail *,
.canvas-panel.is-fullscreen .game-status-rail * {
  touch-action: pan-y;
}

.canvas-panel:fullscreen .panel-actions,
.canvas-panel.is-fullscreen .panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  width: 100%;
  gap: 6px;
  overflow: hidden;
}

.canvas-panel:fullscreen .replay-stack,
.canvas-panel.is-fullscreen .replay-stack {
  gap: 6px;
}

.canvas-panel:fullscreen .fullscreen-btn,
.canvas-panel.is-fullscreen .fullscreen-btn {
  margin-left: auto;
}

.canvas-panel:fullscreen .exit-game-btn,
.canvas-panel.is-fullscreen .exit-game-btn {
  border-color: rgba(255, 91, 46, 0.42);
  background: rgba(255, 91, 46, 0.12);
  color: #fff0e6;
}

.canvas-panel:fullscreen .preview-headline h2,
.canvas-panel.is-fullscreen .preview-headline h2 {
  margin-bottom: 0;
  font-size: clamp(1.12rem, 1.45vw, 1.34rem);
}

.canvas-panel:fullscreen .selection-badge,
.canvas-panel.is-fullscreen .selection-badge {
  max-width: min(22ch, 28vw);
  font-size: 0.72rem;
}

.canvas-panel:fullscreen .primary-btn,
.canvas-panel.is-fullscreen .primary-btn,
.canvas-panel:fullscreen .secondary-btn,
.canvas-panel.is-fullscreen .secondary-btn,
.canvas-panel:fullscreen .ghost-btn,
.canvas-panel.is-fullscreen .ghost-btn {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.canvas-panel:fullscreen .panel-volume-control,
.canvas-panel.is-fullscreen .panel-volume-control {
  min-width: 160px;
  padding: 5px 9px 6px;
}

.canvas-panel:fullscreen .panel-audio-control,
.canvas-panel.is-fullscreen .panel-audio-control {
  min-width: 172px;
  padding: 5px 7px;
  gap: 6px;
}

.canvas-panel:fullscreen .panel-audio-control .audio-channel-control,
.canvas-panel.is-fullscreen .panel-audio-control .audio-channel-control {
  grid-template-columns: 20px minmax(0, 1fr);
  height: 30px;
  padding: 0 8px;
}

.canvas-panel:fullscreen .panel-audio-control .audio-channel-control svg,
.canvas-panel.is-fullscreen .panel-audio-control .audio-channel-control svg {
  width: 18px;
  height: 18px;
}

.canvas-panel:fullscreen .lap-control,
.canvas-panel.is-fullscreen .lap-control {
  min-width: 116px;
  padding: 5px 9px 6px;
}

.canvas-panel:fullscreen .replay-speed-control,
.canvas-panel.is-fullscreen .replay-speed-control {
  min-width: 126px;
}

.canvas-panel:fullscreen .turn-magnifier-btn,
.canvas-panel.is-fullscreen .turn-magnifier-btn {
  min-width: 78px;
  padding-inline: 8px;
}

.canvas-panel:fullscreen .turn-order-btn,
.canvas-panel.is-fullscreen .turn-order-btn {
  min-width: 70px;
  padding-inline: 8px;
}

.canvas-panel:fullscreen .reset-race-top-btn,
.canvas-panel.is-fullscreen .reset-race-top-btn {
  min-width: 104px;
}

.canvas-panel:fullscreen .replay-btn,
.canvas-panel.is-fullscreen .replay-btn {
  min-width: 72px;
}

.canvas-panel:fullscreen .panel-volume-label,
.canvas-panel.is-fullscreen .panel-volume-label {
  font-size: 0.66rem;
}

.canvas-panel:fullscreen .panel-volume-control output,
.canvas-panel.is-fullscreen .panel-volume-control output {
  min-width: 34px;
  font-size: 0.8rem;
}

.canvas-panel:fullscreen .panel-volume-control input[type="range"],
.canvas-panel.is-fullscreen .panel-volume-control input[type="range"] {
  min-width: 90px;
}

.canvas-panel:fullscreen .lap-step-btn,
.canvas-panel.is-fullscreen .lap-step-btn {
  min-width: 30px;
  height: 30px;
}

.canvas-panel:fullscreen .replay-pause-btn,
.canvas-panel.is-fullscreen .replay-pause-btn {
  min-width: 82px;
}

.canvas-panel:fullscreen .replay-step-btn,
.canvas-panel.is-fullscreen .replay-step-btn {
  min-width: 62px;
}

.canvas-panel:fullscreen .lap-count-value,
.canvas-panel.is-fullscreen .lap-count-value {
  min-width: 30px;
  font-size: 0.86rem;
}

.canvas-panel:fullscreen .status-rail-card,
.canvas-panel.is-fullscreen .status-rail-card {
  padding: 12px 14px 11px;
  gap: 7px;
  border-radius: 16px;
}

.canvas-panel:fullscreen .status-rail-name,
.canvas-panel.is-fullscreen .status-rail-name {
  font-size: 0.92rem;
}

.canvas-panel:fullscreen .status-rail-name-meta,
.canvas-panel.is-fullscreen .status-rail-name-meta {
  font-size: 0.6rem;
}

.canvas-panel:fullscreen .status-rail-gauge-shell,
.canvas-panel.is-fullscreen .status-rail-gauge-shell {
  width: min(100%, 164px);
  padding: 7px;
}

.canvas-panel:fullscreen .status-rail-magnifier-shell,
.canvas-panel.is-fullscreen .status-rail-magnifier-shell {
  padding: 7px;
  border-radius: 18px;
}

.canvas-panel:fullscreen .status-rail-body,
.canvas-panel.is-fullscreen .status-rail-body {
  gap: 5px;
  padding-top: 5px;
}

.canvas-panel:fullscreen .status-rail-meta,
.canvas-panel.is-fullscreen .status-rail-meta {
  gap: 6px;
}

.canvas-panel:fullscreen .status-rail-meta-item,
.canvas-panel.is-fullscreen .status-rail-meta-item {
  min-height: 42px;
  padding: 6px 7px;
}

.canvas-panel:fullscreen .status-rail-meta-item small,
.canvas-panel.is-fullscreen .status-rail-meta-item small {
  font-size: 0.52rem;
}

.canvas-panel:fullscreen .status-rail-meta-item strong,
.canvas-panel.is-fullscreen .status-rail-meta-item strong {
  font-size: 0.78rem;
}

.canvas-panel:fullscreen .status-rail-line,
.canvas-panel.is-fullscreen .status-rail-line {
  font-size: 0.63rem;
}

.canvas-panel:fullscreen .status-rail-chip,
.canvas-panel.is-fullscreen .status-rail-chip {
  font-size: 0.8rem;
}

.canvas-panel:fullscreen .status-rail-chip-detail,
.canvas-panel.is-fullscreen .status-rail-chip-detail {
  font-size: 0.58rem;
}

.canvas-panel:fullscreen .turn-banner,
.canvas-panel.is-fullscreen .turn-banner {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    align-items: stretch;
  }

  .language-switch {
    align-self: flex-end;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100vw - 20px, 1400px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-actions,
  .panel {
    border-radius: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-header-with-actions,
  .panel-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-header-actions {
    margin-left: 0;
    width: 100%;
  }

  .race-hud {
    inset: 12px;
  }

  .canvas-layout {
    min-height: inherit;
  }

  .race-hud-top,
  .race-hud-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-chip,
  .hud-card {
    max-width: none;
    min-width: 0;
  }

  .hud-grid {
    grid-template-columns: 1fr;
  }

  .fullscreen-btn {
    min-width: 0;
    width: 100%;
  }

  .setup-toolbar {
    grid-template-columns: 1fr;
  }

  .machine-buttons {
    flex-direction: column;
  }

  .track-browser {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .track-scroll-btn:first-child,
  .track-scroll-btn:last-child {
    grid-column: 1;
    width: 100%;
    min-height: 48px;
  }

  .track-scroll-btn:first-child {
    grid-row: 1;
  }

  .track-list-frame {
    grid-column: 1;
    grid-row: 2;
  }

  .track-scroll-btn:last-child {
    grid-row: 3;
  }

  .track-list-total {
    grid-column: 1;
    grid-row: 4;
    padding-right: 2px;
  }

  .canvas-panel:fullscreen .canvas-layout,
  .canvas-panel.is-fullscreen .canvas-layout {
    padding-inline: 0;
  }

  .canvas-panel:fullscreen .race-hud,
  .canvas-panel.is-fullscreen .race-hud {
    display: none;
  }

  .canvas-panel:fullscreen .game-sidebar,
  .canvas-panel.is-fullscreen .game-sidebar {
    display: none;
  }

  .canvas-panel:fullscreen::after,
  .canvas-panel.is-fullscreen::after {
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .canvas-panel {
    min-height: 620px;
  }
}

@media (max-width: 1480px) {
  .canvas-panel:fullscreen .canvas-layout,
  .canvas-panel.is-fullscreen .canvas-layout {
    padding-left: clamp(232px, 18vw, 294px);
    padding-right: 0;
  }

  .canvas-panel:fullscreen .game-status-rail,
  .canvas-panel.is-fullscreen .game-status-rail {
    width: clamp(220px, 17vw, 278px);
  }

  .canvas-panel:fullscreen .game-track-record-badge.is-online-chat,
  .canvas-panel.is-fullscreen .game-track-record-badge.is-online-chat {
    left: calc(10px + clamp(220px, 17vw, 278px) + 12px);
  }
}

@media (max-width: 1366px), (max-height: 860px) {
  body.app-game-screen .canvas-panel {
    padding: 8px 10px 10px;
  }

  body.app-game-screen .panel-header-with-actions {
    gap: 4px;
  }

  body.app-game-screen .panel-actions {
    gap: 4px;
  }

  body.app-game-screen .fullscreen-btn {
    margin-left: 0;
  }

  body.app-game-screen .primary-btn,
  body.app-game-screen .secondary-btn,
  body.app-game-screen .ghost-btn {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 0.82rem;
  }

  body.app-game-screen .panel-volume-control {
    min-width: 146px;
    padding: 4px 8px 5px;
  }

  body.app-game-screen .panel-audio-control {
    min-width: 150px;
    padding: 4px 6px;
    gap: 5px;
  }

  body.app-game-screen .panel-audio-control .audio-channel-control {
    grid-template-columns: 18px minmax(0, 1fr);
    height: 28px;
    padding: 0 7px;
  }

  body.app-game-screen .panel-audio-control .audio-channel-control svg {
    width: 16px;
    height: 16px;
  }

  body.app-game-screen .lap-control {
    min-width: 104px;
    padding: 4px 8px 5px;
  }

  body.app-game-screen .replay-speed-control {
    min-width: 112px;
  }

  body.app-game-screen .turn-magnifier-btn {
    min-width: 70px;
  }

  body.app-game-screen .turn-order-btn {
    min-width: 64px;
  }

  body.app-game-screen .panel-volume-label {
    font-size: 0.62rem;
  }

  body.app-game-screen .panel-volume-control output {
    min-width: 32px;
    font-size: 0.76rem;
  }

  body.app-game-screen .panel-volume-control input[type="range"] {
    min-width: 76px;
  }

  body.app-game-screen .lap-step-btn {
    min-width: 28px;
    height: 28px;
  }

  body.app-game-screen .replay-pause-btn {
    min-width: 72px;
  }

  body.app-game-screen .replay-step-btn {
    min-width: 56px;
  }

  body.app-game-screen .lap-count-value {
    min-width: 26px;
    font-size: 0.8rem;
  }

  body.app-game-screen .canvas-layout {
    padding-left: clamp(214px, 18vw, 262px);
  }

  body.app-game-screen .game-status-rail {
    bottom: 46px;
    width: clamp(204px, 17vw, 250px);
    gap: 6px;
  }

  body.app-game-screen .game-track-record-badge.is-online-chat {
    left: calc(10px + clamp(204px, 17vw, 250px) + 10px);
    right: 112px;
    max-width: none;
    padding: 6px 10px;
  }

  body.app-game-screen .status-rail-card {
    padding: 8px 9px 7px;
    gap: 4px;
    border-radius: 14px;
  }

  body.app-game-screen .status-rail-card.is-replay-view {
    gap: 3px;
    padding: 7px 8px 7px;
  }

  body.app-game-screen .status-rail-name {
    font-size: 0.86rem;
  }

  body.app-game-screen .status-rail-name-meta {
    font-size: 0.55rem;
  }

  body.app-game-screen .status-rail-card.is-replay-view .status-rail-name {
    font-size: 0.8rem;
  }

  body.app-game-screen .status-rail-chip-detail {
    font-size: 0.5rem;
  }

  body.app-game-screen .status-rail-pill {
    min-height: 16px;
    padding: 0 6px;
    font-size: 0.54rem;
  }

  body.app-game-screen .status-rail-gauge-shell {
    width: min(100%, 108px);
    padding: 5px;
  }

  body.app-game-screen .status-rail-gauge-shell.is-replay-view {
    width: min(100%, 100px);
    padding: 4px;
  }

  body.app-game-screen .status-rail-gauge-shell.is-compact {
    width: min(100%, 88px);
    padding: 4px;
  }

  body.app-game-screen .status-rail-gauge-shell.is-compact.is-replay-view {
    width: min(100%, 92px);
    padding: 4px;
  }

  body.app-game-screen .status-rail-meta {
    gap: 3px;
  }

  body.app-game-screen .status-rail-meta-item {
    min-height: 28px;
    padding: 4px 5px;
    border-radius: 10px;
  }

  body.app-game-screen .status-rail-meta-item small {
    font-size: 0.42rem;
  }

  body.app-game-screen .status-rail-meta-item strong {
    font-size: 0.64rem;
  }

  body.app-game-screen .status-rail-line {
    padding: 2px 6px;
    font-size: 0.52rem;
  }

  body.app-game-screen .status-rail-chip {
    font-size: 0.68rem;
  }

  body.app-game-screen .status-rail-chip-detail {
    font-size: 0.5rem;
  }

  body.app-game-screen .canvas-panel::after {
    right: 10px;
    bottom: 10px;
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  body.app-game-screen .game-version-badge {
    left: 10px;
    bottom: 10px;
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  body.app-game-screen .game-track-record-badge {
    bottom: 10px;
    max-width: min(54vw, 620px);
    padding: 0;
    font-size: 0.7rem;
  }

  body.app-game-screen .online-chat-bar {
    gap: 8px;
    min-width: 0;
  }

  body.app-game-screen .online-chat-status {
    max-width: 18ch;
    font-size: 0.62rem;
  }

  body.app-game-screen .online-chat-message {
    font-size: 0.68rem;
  }

  body.app-game-screen .online-chat-input {
    flex-basis: 160px;
    min-width: 120px;
    max-width: 190px;
    padding: 6px 10px;
    font-size: 0.68rem;
  }

  body.app-game-screen .game-record-notice {
    bottom: 42px;
    max-width: min(58vw, 700px);
    padding: 8px 14px;
    font-size: clamp(0.84rem, 1.02vw, 1.04rem);
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  body.app-game-screen,
  body.app-game-screen .page-shell,
  body.app-game-screen .layout,
  body.app-game-screen .canvas-panel {
    min-height: 100dvh;
    height: 100dvh;
  }

  body.app-game-screen .canvas-panel {
    padding:
      calc(env(safe-area-inset-top, 0px) + 4px)
      8px
      calc(env(safe-area-inset-bottom, 0px) + 6px);
  }

  body.app-game-screen .panel-header {
    margin-bottom: 4px;
  }

  body.app-game-screen .panel-header-with-actions,
  .canvas-panel:fullscreen .panel-header-with-actions,
  .canvas-panel.is-fullscreen .panel-header-with-actions {
    gap: 4px;
    align-items: flex-start;
  }

  body.app-game-screen .panel-actions,
  .canvas-panel:fullscreen .panel-actions,
  .canvas-panel.is-fullscreen .panel-actions {
    flex-wrap: nowrap;
    gap: 3px;
    align-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }

  body.app-game-screen .panel-actions::-webkit-scrollbar,
  .canvas-panel:fullscreen .panel-actions::-webkit-scrollbar,
  .canvas-panel.is-fullscreen .panel-actions::-webkit-scrollbar {
    display: none;
  }

  body.app-game-screen .panel-actions > *,
  .canvas-panel:fullscreen .panel-actions > *,
  .canvas-panel.is-fullscreen .panel-actions > * {
    flex: 0 0 auto;
    min-width: 0;
  }

  body.app-game-screen #fullscreenBtn,
  .canvas-panel:fullscreen #fullscreenBtn,
  .canvas-panel.is-fullscreen #fullscreenBtn {
    margin-left: 10px;
  }

  body.app-game-screen .primary-btn,
  body.app-game-screen .secondary-btn,
  body.app-game-screen .ghost-btn,
  .canvas-panel:fullscreen .primary-btn,
  .canvas-panel:fullscreen .secondary-btn,
  .canvas-panel:fullscreen .ghost-btn,
  .canvas-panel.is-fullscreen .primary-btn,
  .canvas-panel.is-fullscreen .secondary-btn,
  .canvas-panel.is-fullscreen .ghost-btn {
    min-height: 26px;
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  body.app-game-screen .panel-volume-control,
  .canvas-panel:fullscreen .panel-volume-control,
  .canvas-panel.is-fullscreen .panel-volume-control {
    min-width: 98px;
    padding: 3px 5px 3px;
  }

  body.app-game-screen .panel-audio-control,
  .canvas-panel:fullscreen .panel-audio-control,
  .canvas-panel.is-fullscreen .panel-audio-control {
    min-width: 112px;
    padding: 3px 4px;
    gap: 4px;
  }

  body.app-game-screen .panel-audio-control .audio-channel-control,
  .canvas-panel:fullscreen .panel-audio-control .audio-channel-control,
  .canvas-panel.is-fullscreen .panel-audio-control .audio-channel-control {
    grid-template-columns: 15px minmax(0, 1fr);
    height: 26px;
    padding: 0 5px;
  }

  body.app-game-screen .panel-audio-control .audio-channel-control svg,
  .canvas-panel:fullscreen .panel-audio-control .audio-channel-control svg,
  .canvas-panel.is-fullscreen .panel-audio-control .audio-channel-control svg {
    width: 14px;
    height: 14px;
  }

  body.app-game-screen .panel-volume-control input[type="range"],
  .canvas-panel:fullscreen .panel-volume-control input[type="range"],
  .canvas-panel.is-fullscreen .panel-volume-control input[type="range"] {
    min-width: 46px;
  }

  body.app-game-screen .lap-control,
  .canvas-panel:fullscreen .lap-control,
  .canvas-panel.is-fullscreen .lap-control {
    min-width: 74px;
    padding: 3px 5px 3px;
  }

  body.app-game-screen .lap-step-btn,
  .canvas-panel:fullscreen .lap-step-btn,
  .canvas-panel.is-fullscreen .lap-step-btn {
    min-width: 26px;
    height: 26px;
  }

  body.app-game-screen .lap-count-value,
  .canvas-panel:fullscreen .lap-count-value,
  .canvas-panel.is-fullscreen .lap-count-value {
    min-width: 20px;
    font-size: 0.68rem;
  }

  body.app-game-screen .replay-speed-control,
  .canvas-panel:fullscreen .replay-speed-control,
  .canvas-panel.is-fullscreen .replay-speed-control {
    min-width: 74px;
  }

  body.app-game-screen .turn-magnifier-btn,
  body.app-game-screen .turn-order-btn,
  .canvas-panel:fullscreen .turn-magnifier-btn,
  .canvas-panel:fullscreen .turn-order-btn,
  .canvas-panel.is-fullscreen .turn-magnifier-btn,
  .canvas-panel.is-fullscreen .turn-order-btn {
    min-width: 32px;
    padding-inline: 4px;
  }

  body.app-game-screen .exit-game-btn,
  .canvas-panel:fullscreen .exit-game-btn,
  .canvas-panel.is-fullscreen .exit-game-btn {
    min-width: 62px;
  }

  body.app-game-screen .replay-pause-btn,
  .canvas-panel:fullscreen .replay-pause-btn,
  .canvas-panel.is-fullscreen .replay-pause-btn {
    min-width: 50px;
  }

  body.app-game-screen .replay-step-btn,
  .canvas-panel:fullscreen .replay-step-btn,
  .canvas-panel.is-fullscreen .replay-step-btn {
    min-width: 38px;
  }

  body.app-game-screen .panel-volume-label,
  .canvas-panel:fullscreen .panel-volume-label,
  .canvas-panel.is-fullscreen .panel-volume-label {
    display: none;
  }

  body.app-game-screen .panel-volume-control output,
  .canvas-panel:fullscreen .panel-volume-control output,
  .canvas-panel.is-fullscreen .panel-volume-control output {
    min-width: 24px;
    font-size: 0.64rem;
  }

  body.app-game-screen .canvas-frame,
  .canvas-panel:fullscreen .canvas-frame,
  .canvas-panel.is-fullscreen .canvas-frame {
    min-height: 0;
  }

  body.app-game-screen .canvas-layout,
  .canvas-panel:fullscreen .canvas-layout,
  .canvas-panel.is-fullscreen .canvas-layout {
    box-sizing: border-box;
    padding-left: clamp(176px, 16vw, 208px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }

  body.app-game-screen .canvas-stage,
  .canvas-panel:fullscreen .canvas-stage,
  .canvas-panel.is-fullscreen .canvas-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  body.app-game-screen canvas,
  .canvas-panel:fullscreen canvas,
  .canvas-panel.is-fullscreen canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }

  body.app-game-screen .game-status-rail,
  .canvas-panel:fullscreen .game-status-rail,
  .canvas-panel.is-fullscreen .game-status-rail {
    top: 2px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    width: clamp(168px, 15.5vw, 204px);
    gap: 4px;
  }

  body.app-game-screen .status-rail-card,
  .canvas-panel:fullscreen .status-rail-card,
  .canvas-panel.is-fullscreen .status-rail-card {
    padding: 7px 7px 6px;
    gap: 4px;
    border-radius: 14px;
  }

  body.app-game-screen .status-rail-name,
  .canvas-panel:fullscreen .status-rail-name,
  .canvas-panel.is-fullscreen .status-rail-name {
    font-size: 0.84rem;
  }

  body.app-game-screen .status-rail-name-meta,
  .canvas-panel:fullscreen .status-rail-name-meta,
  .canvas-panel.is-fullscreen .status-rail-name-meta {
    font-size: 0.52rem;
  }

  body.app-game-screen .status-rail-gauge-shell,
  .canvas-panel:fullscreen .status-rail-gauge-shell,
  .canvas-panel.is-fullscreen .status-rail-gauge-shell {
    width: min(100%, 108px);
    padding: 4px;
  }

  body.app-game-screen .status-rail-meta,
  .canvas-panel:fullscreen .status-rail-meta,
  .canvas-panel.is-fullscreen .status-rail-meta {
    gap: 4px;
  }

  body.app-game-screen .status-rail-meta-item,
  .canvas-panel:fullscreen .status-rail-meta-item,
  .canvas-panel.is-fullscreen .status-rail-meta-item {
    min-height: 28px;
    padding: 3px 5px;
    border-radius: 10px;
  }

  body.app-game-screen .status-rail-meta-item small,
  .canvas-panel:fullscreen .status-rail-meta-item small,
  .canvas-panel.is-fullscreen .status-rail-meta-item small {
    font-size: 0.42rem;
  }

  body.app-game-screen .status-rail-meta-item strong,
  .canvas-panel:fullscreen .status-rail-meta-item strong,
  .canvas-panel.is-fullscreen .status-rail-meta-item strong {
    font-size: 0.62rem;
  }

  body.app-game-screen .game-version-badge,
  .canvas-panel:fullscreen .game-version-badge,
  .canvas-panel.is-fullscreen .game-version-badge {
    left: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    padding: 5px 9px;
    font-size: 0.64rem;
  }

  body.app-game-screen .game-track-record-badge,
  .canvas-panel:fullscreen .game-track-record-badge,
  .canvas-panel.is-fullscreen .game-track-record-badge {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    max-width: min(48vw, 420px);
    padding: 0;
    font-size: 0.64rem;
  }

  body.app-game-screen .game-track-record-badge.is-online-chat,
  .canvas-panel:fullscreen .game-track-record-badge.is-online-chat,
  .canvas-panel.is-fullscreen .game-track-record-badge.is-online-chat {
      right: 104px;
      max-width: none;
      padding: 4px 8px;
    }

  body.app-game-screen .online-chat-bar,
  .canvas-panel:fullscreen .online-chat-bar,
  .canvas-panel.is-fullscreen .online-chat-bar {
    gap: 6px;
    min-width: 0;
  }

  body.app-game-screen .online-chat-status,
  .canvas-panel:fullscreen .online-chat-status,
  .canvas-panel.is-fullscreen .online-chat-status {
    max-width: 12ch;
    font-size: 0.52rem;
  }

body.app-game-screen .online-chat-message,
.canvas-panel:fullscreen .online-chat-message,
.canvas-panel.is-fullscreen .online-chat-message {
  font-size: 0.9rem !important;
}

body.app-mac-runtime.app-game-screen .online-chat-message.is-alert,
body.app-mac-runtime .canvas-panel:fullscreen .online-chat-message.is-alert,
body.app-mac-runtime .canvas-panel.is-fullscreen .online-chat-message.is-alert {
  font-size: 0.45rem !important;
}

  body.app-game-screen .online-chat-input,
  .canvas-panel:fullscreen .online-chat-input,
  .canvas-panel.is-fullscreen .online-chat-input {
    flex-basis: 110px;
    min-width: 82px;
    max-width: 128px;
    min-height: 24px;
    padding: 4px 6px;
    font-size: 0.56rem;
  }

  body.app-game-screen .game-record-notice,
  .canvas-panel:fullscreen .game-record-notice,
  .canvas-panel.is-fullscreen .game-record-notice {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
    max-width: min(56vw, 620px);
  }

  body.app-game-screen .canvas-panel::after,
  .canvas-panel:fullscreen::after,
  .canvas-panel.is-fullscreen::after {
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    padding: 5px 9px;
    font-size: 0.64rem;
  }
}
