:root {
  font-family: system-ui, Segoe UI, Roboto, sans-serif;
  background: #0f1419;
  color: #e6edf3;
  line-height: 1.45;
}
body {
  margin: 0 auto;
  max-width: 1200px;
  padding: 1.25rem;
}

.replay-controls {
  width: 100%;
  box-sizing: border-box;
}
.replay-controls .controls {
  margin: 0;
}
.replay-controls .replay-tools {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  margin-bottom: 0;
}
.replay-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: flex-start;
  gap: 1.25rem;
  margin-top: 0.75rem;
}
.replay-main {
  width: 100%;
  box-sizing: border-box;
}
.replay-main .canvas-wrap {
  width: 100%;
  max-width: 100%;
}
.replay-sidebar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.replay-sidebar section {
  margin: 0;
}

@media (max-width: 980px) {
  .replay-layout {
    grid-template-columns: 1fr;
  }
}
.error-banner {
  color: #f85149;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  min-height: 1.25rem;
}

.muted {
  color: #8b949e;
  font-size: 0.85rem;
  margin: 0.25rem 0 0.75rem;
}

.commands-panel {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.85rem;
}
.commands-panel h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.commands-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c9d1d9;
}
h1 {
  font-weight: 600;
  font-size: 1.35rem;
}
section {
  margin: 1.25rem 0;
  padding: 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  border-bottom: 1px solid #30363d;
  padding: 0.45rem 0.35rem;
  text-align: left;
}
a {
  color: #58a6ff;
}
#replayCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #010409;
  border: 1px solid #30363d;
  border-radius: 6px;
}
.controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
button {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
button:hover {
  background: #30363d;
}
input[type="range"] {
  flex: 1;
  min-width: 160px;
}

.canvas-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.replay-tools {
  margin: 0.75rem 0 1rem; /* default; replay page overrides in .replay-controls */
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.88rem;
}
.replay-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.replay-tools-row:last-of-type {
  margin-bottom: 0;
}
.replay-field select {
  margin-left: 0.35rem;
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
}
.replay-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}
.replay-legend {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
}

.tooltip {
  display: none;
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 0.45rem 0.6rem;
  background: #21262d;
  border: 1px solid #484f58;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c9d1d9;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.inspect-section {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.85rem;
}
.inspect-section h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.inspect-section pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c9d1d9;
}

.history-section {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.85rem;
}
.history-section h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.history-scroll {
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #c9d1d9;
  line-height: 1.4;
}

.wincond-section {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.85rem;
}
.wincond-section h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.wincond-section pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #c9d1d9;
  line-height: 1.4;
}

.muted-inline {
  color: #8b949e;
}
