:root {
  --ink: #17202a;
  --muted: #66727f;
  --line: #d8e0e6;
  --panel: #ffffff;
  --field: #f7f9fb;
  --blue: #1769aa;
  --blue-dark: #0e4f82;
  --green: #1e7d67;
  --amber: #a35e00;
  --bg: #edf3f6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgba(237, 243, 246, 0.9), rgba(237, 243, 246, 0.96)),
    url("assets/bg1.jpg") center / cover fixed;
}

.workspace {
  width: min(1500px, 100%);
  margin: 0 auto;
}

.intro {
  max-width: 780px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.intro p:last-child {
  margin-bottom: 0;
  color: #40505f;
  font-size: 1.05rem;
  line-height: 1.5;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.control-panel,
.viewer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(23, 32, 42, 0.08);
}

.control-panel {
  padding: 18px;
}

.section-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.section-block:first-child {
  padding-top: 0;
}

.section-heading,
.viewer-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.section-heading h2,
.viewer-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.section-heading span,
.viewer-heading span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.segmented label,
.switch {
  cursor: pointer;
}

.segmented input,
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: #455566;
  font-weight: 700;
}

.segmented input:checked + span {
  color: #fff;
  background: var(--blue);
}

.switch span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.switch input:checked + span {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.popq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.is-muted {
  opacity: 0.72;
}

.is-muted.is-enabled {
  opacity: 1;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  background: var(--blue);
}

.button.primary:hover {
  background: var(--blue-dark);
}

.button.secondary {
  color: var(--blue);
  border-color: var(--line);
  background: #fff;
}

.viewer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.viewer-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.viewer-heading {
  min-height: 56px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.viewer-heading span {
  color: var(--amber);
}

iframe {
  display: block;
  width: 100%;
  height: clamp(360px, 42vw, 560px);
  flex: 1;
  border: 0;
  background: #231f20;
}

@media (max-width: 1100px) {
  .layout-grid,
  .viewer-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-width: none;
  }
}

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

  .popq-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    display: grid;
  }

  iframe {
    height: min(86vw, 420px);
  }
}
