.p59-writing-page {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: #172033;
  background: #f6f8ff;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.p59-writing-page * {
  box-sizing: border-box;
}

.p59-writing-page svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p59-writing-page a {
  color: inherit;
  text-decoration: none;
}

.p59-writing-page p {
  margin: 0;
  color: #5d6b82;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.p59-writing-page h1,
.p59-writing-page h2,
.p59-writing-page h3 {
  margin: 0;
  color: #071633;
  letter-spacing: 0;
}

.p59-writing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #dde6f5;
  backdrop-filter: blur(14px);
}

.p59-writing-nav-inner {
  width: min(1320px, calc(100% - 36px));
  min-height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.p59-writing-brand,
.p59-writing-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #172033;
  font-weight: 800;
  white-space: nowrap;
}

.p59-writing-brand {
  justify-self: start;
}

.p59-writing-brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #155eef;
  background: #eef4ff;
}

.p59-writing-nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.p59-writing-nav-links a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  color: #46556d;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.p59-writing-nav-links a.is-active,
.p59-writing-nav-links a:hover {
  color: #155eef;
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px #dbe7ff;
}

.p59-writing-nav-links a.p59-writing-plan-link {
  margin-left: 6px;
  color: #155eef;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #b9c9e7;
  font-weight: 850;
}

.p59-writing-nav-links a.p59-writing-plan-link:hover {
  background: #eef4ff;
}

.p59-writing-menu {
  display: none;
  flex: 0 0 auto;
}

.p59-writing-page .p59-writing-menu {
  display: none;
}

.p59-writing-main {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
}

.p59-writing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 64px;
  padding: 56px 24px 48px;
}

.p59-writing-hero-copy {
  max-width: 880px;
}

.p59-writing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #155eef !important;
  font-weight: 800;
}

.p59-writing-eyebrow span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.p59-writing-hero h1 {
  margin-top: 8px;
  font-size: 38px;
  line-height: 1.18;
}

.p59-writing-hero p:not(.p59-writing-eyebrow) {
  max-width: 560px;
  margin-top: 14px;
  font-size: 18px;
}

.p59-writing-hero-actions,
.actions,
.model-essay-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.p59-writing-hero-actions {
  margin-top: 24px;
}

.p59-writing-button,
.p59-writing-page button,
.p59-writing-page .secondary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #155eef;
  border-radius: 8px;
  padding: 0 18px;
  color: #ffffff;
  background: #155eef;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
}

.p59-writing-button svg,
.p59-writing-page button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
}

.p59-writing-button.is-secondary,
.p59-writing-page .secondary-button {
  color: #155eef;
  background: #ffffff;
  border-color: #b9c9e7;
}

.p59-writing-page button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.p59-writing-page button:focus,
.p59-writing-page input:focus,
.p59-writing-page textarea:focus,
.p59-writing-page select:focus,
.p59-writing-page a:focus {
  outline: 3px solid rgba(21, 94, 239, 0.22);
  outline-offset: 2px;
}

.p59-writing-hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-self: start;
}

.p59-writing-metric,
.p59-writing-submit,
.p59-writing-result,
.p59-writing-submit-recent,
.panel,
.p59-writing-cta {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  box-shadow: 0 14px 35px rgba(32, 55, 94, 0.08);
}

.p59-writing-metric {
  min-height: 98px;
  padding: 16px;
}

.p59-writing-metric svg {
  color: #155eef;
}

.p59-writing-metric span {
  display: block;
  margin-top: 8px;
  color: #6a7890;
  font-size: 13px;
  font-weight: 700;
}

.p59-writing-metric strong {
  display: block;
  margin-top: 6px;
  color: #172033;
  font-size: 18px;
  line-height: 1.25;
}

.p59-writing-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(0, 1.14fr);
  gap: 20px;
  align-items: start;
  padding: 0 24px;
}

.p59-writing-shell.has-result {
  grid-template-columns: minmax(360px, 37.5%) minmax(0, 62.5%);
}

.p59-writing-submit,
.p59-writing-result,
.panel {
  padding: 20px;
}

.p59-writing-shell.has-result .p59-writing-submit {
  position: sticky;
  top: 78px;
  max-height: none;
  overflow: visible;
  align-self: start;
}

