:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #66758a;
  --line: #dce5ef;
  --paper: #f4fbff;
  --surface: #ffffff;
  --primary: #12b8a6;
  --primary-dark: #087f78;
  --accent: #f2b84b;
  --green: #3bc58a;
  --rose: #ff5c8a;
  --violet: #5f7eea;
  --aqua-soft: #e7faf7;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(237, 251, 248, 0.94)),
    var(--paper);
  color: var(--ink);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.topbar h1,
.section-heading h2,
.prompt-panel h2 {
  margin: 0;
  line-height: 1.08;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topnav {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.nav-button,
.ghost-button,
.primary-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
}

.nav-button {
  background: transparent;
  color: var(--muted);
}

.nav-button.is-active {
  background: var(--violet);
  color: #fff;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2,
.prompt-panel h2 {
  font-size: clamp(25px, 3vw, 36px);
}

.status-pill {
  white-space: nowrap;
  border: 1px solid rgba(18, 184, 166, 0.28);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--primary-dark);
  background: var(--aqua-soft);
  font-size: 13px;
  font-weight: 700;
}

.setup-grid,
.response-form,
.share-panel,
.prompt-panel,
.visual-panel,
.insight-panel,
.responses-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 22px;
}

.field {
  display: grid;
  gap: 8px;
}

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

.field span,
.response-picker legend {
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.14);
}

.response-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  border: 0;
  padding: 0;
}

.response-picker legend {
  grid-column: 1 / -1;
}

.choice-card {
  display: flex;
  gap: 12px;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.choice-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.actions,
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

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

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

.ghost-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.ghost-button.danger {
  color: var(--rose);
}

.full {
  width: 100%;
}

.share-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 22px;
}

.share-panel h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.share-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  display: grid;
  flex: 0 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-card img {
  width: 138px;
  height: 138px;
  border-radius: 4px;
  object-fit: contain;
}

.qr-card a {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.learner-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1fr);
  gap: 20px;
}

.prompt-panel,
.response-form {
  padding: 24px;
}

.prompt-panel {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.prompt-panel p:last-child {
  color: var(--muted);
  line-height: 1.65;
  font-size: 18px;
}

.response-form {
  display: grid;
  gap: 16px;
}

.field small,
.submit-message {
  color: var(--muted);
  line-height: 1.5;
}

.submit-message {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.metric-band {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-band > div {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 18px;
  background: var(--violet);
  color: #fff;
}

.metric-band > div:nth-child(2) {
  background: var(--primary);
}

.metric-band > div:nth-child(3) {
  background: var(--rose);
}

.metric-value {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  font-weight: 700;
}

.visual-panel,
.responses-panel {
  grid-column: 1 / -1;
  padding: 20px;
}

.insight-panel {
  padding: 20px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-title h3,
.insight-panel h3 {
  margin: 0;
  font-size: 21px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 48px;
  margin-bottom: 14px;
}

.keyword {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--aqua-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

#summaryCanvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cluster-list,
.response-list {
  display: grid;
  gap: 10px;
}

.cluster-item,
.response-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.cluster-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.cluster-item strong,
.response-item strong {
  display: block;
  margin-bottom: 6px;
}

.cluster-count {
  flex: 0 0 auto;
  min-width: 44px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.response-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

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

  .topbar,
  .section-heading,
  .share-panel,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav,
  .actions,
  .dashboard-actions {
    width: 100%;
  }

  .nav-button,
  .ghost-button,
  .primary-button {
    flex: 1 1 auto;
  }

  .setup-grid,
  .response-picker,
  .learner-layout,
  .dashboard-grid,
  .metric-band {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .dashboard-actions,
  #setupView,
  #learnerView {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  #dashboardView {
    display: block !important;
  }

  .visual-panel,
  .insight-panel,
  .responses-panel,
  .setup-grid,
  .response-form,
  .share-panel,
  .prompt-panel {
    box-shadow: none;
  }
}
