:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191c22;
  --panel-2: #22262e;
  --text: #f5f7fb;
  --muted: #aeb6c3;
  --line: #353b46;
  --primary: #10b981;
  --primary-dark: #0f8f66;
  --danger: #ef4444;
  --ink: #08110e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  min-height: 100vh;
}

.home-shell {
  display: grid;
  place-items: center;
  padding: 28px;
}

.brand-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 22px;
}

.brand-mark,
.logo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  background: var(--primary);
  color: var(--ink);
  border-radius: 8px;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 5rem);
  line-height: 0.95;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.primary,
button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--ink);
}

.button.secondary {
  display: inline-grid;
  place-items: center;
}

button.danger {
  border-color: #5f252b;
  background: #33171b;
  color: #ffd5d9;
}

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

.status-strip {
  position: fixed;
  left: 28px;
  right: 28px;
  bottom: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.status-strip strong {
  color: var(--primary);
}

.diagnostics {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 28px;
}

.diagnostics h1 {
  font-size: 2.4rem;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.diagnostic-grid div {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--panel);
}

.diagnostic-grid span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.diagnostic-grid strong {
  font-size: 1.4rem;
}

.app-shell {
  display: grid;
  grid-template-rows: 72px 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.logo {
  width: 42px;
  height: 42px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 0;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.side-panel h1 {
  font-size: 2rem;
  line-height: 1.05;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0d0f12;
  color: var(--text);
  font: inherit;
}

.remote-surface {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #111318;
  background-size: 32px 32px;
}

.connection-card,
.screen-placeholder {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 34, 0.92);
}

.connection-card strong {
  font-size: clamp(2rem, 7vw, 4.5rem);
  overflow-wrap: anywhere;
}

.eyebrow,
.state-line span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
}

.state-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-log {
  width: min(520px, 100%);
  min-height: 96px;
  color: var(--muted);
  font-size: 0.92rem;
}

.audit-log div {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.viewer-surface {
  align-content: stretch;
  grid-template-rows: 1fr auto auto;
}

.screen-placeholder {
  width: min(900px, 100%);
  min-height: min(560px, 70vh);
  place-items: center;
  align-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.screen-placeholder strong {
  font-size: 1.8rem;
}

.screen-placeholder span {
  color: var(--muted);
}

#remoteFrame {
  display: none;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
}

.screen-placeholder.has-frame {
  padding: 10px;
  background: #050607;
  cursor: crosshair;
}

.screen-placeholder.has-frame .brand-mark,
.screen-placeholder.has-frame strong,
.screen-placeholder.has-frame span {
  display: none;
}

.screen-placeholder.has-frame #remoteFrame {
  display: block;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-input {
  grid-auto-flow: column;
  align-items: center;
  color: var(--muted);
}

.toolbar-input input {
  width: min(280px, 52vw);
}

.command-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 780px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-shell {
    grid-template-rows: auto 1fr;
  }

  .diagnostic-grid {
    grid-template-columns: 1fr;
  }
}
