@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("dm-sans.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --radius: 22px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.32, 0.94, 0.6, 1);

  --bg: #fdfbf7;
  --surface: #ffffff;
  --surface-subtle: #f5f2ec;
  --surface-hover: #efebe3;
  --surface-tint: #f1eefb;

  --ink: #242320;
  --ink-soft: #4c4943;
  --ink-muted: #6c675f;

  --line: #e4dfd7;
  --line-strong: #cbc5bc;

  --accent: #005ce6;
  --accent-hover: #0047b8;
  --accent-soft: #e8f0ff;
  --accent-ink: #174596;
  --accent-link: #005ce6;

  --hero-bg: linear-gradient(118deg, #fff1c7 0%, #ffe0b5 52%, #ffd7cc 100%);
  --hero-ink: #24201c;
  --hero-soft: #4b4137;
  --art-sparkle: #fbffeb;
  --art-star: #724baa;

  --timer-bg: #fff1bf;
  --timer-ink: #2a2417;
  --timer-warn-bg: #ffe5bd;
  --prompt-band-bg: #eef4ff;
  --prompt-band-border: #d5e3ff;
  --notice-bg: #fff3cc;
  --notice-border: #edd79a;
  --review-top-bg: #e6f3ea;
  --quote-bg: #fff8e7;
  --quote-border: #e5a93b;
  --badge-bg: #fff8d7;
  --success: #2a7e53;
  --warn: #c4761c;
  --focus-ring: #2254d1;

  --doc-canvas: #f1f3f6;
  --doc-paper: #ffffff;
  --doc-toolbar: #edf2fa;
  --doc-toolbar-active: #d3e3fd;
  --doc-sheet-border: #dadce0;
  --doc-sheet-shadow:
    0 1px 3px rgba(32, 33, 36, 0.08), 0 10px 28px rgba(32, 33, 36, 0.05);
  --switch-active-bg: #ffffff;
  --switch-active-border: rgba(36, 35, 32, 0.1);
  --backdrop: rgba(36, 35, 32, 0.42);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14161a;
  --surface: #1c1f25;
  --surface-subtle: #242831;
  --surface-hover: #2d323e;
  --surface-tint: #232234;

  --ink: #f0eee9;
  --ink-soft: #c7c3ba;
  --ink-muted: #98938a;

  --line: #2f343f;
  --line-strong: #454c5b;

  --accent: #256ce8;
  --accent-hover: #387cf2;
  --accent-soft: #1d2d4a;
  --accent-ink: #a8c7ff;
  --accent-link: #7cb0ff;

  --hero-bg: linear-gradient(120deg, #2d251d 0%, #2b2128 54%, #1e2433 100%);
  --hero-ink: #f6f2ea;
  --hero-soft: #d5cbc0;
  --art-sparkle: #ffe8a3;
  --art-star: #b392e6;

  --timer-bg: #2e2718;
  --timer-ink: #f7e4b0;
  --timer-warn-bg: #3b2a17;
  --prompt-band-bg: #1a2436;
  --prompt-band-border: #2a3a57;
  --notice-bg: #2d2617;
  --notice-border: #4a3d20;
  --review-top-bg: #172b22;
  --quote-bg: #272217;
  --quote-border: #d99d36;
  --badge-bg: #322c1b;
  --success: #52b780;
  --warn: #e5a349;
  --focus-ring: #7cb0ff;

  --doc-canvas: #101216;
  --doc-paper: #1b1e24;
  --doc-toolbar: #222732;
  --doc-toolbar-active: #2e4268;
  --doc-sheet-border: #303643;
  --doc-sheet-shadow:
    0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.28);
  --switch-active-bg: #323947;
  --switch-active-border: #485164;
  --backdrop: rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14161a;
    --surface: #1c1f25;
    --surface-subtle: #242831;
    --surface-hover: #2d323e;
    --surface-tint: #232234;
    --ink: #f0eee9;
    --ink-soft: #c7c3ba;
    --ink-muted: #98938a;
    --line: #2f343f;
    --line-strong: #454c5b;
    --accent: #256ce8;
    --accent-hover: #387cf2;
    --accent-soft: #1d2d4a;
    --accent-ink: #a8c7ff;
    --accent-link: #7cb0ff;
    --hero-bg: linear-gradient(120deg, #2d251d 0%, #2b2128 54%, #1e2433 100%);
    --hero-ink: #f6f2ea;
    --hero-soft: #d5cbc0;
    --art-sparkle: #ffe8a3;
    --art-star: #b392e6;
    --timer-bg: #2e2718;
    --timer-ink: #f7e4b0;
    --timer-warn-bg: #3b2a17;
    --prompt-band-bg: #1a2436;
    --prompt-band-border: #2a3a57;
    --notice-bg: #2d2617;
    --notice-border: #4a3d20;
    --review-top-bg: #172b22;
    --quote-bg: #272217;
    --quote-border: #d99d36;
    --badge-bg: #322c1b;
    --success: #52b780;
    --warn: #e5a349;
    --focus-ring: #7cb0ff;
    --doc-canvas: #101216;
    --doc-paper: #1b1e24;
    --doc-toolbar: #222732;
    --doc-toolbar-active: #2e4268;
    --doc-sheet-border: #303643;
    --doc-sheet-shadow:
      0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.28);
    --switch-active-bg: #323947;
    --switch-active-border: #485164;
    --backdrop: rgba(0, 0, 0, 0.65);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
select {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

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

a {
  color: var(--accent-link);
}

:focus-visible {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 3px;
}

.skip,
.sr {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
}

.skip:focus {
  width: auto;
  height: auto;
  clip-path: none;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  top: 10px;
  left: 10px;
  z-index: 20;
}

/* Header & Footer */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.bar,
main,
.site-footer {
  max-width: 1180px;
  width: calc(100% - 72px);
  margin: auto;
}

body.screen-write main {
  max-width: 1320px;
  width: calc(100% - 48px);
  padding: 18px 0 36px;
}

.bar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.045em;
  flex-shrink: 0;
}

.bar nav {
  display: flex;
  gap: 4px;
}

.bar nav button,
.site-footer button,
.link {
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 32px;
}

.bar nav button:hover {
  background: var(--surface-subtle);
}

.bar nav button[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Light / Dark / Auto segmented control */
.theme-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 24px;
  line-height: 1;
}

.theme-switch button:hover {
  color: var(--ink);
}

.theme-switch button[aria-checked="true"] {
  background: var(--switch-active-bg);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px var(--switch-active-border),
    0 1px 2px rgba(0, 0, 0, 0.12);
}

.bar .account {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 32px;
  font-weight: 600;
  font-size: 13.5px;
  padding: 7px 14px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar .account:hover {
  background: var(--surface-subtle);
}

.bar .account::before {
  content: "";
  display: inline-block;
  vertical-align: 1px;
  width: 7px;
  height: 7px;
  background: var(--warn);
  border-radius: 50%;
  margin-right: 8px;
}

.bar .account.connected::before {
  background: var(--success);
}

main {
  min-height: calc(100vh - 165px);
  padding: 26px 0 40px;
}

main:focus {
  outline: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  padding: 14px 0 24px;
  font-size: 13.5px;
}

.site-footer i {
  margin: 0 6px;
  font-style: normal;
}

.site-footer button,
.link {
  color: var(--accent-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 4px;
}

/* Typography & Shared Surfaces */
h1,
h2,
h3,
p,
blockquote {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(36px, 4.2vw, 54px);
}

h2 {
  font-size: clamp(23px, 2.3vw, 32px);
}

h3 {
  font-size: 20px;
}

.lead {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 58ch;
  line-height: 1.55;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  align-items: center;
  min-height: 230px;
  background: var(--hero-bg);
  color: var(--hero-ink);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero .eyebrow {
  color: var(--hero-soft);
}

.hero .copy {
  padding: 34px 16px 34px 42px;
  z-index: 1;
}

.hero h1 {
  margin: 10px 0 12px;
  max-width: 16ch;
}

.hero p {
  max-width: 48ch;
  color: var(--hero-soft);
  line-height: 1.58;
}

.hero svg {
  width: 100%;
  height: 255px;
  display: block;
}

.row,
.actions,
.cardhead,
.statrow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cardhead,
.statrow {
  justify-content: space-between;
}

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

.subtle,
.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(260px, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.card,
.tint,
.chartbox {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 26px 30px;
}

.tint {
  border-color: transparent;
  background: var(--surface-tint);
}

.tint h3 {
  margin: 12px 0 10px;
}

.meta {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.meta .dot {
  color: var(--line-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 32px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 650;
  padding: 5px 12px;
}

/* 4-prompt selector pills */
.prompt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
}

.prompt-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface-subtle);
  color: var(--ink-soft);
  border-radius: 32px;
  padding: 8px 15px;
  font-size: 14px;
  font-weight: 600;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.prompt-tab:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.prompt-tab[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.prompt-tab .done-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.question {
  font-size: clamp(23px, 2.2vw, 31px);
  margin: 0 0 12px;
  max-width: 34ch;
}

.prompt-body {
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
  max-width: 60ch;
}

.prompt-hint {
  margin-top: 12px;
  font-size: 14.5px;
  color: var(--ink-muted);
  max-width: 58ch;
}

.card .actions {
  margin-top: 22px;
}

/* Buttons */
.primary,
.secondary,
.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 32px;
  padding: 10px 20px;
  font-weight: 650;
  font-size: 15px;
  border: 1px solid transparent;
  text-decoration: none;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    transform 0.12s var(--ease);
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.primary:active:not(:disabled),
.secondary:active:not(:disabled) {
  transform: translateY(1px);
}

.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.secondary:hover:not(:disabled),
.quiet:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.quiet {
  background: transparent;
  padding: 8px 14px;
  font-size: 14px;
}

.badgeicon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--badge-bg);
  font-size: 22px;
}

.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0;
  color: var(--ink);
}

.sectionhead {
  margin: 8px 0 22px;
}

.sectionhead h1 {
  font-size: clamp(32px, 3.6vw, 46px);
  margin: 6px 0 8px;
}

/* =====================================================================
   Google Docs-style Writing Workspace
   ===================================================================== */
.doc-shell {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--doc-canvas);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.doc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.doc-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 280px;
}

.doc-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
}

.doc-title-meta {
  min-width: 0;
  flex: 1;
}

.doc-title-input {
  width: 100%;
  max-width: 420px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  padding: 2px 6px;
  margin-left: -6px;
  letter-spacing: -0.02em;
}

.doc-title-input:hover {
  border-color: var(--line);
}

.doc-title-input:focus {
  border-color: var(--accent);
  background: var(--surface-subtle);
  outline: none;
}

.doc-submeta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
  flex-wrap: wrap;
}

.doc-submeta .save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.doc-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 24px;
  background: var(--timer-bg);
  color: var(--timer-ink);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}

