:root {
  color-scheme: dark;
  font-family: Montserrat, Circular, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #121212;
  color: #f2f5f8;
  --bg: #121212;
  --panel: #1a1a1a;
  --panel-2: #212121;
  --line: #333333;
  --text: #f2f5f8;
  --muted: #b3b3b3;
  --soft: #e0e0e0;
  --purple: #9900ff;
  --purple-2: #7700cc;
  --blue: #5865f2;
  --green: #43a047;
  --cyan: #00b8d9;
  --red: #dc3545;
  --yellow: #ffb84d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(153, 0, 255, 0.22), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(88, 101, 242, 0.16), transparent 28%),
    linear-gradient(180deg, #171717 0%, var(--bg) 44%);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  gap: 18px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.hero-panel,
.preview-panel,
.control-panel,
.detail-panel,
.login-card {
  border: 1px solid var(--line);
  background: rgba(26, 26, 26, 0.94);
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 18px rgba(153, 0, 255, 0.35));
}

.brand-logo.large {
  width: 96px;
  height: 96px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 14px;
  font-weight: 800;
}

.status-line,
.section-label,
label,
span,
dd,
li {
  color: var(--muted);
}

.topbar-actions,
.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.preset-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-2);
}

.primary-button {
  background: var(--purple);
  border-color: var(--purple);
  color: #ffffff;
  font-weight: 800;
}

.primary-button:hover:not(:disabled) {
  background: var(--purple-2);
  border-color: var(--purple-2);
}

.danger-button {
  border-color: rgba(236, 95, 103, 0.5);
  color: #ffd8dc;
}

.hero-panel {
  display: grid;
  grid-template-columns: 320px minmax(260px, 0.8fr) 1fr;
  gap: 14px;
  padding: 14px;
}

.code-panel {
  display: grid;
  gap: 6px;
  min-height: 132px;
  align-content: center;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(153, 0, 255, 0.16), rgba(153, 0, 255, 0.04)),
    #151515;
  border: 1px solid rgba(153, 0, 255, 0.34);
}

.code-panel strong {
  font-size: 50px;
  line-height: 1;
  letter-spacing: 4px;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(153, 0, 255, 0.55);
}

.code-hint {
  color: var(--soft);
  min-height: 20px;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.hero-copy h2 {
  font-size: 24px;
  line-height: 1.15;
  color: #ffffff;
}

.hero-copy p {
  color: var(--muted);
  line-height: 1.5;
}

.health-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.health-strip div {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181818;
}

.health-strip strong {
  font-size: 22px;
  color: #ffffff;
}

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

.preview-panel {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  background: #06080b;
}

video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  object-fit: contain;
  background: #06080b;
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.empty-preview span {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(23, 26, 33, 0.84);
}

.warning-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(232, 188, 88, 0.45);
  border-radius: 7px;
  background: rgba(47, 38, 18, 0.94);
  color: #ffe4a3;
}

.control-panel,
.detail-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px;
}

.panel-section {
  display: grid;
  gap: 10px;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

select,
input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10141a;
  color: var(--text);
  padding: 0 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-button.active {
  border-color: var(--purple);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(153, 0, 255, 0.28);
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.viewer-list {
  display: grid;
  gap: 8px;
  min-height: 78px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.viewer-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10141a;
}

.viewer-list strong {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 14px;
  margin: 0;
}

dt {
  color: var(--soft);
}

dd {
  margin: 0;
  text-align: right;
  color: var(--text);
}

.login-body {
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 24px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(153, 0, 255, 0.08), rgba(153, 0, 255, 0.02)),
    rgba(26, 26, 26, 0.96);
}

.login-form {
  display: grid;
  gap: 14px;
}

@media (max-width: 980px) {
  .hero-panel,
  .workspace,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .health-strip {
    grid-template-columns: 1fr 1fr;
  }

  .preview-panel,
  video {
    min-height: 240px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .button-row,
  .compact-grid,
  .preset-grid,
  .health-strip {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .button-row {
    display: grid;
  }

  .code-panel strong {
    font-size: 40px;
  }
}
