:root {
  color-scheme: dark;
  --bg: #0e1014;
  --surface: #161a23;
  --surface-strong: #1c2230;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --subtle: #7c8595;
  --border: #232a3a;
  --border-strong: #2a3243;
  --music: #1db954;
  --music-dark: #117c3a;
  --tvs: #2b6cb0;
  --tvs-dark: #1f4d82;
  --accent: #2dd4d4;
  --danger: #f87171;
  --danger-bg: #3b1720;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(45, 212, 212, 0.10), transparent 60%),
    radial-gradient(900px 520px at 90% 110%, rgba(236, 72, 153, 0.08), transparent 60%),
    linear-gradient(145deg, #0d121c 0%, var(--bg) 64%, #111827 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

.login-shell,
.remote-shell {
  width: min(100%, 30rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem;
}

.login-shell {
  display: grid;
  align-items: center;
}

.login-panel,
.status-panel {
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel {
  padding: 1.35rem;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-context,
.section-label {
  color: var(--muted);
}

.login-context {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.access-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 3.25rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #0d121c;
  color: var(--text);
  padding: 0 0.95rem;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

input:focus,
button:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 35%, transparent);
  outline-offset: 3px;
}

.primary-button,
.ghost-button,
.action-button {
  min-height: 3.25rem;
  border: 0;
  border-radius: 0.95rem;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #071012;
}

.notice {
  margin-top: 1rem;
  border-radius: 0.9rem;
  padding: 0.8rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.notice.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.keypad button {
  min-height: 3.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.95rem;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 850;
}

.keypad button:active {
  background: color-mix(in oklab, var(--accent) 20%, var(--surface-strong));
}

.keypad-icon {
  color: var(--muted);
}

.secondary-link {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.secondary-link:focus-visible {
  border-radius: 0.4rem;
  outline: 3px solid color-mix(in oklab, var(--accent) 35%, transparent);
  outline-offset: 0.2rem;
}

.remote-shell {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.remote-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
}

.remote-header h1 {
  max-width: 14rem;
  margin-top: 0.25rem;
  font-size: 1.05rem;
  line-height: 1.2;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-button {
  min-height: 2.45rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 0.85rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

.status-panel {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
}

.status-topline {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.live {
  background: var(--music);
}

.status-dot.pending {
  background: var(--tvs);
}

.mix-status {
  font-size: 0.95rem;
  font-weight: 800;
}

.bus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.bus-card {
  display: grid;
  gap: 0.3rem;
  min-height: 3.75rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-strong);
  padding: 0.7rem;
}

.bus-card.active {
  border-color: color-mix(in oklab, var(--accent) 52%, var(--border-strong));
  background: color-mix(in oklab, var(--accent) 11%, var(--surface-strong));
}

.bus-name {
  font-size: 0.92rem;
  font-weight: 800;
}

.bus-detail {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.action-panel {
  display: grid;
  gap: 0.65rem;
}

.action-button {
  --button-top: var(--accent);
  --button-bottom: color-mix(in oklab, var(--accent) 72%, black);
  position: relative;
  display: flex;
  min-height: 4.6rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--button-top) 66%, white);
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, var(--button-top), var(--button-bottom));
  color: white;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 12px 24px rgba(0, 0, 0, 0.32);
  transition: box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.action-button:active {
  transform: scale(0.985);
}

.action-button:disabled {
  opacity: 0.72;
}

.action-button.is-pending::after {
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 1.15rem;
  height: 1.15rem;
  border: 3px solid rgba(255, 255, 255, 0.38);
  border-top-color: white;
  border-radius: 999px;
  content: "";
  animation: spin 780ms linear infinite;
}

.action-music {
  --button-top: #1db954;
  --button-bottom: #117c3a;
}

.action-tvs {
  --button-top: #2f80d0;
  --button-bottom: #1f4d82;
}

.button-kicker {
  font-size: 0.72rem;
  font-weight: 750;
  color: rgba(255, 255, 255, 0.72);
}

.button-label {
  margin-top: 0.1rem;
  font-size: 1.25rem;
  font-weight: 850;
  line-height: 1.1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 10;
  width: min(calc(100% - 2rem), 28rem);
  transform: translate(-50%, 150%);
  border-radius: 1rem;
  background: var(--text);
  color: white;
  padding: 0.9rem 1rem;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 48rem) {
  .remote-shell {
    width: min(100%, 42rem);
  }

  .action-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
