:root {
  color-scheme: light;
  --paper: #faf7f0;
  --paper-deep: #faf7f0;
  --ink: #111827;
  --muted: #6b7280;
  --muted-grey: #6b7280;
  --hairline: #e5e7eb;
  --border: #e5e7eb;
  --warm-border: #ddd6c8;
  --target: #b42318;
  --phrase-red: #b42318;
  --target-soft: #fef2f2;
  --pale-red: #fef2f2;
  --pale-grey: #f9fafb;
  --link-blue: #2563eb;
  --green: #b42318;
  --green-soft: #fef2f2;
  --white: #ffffff;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.landing-view {
  min-height: 100vh;
  background: var(--paper);
}

.public-header {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 78px;
  padding: 14px 42px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-copy {
  display: grid;
  gap: 1px;
  justify-items: start;
}

.phi-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--phrase-red);
  border-radius: 999px;
  color: var(--phrase-red);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  line-height: 1;
}

.phi-mark::before {
  content: "\03C6";
  display: block;
  color: var(--phrase-red);
  font-size: 1.9rem;
  line-height: 0.86;
  transform: translateY(-0.03em);
}

.phi-mark.compact {
  width: 30px;
  height: 30px;
  border-width: 1.5px;
}

.phi-mark.compact::before {
  font-size: 1.34rem;
}

.brand-word {
  font-size: 1.82rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.brand-tagline {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.public-nav button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.public-nav button:hover {
  color: var(--phrase-red);
}

.public-nav .nav-signup,
.button-primary {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.12);
}

.public-nav .nav-signup {
  padding: 0 18px;
}

.landing-page {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.72fr);
  gap: 56px;
  align-items: center;
  min-height: 610px;
}

.hero-copy {
  display: grid;
  gap: 18px;
  justify-items: stretch;
}

.hero-title {
  max-width: 620px;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 4.15rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.04;
}

.hero-title span {
  color: var(--phrase-red);
}

.hero-copy > p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 1.17rem;
  line-height: 1.5;
}

.landing-form {
  display: grid;
  gap: 14px;
  margin-top: 2px;
}

.hero-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(214px, 0.34fr);
  gap: 10px;
  align-items: stretch;
}

.prompt-input-wrap {
  position: relative;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.03);
}

.prompt-input {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  background: transparent;
  color: var(--ink);
  font: 1rem var(--sans);
  outline: none;
}

