:root {
  color-scheme: dark;
  --page: #121212;
  --panel: #1d1f20;
  --panel-border: #33383a;
  --text: #f4f0e8;
  --muted: #b6b0a6;
  --accent: #4fb286;
  --accent-strong: #64d2a0;
  --danger: #ef767a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--page);
  color: var(--text);
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.viewer {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  background: #080909;
}

#preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #080909;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state.is-hidden {
  display: none;
}

.empty-state p {
  max-width: 28rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  padding: 32px;
  border-left: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #111313;
  color: var(--text);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #062116;
  cursor: pointer;
  font-weight: 800;
}

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

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

button.secondary {
  border-color: var(--panel-border);
  background: #111313;
  color: var(--text);
}

button.secondary:hover {
  border-color: var(--accent);
}

#permissionButton {
  grid-column: 1 / -1;
}

.status {
  min-height: 44px;
  margin: auto 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.status.is-error {
  color: var(--danger);
}

@media (max-width: 840px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 62vh) auto;
  }

  .viewer {
    min-height: 360px;
  }

  .controls {
    min-height: auto;
    border-top: 1px solid var(--panel-border);
    border-left: 0;
    box-shadow: none;
  }
}

@media (max-width: 440px) {
  .controls {
    padding: 24px 18px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  #permissionButton {
    grid-column: auto;
  }
}
