:root {
  color-scheme: light;
  --accent: #e6213c;
  --accent-dark: #c81730;
  --accent-soft: #fff0f2;
  --background: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --border: #dfe2e8;
  --text: #20232a;
  --muted: #69707d;
  --success: #18794e;
  --warning: #9a6700;
  --danger: #c62828;
  --shadow: 0 14px 36px rgba(24, 28, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero,
.panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px 26px;
  background:
    linear-gradient(120deg, rgba(230, 33, 60, 0.09), transparent 42%),
    var(--surface);
}

.hero-row,
.panel-heading,
.actions,
.status-row,
.item-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-row,
.panel-heading,
.item-heading {
  justify-content: space-between;
}

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

h1 {
  margin-bottom: 5px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 19px;
}

h3 {
  margin-bottom: 3px;
  font-size: 16px;
}

.subtitle,
.muted,
.help {
  color: var(--muted);
}

.subtitle,
.panel-heading p,
.item p {
  margin-bottom: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.nav a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}

.nav a:hover,
.nav a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.panel {
  grid-column: span 12;
  padding: 22px;
}

.panel.half {
  grid-column: span 6;
}

.panel-heading {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(230, 33, 60, 0.18);
  outline-offset: 1px;
  border-color: var(--accent);
}

.actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.item-heading > .actions,
.panel-heading > .actions {
  margin-top: 0;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 15px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

button.secondary,
.button.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--surface-muted);
}

button.danger {
  border-color: #f2c6cc;
  background: #fff5f6;
  color: var(--danger);
}

button:disabled,
.button.disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status.success {
  background: #eaf8f1;
  color: var(--success);
}

.status.warning {
  background: #fff8dd;
  color: var(--warning);
}

.status.error {
  background: #fff0f0;
  color: var(--danger);
}

.status.loading::before {
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  to { opacity: 0.25; }
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 30px 18px;
  color: var(--muted);
  text-align: center;
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.success {
  background: #eaf8f1;
  color: var(--success);
}

.badge.error {
  background: #fff0f0;
  color: var(--danger);
}

.video-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #0b0d12;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #bac0ca;
  text-align: center;
  pointer-events: none;
}

.log-output {
  overflow: auto;
  min-height: 180px;
  max-height: 360px;
  margin: 0;
  border-radius: 12px;
  padding: 14px;
  background: #151820;
  color: #d9dde6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.module-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  background: var(--surface);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: #f0a8b2;
  box-shadow: var(--shadow);
}

.module-card .number {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.module-card h2 {
  margin-top: 10px;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero,
  .panel {
    border-radius: 14px;
    padding: 17px;
  }

  .panel.half {
    grid-column: span 12;
  }

  .form-grid,
  .cards {
    grid-template-columns: 1fr;
  }

  .hero-row,
  .panel-heading,
  .item-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
