/* Stage Timer – shared styles for /display and /control. System fonts only. */
:root {
  --bg: #000;
  --fg: #fff;
  --muted: #9a9a9a;
  --panel: #161616;
  --panel-border: #2c2c2c;
  --btn: #2a2a2a;
  --btn-active: #3a3a3a;
  --btn-primary: #1f6f3f;
  --btn-danger: #7a1f1f;
  --ok: #34c759;
  --warn: #ff9f0a;
  --white: #ffffff;
  --gold: #ffc53d;
  --red: #ff3b30;
  --focus: #4da3ff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Buttons (shared) ---------- */
.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15em;
  min-height: 72px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--btn);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}
.btn:active {
  background: var(--btn-active);
}
.btn[disabled] {
  opacity: 0.35;
  cursor: default;
}
.btn .sub {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}
.btn-primary {
  background: var(--btn-primary);
}
.btn-danger {
  background: var(--btn-danger);
}
.btn-quiet {
  background: transparent;
  border: 2px solid var(--panel-border);
  font-size: 1.05rem;
  min-height: 56px;
}
.btn-selected {
  outline: 3px solid var(--fg);
  outline-offset: -3px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stack {
  display: grid;
  gap: 12px;
}

/* ---------- Confirm dialog (shared) ---------- */
.confirm {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
}
.confirm-box {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.confirm-box p {
  margin: 0 0 20px;
  font-size: 1.35rem;
  line-height: 1.35;
}

/* ---------- Display page ---------- */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.timer {
  margin: 0;
  font-size: min(34vw, 80vh);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  color: var(--white);
  white-space: nowrap;
}
.timer[data-color='gold'] {
  color: var(--gold);
}
.timer[data-color='red'] {
  color: var(--red);
}

.panel-toggle {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 10;
  min-width: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.95rem;
}

.panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  padding: 20px;
  background: rgba(0, 0, 0, 0.92);
}
.panel-inner {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.panel h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-mini {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 1.1rem;
}
.panel-mini strong {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}
.status-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
  color: var(--muted);
}
.status-list li {
  padding: 6px 0;
  border-top: 1px solid var(--panel-border);
}
.status-list b {
  color: var(--fg);
  font-weight: 600;
}
.dot {
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: 0.35em;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: baseline;
}
.dot-ok {
  background: var(--ok);
}
.dot-warn {
  background: var(--warn);
}

.pin-form {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.pin-form input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid var(--panel-border);
  background: #000;
  color: var(--fg);
  font-size: 1.4rem;
  letter-spacing: 0.2em;
}
.hint {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
}
.hint-warn {
  color: var(--warn);
}

/* ---------- Control page ---------- */
.control {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 16px 16px 40px;
  min-height: 100%;
}
.control h1 {
  margin: 4px 0 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.conn {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 1.1rem;
  font-weight: 600;
}
.conn[data-state='offline'] {
  background: #3a1a12;
  border-color: #7a3a24;
}
.mini {
  margin: 16px 0;
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  text-align: center;
}
.mini .label {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.mini .time {
  margin: 4px 0;
  font-size: clamp(3.5rem, 22vw, 6rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--white);
}
.mini .time[data-color='gold'] {
  color: var(--gold);
}
.mini .time[data-color='red'] {
  color: var(--red);
}
.mini .meta {
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 1.05rem;
  color: var(--muted);
}
.mini .meta b {
  color: var(--fg);
}
.section-title {
  margin: 22px 0 10px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.9);
}
.overlay .confirm-box h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.notice {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #3a1a12;
  border: 1px solid #7a3a24;
  font-size: 1rem;
  line-height: 1.4;
}
