:root {
  --blue: #183B5B;
  --red: #B8433C;
  --green: #5D7C5B;
  --beige: #F5F1EB;
  --gray: #F7F8FA;
  --ink: #18232E;
  --muted: #66717B;
  --line: rgba(24, 59, 91, 0.14);
  --white: #FFFFFF;
  --blue-soft: #EEF5FB;
  --red-soft: #F9EBE9;
  --green-soft: #EDF3EC;
  --shadow: 0 22px 60px rgba(24, 35, 46, 0.12);
  --soft-shadow: 0 14px 36px rgba(24, 35, 46, 0.08);
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(245, 241, 235, 0.98), rgba(247, 248, 250, 0.98));
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid rgba(184, 67, 60, 0.58);
  outline-offset: 4px;
}

.practice-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  padding: 8px max(18px, calc((100vw - var(--container)) / 2));
  border-bottom: 1px solid rgba(24, 59, 91, 0.1);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.practice-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.practice-brand img {
  width: min(300px, 58vw);
  height: 78px;
  object-fit: contain;
  object-position: left center;
}

.site-return,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border-radius: 999px;
  font-family: Poppins, Inter, system-ui, sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.site-return {
  padding: 0 15px;
  border: 1px solid var(--line);
  color: var(--blue);
  background: var(--white);
  font-size: 0.88rem;
  box-shadow: 0 10px 24px rgba(24, 59, 91, 0.08);
}

.site-return:hover,
.btn:hover {
  transform: translateY(-2px);
}

.site-return svg,
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.practice-main {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
  padding: 34px 0 62px;
}

.practice-hero,
.practice-section {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--soft-shadow);
}

.practice-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 56px);
}

.practice-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--blue), var(--red), var(--green));
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 12px;
  color: var(--red);
  font-family: Poppins, Inter, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  color: var(--blue);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(2.25rem, 5vw, 4.1rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.practice-hero p:not(.eyebrow),
.component-card p,
.practice-section p {
  color: var(--muted);
}

.practice-section {
  margin-top: 22px;
  padding: clamp(20px, 4vw, 32px);
}

.practice-section.is-muted {
  background: linear-gradient(135deg, rgba(238, 245, 251, 0.76), rgba(255, 255, 255, 0.96));
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.subject-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--gray);
  box-shadow: inset 0 0 0 1px rgba(24, 59, 91, 0.08);
}

.subject-card.is-selected {
  border-color: var(--green);
  background: var(--green-soft);
}

.subject-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(24, 59, 91, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.subject-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent 42%, rgba(24, 59, 91, 0.72));
  opacity: 0.82;
  pointer-events: none;
}

.subject-preview:hover,
.subject-preview:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 18px 36px rgba(24, 59, 91, 0.16);
  transform: translateY(-2px);
}

.subject-card.is-selected .subject-preview {
  border-color: var(--green);
  box-shadow: 0 18px 36px rgba(93, 124, 91, 0.2);
}

.subject-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.subject-click-hint {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--white);
  background: rgba(24, 59, 91, 0.94);
  font-family: Poppins, Inter, system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

.subject-click-hint span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.subject-card.is-selected .subject-click-hint {
  background: var(--green);
}

.subject-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 190px;
  padding: 18px;
  color: var(--blue);
  background:
    linear-gradient(135deg, rgba(24, 59, 91, 0.06), rgba(184, 67, 60, 0.05)),
    var(--white);
  text-align: center;
  font-weight: 800;
}

.subject-card h3 {
  margin-bottom: 0;
}

.work-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: 22px;
  align-items: start;
}

.editor-column {
  position: sticky;
  top: 118px;
}

.component-card {
  display: grid;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.component-card + .component-card {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--blue);
  font-weight: 800;
}

label span {
  color: var(--blue);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(24, 59, 91, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(93, 124, 91, 0.12);
}

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

.switch {
  display: inline-flex;
  grid-template-columns: auto;
  align-items: center;
  min-width: 220px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--blue-soft);
  cursor: pointer;
}

.switch input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.production-editor {
  min-height: 430px;
  line-height: 1.7;
}

.word-status {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--red-soft);
}

.word-status.is-ok {
  background: var(--green-soft);
}

.word-status.is-long {
  background: var(--red-soft);
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.word-row strong {
  color: var(--blue);
}

.word-row span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  color: var(--white);
  background: var(--red);
  font-weight: 900;
}

.word-status.is-ok .word-row span {
  background: var(--green);
}

.progress-track {
  height: 9px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 59, 91, 0.12);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.2s ease;
}

.word-status p {
  margin-bottom: 0;
  font-weight: 700;
}

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

.accent-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(38px, 1fr));
  gap: 8px;
}

