:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b2028;
  --panel-2: #242b35;
  --text: #f4f7fb;
  --muted: #9ba8b8;
  --accent: #35c2a0;
  --accent-2: #f0b84d;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px;
}

.screen {
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
}

.hidden {
  display: none !important;
}

.brand {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
}

.join-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

input {
  width: 100%;
  border: 1px solid #394452;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 15px 14px;
  font-size: 20px;
}

#codeInput {
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0;
  font-size: 34px;
  font-weight: 800;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07110f;
  font-weight: 800;
  padding: 12px 14px;
}

button:disabled {
  opacity: 0.55;
}

.error {
  min-height: 24px;
  color: var(--danger);
  text-align: center;
}

#appScreen {
  justify-content: flex-start;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 6px;
}

.status-strip > div,
.panel {
  background: var(--panel);
  border: 1px solid #2d3642;
  border-radius: 8px;
  padding: 14px;
}

.status-strip span,
.status-strip strong {
  display: block;
}

.muted,
.fine {
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tab {
  background: var(--panel-2);
  color: var(--text);
}

.tab.active {
  background: var(--accent-2);
  color: #171109;
}

.panel {
  display: grid;
  gap: 14px;
}

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

.dpad button,
.actions button {
  background: var(--panel-2);
  color: var(--text);
}

.dpad .select {
  background: var(--accent);
  color: #07110f;
}

.ghost {
  visibility: hidden;
}

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

.meter {
  height: 18px;
  border-radius: 999px;
  background: #2b3440;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 80ms linear;
}

.metrics {
  display: grid;
  gap: 8px;
  margin: 0;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #2d3642;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#eventLog {
  min-height: 160px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: #0c0f13;
  border-radius: 8px;
  color: #d8e1ec;
  white-space: pre-wrap;
}