.timer-chip.warn {
  background: var(--timer-warn-bg);
}

.doc-topbar .primary {
  min-height: 38px;
  padding: 8px 18px;
  font-size: 14px;
}

.doc-topbar .secondary {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13.5px;
}

/* Google Docs pill toolbar */
.doc-toolbar-wrap {
  background: var(--surface);
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.doc-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--doc-toolbar);
  border-radius: 24px;
  padding: 5px 10px;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color 0.12s var(--ease);
}

.tb-btn:hover {
  background: var(--surface-hover);
}

.tb-btn[aria-pressed="true"] {
  background: var(--doc-toolbar-active);
  color: var(--accent-ink);
}

.tb-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.tb-select:hover,
.tb-select:focus {
  background: var(--surface);
  border-color: var(--line);
}

.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
  margin: 0 4px;
}

.tb-spacer {
  flex: 1 1 8px;
}

/* Prompt strip inside workspace */
.doc-prompt {
  max-width: 1124px;
  margin: 16px auto 0;
  width: calc(100% - 40px);
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--prompt-band-bg);
  border: 1px solid var(--prompt-band-border);
}

.doc-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.doc-prompt p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.doc-prompt .hint-line {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

/* Workspace Grid: Centered Paper + Collapsible Side Panel */
.doc-workspace {
  max-width: 1164px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 20px;
  padding: 20px 20px 24px;
  align-items: start;
}

.doc-workspace.side-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.doc-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* The Sheet of Paper */
.doc-paper {
  width: min(100%, 816px);
  min-height: 660px;
  background: var(--doc-paper);
  border: 1px solid var(--doc-sheet-border);
  border-radius: 4px;
  box-shadow: var(--doc-sheet-shadow);
  padding: 54px 68px 64px;
  cursor: text;
}

.doc-paper[data-font="sans"] .doc-editor {
  font-family: var(--sans);
}

.doc-paper[data-font="serif"] .doc-editor {
  font-family: var(--serif);
}

.doc-paper[data-size="11"] .doc-editor {
  font-size: 15.5px;
}

.doc-paper[data-size="12"] .doc-editor {
  font-size: 17.5px;
}

.doc-paper[data-size="14"] .doc-editor {
  font-size: 19.5px;
}

.doc-paper[data-spacing="1.15"] .doc-editor {
  line-height: 1.42;
}

.doc-paper[data-spacing="1.5"] .doc-editor {
  line-height: 1.75;
}

.doc-paper[data-spacing="2.0"] .doc-editor {
  line-height: 2.15;
}

.doc-editor {
  position: relative;
  min-height: 540px;
  color: var(--ink);
  line-height: 1.78;
  outline: none;
  overflow-wrap: break-word;
  word-break: break-word;
}

.doc-editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--ink-muted);
  pointer-events: none;
  font-style: italic;
}