.accent-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--blue);
  background: var(--white);
  font-weight: 800;
  cursor: pointer;
}

.accent-button:hover,
.accent-button:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  font-size: 0.94rem;
}

.btn:disabled {
  cursor: wait;
  opacity: 0.75;
  transform: none;
}

.btn-primary {
  color: var(--white);
  background: linear-gradient(135deg, #B8433C, #A93B35);
  box-shadow: 0 14px 28px rgba(184, 67, 60, 0.22);
}

.btn-secondary {
  color: var(--white);
  background: linear-gradient(135deg, #183B5B, #123049);
  box-shadow: 0 14px 28px rgba(24, 59, 91, 0.2);
}

.btn-neutral {
  color: var(--blue);
  background: var(--white);
  border: 1px solid var(--line);
}

.copy-feedback {
  min-height: 1.6em;
  margin: 12px 0 0;
  color: var(--green);
  font-weight: 800;
}

.copy-feedback.is-error {
  color: var(--red);
}

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

  .editor-column {
    position: static;
  }
}

@media (max-width: 720px) {
  .practice-header {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 10px 16px 14px;
  }

  .practice-brand img {
    width: min(260px, 74vw);
    height: 68px;
  }

  .site-return {
    width: 100%;
  }

  .section-title-row,
  .toggle-row {
    align-items: stretch;
    flex-direction: column;
  }

  .accent-grid {
    grid-template-columns: repeat(6, minmax(40px, 1fr));
  }

  .action-row {
    flex-direction: column;
  }

  .action-row .btn {
    width: 100%;
  }
}

@media print {
  .practice-header,
  .practice-hero,
  .practice-section:not(.editor-panel),
  .word-status,
  .accent-panel,
  .action-row,
  .copy-feedback {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .practice-main,
  .work-layout,
  .editor-column {
    display: block;
    width: 100%;
    padding: 0;
  }

  .editor-panel {
    border: 0;
    box-shadow: none;
  }

  .production-editor {
    min-height: 0;
    border: 0;
  }
}

/* Writing components and persistent task-one aids. */
.component-guidance { padding:16px 18px; border-left:3px solid var(--blue); border-radius:12px; background:#f2f6fa; color:var(--blue); }
.builder-panel > .component-card:nth-of-type(4n + 1), .task-two .greeting, .task-two #titleBox { background:#f0f5fa; }
.builder-panel > .component-card:nth-of-type(4n + 2), .task-two .field:has(#story) { background:#f2f6f0; }
.builder-panel > .component-card:nth-of-type(4n + 3), .task-two .field:has(#opinion) { background:#fcf2f0; }
.builder-panel > .component-card:nth-of-type(4n), .task-two .field:has(#ending) { background:#f7f4ee; }
.task-one { --container:1380px; --workspace-top:112px; }
.task-one-workspace { grid-template-columns:160px minmax(0,1fr) minmax(300px,.85fr); }
.accent-column, .persistent-production { position:sticky; top:var(--workspace-top); align-self:start; }
.accent-column { padding:16px; }
.accent-column .accent-panel { margin:0; }
.accent-column h3 { font-size:1rem; }
.accent-column .accent-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.accent-column .accent-button { min-width:0; padding:8px 0; }
.accent-column .help { font-size:.85rem; color:var(--muted); margin:14px 0 0; }
.persistent-production .editor-panel { display:flex; flex-direction:column; gap:10px; height:calc(100dvh - var(--workspace-top) - 16px); max-height:820px; margin:0; padding:20px; overflow:auto; }
.persistent-production h2 { font-size:1.55rem; margin:0; }
.persistent-production .eyebrow { margin:0; }
.persistent-production .production-editor { flex:1 1 160px; min-height:90px; height:auto; resize:none; }
.persistent-production .word-status { flex:none; margin:0; padding:12px; }
.persistent-production .word-status p { margin:8px 0 0; font-size:.85rem; }
.persistent-production .action-row { margin:0; }
.persistent-production .copy-feedback { margin:0; min-height:0; }
@media (max-width:1100px) {
  .task-one-workspace { grid-template-columns:120px minmax(0,1fr) minmax(270px,.8fr); gap:14px; }
}
@media (max-width:800px) {
  .task-one-workspace { grid-template-columns:1fr; }
  .accent-column { position:sticky; top:var(--workspace-top); z-index:15; padding:10px; background:rgba(255,255,255,.98); margin:0; }
  .accent-column h3, .accent-column .help { display:none; }
  .accent-column .accent-grid { display:flex; flex-wrap:nowrap; overflow-x:auto; }
  .accent-column .accent-button { flex:0 0 36px; }
  .persistent-production { position:sticky; bottom:0; top:auto; z-index:16; }
  .persistent-production .editor-panel { height:300px; max-height:45dvh; box-shadow:0 -8px 24px rgba(24,35,46,.12); }
  .task-one-workspace { padding-bottom:20px; }
}
@media print {
  .accent-column { display:none; }
  .persistent-production .editor-panel { height:auto; max-height:none; overflow:visible; }
}
.accent-column { max-height:calc(100dvh - var(--workspace-top) - 16px); overflow-y:auto; }
@media (max-width:800px) {
  .task-one.is-writing .persistent-production { position:fixed; left:16px; right:16px; bottom:8px; width:auto; }
  .task-one-workspace .builder-panel { padding-bottom:320px; }
}

/* Compact desktop palettes; no accent controls on phones or tablets. */
.task-two { --container:1380px; --workspace-top:112px; }
.task-two-workspace { grid-template-columns:160px minmax(0,1fr) minmax(300px,.85fr); }
.task-two-accent-column { position:sticky; top:var(--workspace-top); align-self:start; max-height:calc(100dvh - var(--workspace-top) - 16px); overflow-y:auto; }
.task-two .task-two-accent-column .accents { margin:0; padding:14px; }
.task-two .task-two-accent-column .keys { gap:6px; }
.task-two .task-two-accent-column .keys button { flex:1 0 32px; padding:7px 0; min-height:36px; }
.task-two-accent-column .help { font-size:.85rem; }
.accent-column .accent-button { background:var(--blue-soft); border-radius:10px; min-height:36px; color:var(--blue); font-weight:400; }
.accent-column .accent-button:hover { background:var(--red-soft); }
@media (max-width:1024px) {
  .accent-column, .task-two-accent-column { display:none; }
  .task-one-workspace, .task-two-workspace { grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); }
}
@media (max-width:980px) { .task-two-workspace { grid-template-columns:1fr; } }
@media (max-width:800px) { .task-one-workspace { grid-template-columns:1fr; } }
@media (hover:none) and (pointer:coarse) {
  .accent-column, .task-two-accent-column { display:none; }
  .task-one-workspace, .task-two-workspace { grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); }
}
@media (max-width:980px) and (hover:none) and (pointer:coarse) { .task-two-workspace { grid-template-columns:1fr; } }
@media (max-width:800px) and (hover:none) and (pointer:coarse) { .task-one-workspace { grid-template-columns:1fr; } }
@media print { .task-two-accent-column { display:none; } }

/* A single persistent production panel for task two. */
.task-two-production .preview-label { margin:0; font-weight:800; color:var(--blue); }
.task-two #preview.production-preview { flex:1 1 160px; min-height:90px; overflow-y:auto; padding:14px; border:1px solid var(--line); border-radius:14px; margin:0; background:var(--white); white-space:pre-wrap; overflow-wrap:anywhere; }
.task-two-production #counter { font-size:1rem; }
.task-two-production #status { margin:8px 0 0; font-size:.85rem; }
.task-two-production #message { margin:0; min-height:0; }
.task-two-production progress { display:block; height:9px; margin:10px 0 0; }
@media (max-width:980px) {
  .task-two-workspace { grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); }
}
@media (max-width:800px) {
  .task-two-workspace { grid-template-columns:1fr; }
  .task-two-workspace > div { padding-bottom:320px; }
  .task-two.is-writing .task-two-production { position:fixed; left:16px; right:16px; bottom:8px; width:auto; }
}
@media (max-width:980px) and (hover:none) and (pointer:coarse) { .task-two-workspace { grid-template-columns:minmax(0,1fr) minmax(280px,.85fr); } }
@media (max-width:800px) and (hover:none) and (pointer:coarse) { .task-two-workspace { grid-template-columns:1fr; } }
.task-two .practice-main { padding-bottom:16px; }

/* Keep the subject text unobscured in the new cards. */
.subject-preview { display:flex; flex-direction:column; min-height:0; }
.subject-preview::after { display:none; }
.subject-preview img { width:100%; height:auto; }
.subject-click-hint { position:static; width:calc(100% - 20px); margin:10px; }
.selected-subject-prompt { padding:18px; margin:20px 0 0; border:1px solid var(--line); border-radius:14px; background:var(--blue-soft); color:var(--blue); }

/* Heading hierarchy for the writing tools. */
.practice-hero > .eyebrow {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  letter-spacing: 0.025em;
  line-height: 1.2;
  margin-bottom: 18px;
}
.task-two .practice-hero h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 1.15;
}

/* Production is a reading region, composed only from writing fields. */
.persistent-production .preview-label {
  margin: 0;
  font-weight: 800;
  color: var(--blue);
}
.persistent-production .production-preview {
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