.p59-writing-shell.has-result .p59-writing-result {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.p59-writing-shell.has-result .editor-fields,
.p59-writing-shell.has-result .status {
  display: none;
}

.p59-writing-shell.has-result .annotated-source-panel {
  display: grid;
  align-content: start;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

.p59-panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.p59-panel-heading svg {
  color: #155eef;
  font-size: 18px;
}

.p59-panel-heading h2,
.panel h2 {
  font-size: 22px;
  line-height: 1.3;
}

.access-panel,
.p59-form-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #fbfdff;
}

.access-panel {
  margin-bottom: 16px;
}

.p59-form-card {
  background: #ffffff;
}

.p59-writing-page label {
  display: block;
  margin: 16px 0 8px;
  color: #253149;
  font-weight: 800;
}

.p59-writing-page textarea,
.p59-writing-page input,
.p59-writing-page select {
  width: 100%;
  max-width: 100%;
  border: 1px solid #c9d8ee;
  border-radius: 8px;
  padding: 11px 12px;
  color: #172033;
  background: #ffffff;
  font: inherit;
  line-height: 1.55;
}

.p59-writing-page textarea {
  min-height: 118px;
  resize: vertical;
}

.p59-writing-page textarea#essay {
  min-height: 300px;
}

.task1-prompt-upload {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed #b9c9e7;
  border-radius: 8px;
  background: #f8fbff;
}

.task1-prompt-upload[hidden] {
  display: none;
}

.task1-prompt-upload__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.task1-prompt-upload__head label {
  margin: 0 0 4px;
}

.task1-prompt-upload__head p,
.task1-prompt-upload__status,
.task1-prompt-preview__meta span {
  color: #5d6b82;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.task1-prompt-preview {
  display: grid;
  grid-template-columns: minmax(112px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.task1-prompt-preview[hidden] {
  display: none;
}

.task1-prompt-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  background: #ffffff;
}

.task1-prompt-preview__meta {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.task1-prompt-preview__meta strong {
  overflow-wrap: anywhere;
  color: #172033;
}

.task1-prompt-preview__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(148px, 0.44fr);
  gap: 14px;
  align-items: end;
}

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

.counter {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #5d6b82;
  font-weight: 800;
}

.pre-submit-hint,
.status,
.coverage-note,
.preprocess-note {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #d9e5f8;
  border-radius: 8px;
  color: #203a61;
  background: #eef4ff;
  font-weight: 800;
  line-height: 1.55;
}

.status.fail {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.status.ok {
  color: #155eef;
  background: #eef4ff;
  border-color: #cfe0ff;
}

.quota-strip,
.price-grid,
.redeem-row {
  display: grid;
  gap: 10px;
}

.quota-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.quota-pill,
.price-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #ffffff;
}

.quota-pill strong,
.price-card strong {
  display: block;
  margin-bottom: 4px;
  color: #172033;
  overflow-wrap: anywhere;
}

.quota-pill span,
.price-card span {
  color: #5d6b82;
  font-size: 13px;
  line-height: 1.45;
}

.quota-message {
  min-height: 22px;
  margin-top: 8px;
  color: #155eef;
  font-weight: 800;
}

.redeem-later,
.essay-collapse {
  margin-top: 12px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.redeem-later summary,
.essay-collapse summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  color: #172033;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.redeem-later summary::-webkit-details-marker,
.essay-collapse summary::-webkit-details-marker {
  display: none;
}

.redeem-summary-action,
.essay-collapse-action {
  flex: 0 0 auto;
  color: #155eef;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.redeem-later-body,
.essay-collapse-body {
  padding: 0 14px 14px;
}

.redeem-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.purchase-note,
.revision-hint {
  margin-top: 10px;
  color: #5d6b82;
  font-weight: 700;
}

.actions {
  margin-top: 18px;
}

.p59-profile-link {
  min-height: 40px;
}

.meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.meta div,
.notice,
.rubric-item,
.sentence-item,
.priority-item,
.revision-title,
.revision-block,
.revision-mini-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #fbfdff;
}

.meta strong {
  display: block;
  margin-bottom: 4px;
  color: #6a7890;
  font-size: 12px;
}

.meta span {
  display: block;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.result {
  display: grid;
  gap: 16px;
}

.empty {
  min-height: 300px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
  border: 1px dashed #c9d8ee;
  border-radius: 8px;
  color: #5d6b82;
  background: #ffffff;
}

.empty h2 {
  font-size: 22px;
}

.empty ul {
  margin: 0;
  padding-left: 20px;
  color: #46556d;
  line-height: 1.75;
}

.source-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-toolbar .secondary-button {
  flex: 0 0 auto;
  min-width: 88px;
  padding-inline: 14px;
  white-space: nowrap;
}

.source-toolbar h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.source-note {
  font-size: 14px;
}

.annotation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 2px;
}

.annotation-legend span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.legend-p0 {
  color: #9a3412;
  background: #fff7ed;
}

.legend-p1 {
  color: #155eef;
  background: #eef4ff;
}

.legend-p2 {
  color: #46556d;
  background: #f4f7fb;
}

.annotated-source-panel {
  display: none;
  gap: 12px;
}

.annotated-sentence-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.annotated-paragraph {
  display: grid;
  gap: 10px;
  margin: 0;
}

.annotated-sentence {
  width: 100%;
  min-height: auto;
  justify-content: flex-start;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid #dde6f5;
  border-left: 4px solid #d8e1ef;
  border-radius: 8px;
  color: #253149;
  background: #ffffff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.annotated-sentence strong {
  color: #172033;
  font-size: 12px;
  font-weight: 900;
}

.annotated-sentence .annotation-text {
  min-width: 0;
  color: inherit;
  line-height: 1.6;
}

.annotated-sentence .annotation-tag {
  grid-column: 2;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  color: #46556d;
  background: #f4f7fb;
  font-size: 12px;
  font-weight: 900;
}

.sentence-level-p0 {
  border-left-color: #f97316;
  background: #fff7ed;
}

.sentence-level-p0 .annotation-tag {
  color: #9a3412;
  background: #ffedd5;
}

.sentence-level-p1 {
  border-left-color: #155eef;
  background: #eef4ff;
}

.sentence-level-p1 .annotation-tag {
  color: #155eef;
  background: #ffffff;
}

.sentence-level-p2 {
  border-left-color: #8aa0bd;
  background: #f8fbff;
}

.sentence-level-none {
  border-left-color: #d8e1ef;
  background: #ffffff;
}

.annotated-sentence.active {
  border-color: #155eef;
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.16);
}

.sentence-item.active {
  border-color: #155eef;
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.16);
  background: #f7fbff;
}