.prompt-input-wrap:focus-within,
.select-control:focus {
  border-color: var(--phrase-red);
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.animated-placeholder {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  z-index: 1;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.2;
  pointer-events: none;
  text-overflow: clip;
  transform: translateY(-50%);
  white-space: nowrap;
}

.animated-placeholder[hidden] {
  display: none;
}

.typewriter-cursor {
  display: inline-block;
  width: 1px;
  height: 1.2em;
  margin-left: 2px;
  background: var(--muted);
  vertical-align: -0.15em;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.button-primary {
  min-height: 58px;
  padding: 0 18px;
  font: 700 0.94rem var(--sans);
  white-space: nowrap;
}

.button-secondary {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 700 0.9rem var(--sans);
  white-space: nowrap;
}

.button-secondary:hover {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--phrase-red);
}

.button-primary:disabled,
.button-secondary:disabled {
  cursor: wait;
  opacity: 0.7;
}

.landing-action-group {
  display: grid;
  gap: 8px;
}

.landing-action-group .button-primary,
.landing-action-group .button-secondary {
  width: 100%;
}

.landing-controls {
  display: grid;
  grid-template-columns: minmax(0, 170px) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.landing-language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: none;
}

.landing-language-control span {
  color: var(--ink);
}

.select-control {
  min-height: auto;
  width: auto;
  margin: 0;
  padding: 0 24px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 0.9rem var(--sans);
}

.control-arrow {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1;
}

.landing-level-control {
  display: grid;
  grid-column: 1 / -1;
  gap: 9px;
  padding: 11px 12px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.landing-level-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.landing-level-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.landing-level-heading strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.landing-level-control input[type="range"] {
  width: 100%;
  accent-color: var(--phrase-red);
}

.landing-level-control input[type="range"]:focus {
  outline: none;
}

.landing-level-control input[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.landing-level-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.62rem;
}

.landing-level-labels span {
  min-width: 0;
  width: 0;
  display: flex;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.landing-level-labels span:first-child {
  justify-content: flex-start;
}

.landing-level-labels span:last-child {
  justify-content: flex-end;
}

.popular-situations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.popular-situations span {
  margin-right: 3px;
  font-size: 0.86rem;
  font-weight: 700;
}

.popular-situations button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.popular-situations button:hover {
  border-color: rgba(180, 35, 24, 0.34);
  color: var(--phrase-red);
}

.landing-status {
  min-height: 1.35em;
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-status.error {
  color: var(--phrase-red);
}

.landing-status.success {
  color: var(--link-blue);
}

.hero-visual {
  position: relative;
  z-index: 0;
  display: grid;
  place-items: center;
  justify-self: end;
  width: min(100%, 420px);
  min-height: 440px;
}

.sheet-stack {
  position: relative;
  justify-self: start;
  width: min(100%, 334px);
  height: 414px;
}

.mini-sheet,
.sheet-ghost {
  position: absolute;
  inset: 0;
  border: 1px solid var(--warm-border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.06);
}

.sheet-ghost {
  top: 24px;
  left: 22px;
  opacity: 0.72;
}

.ghost-two {
  top: 48px;
  left: 44px;
  opacity: 0.48;
}

.mini-sheet {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 32px;
}

.mini-sheet strong {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--warm-border);
  font-size: 0.95rem;
}

.mini-line {
  width: 68%;
  height: 5px;
  border-radius: 999px;
  background: #d8d2c8;
}

.mini-row {
  display: grid;
  grid-template-columns: 8px 112px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid #eee7db;
}

.mini-row i {
  width: 7px;
  height: 7px;
  margin-top: 2px;
  border-radius: 999px;
  background: #aaa39a;
}

.mini-row b,
.mini-row span {
  display: block;
  height: 6px;
  border-radius: 999px;
}

.mini-row b {
  background: var(--phrase-red);
}

.mini-row span {
  background: #ded8cf;
}

.save-callout {
  position: absolute;
  right: 0;
  bottom: 46px;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border-radius: 999px;
  border: 1px solid var(--warm-border);
  background: #fffdf9;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.1);
  transform: translateX(10px);
}

.save-icon {
  position: relative;
  width: 23px;
  height: 27px;
  margin-bottom: -4px;
  border: 1.5px solid var(--phrase-red);
  border-radius: 4px;
}

.save-icon::before,
.save-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  height: 1.5px;
  background: var(--phrase-red);
}

.save-icon::before {
  top: 8px;
}

.save-icon::after {
  top: 14px;
}

.save-callout p {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.benefit-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 28px 0 4px;
  border-top: 1px solid var(--border);
}

.benefit-row article {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
}

.benefit-icon {
  grid-row: span 2;
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
}

.benefit-icon::before,
.benefit-icon::after {
  content: "";
  position: absolute;
}

.icon-sheet::before {
  inset: 6px 5px auto;
  height: 1.5px;
  background: var(--phrase-red);
  box-shadow: 0 5px 0 var(--warm-border), 0 10px 0 var(--warm-border);
}

.icon-recall {
  border-radius: 999px;
}

.icon-recall::before {
  inset: 6px;
  border: 1.5px solid var(--phrase-red);
  border-radius: 999px;
  border-right-color: transparent;
}

.icon-save::before {
  left: 6px;
  top: 5px;
  width: 12px;
  height: 15px;
  border: 1.5px solid var(--phrase-red);
  border-radius: 3px;
}

.icon-print::before {
  left: 5px;
  right: 5px;
  top: 8px;
  height: 10px;
  border: 1.5px solid var(--phrase-red);
  border-radius: 3px;
}

.icon-print::after {
  left: 8px;
  right: 8px;
  top: 4px;
  height: 6px;
  border: 1.5px solid var(--warm-border);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.benefit-row h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.benefit-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.landing-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 28px 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.landing-footer a {
  color: var(--muted);
  text-decoration: none;
}

.landing-footer a:hover {
  color: var(--phrase-red);
  text-decoration: underline;
}

.app-shell {
  --generator-width: minmax(280px, 360px);
  --generator-tag-width: 48px;
  display: grid;
  grid-template-columns: var(--generator-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
  overflow-x: hidden;
  transition: grid-template-columns 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-shell.panel-collapsed {
  grid-template-columns: var(--generator-tag-width) minmax(0, 1fr);
}

.app-shell.shared-readonly {
  grid-template-columns: minmax(0, 1fr);
}

.setup-panel {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 360px;
  max-width: calc(100vw - var(--generator-tag-width));
  min-height: 100vh;
  padding: 28px 24px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(17, 24, 39, 0.025);
  min-width: 0;
  transition:
    transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 250ms ease,
    border-color 250ms ease;
  will-change: transform;
}

.panel-collapsed .setup-panel {
  transform: translateX(-100%);
  border-color: transparent;
  box-shadow: none;
}

.panel-collapsed .setup-panel > :not(.generator-drawer-toggle) {
  pointer-events: none;
}

.shared-readonly .setup-panel {
  display: none;
}

.setup-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.72rem;
}

.setup-footer a {
  color: var(--muted);
  text-decoration: none;
}

.setup-footer a:hover {
  color: var(--phrase-red);
  text-decoration: underline;
}

.generator-drawer-toggle {
  position: absolute;
  top: 126px;
  right: calc(-1 * var(--generator-tag-width));
  z-index: 6;
  display: grid;
  place-items: center;
  width: var(--generator-tag-width);
  min-height: 70px;
  padding: 0;
  border: 1px solid var(--warm-border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #fffdfa;
  color: var(--phrase-red);
  box-shadow: 5px 8px 18px rgba(17, 24, 39, 0.07);
  font: 800 0.86rem var(--sans);
  letter-spacing: 0.04em;
  text-transform: none;
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.drawer-arrows {
  line-height: 1;
}

.generator-drawer-toggle:hover,
.generator-drawer-toggle:focus-visible {
  background: var(--pale-red);
  border-color: rgba(180, 35, 24, 0.28);
  outline: none;
}

.generator-drawer-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14), 0 8px 22px rgba(17, 24, 39, 0.08);
}

.brand-block {
  display: grid;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.app-brand-copy {
  display: grid;
  gap: 1px;
}

.app-logo strong,
.app-brand-copy small {
  display: block;
}

.app-logo strong {
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.app-brand-copy small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}

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

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

h1 {
  margin-bottom: 0;
  font-family: var(--sans);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.16;
}

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

label,
legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

textarea,
select {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
}

select {
  min-height: 42px;
  padding: 0 10px;
}

.setup-panel select {
  font-size: 0.82rem;
  font-weight: 400;
}

textarea:focus,
select:focus {
  border-color: var(--phrase-red);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.topic-control {
  display: grid;
  gap: 7px;
}

.topic-control textarea {
  margin-top: 0;
}

.topic-control.is-dragging textarea {
  border-color: var(--phrase-red);
  background: var(--pale-red);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.topic-counter {
  justify-self: end;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.topic-counter.over-limit {
  color: #8a3f30;
}

.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.topic-chip,
.mode-button,
.ghost-button,
.primary-action,
.secondary-action {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
}

.topic-chip {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 0.83rem;
}

.topic-chip:hover,
.ghost-button:hover,
.mode-button:hover {
  border-color: rgba(180, 35, 24, 0.28);
  background: #ffffff;
}

.paired-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.level-control {
  display: grid;
  gap: 9px;
}

.level-heading,
.fixed-settings p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.level-heading span,
.fixed-settings span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.level-heading strong,
.fixed-settings strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.level-control input[type="range"] {
  width: 100%;
  accent-color: var(--phrase-red);
}

.level-control input[type="range"]:focus {
  outline: none;
}

.level-control input[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.level-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.58rem;
}

.level-labels span {
  min-width: 0;
  width: 0;
  display: flex;
  justify-content: center;
  white-space: nowrap;
  text-align: center;
}

.level-labels span:first-child {
  justify-content: flex-start;
}

.level-labels span:last-child {
  justify-content: flex-end;
}

.fixed-settings {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.segmented label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: none;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label:has(input:checked) {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--pale-red);
  color: var(--phrase-red);
}

.primary-action {
  min-height: 48px;
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
}

.secondary-action {
  min-height: 48px;
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
}

.generator-actions {
  display: grid;
  gap: 9px;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.generation-status {
  min-height: 1.35em;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.generation-status.error {
  color: var(--phrase-red);
}

.generation-status.success {
  color: var(--link-blue);
}

.sheet-actions,
.recent-sheets {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.sheet-actions[hidden],
.recent-sheets[hidden] {
  display: none;
}

.sheet-actions div {
  display: grid;
  gap: 2px;
}

.sheet-actions strong,
.recent-sheets h3 {
  margin: 0;
  color: var(--ink);
  font: 700 0.86rem var(--sans);
}

.sheet-actions span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.sheet-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  width: 100%;
}

.share-link-row input {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: 0.78rem var(--sans);
}

.recent-sheet-list {
  display: grid;
  gap: 6px;
}

.recent-sheet-list button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.recent-sheet-list button:hover,
.recent-sheet-list button:focus-visible {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fffdfa;
  outline: none;
}

.recent-sheet-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.recent-sheet-topline strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recent-sheet-kind {
  align-self: start;
  padding: 2px 6px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 999px;
  background: var(--pale-red);
  color: var(--phrase-red);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.recent-sheet-meta {
  color: var(--muted);
  font-size: 0.74rem;
}

.session-path {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.session-path[hidden] {
  display: none;
}

.session-path h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
}

.session-path p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.session-estimate {
  display: none;
}

.session-roadmap {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 2px 0 0;
  list-style: none;
}

.session-roadmap::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 12px;
  width: 1px;
  background: var(--border);
}

.session-path li {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  position: relative;
  padding: 7px 8px 7px 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.session-path li.active {
  background: var(--pale-red);
  color: var(--ink);
}

.session-path li.completed {
  color: var(--phrase-red);
}

.session-step-marker {
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: 700 0.78rem var(--sans);
}

.session-path li.active .session-step-marker,
.session-path li.completed .session-step-marker {
  border-color: var(--phrase-red);
  background: var(--phrase-red);
  color: #ffffff;
}

.session-step-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.session-path strong {
  display: block;
  color: inherit;
  font-size: 0.9rem;
}

.session-step-content > span {
  color: var(--muted);
}

.session-path li em {
  color: var(--muted);
  font: 700 0.68rem var(--sans);
  font-style: normal;
  text-transform: uppercase;
}

.session-actions {
  display: grid;
  gap: 8px;
}

.session-action {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 700 0.82rem var(--sans);
}

.session-action.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.session-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.focus-timer {
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.focus-timer.ready {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--pale-red);
}

.focus-timer span,
.focus-timer small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.focus-timer strong {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.reader-panel {
  min-width: 0;
  padding: 28px;
  background: var(--paper);
}

.history-panel {
  min-width: 0;
  padding: 28px;
  background: var(--paper);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: max-width 220ms ease;
}

.history-header,
.history-import,
.history-filters,
.history-table-wrap,
.history-empty {
  max-width: 1180px;
  width: 100%;
  margin-inline: auto;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.history-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.78rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.12;
}

.history-import {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: var(--pale-red);
}

.history-import[hidden] {
  display: none;
}

.history-import strong,
.history-empty h3 {
  display: block;
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 0.96rem;
}

.history-import p,
.history-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.history-import > div:last-child,
.import-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(132px, 0.7fr)) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.history-filters input[type="search"],
.history-filters select {
  min-height: 40px;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 0.88rem var(--sans);
  text-transform: none;
}

.history-filters input[type="search"] {
  width: 100%;
  padding: 0 11px;
}

.history-bookmarked-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink);
  text-transform: none;
}

.history-bookmarked-filter input {
  width: 16px;
  height: 16px;
  accent-color: var(--phrase-red);
}

.history-action,
.history-load-more {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 700 0.82rem var(--sans);
}

.history-action.primary,
.history-load-more {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.history-action.danger {
  border-color: rgba(180, 35, 24, 0.32);
  color: var(--phrase-red);
}

.history-action:disabled,
.history-load-more:disabled {
  opacity: 0.48;
  cursor: default;
}

.history-status {
  max-width: 1180px;
  min-height: 1.35em;
  margin: 0 auto 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-status.error {
  color: var(--phrase-red);
}

.history-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.history-table th,
.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.history-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-table tbody tr {
  cursor: pointer;
}

.history-table tbody tr:hover {
  background: var(--pale-grey);
}

.history-select-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--phrase-red);
}

.history-topic-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 0.9rem var(--sans);
  text-align: left;
}

.history-bookmark-button,
.history-share-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: 700 0.76rem var(--sans);
}

.history-bookmark-button.active,
.history-share-button.active {
  border-color: rgba(180, 35, 24, 0.32);
  background: var(--pale-red);
  color: var(--phrase-red);
}

.shared-readonly #generalFeedbackButton,
.shared-readonly #profileMenu,
.shared-readonly #sheetFeedbackPanel,
.shared-readonly #recallReviewPanel {
  display: none;
}

.history-empty {
  padding: 28px 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.history-load-more {
  display: block;
  width: min(180px, 100%);
  margin: 14px auto 0;
}

.reader-toolbar h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.78rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.12;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-menu {
  position: relative;
  z-index: 45;
  flex: 0 0 auto;
  margin-left: 2px;
}

.mode-button,
.ghost-button {
  min-height: 38px;
  padding: 0 14px;
}

.mode-button.active {
  border-color: rgba(180, 35, 24, 0.42);
  background: var(--pale-red);
  color: var(--phrase-red);
}

.profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.12);
}

.profile-button:hover,
.profile-button:focus-visible {
  background: #020617;
  border-color: #020617;
}

.profile-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.profile-button.is-logged-in {
  width: 40px;
  padding: 4px;
  border-color: rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
}

.profile-button.is-logged-out {
  gap: 7px;
}

.profile-button.is-logged-in:hover,
.profile-button.is-logged-in:focus-visible {
  border-color: rgba(180, 35, 24, 0.22);
  background: #ffffff;
}

.profile-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 999px;
  background: #ffffff;
  object-fit: cover;
  overflow: hidden;
}

.profile-avatar-initial {
  display: grid;
  place-items: center;
  background: #fffdf9;
  color: var(--phrase-red);
  font-size: 0.86rem;
  font-weight: 800;
}

.profile-avatar.large {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.profile-button-label {
  padding-right: 3px;
}

.landing-profile-menu {
  display: flex;
  align-items: center;
  margin-left: 0;
}

.landing-profile-button.is-logged-out {
  min-height: 40px;
  min-width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.landing-profile-button.is-logged-out:hover,
.landing-profile-button.is-logged-out:focus-visible {
  background: transparent;
  color: var(--phrase-red);
}

.landing-profile-button.is-logged-in {
  min-width: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.landing-profile-button.is-logged-in .profile-avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border: 0;
}

.landing-profile-button.is-logged-in:hover,
.landing-profile-button.is-logged-in:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.profile-dropdown {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 8px;
  width: min(286px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(31, 27, 22, 0.13);
  font-family: var(--sans);
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border);
}

.profile-summary div {
  min-width: 0;
}

.profile-summary strong,
.profile-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary strong {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.profile-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.profile-menu-list {
  display: grid;
  gap: 3px;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 39px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
}

.profile-menu-item:hover:not(:disabled) {
  border-color: var(--hairline);
  background: var(--pale-grey);
}

.profile-menu-item em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-menu-item.disabled {
  cursor: default;
  color: rgba(119, 111, 102, 0.72);
}

.profile-menu-item.disabled em {
  color: rgba(119, 111, 102, 0.62);
}

.profile-menu-item.logout {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  color: var(--phrase-red);
  font-weight: 700;
}

.book-page {
  --translation-gutter: 266px;
  position: relative;
  max-width: 1180px;
  width: 100%;
  min-height: calc(100vh - 138px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: max-width 220ms ease;
}

.panel-collapsed .reader-toolbar,
.panel-collapsed .book-page {
  max-width: 1360px;
}

.book-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      transparent 0,
      transparent calc(100% - var(--translation-gutter)),
      rgba(249, 250, 251, 0.88) calc(100% - var(--translation-gutter)),
      rgba(249, 250, 251, 0.88) 100%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), transparent 260px);
}

.chapter-heading,
.phrase-list,
.notes-panel,
.practice-panel {
  position: relative;
  z-index: 1;
}

.chapter-heading {
  padding: 40px 56px 18px;
}

.chapter-heading p {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--sans);
  font-style: italic;
  font-size: 0.88rem;
}

.phrase-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 12px 30px;
  padding: 0 56px 34px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.42;
}

.sentence-row {
  display: contents;
}

.sentence-text,
.translation-text {
  min-height: 1.42em;
}

.sentence-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sentence-spoken-text {
  min-width: 0;
}

.audio-play-button {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(2px);
}

.audio-play-button:hover,
.audio-play-button:focus-visible,
.audio-play-button.is-speaking {
  border-color: rgba(180, 35, 24, 0.18);
  background: #fef2f2;
  color: var(--phrase-red);
}

.audio-play-button:focus-visible {
  outline: 2px solid rgba(180, 35, 24, 0.28);
  outline-offset: 2px;
}

.audio-play-icon {
  position: relative;
  width: 15px;
  height: 15px;
}

.audio-play-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 1px;
  width: 5px;
  height: 7px;
  border-radius: 2px 0 0 2px;
  background: currentColor;
}

.audio-play-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 8px;
  height: 10px;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 10px 10px 0;
}

.translation-text {
  color: var(--muted);
  font-size: 0.96rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(41, 38, 34, 0.32);
}

.modal-backdrop[hidden] {
  display: none;
}

.login-modal {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(448px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-modal h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0;
  text-align: center;
}

.login-modal p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
}

.google-button-host,
.login-provider,
.email-login-form {
  width: 100%;
}

.login-legal-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
}

