:root {
  color-scheme: dark;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  background: #090b12;
  color: #f4f6ff;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid #2b3040;
  background: #111522;
}

h1, h2, p { margin: 0; }
h1 { font-size: 20px; }
.toolbar p { margin-top: 5px; color: #aab1c5; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

button {
  border: 1px solid #424a62;
  border-radius: 9px;
  padding: 10px 14px;
  background: #202638;
  color: inherit;
  cursor: pointer;
}
button.primary { background: #645cff; border-color: #7e78ff; }
button:disabled { opacity: .45; cursor: not-allowed; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: calc(100vh - 86px);
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  background: radial-gradient(circle at center, #20263a, #080a10 70%);
}

#sharedScreen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: #aab1c5;
}
.empty-state strong { color: #f4f6ff; font-size: 24px; }

.rig-frame {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(430px, 42vw);
  height: min(610px, calc(100% - 32px));
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
}
.rig-frame.controls-visible {
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(9, 11, 18, .96);
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.rig-frame.hidden { display: none; }

.diagnostics {
  border-left: 1px solid #2b3040;
  background: #111522;
  padding: 22px;
}
.diagnostics h2 { font-size: 16px; margin-bottom: 18px; }
dl { margin: 0 0 24px; }
dl div { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; }
dt { color: #aab1c5; }
dd { margin: 0; text-align: right; }
.diagnostics label { display: block; margin: 18px 0 8px; color: #c9cee0; }
meter, input[type="range"] { width: 100%; }
output { display: block; margin-top: 5px; font-variant-numeric: tabular-nums; }
.message { margin-top: 24px; color: #aab1c5; line-height: 1.55; font-size: 13px; }
.message.error { color: #ff9d9d; }
.note { margin-top: 14px; color: #777f96; line-height: 1.5; font-size: 12px; }

@media (max-width: 820px) {
  .toolbar { align-items: flex-start; flex-direction: column; }
  main { grid-template-columns: 1fr; }
  .diagnostics { border-left: 0; border-top: 1px solid #2b3040; }
  .rig-frame { width: min(390px, calc(100% - 32px)); height: 60%; }
}
