:root {
  --bg: #f4f7fb;
  --bg-soft: #eef3f9;
  --surface: #ffffff;
  --surface-subtle: #f8fbff;
  --surface-accent: #eef4ff;
  --text: #162033;
  --muted: #65748a;
  --line: #d9e2ee;
  --line-strong: #c6d3e2;
  --accent: #2463eb;
  --accent-strong: #1749b8;
  --accent-soft: #e8f0ff;
  --success-soft: #edf8f2;
  --shadow: 0 10px 30px rgba(18, 32, 51, 0.06);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "IBM Plex Sans", "Segoe UI", "PingFang SC", sans-serif;
  background:
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 22%, #f2f6fb 100%);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 24px auto 36px;
  display: grid;
  gap: 20px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 4px 0;
}

.header-copy {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.eyebrow,
.panel-kicker,
.section-label,
.band-label,
.placeholder-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Avenir Next", "IBM Plex Sans", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.15;
  font-weight: 750;
}

h2 {
  font-size: clamp(1.08rem, 1.5vw, 1.28rem);
  line-height: 1.25;
  font-weight: 720;
}

h3 {
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 700;
}

.header-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.96rem;
}

.header-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.header-pill,
.tag,
.word-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
}

.header-pill {
  background: var(--surface-subtle);
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.practice-column {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.question-panel,
.answer-panel,
.feedback-panel {
  padding: 20px;
}

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

.panel-head p,
.panel-kicker,
.section-label {
  margin-bottom: 8px;
}

.panel-copy {
  display: grid;
  gap: 6px;
}

.question-actions {
  display: flex;
  align-items: flex-start;
}

.question-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.question-topic {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.prompt-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #d7e3f7;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f9fbff 0%, var(--surface-accent) 100%);
}

.question-text {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.3rem, 2.1vw, 1.7rem);
  line-height: 1.5;
  font-weight: 680;
}

.question-hint {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.secondary-tag {
  background: var(--bg-soft);
}

.answer-panel {
  background: var(--surface);
}

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

.workspace-copy {
  display: grid;
  gap: 6px;
}

.input-label {
  display: block;
  margin: 18px 0 10px;
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--text);
}

textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  background: #fbfdff;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: #8fb0ff;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.1);
}

.microcopy,
.form-note,
.feedback-lead,
.placeholder-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

.microcopy {
  margin-top: 12px;
}

.button-row,
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row {
  margin-top: 18px;
}

.feedback-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:not(.secondary) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(36, 99, 235, 0.18);
}

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

.form-note {
  min-height: 1.7em;
  margin-top: 12px;
}

.feedback-panel {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  min-height: 560px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.report-copy {
  display: grid;
  gap: 6px;
}

.band-box {
  min-width: 200px;
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #cdddff;
  background: var(--accent-soft);
}

.band-label {
  color: var(--accent-strong);
}

#bandRange {
  font-size: 1.35rem;
  font-weight: 760;
  color: var(--accent-strong);
  line-height: 1.1;
}

.report-placeholder {
  display: none;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  align-content: start;
}

.report-placeholder h3 {
  font-size: 1.02rem;
}

.report-body {
  display: grid;
  gap: 16px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.feedback-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfdff;
}

.featured-card {
  background: var(--surface-accent);
  border-color: #cfddff;
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.65;
}

.answer-text,
.improved-answer {
  margin: 0;
  color: var(--text);
  line-height: 1.78;
  white-space: pre-wrap;
}

#feedbackPanel.is-hidden {
  display: flex;
}

#feedbackPanel.is-hidden .report-body,
#feedbackPanel.is-hidden .feedback-actions {
  display: none;
}

#feedbackPanel.is-hidden .report-placeholder {
  display: grid;
}

#feedbackPanel.is-hidden .band-score {
  color: var(--muted);
}

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

  .feedback-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1280px);
    margin: 16px auto 28px;
    gap: 16px;
  }

  .app-header,
  .panel-head,
  .workspace-head,
  .report-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-status,
  .question-meta {
    justify-content: flex-start;
  }

  .question-actions {
    width: 100%;
  }

  .question-actions button,
  .feedback-actions button {
    width: 100%;
  }

  .button-row button {
    width: 100%;
  }

  .feedback-actions {
    justify-content: stretch;
  }

  textarea {
    min-height: 220px;
  }
}