.p59-writing-page .annotated-sentence {
  width: 100%;
  min-height: auto;
  max-height: 120px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  justify-content: flex-start;
  align-items: flex-start;
  gap: 6px 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid #dde6f5;
  border-left: 4px solid #d8e1ef;
  color: #253149;
  background: #ffffff;
  text-align: left;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.p59-writing-page .annotated-sentence strong {
  white-space: nowrap;
}

.p59-writing-page .annotated-sentence .annotation-text {
  display: -webkit-box;
  overflow: hidden;
  color: #253149;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.p59-writing-page .annotated-sentence .annotation-tag {
  grid-column: 2;
  max-width: 100%;
}

.p59-writing-page .sentence-level-p0 {
  border-left-color: #f97316;
  background: #fff7ed;
}

.p59-writing-page .sentence-level-p1 {
  border-left-color: #155eef;
  background: #eef4ff;
}

.p59-writing-page .sentence-level-p2 {
  border-left-color: #8aa0bd;
  background: #f8fbff;
}

.p59-writing-page .sentence-level-none {
  border-left-color: #d8e1ef;
  background: #ffffff;
}

.p59-writing-page .annotated-sentence.active {
  border-color: #155eef;
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.16);
}

.p59-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.p59-result-header .secondary-button {
  flex: 0 0 auto;
  min-width: 112px;
  white-space: nowrap;
}

.p59-result-header h2 {
  margin-bottom: 4px;
}

.p59-score-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(72px, 0.55fr));
  gap: 12px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  background: #f7fbff;
}

.p59-score-main,
.p59-score-mini {
  display: grid;
  align-content: center;
  gap: 2px;
}

.p59-score-main strong {
  color: #155eef;
  font-size: 34px;
  line-height: 1;
}

.p59-score-main span,
.p59-score-mini span {
  color: #6a7890;
  font-size: 12px;
  font-weight: 800;
}

.p59-score-mini {
  justify-items: center;
  border-left: 1px solid #d9e5f8;
}

.p59-score-mini strong {
  color: #172033;
  font-size: 24px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  color: #155eef;
  background: #eef4ff;
  font-size: 13px;
  font-weight: 800;
}

.rubric-grid,
.priority-list,
.sentence-list,
.training-grid,
.expression-grid,
.paragraph-map,
.p59-compact-card-list,
.recent-records-list {
  display: grid;
  gap: 12px;
}

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

