:root {
  color-scheme: dark;
  --page: #07192d;
  --header: #0a2039;
  --panel: #0e2947;
  --input: #091f36;
  --border: #2b4562;
  --text: #f5f8fe;
  --muted: #aebfd3;
  --accent: #b6ef43;
  --accent-hover: #c8fa6c;
  --error: #ffc0c4;
  font-family: "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at 68% 0, #122e50, transparent 58%) var(--page);
}

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

button, input, select { font: inherit; }

button, a, input, select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  background: var(--header);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: min(100% - 64px, 1260px);
  min-height: 64px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
  letter-spacing: .07em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  grid-auto-flow: column;
  align-content: center;
  justify-content: center;
  place-items: center;
  width: 40px;
  height: 34px;
  color: #0a1a28;
  background: var(--accent);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: 1;
}

.brand-mark span { font-size: 17px; }
.brand-accent { color: var(--accent); }

.workspace {
  width: min(100% - 64px, 1260px);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 46px) 0 56px;
}

.intro { margin-bottom: 22px; }

h1 {
  font-size: clamp(35px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -.055em;
}

.intro p {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px #020d1824;
}

.event-panel { padding: clamp(16px, 2.5vw, 23px); }
.event-panel h2 { margin-bottom: 13px; font-size: 18px; }

.event-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.event-form .field { flex: 0 1 270px; }

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

input:not([type=checkbox]), select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 450;
}

select { padding-right: 20px; }
input::placeholder { color: #9aaec8; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 13px;
  color: var(--text);
  background: #193958;
  border: 1px solid #3b5774;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}

.button:hover:not(:disabled) { background: #244662; }

.button-primary {
  color: #10210c;
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover:not(:disabled) { background: var(--accent-hover); }

.button-quiet {
  color: #d3e2f5;
  background: transparent;
  border-color: transparent;
}

.button-small {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 12px;
}

.button:disabled, fieldset:disabled { opacity: .58; }
.button:disabled { cursor: default; }

.event-workspace { margin-top: 32px; }

.event-heading, .screen-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.event-heading { margin-bottom: 14px; }
.event-heading h2 {
  margin-top: 3px;
  font-size: clamp(23px, 3.2vw, 30px);
  line-height: 1.15;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.event-id-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .035em;
  overflow-wrap: anywhere;
}

.data-status, .screen-dimensions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.data-status::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #f4ba6e;
  border-radius: 50%;
}

.data-status[data-ready=true]::before { background: var(--accent); }

.screen-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.screen-card { overflow: hidden; }

.screen-heading {
  padding: 17px 19px;
  border-bottom: 1px solid var(--border);
}

.screen-heading h3 {
  max-width: 100%;
  font-size: 20px;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.screen-dimensions { font-variant-numeric: tabular-nums; }

.preview-section { background: #081d33; }

.preview-stage {
  display: grid;
  place-items: center;
  container-type: size;
  width: 100%;
  height: clamp(180px, 20vw, 252px);
  padding: 12px;
  background: #071522;
}

.preview-stage iframe {
  display: block;
  pointer-events: none;
  width: min(100cqw, calc(100cqh * var(--screen-ratio, 1.7778)));
  height: auto;
  aspect-ratio: var(--screen-ratio, 1.7778);
  border: 1px solid #294865;
  border-radius: 4px;
  background: var(--input);
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px 5px;
  padding: 4px 10px 4px 19px;
  border-bottom: 1px solid var(--border);
}

.preview-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.screen-settings { padding: 16px 19px 13px; }

.control-section {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-section legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 15px;
  font-weight: 750;
}

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

.clock-controls { align-items: end; margin-top: 10px; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.format-section { margin-top: 12px; }

.format-section legend {
  width: 100%;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.custom-size { margin-top: 10px; }
.format-save { margin-top: 10px; }

.screen-message {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.notice-error {
  border-color: #835464;
  background: #382334;
  color: var(--error);
}

.screen-message.is-error { color: var(--error); }

@media (max-width: 820px) {
  .topbar-inner, .workspace { width: calc(100% - 32px); }
  .screen-grid { grid-template-columns: 1fr; }
  .preview-stage { height: clamp(190px, 33vw, 260px); }
}

@media (max-width: 460px) {
  .topbar-inner { min-height: 56px; }
  .event-form .field { flex-basis: 100%; }
  .event-panel, .screen-settings, .screen-heading { padding-inline: 13px; }
  .preview-actions { padding-left: 13px; }
  .control-grid { grid-template-columns: 1fr; }
  .clock-controls { gap: 2px; }
  .preview-actions > span { flex-basis: 100%; margin-top: 5px; }
}
