body {
  padding-bottom: 5rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.5rem;
  gap: 0.5rem;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.learn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.learn-toggle input {
  margin: 0;
}

.icon-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: var(--pico-border-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  color: inherit;
  box-shadow: none;
}

.icon-btn:hover {
  background: var(--pico-secondary-background);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.settings-panel {
  margin-bottom: 1.25rem;
}

.settings-section {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1rem;
}

.settings-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.muted {
  color: var(--pico-muted-color);
}

.small {
  font-size: 0.85rem;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 0.5rem;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--pico-secondary-background);
  font-family: var(--pico-font-family-monospace, monospace);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.status-pill.armed { background: #4a90e2; color: white; }
.status-pill.recording { background: #e24a4a; color: white; }
.status-pill.labelling { background: #e2b04a; color: black; }
.status-pill.classifying { background: #4ae28a; color: black; }

.trigger-bar {
  flex: 1;
  height: 0.6rem;
  margin-left: 0.75rem;
  background: var(--pico-secondary-background);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.trigger-fill {
  height: 100%;
  width: 0%;
  background: #4a90e2;
  transition: width 60ms linear, background 120ms linear;
}

.trigger-fill.fired {
  background: #e24a4a;
}

.action-section {
  text-align: center;
  margin: 1.5rem 0;
}

.big-btn {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.trick-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.trick-buttons button {
  padding: 0.875rem;
  font-size: 1rem;
  text-align: left;
}

.trick-buttons button small {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
}

.new-trick-form {
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

.result-table {
  font-family: var(--pico-font-family-monospace, monospace);
  font-size: 0.85rem;
  width: 100%;
}

.result-table th, .result-table td {
  padding: 0.35rem 0.5rem;
  text-align: right;
  white-space: nowrap;
}

.result-table th:first-child, .result-table td:first-child {
  text-align: left;
}

.result-table tbody tr.captured td {
  font-weight: 600;
  border-bottom: 2px solid var(--pico-muted-border-color);
}

.result-table tbody tr.winner td {
  background: rgba(74, 226, 138, 0.12);
}

.result-table tbody tr.ambiguous td {
  background: rgba(226, 176, 74, 0.15);
}

.desktop-banner {
  background: #e2a04a;
  color: black;
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.desktop-banner-text {
  flex: 1;
}

.desktop-banner-text .muted {
  color: rgba(0, 0, 0, 0.65);
  word-break: break-all;
  margin: 0.5rem 0 0;
}

.desktop-banner-qr {
  flex: 0 0 auto;
  background: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  line-height: 0;
}

.desktop-banner-qr svg {
  display: block;
  width: 160px;
  height: 160px;
}

.bailed-hint {
  background: #e24a4a;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--pico-border-radius);
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.inline-check input {
  margin: 0;
}

#viz-section {
  margin: 1rem 0;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 0.75rem;
}

#viz-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.viz-legend {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-family: var(--pico-font-family-monospace, monospace);
  color: var(--pico-muted-color);
}

.stats-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pico-muted-border-color);
  text-align: center;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}