.login-legal-links a {
  color: var(--muted);
  text-decoration: none;
}

.login-legal-links a:hover {
  color: var(--phrase-red);
  text-decoration: underline;
}

.google-button-host {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
}

.google-button-host > div {
  width: 100% !important;
  max-width: 100% !important;
  height: 44px !important;
  max-height: 44px !important;
  overflow: hidden !important;
}

.google-button-host iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: 44px !important;
  max-height: 44px !important;
}

.google-button-host svg,
.google-button-host img {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
}

.login-provider,
.email-login-form button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
}

.login-provider:disabled {
  border-color: var(--hairline);
  background: #fffdf9;
  color: var(--muted);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.email-login-form {
  display: grid;
  gap: 10px;
}

.email-login-form input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 13px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.email-login-form input:focus {
  border-color: var(--phrase-red);
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.login-status {
  min-height: 1.3em;
  font-size: 0.82rem;
}

.login-status.error {
  color: var(--phrase-red);
}

.login-status.success {
  color: var(--link-blue);
}

.target-term {
  position: relative;
  display: inline-block;
  border-radius: 4px;
  color: var(--target);
  font-weight: 600;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.target-term:focus {
  outline: 2px solid rgba(180, 35, 24, 0.3);
  outline-offset: 2px;
}

.quiz-mode .target-term {
  min-width: var(--blank-width, 4.2em);
  color: transparent;
  background: linear-gradient(0deg, rgba(180, 35, 24, 0.12), rgba(180, 35, 24, 0.12));
  box-shadow: inset 0 -1px 0 rgba(180, 35, 24, 0.46);
  user-select: none;
}

.quiz-mode .target-term.revealed,
.quiz-mode .target-term.manual-revealed {
  color: var(--target);
  background: #ffffff;
  box-shadow: inset 0 -1px 0 rgba(180, 35, 24, 0.22);
}

.notes-panel,
.practice-panel,
.recall-review-panel {
  padding: 30px 56px;
  border-top: 1px solid var(--border);
  background: var(--pale-grey);
}

.practice-panel {
  padding-bottom: 54px;
}

.general-feedback-panel {
  width: min(100%, 760px);
  margin: 0 auto 16px;
  padding: 0 16px;
}

.general-feedback-panel[hidden],
.sheet-feedback-panel[hidden],
.recall-review-panel[hidden],
.recall-review-card[hidden],
.sheet-feedback-note[hidden],
.sheet-feedback-form[hidden] {
  display: none;
}

.general-feedback-form,
.sheet-feedback-form {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.035);
}

.general-feedback-form h3,
.sheet-feedback-form h4 {
  margin: 0;
  color: var(--ink);
  font: 700 0.98rem var(--sans);
}

.general-feedback-form p,
.sheet-feedback-form p,
.feedback-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.general-feedback-form label,
.sheet-feedback-note label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.general-feedback-form textarea,
.sheet-feedback-form textarea,
.general-feedback-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}

.feedback-actions,
.sheet-feedback-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-feedback-options button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.sheet-feedback-options button:hover,
.sheet-feedback-options button:focus-visible,
.sheet-feedback-options button.selected {
  border-color: rgba(180, 35, 24, 0.34);
  background: var(--pale-red);
  color: var(--phrase-red);
  outline: none;
}

.sheet-feedback-note {
  display: grid;
  gap: 10px;
}

.sheet-feedback-panel {
  position: relative;
  z-index: 1;
  padding: 28px 56px 42px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.primary-action.small {
  min-height: 38px;
  width: auto;
  padding: 0 14px;
}

.feedback-status.error {
  color: var(--phrase-red);
}

.feedback-status.success {
  color: var(--link-blue);
}

.notes-content,
.practice-content {
  max-width: 820px;
}

.practice-content {
  max-width: 620px;
}

.recall-review-content {
  max-width: 620px;
}

.recall-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.recall-review-header h4 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 600;
}

.recall-review-header p {
  margin: 0;
  color: var(--muted);
  font: 0.82rem/1.4 var(--sans);
}

.recall-review-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.notes-panel h4,
.practice-panel h4 {
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 600;
}

.notes-panel ol {
  margin: 0;
  padding-left: 22px;
  font-family: var(--serif);
  line-height: 1.5;
}

.notes-panel li + li {
  margin-top: 8px;
}

.exercise-list {
  display: grid;
  gap: 16px;
  font-family: var(--serif);
}

.practice-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.practice-intro {
  margin-bottom: 16px;
  color: #4d4740;
  line-height: 1.45;
}

.practice-items {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.practice-item {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(216, 205, 191, 0.7);
}

.practice-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.practice-cue {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.practice-prompt {
  margin: 0;
  line-height: 1.45;
}

.practice-input {
  width: min(100%, 260px);
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 0.95rem var(--serif);
}

.practice-input:focus {
  border-color: var(--phrase-red);
  outline: none;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.practice-feedback {
  min-height: 1.3em;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.practice-item.correct .practice-feedback {
  color: var(--link-blue);
}

.practice-item.needs-work .practice-feedback,
.recall-review-card.needs-work .practice-feedback {
  color: var(--phrase-red);
}

.recall-review-card.correct .practice-feedback {
  color: var(--link-blue);
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-action {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: 700 0.82rem var(--sans);
}

.practice-action.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.reveal-overlay {
  position: absolute;
  z-index: 3;
  top: var(--reveal-y, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(178, 61, 48, 0.18), rgba(178, 61, 48, 0.1)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 14px);
  border-top: 1px solid rgba(129, 31, 24, 0.34);
  touch-action: none;
  user-select: none;
  transition: opacity 160ms ease;
}

.quiz-mode .reveal-overlay {
  pointer-events: auto;
  opacity: 1;
}

.slide-handle {
  position: absolute;
  right: 18px;
  top: -30px;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 112px;
  height: 58px;
  border: 1px solid rgba(129, 31, 24, 0.28);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.88);
  box-shadow: 0 8px 24px rgba(72, 32, 24, 0.18);
  touch-action: none;
  user-select: none;
}

.slide-handle em {
  color: rgba(129, 31, 24, 0.64);
  font: 700 0.7rem var(--sans);
  font-style: normal;
  letter-spacing: 0;
  text-transform: uppercase;
}

.slide-handle span,
.slide-handle span::before,
.slide-handle span::after {
  display: block;
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: rgba(129, 31, 24, 0.52);
}

.slide-handle span::before,
.slide-handle span::after {
  content: "";
  margin-top: 7px;
}

@media (max-width: 980px) {
  .public-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 24px;
  }

  .public-nav {
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .landing-page {
    width: min(100% - 32px, 760px);
    padding-top: 28px;
  }

  .hero-section {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: auto;
  }

  .hero-visual {
    justify-self: center;
    width: min(100%, 370px);
    min-height: 320px;
  }

  .sheet-stack {
    height: 330px;
    width: min(100%, 285px);
  }

  .mini-sheet {
    padding: 24px;
  }

  .save-callout {
    right: 4px;
    bottom: 4px;
    transform: none;
  }

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

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.panel-collapsed {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    position: relative;
    width: auto;
    max-width: none;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }

  .panel-collapsed .setup-panel {
    min-height: 42px;
    padding: 0;
    border-bottom: 0;
    transform: none;
  }

  .panel-collapsed .setup-panel > :not(.generator-drawer-toggle) {
    display: none;
  }

  .generator-drawer-toggle {
    top: auto;
    right: 16px;
    bottom: -44px;
    width: auto;
    min-width: 76px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--warm-border);
    border-radius: 0 0 8px 8px;
  }

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

  .topic-control,
  .level-control,
  .fixed-settings,
  .generator-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 740px) {
  .public-header {
    gap: 14px;
    min-height: auto;
    padding: 16px;
  }

  .brand-word {
    font-size: 1.72rem;
  }

  .phi-mark {
    width: 38px;
    height: 38px;
  }

  .phi-mark::before {
    font-size: 1.62rem;
  }

  .brand-tagline {
    display: none;
  }

  .public-nav {
    gap: 6px;
  }

  .public-nav button {
    min-height: 38px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .hero-title {
    font-size: 2.72rem;
  }

  .hero-prompt-row {
    grid-template-columns: 1fr;
  }

  .button-primary,
  .button-secondary,
  .prompt-input-wrap,
  .prompt-input {
    min-height: 52px;
  }

  .landing-controls {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .landing-language-control,
  .select-control {
    width: 100%;
  }

  .control-arrow {
    display: none;
  }

  .hero-visual {
    display: none;
  }

  .benefit-row {
    grid-template-columns: 1fr;
  }

  .reader-panel {
    padding: 18px 12px;
  }

  .history-panel {
    padding: 18px 12px;
  }

  .reader-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-header,
  .history-import {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-filters {
    grid-template-columns: 1fr 1fr;
  }

  .history-search-field,
  .history-bookmarked-filter {
    grid-column: 1 / -1;
  }

  .toolbar-actions {
    width: 100%;
  }

  .profile-menu {
    margin-left: auto;
  }

  .mode-button,
  .ghost-button {
    flex: 1;
  }

  .chapter-heading,
  .phrase-list,
  .notes-panel,
  .practice-panel,
  .recall-review-panel,
  .sheet-feedback-panel {
    padding-left: 20px;
    padding-right: 20px;
  }

  .phrase-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .translation-text {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.92rem;
  }

  .control-stack,
  .paired-fields {
    grid-template-columns: 1fr;
  }

  .book-page::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 260px);
  }

  .history-filters {
    grid-template-columns: 1fr;
  }

  .history-table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .history-table,
  .history-table tbody,
  .history-table tr,
  .history-table td {
    display: block;
    width: 100%;
  }

  .history-table thead {
    display: none;
  }

  .history-table tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .history-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-bottom: 0;
  }

  .history-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font: 800 0.68rem var(--sans);
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typewriter-cursor {
    animation: none;
  }

  .app-shell,
  .setup-panel,
  .reader-toolbar,
  .book-page {
    transition: none;
  }
}

@page {
  size: A4 portrait;
  margin: 14mm;
}

@media print {
  html,
  body {
    width: auto;
    min-height: auto;
    background: #ffffff !important;
    color: #111827;
  }

  .landing-view,
  .setup-panel,
  .reader-toolbar,
  .history-panel,
  .reveal-overlay,
  .profile-menu,
  .modal-backdrop,
  .anonymous-import-notice,
  .general-feedback-panel,
  .recall-review-panel,
  .sheet-feedback-panel,
  .sheet-actions,
  .session-path,
  .recent-sheets {
    display: none !important;
  }

  .app-shell,
  .app-shell.panel-collapsed {
    display: block !important;
    min-height: auto;
    background: #ffffff !important;
  }

  .reader-panel {
    display: block;
    padding: 0;
    background: #ffffff !important;
  }

  .book-page,
  .panel-collapsed .book-page {
    width: 100%;
    max-width: none;
    min-height: auto;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #ffffff !important;
    box-shadow: none;
  }

  .book-page::before {
    display: none;
  }

  .chapter-heading {
    padding: 0 0 8mm;
  }

  .chapter-heading p {
    color: #6b7280;
    font-size: 10pt;
  }

  .phrase-list {
    display: block;
    padding: 0;
    font-size: 11.5pt;
    line-height: 1.35;
  }

  .sentence-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38mm;
    gap: 7mm;
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 0 0 3.5mm;
  }

  .sentence-text,
  .translation-text {
    margin: 0;
    min-height: 0;
  }

  .translation-text {
    color: #6b7280;
    font-size: 9.5pt;
  }

  .target-term {
    color: #b42318 !important;
    font-weight: 600;
  }

  .target-term::after {
    display: none !important;
  }

  .notes-panel,
  .practice-panel {
    break-before: auto;
    padding: 8mm 0 0;
  }

  .notes-content,
  .practice-content {
    max-width: none;
    padding: 0;
    border: 0;
    background: #ffffff;
  }

  .practice-item,
  .notes-list li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  button,
  input,
  textarea,
  select {
    display: none !important;
  }
}