.doc-editor p,
.doc-readback p {
  margin: 0 0 0.85em;
}

.doc-editor p[data-indent="1"],
.doc-readback p[data-indent="1"] {
  text-indent: 2.2em;
}

.doc-editor [data-align="center"],
.doc-readback [data-align="center"] {
  text-align: center;
}

.doc-editor h2,
.doc-readback h2 {
  font-size: 1.42em;
  font-weight: 700;
  margin: 0.25em 0 0.65em;
  line-height: 1.28;
  letter-spacing: -0.025em;
}

.doc-editor ul,
.doc-editor ol,
.doc-readback ul,
.doc-readback ol {
  margin: 0 0 0.9em;
  padding-left: 1.6em;
}

.doc-editor li,
.doc-readback li {
  margin: 0.25em 0;
}

/* Word-count status bar under the sheet */
.doc-statusbar {
  width: min(100%, 816px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  flex-wrap: wrap;
}

.word-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
}

.meter-track {
  width: 110px;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition:
    width 0.2s var(--ease),
    background-color 0.2s var(--ease);
}

.meter-fill.sweet {
  background: var(--success);
}

.meter-fill.over {
  background: var(--warn);
}

/* Side Panel beside paper */
.doc-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.doc-side .card,
.doc-side .tint {
  padding: 18px 20px;
  border-radius: 16px;
}

