:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #000;
  color: #f4f4f0;
  --accent: #edff76;
  --muted: #adafa4;
  --border: #393b34;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
.display, #calibration { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
[hidden] { display: none !important; }
h2, p { margin: 0; }
button, input { font: inherit; }
button, summary { cursor: pointer; }

button {
  min-height: 44px;
  color: inherit;
  background: #1b1c18;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.display {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  touch-action: none;
  overscroll-behavior: none;
}

.digit-canvas, .calibration-stage {
  position: absolute;
  inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.digit-canvas {
  z-index: 1;
  pointer-events: none;
}

.display[data-team="left"] { --digit-color: #ff9d00; }
.display[data-team="right"] { --digit-color: #009dff; }
.display[data-occupied] #digit { opacity: 0.35; }

#digit {
  position: absolute;
  color: var(--digit-color);
}

#calibration {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: inherit;
  background: #000;
  overscroll-behavior: none;
  touch-action: none;
}

.calibration-frame {
  position: absolute;
  z-index: 1;
  background: #a85f7d;
  box-shadow: inset 0 0 0 2px #39adff;
  color: #10263c;
}

.calibration-safe-area {
  position: absolute;
  background: #ffd4e5;
  pointer-events: none;
}

.calibration-actions {
  position: absolute;
  top: 7%;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.calibration-actions button {
  min-width: 44px;
  padding-inline: 6px;
  font-size: 0.875rem;
  color: #f4f4f0;
  background: #192334;
  border-color: #253d57;
}

.calibration-actions .primary {
  color: #071825;
  background: #7ecbff;
  border-color: #0d72b7;
  font-weight: 700;
}

.calibration-handle {
  position: absolute;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 10px;
  place-items: center;
  color: #14334b;
  background: #fff2f8;
  border-color: #266d9e;
  touch-action: none;
}

.calibration-handle svg { width: 100%; height: 100%; pointer-events: none; }
.move-handle { top: 50%; left: 50%; transform: translate(-50%, -50%); cursor: move; }
.resize-handle { right: max(4px, 5%); bottom: max(4px, 2.5%); cursor: nwse-resize; }

.calibration-note, .display-tools {
  position: absolute;
  margin: 0;
  font-size: 0.875rem;
}

.calibration-note {
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  max-width: calc(100% - 16px);
  padding: 6px 8px;
  border-radius: 6px;
  background: #101c28;
  color: #bbdef6;
  pointer-events: none;
}

.display-tools {
  z-index: 2;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: max(8px, env(safe-area-inset-left));
  max-width: calc(100% - 16px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
}

.display-tools details {
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #141414;
}

.display-tools details[open] { width: min(340px, 100%); padding-bottom: 10px; }
#presentation-status { margin: 0 0 8px; white-space: pre-wrap; font-size: 0.8rem; }
summary { display: list-item; min-height: 44px; padding-block: 12px; color: var(--muted); }
.demo-occupancy { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
#test-vibration, #vibration-result { margin-top: 8px; }

.demo-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 8px;
}

.demo-form input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 6px;
  background: #090a08;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: text;
  -webkit-user-select: text;
}

