:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #191d25;
  --panel-strong: #202633;
  --text: #f4f7fb;
  --muted: #aeb7c6;
  --line: #313848;
  --accent: #4fc3a1;
  --accent-strong: #38a988;
  --danger: #ff7b7b;
  --shadow: 0 24px 70px rgb(0 0 0 / 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(145deg, #111318 0%, #181c25 52%, #10131a 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.75rem;
  border: 0;
  border-radius: 7px;
  padding: 0 1rem;
  background: var(--accent);
  color: #08130f;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

button.secondary:hover {
  background: rgb(255 255 255 / 0.06);
}

button.secondary[aria-pressed="true"] {
  border-color: rgb(79 195 161 / 0.75);
  background: rgb(79 195 161 / 0.14);
  color: #baf5df;
}

button.compact {
  min-height: 2.25rem;
  padding: 0 0.75rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.access-panel {
  width: min(100%, 30rem);
  display: grid;
  gap: 2rem;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(25 29 37 / 0.92);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.75rem;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: 0;
}

.viewer-toolbar h1 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.empty-state h2 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.lede {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 0.75rem;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 0.9rem;
  background: #10131a;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(79 195 161 / 0.18);
}

.form-error {
  min-height: 1.2rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.viewer-panel {
  width: min(100%, 92rem);
  min-height: calc(100vh - 2.5rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
}

.viewer-toolbar,
.viewer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(25 29 37 / 0.9);
}

.toolbar-actions,
.viewer-meta {
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.status-pill {
  min-height: 2.25rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 0.85rem;
  background: rgb(79 195 161 / 0.13);
  color: #9af0d2;
  font-size: 0.86rem;
  font-weight: 800;
}

.status-pill.warn {
  background: rgb(255 203 107 / 0.14);
  color: #ffd58a;
}

.status-pill.bad {
  background: rgb(255 123 123 / 0.14);
  color: #ffaaa9;
}

.screen-stage {
  position: relative;
  min-height: 22rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06070a;
  box-shadow: var(--shadow);
}

.screen-stage.control-enabled {
  cursor: grab;
  touch-action: none;
}

.screen-stage.control-enabled:active {
  cursor: grabbing;
}

#screenCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: auto;
}

.screen-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

.screen-stage:fullscreen.control-enabled {
  cursor: none;
}

.screen-stage:fullscreen #screenCanvas {
  width: 100vw;
  height: 100vh;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 1.5rem;
  text-align: center;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 0.04) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.viewer-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0.85rem;
  }

  .access-panel {
    padding: 1.25rem;
  }

  h1 {
    font-size: 2rem;
  }

  .viewer-panel {
    min-height: calc(100vh - 1.7rem);
  }

  .viewer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions > * {
    flex: 1 1 auto;
  }
}