.rubric-head,
.sentence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.rubric-head span {
  color: #155eef;
  font-weight: 900;
}

.rubric-head strong {
  color: #172033;
  font-size: 24px;
}

.priority-item {
  display: grid;
  gap: 8px;
  border-left: 4px solid #155eef;
}

.priority-item h3,
.training-card h3 {
  font-size: 17px;
  line-height: 1.45;
}

.field {
  margin-top: 10px;
}

.field span {
  display: block;
  margin-bottom: 4px;
  color: #6a7890;
  font-size: 13px;
  font-weight: 800;
}

.field p {
  color: #253149;
}

.expand-feedback-button {
  margin-bottom: 12px;
}

details.sentence-item {
  padding: 0;
  overflow: hidden;
}

details.sentence-item summary {
  padding: 14px;
  list-style: none;
  cursor: pointer;
}

details.sentence-item summary::-webkit-details-marker {
  display: none;
}

.sentence-head strong {
  color: #172033;
  font-size: 18px;
}

.original {
  color: #172033;
  font-weight: 800;
  line-height: 1.65;
}

.sentence-body {
  padding: 0 14px 14px;
}

.priority-p0 {
  color: #9a3412;
  background: #fff7ed;
}

.priority-p1 {
  color: #155eef;
  background: #eef4ff;
}

.priority-p2 {
  color: #46556d;
  background: #f4f7fb;
}

.model-essay-actions {
  margin-top: 14px;
}

.model-essay-status {
  color: #5d6b82;
  font-weight: 800;
}

.model-essay-output,
.revision-output {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.model-essay-status-line {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  color: #155eef;
  background: #eef4ff;
  font-weight: 900;
}

.model-essay-text {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #fbfdff;
}

.model-essay-section h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.model-essay-section p {
  color: #253149;
  line-height: 1.78;
}

.model-essay-warning {
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  background: #fff7ed;
  font-weight: 800;
  line-height: 1.65;
}

.p59-compact-card,
.expression-item,
.paragraph-map-item,
.training-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #fbfdff;
}

.p59-compact-card strong,
.expression-item strong,
.paragraph-map-item strong,
.revision-mini-card strong {
  display: block;
  margin-bottom: 6px;
  color: #172033;
}

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

.revision-block {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.revision-textarea {
  min-height: 220px;
  margin-top: 12px;
}

.training-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.training-card {
  display: grid;
  gap: 8px;
}

.training-tag {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  color: #155eef;
  background: #eef4ff;
  font-size: 12px;
  font-weight: 900;
}

.recent-record {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #ffffff;
}

.recent-record > span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  color: #155eef;
  background: #eef4ff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.recent-record strong {
  color: #172033;
}

.recent-record .recent-score {
  color: #155eef;
  font-size: 22px;
}

.recent-record a {
  color: #155eef;
  font-weight: 900;
}

.p59-writing-submit-recent,
.p59-writing-cta {
  margin: 40px 24px 0;
  padding: 24px;
}

.p59-writing-cta {
  display: grid;
  justify-items: center;
  text-align: center;
}

.p59-writing-cta h2 {
  max-width: 720px;
  font-size: 28px;
  line-height: 1.35;
}

.p59-writing-cta p {
  margin-top: 10px;
}

.p59-writing-footer {
  margin-top: 56px;
  border-top: 1px solid #dde6f5;
  background: #ffffff;
}

.p59-writing-footer-inner {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(150px, 1fr));
  gap: 32px;
  padding: 56px 24px 40px;
}

.p59-writing-footer h3 {
  margin-bottom: 14px;
  color: #172033;
  font-size: 14px;
}

.p59-writing-footer a {
  display: block;
  margin-top: 10px;
  color: #5d6b82;
  font-size: 14px;
}

.p59-writing-footer p {
  margin-top: 12px;
  max-width: 300px;
  font-size: 14px;
}

.p59-writing-footer-bottom {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 32px;
  border-top: 1px solid #eef2fa;
  color: #6a7890;
  font-size: 13px;
}

.p59-writing-footer-bottom span:last-child {
  display: flex;
  gap: 20px;
}

.hidden,
.internal-only.hidden {
  display: none !important;
}

.writing-logic-chain-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 35px rgba(32, 55, 94, 0.08);
}

.logic-mode-note {
  padding: 10px 12px;
  border-radius: 8px;
  color: #155eef;
  background: #eef4ff;
  font-size: 14px;
  line-height: 1.6;
}

