:root {
  color-scheme: dark;
  --bg: #0c0f19;
  --panel: #131828;
  --line: #2a3045;
  --text: #f0f2ff;
  --muted: #a2abc6;
  --accent: #c3ff68;
  --purple: #b1a1ff;
  font:
    15px/1.6 Inter,
    ui-sans-serif,
    system-ui,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 75% -10%, #2a2449, transparent 48%), var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
header {
  max-width: 1480px;
  margin: auto;
  padding: 25px 36px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
header > a:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.brand {
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -2px;
  text-decoration: none;
}
.brand span {
  color: var(--accent);
}
.brand small {
  font-size: 11px;
  letter-spacing: 3px;
  margin-left: 10px;
}
.tag {
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 30px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
}
main {
  max-width: 1480px;
  margin: auto;
  padding: 40px 36px;
}
.intro {
  max-width: 820px;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 700;
}
h1 {
  font-size: clamp(42px, 5vw, 70px);
  line-height: 1.07;
  letter-spacing: -3px;
  margin: 18px 0;
}
h1 em {
  color: var(--purple);
  font-style: normal;
}
p {
  color: var(--muted);
  margin: 12px 0;
}
.intro > p:not(.eyebrow) {
  max-width: 680px;
}
.intro .honest {
  font-size: 12px;
}
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  margin: 0 0 25px;
  background: #171c2c;
  font-size: 13px;
}
.notice.error {
  border-left-color: #ff827e;
}
.workspace {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 26px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(120deg, #191f31, #121726);
  margin-bottom: 20px;
}
.panel p,
.panel details {
  font-size: 12px;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.step > span:first-child {
  font:
    11px ui-monospace,
    monospace;
  color: var(--accent);
  border: 1px solid #465239;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.step h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.3px;
}
.step .tag {
  margin-left: auto;
}
button,
input,
select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1423;
  color: var(--text);
  padding: 10px 13px;
  min-width: 0;
}
button {
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  background: #292f48;
  transform: translateY(-1px);
}
button.primary {
  background: var(--accent);
  color: #13200a;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) {
  background: #d8ff9e;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}
input[type="file"] {
  display: block;
  width: 100%;
  font-size: 11px;
  padding: 9px;
  margin-top: 6px;
}
input[type="file"]::file-selector-button {
  background: #2a3149;
  border: 0;
  color: white;
  border-radius: 4px;
  padding: 5px 8px;
  margin-right: 8px;
}
.file {
  display: block;
  font-size: 12px;
  margin: 16px 0;
}
.file small {
  float: right;
  color: var(--muted);
  font-size: 10px;
}
.compact {
  margin: 10px 0;
}
details {
  margin: 12px 0;
}
summary {
  cursor: pointer;
  color: var(--purple);
}
progress {
  width: 100%;
  height: 5px;
  accent-color: var(--accent);
}
#file-status {
  min-height: 38px;
}
#verify {
  width: 100%;
}
label {
  font-size: 12px;
}
select {
  display: block;
  width: 100%;
  margin: 7px 0;
}
.screen-wrap {
  position: relative;
  background: #070911;
  border: 1px solid #30394e;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  max-height: 72vh;
  margin: auto;
  display: flex;
  justify-content: center;
}
canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  outline: none;
}
.screen-wrap:focus-within {
  border-color: var(--accent);
}
#splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 35%, #342b5755, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      #ffffff04 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      #ffffff04 40px
    );
}
#splash .cross {
  font-size: 80px;
  line-height: 1;
  color: var(--accent);
}
#splash h2 {
  font-size: clamp(22px, 3vw, 42px);
  text-align: center;
  line-height: 1.1;
  letter-spacing: -1.5px;
}
#splash p {
  font-size: 12px;
  text-align: center;
  max-width: 240px;
}
.screen-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 11px 18px;
  background: #070911bb;
  pointer-events: none;
  font:
    9px ui-monospace,
    monospace;
  letter-spacing: 1px;
  color: var(--muted);
}
.toolbar {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  flex-wrap: wrap;
}
#stop {
  margin-left: auto;
}
#runtime-status {
  font-size: 12px;
  min-height: 40px;
}
.btt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.btt-toolbar #runtime-status {
  /* Reserve space even when targets, timer digits or FPS change length. */
  flex: 0 0 32ch;
  max-width: 100%;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}
.online {
  margin-top: 24px;
}
.room-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
#name {
  display: block;
  width: 100%;
  margin-top: 5px;
}
#code {
  flex: 1;
  width: 130px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#room-code {
  margin-right: auto;
  color: var(--accent);
  letter-spacing: 3px;
  font-family: monospace;
}
#players {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}
#players li {
  padding: 12px;
  background: #0c1120;
  border-radius: 8px;
  flex: 1;
  min-width: 150px;
}
.controls {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 6px;
}
.controls dt {
  color: var(--muted);
}
.controls dd {
  margin: 0;
}
footer {
  font-size: 11px;
  color: #77839f;
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 25px;
}
[hidden] {
  display: none !important;
}
:fullscreen.screen-wrap {
  max-height: none;
  border: 0;
  border-radius: 0;
  width: 100vw;
  height: 100vh;
}
:fullscreen canvas {
  width: auto;
  aspect-ratio: 4/3;
}
@media (max-width: 850px) {
  header {
    padding: 18px;
  }
  .tag {
    font-size: 8px;
  }
  main {
    padding: 25px 18px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  #setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  .screen-wrap {
    max-height: none;
  }
  .panel {
    padding: 18px;
  }
  .intro {
    margin-bottom: 20px;
  }
}
@media (max-width: 530px) {
  #setup {
    display: block;
  }
  .brand small {
    display: none;
  }
  header {
    gap: 12px;
  }
  .room-actions {
    flex-wrap: wrap;
  }
  h1 {
    letter-spacing: -2px;
  }
}

#log {
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
}

.input-live {
  display: block;
  font: 12px/1.6 monospace;
  padding: 10px;
  background: #10141f;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
#adapter-rate {
  display: block;
  min-height: 1.6em;
  margin: 6px 0 12px;
}
#controller-rumble {
  width: auto;
}
#performance-report {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Account and replay controls remain outside the gameplay canvas. */
[hidden] {
  display: none !important;
}
#account-form input,
#replay-share-link {
  width: 100%;
  margin: 5px 0 12px;
}
#account-form button {
  margin: 4px 0;
}
.replay-controls {
  margin-bottom: 12px;
}
.replay-open {
  display: block;
  margin-bottom: 8px;
}
.saved-run {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.saved-run span {
  flex: 1 1 200px;
}
#replay-status,
#account-message {
  overflow-wrap: anywhere;
}

#replay-timeline {
  margin: 12px 0;
}
#replay-position {
  display: block;
  width: 100%;
  padding: 8px 0;
  accent-color: var(--accent);
  cursor: pointer;
}
#replay-position-label {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