.clockcard {
  background: var(--timer-bg);
  color: var(--timer-ink);
  border-color: transparent;
}

.clockcard .eyebrow {
  color: var(--timer-ink);
  opacity: 0.78;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin: 4px 0 6px;
}

.notes-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

.notes {
  display: block;
  width: 100%;
  min-height: 140px;
  resize: vertical;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  line-height: 1.55;
}

.notes-foot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-muted);
}

/* Review & Progress Screens */
.reviewtop {
  background: var(--review-top-bg);
  border-radius: var(--radius);
  padding: 28px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.reviewtop h1 {
  font-size: clamp(28px, 3.2vw, 38px);
  margin: 6px 0 6px;
}

.bigscore {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.bigscore small {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink-soft);
}

.quote {
  padding: 14px 18px;
  margin: 14px 0;
  background: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  border-radius: 0 10px 10px 0;
  font-size: 16.5px;
  line-height: 1.55;
}

.skill {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.skill p {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.52;
}

.skill strong {
  font-weight: 650;
}

.skill b {
  color: var(--accent-ink);
  white-space: nowrap;
}

.doc-readback {
  margin-top: 16px;
  padding: 24px 28px;
  background: var(--doc-paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.75;
  font-size: 16px;
}

.doc-readback-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

details > summary {
  cursor: pointer;
  font-weight: 650;
}

.stack {
  display: grid;
  gap: 18px;
}

/* Progress chart (theme-aware via CSS variables) */
.chartbox svg {
  width: 100%;
  height: auto;
  max-height: 270px;
  display: block;
}

.chart-grid {
  stroke: var(--line);
}

.chart-axis {
  fill: var(--ink-muted);
}

.chart-line {
  fill: none;
  stroke: var(--accent-link);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--accent-link);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-val {
  fill: var(--ink);
  font-weight: 700;
}

.chartbox label {
  font-size: 14px;
  color: var(--ink-soft);
}

.chartbox select {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  margin-left: 6px;
}

.chartempty {
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 8px;
  background: var(--surface-subtle);
  border-radius: 16px;
  margin: 16px 0;
  padding: 20px;
}

.attempt {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 15px 4px;
}

.attempt strong {
  font-size: 16.5px;
}

.attempt small {
  display: block;
  color: var(--ink-muted);
  margin-top: 2px;
}

.attempt:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.attempt b {
  white-space: nowrap;
  color: var(--accent-ink);
}

.progress-icon {
  display: inline-flex;
  align-items: end;
  gap: 4px;
  height: 24px;
}

.progress-icon i {
  width: 6px;
  background: var(--accent-link);
  border-radius: 4px;
  opacity: 0.7;
}

.progress-icon i:nth-child(1) {
  height: 7px;
}

.progress-icon i:nth-child(2) {
  height: 14px;
}

.progress-icon i:nth-child(3) {
  height: 22px;
}

/* Modal Dialog */
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 30px;
  max-width: min(510px, calc(100% - 28px));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: var(--backdrop);
}

dialog h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

dialog p,
dialog li {
  margin: 10px 0;
  color: var(--ink-soft);
  line-height: 1.58;
}

dialog > .secondary {
  margin-top: 16px;
}

dialog .actions {
  margin-top: 18px;
}

.connect-steps {
  margin: 14px 0 12px;
  padding-left: 20px;
}

.connect-form {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.connect-input {
  flex: 1 1 220px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 14.5px;
}

.connect-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}

.connect-err:empty {
  display: none;
}

.connect-err {
  margin-top: 10px;
  color: var(--warn);
  font-size: 14px;
  font-weight: 600;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.status-chip.ok {
  background: var(--review-top-bg);
  color: var(--ink);
}

.status-chip.warn {
  background: var(--notice-bg);
  color: var(--ink);
}

/* Responsive adjustments */
@media (max-width: 1060px) {
  .doc-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc-side {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .doc-paper {
    padding: 40px 44px 52px;
  }
}

@media (max-width: 860px) {
  .bar,
  main,
  .site-footer,
  body.screen-write main {
    width: calc(100% - 36px);
  }
  .bar {
    gap: 14px;
  }
  .theme-switch button span {
    display: none;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero .copy {
    padding: 26px 26px 8px;
  }
  .hero svg {
    height: 180px;
    width: 90%;
    margin: 0 auto;
  }
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .bar,
  main,
  .site-footer,
  body.screen-write main {
    width: calc(100% - 24px);
  }
  .bar {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 0;
    gap: 10px;
  }
  .brand {
    font-size: 21px;
  }
  .bar nav {
    order: 3;
    width: 100%;
  }
  .bar .account {
    max-width: 150px;
  }
  .card,
  .tint,
  .chartbox {
    padding: 20px;
  }
  .doc-paper {
    padding: 26px 20px 36px;
    min-height: 440px;
  }
  .doc-prompt {
    margin: 12px 12px 0;
  }
  .doc-workspace {
    padding: 14px 12px 18px;
  }
  .reviewtop {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }
}

.print-title {
  display: none;
}

/* Clean essay printing */
@media print {
  .print-title:not(:empty) {
    display: block !important;
    font-size: 18pt !important;
    margin: 0 0 16pt !important;
    color: #111111 !important;
  }
  body {
    background: #ffffff !important;
    color: #111111 !important;
  }
  .site-header,
  .site-footer,
  .doc-topbar,
  .doc-toolbar-wrap,
  .doc-prompt,
  .doc-statusbar,
  .doc-side {
    display: none !important;
  }
  body.screen-write main {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
  }
  .doc-shell,
  .doc-workspace,
  .doc-paper {
    border: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }
  .doc-paper[data-size="11"] .doc-editor {
    font-size: 11pt !important;
  }
  .doc-paper[data-size="12"] .doc-editor {
    font-size: 12pt !important;
  }
  .doc-paper[data-size="14"] .doc-editor {
    font-size: 14pt !important;
  }
  .doc-paper[data-spacing="1.15"] .doc-editor {
    line-height: 1.35 !important;
  }
  .doc-paper[data-spacing="1.5"] .doc-editor {
    line-height: 1.65 !important;
  }
  .doc-paper[data-spacing="2.0"] .doc-editor {
    line-height: 2.05 !important;
  }
  .doc-editor {
    color: #111111 !important;
    line-height: 1.9 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
