/* Shared primitives - the second half of the design system.
   Linked from index.html and from every static admin page, so a button on
   settings.html and a button in the React app are literally the same rule.
   Depends on theme.css being linked first. */

/* Page frame ----------------------------------------------------------- */

/* The restrained atmosphere: page gradient plus two soft colour pools.
   Deliberately not the projection screen's 431KB photo + SVG turbulence
   filter, which a phone should not have to paint. */
.page-shell {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(60% 40% at 18% 12%, rgba(255, 107, 53, 0.11), transparent 70%),
    radial-gradient(52% 34% at 88% 82%, rgba(155, 89, 182, 0.11), transparent 70%),
    var(--gradient-page);
  color: var(--color-text);
  font-family: var(--font-body);
}

.page-title {
  margin: 0;
  padding: var(--space-5) var(--space-4) var(--space-2);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 0 20px var(--color-accent-glow);
}

/* Title underline: rule, diamond, rule */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.rule i {
  display: block;
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent));
}

.rule i + i {
  background: linear-gradient(90deg, var(--color-accent), transparent);
}

.rule b {
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  transform: rotate(45deg);
  box-shadow: var(--glow-accent);
}

/* Surfaces ------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

/* Controls ------------------------------------------------------------- */

/* 48px floor so every control clears a thumb on a phone in the dark. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 14px var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

/* Dark ink on pumpkin orange is 6.98:1. White on the same fill is 2.82:1,
   which fails even the large-text bar. */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-bg);
  box-shadow: var(--glow-accent);
}

.btn-ghost {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-ghost.selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}

.btn-gold {
  background: var(--color-gold);
  color: var(--color-bg);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.7);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

.field input {
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
}

.field input::placeholder {
  color: rgba(245, 240, 230, 0.55);
}

.field input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.ok { background: var(--color-success); }
.dot.warn { background: var(--color-warning); }
.dot.bad { background: var(--color-danger); }

/* Readouts ------------------------------------------------------------- */

/* Every number the eye reads as a readout wears this - counter digits,
   scores, totals. The only place Digital-7 appears. */
.readout {
  font-family: var(--font-counter);
  color: var(--color-gold);
  text-shadow: var(--glow-gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.readout.plain { color: var(--color-text); text-shadow: none; }
.readout.accent { color: var(--color-accent); text-shadow: none; }
.readout.dim { color: var(--color-text-dim); text-shadow: none; }

/* Messages ------------------------------------------------------------- */

.message {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.message.success {
  background: rgba(76, 175, 80, 0.16);
  border-color: var(--color-success);
}

.message.error {
  background: rgba(220, 38, 38, 0.16);
  border-color: var(--color-danger);
}

/* Bottom tabs ---------------------------------------------------------- */

/* One component, two link sets (public viewer / admin tools).
   The projection screen renders neither. */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(10, 10, 20, 0.95);
  border-top: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-height: 56px;
  padding: var(--space-2) 0 10px;
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: var(--text-xs);
}

.tab-icon {
  font-size: 21px;
  line-height: 1;
}

.tab.active { color: var(--color-accent); }
.tab.active .tab-label { text-shadow: 0 0 8px var(--color-accent-glow); }

/* Reserves room for the fixed bar so the last card is never underneath it. */
.tab-inset {
  padding-bottom: calc(56px + var(--space-4) + env(safe-area-inset-bottom));
}