.logic-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.logic-heading-row h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.logic-eyebrow {
  margin-bottom: 4px !important;
  color: #155eef !important;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.logic-minutes {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: #46556d;
  background: #f4f7fb;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.logic-topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.logic-topic-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  color: #155eef;
  background: #f8fbff;
  font-size: 14px;
  font-weight: 800;
}

.logic-topic-pill.is-active {
  color: #ffffff;
  background: #155eef;
}

.logic-topic-pill.is-disabled {
  color: #6a7890;
  background: #f4f7fb;
  border-color: #dde6f5;
}

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

.logic-chain-section,
.logic-correction-guide {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dde6f5;
  border-radius: 8px;
  background: #fbfdff;
}

.logic-chain-section-wide {
  grid-column: 1 / -1;
}

.logic-chain-section h3,
.logic-correction-guide h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.logic-chain-section ul {
  margin: 0;
  padding-left: 20px;
  color: #46556d;
  line-height: 1.7;
}

.logic-chain-section li + li {
  margin-top: 6px;
}

.logic-correction-guide {
  display: grid;
  gap: 10px;
}

.p59-writing-page pre {
  max-height: 420px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  color: #e5e7eb;
  background: #111827;
  font: 12px/1.55 Consolas, "SFMono-Regular", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .p59-writing-nav-links {
    display: none;
  }

  .p59-writing-page .p59-writing-menu {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    padding: 0;
  }

  .p59-writing-hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .p59-writing-hero-metrics {
    max-width: 560px;
  }
}

@media (max-width: 880px) {
  .p59-writing-nav-inner,
  .p59-writing-main,
  .p59-writing-footer-inner,
  .p59-writing-footer-bottom {
    width: min(720px, calc(100% - 32px));
  }

  .p59-writing-hero,
  .p59-writing-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .p59-writing-hero h1 {
    font-size: 32px;
  }

  .p59-writing-shell,
  .p59-writing-shell.has-result,
  .row,
  .p59-band-row,
  .quota-strip,
  .redeem-row,
  .rubric-grid,
  .expression-grid,
  .training-grid,
  .logic-grid {
    grid-template-columns: 1fr;
  }

  .p59-writing-shell.has-result .p59-writing-submit {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .p59-writing-shell.has-result .annotated-source-panel {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .p59-writing-result {
    padding: 0;
  }

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

  .p59-score-main {
    grid-column: 1 / -1;
  }

  .p59-score-mini {
    border-left: 0;
    border-top: 1px solid #d9e5f8;
    padding-top: 10px;
  }

  .recent-record {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .recent-record .recent-score {
    font-size: 20px;
  }

  .counter {
    justify-content: flex-start;
  }

  .p59-writing-page button,
  .p59-writing-page .secondary-button,
  .p59-writing-button {
    width: 100%;
  }

  .task1-prompt-preview {
    grid-template-columns: 1fr;
  }

  .task1-prompt-preview img {
    max-height: 260px;
  }

  .source-toolbar,
  .p59-result-header,
  .logic-heading-row,
  .p59-writing-footer-bottom {
    display: grid;
    grid-template-columns: 1fr;
  }

  .p59-writing-submit-recent,
  .p59-writing-cta {
    margin-left: 0;
    margin-right: 0;
  }

  .p59-writing-footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 480px) {
  .p59-writing-nav-inner,
  .p59-writing-main,
  .p59-writing-footer-inner,
  .p59-writing-footer-bottom {
    width: min(100% - 24px, 430px);
  }

  .p59-writing-brand {
    min-width: 0;
    white-space: normal;
  }

  .p59-writing-hero {
    padding-top: 36px;
    padding-bottom: 36px;
  }

  .p59-writing-hero h1 {
    font-size: 30px;
  }

  .p59-writing-hero p:not(.p59-writing-eyebrow) {
    font-size: 16px;
  }

  .p59-writing-hero-metrics {
    grid-template-columns: 1fr;
  }

  .p59-writing-submit,
  .p59-writing-result,
  .panel,
  .access-panel,
  .p59-form-card,
  .p59-writing-submit-recent,
  .p59-writing-cta {
    padding: 16px;
  }

  .p59-score-strip {
    padding: 12px;
  }

  .p59-score-main strong {
    font-size: 30px;
  }

  .annotated-sentence {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 11px;
  }

  .p59-writing-cta h2 {
    font-size: 23px;
  }

  .p59-writing-footer-inner {
    grid-template-columns: 1fr;
  }
}
