:root {
  --bg: #f5f0e8;
  --surface: #fffdf7;
  --ink: #2b2118;
  --muted: #6b6258;
  --line: #ddd5c4;
  --soft: #eaf0f4;
  --accent: #1a5c7a;
  --accent-dark: #124059;
  --danger: #943325;
  --shadow: 0 22px 50px rgba(43, 33, 24, 0.09);
  --shadow-sm: 0 4px 16px rgba(43, 33, 24, 0.07);
  --parchment-line: rgba(180, 160, 120, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 18px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  text-decoration: none;
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 50px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 240, 232, 0.93);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand > span:last-child {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 22px;
  font-style: italic;
  box-shadow: 0 2px 6px rgba(43, 33, 24, 0.08);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.site-nav a {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 7px;
  transition: background 140ms ease, color 140ms ease;
}

.site-nav a:hover {
  background: color-mix(in srgb, var(--soft) 70%, var(--bg));
  color: var(--ink);
}

main {
  width: min(1240px, calc(100vw - 34px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 28px;
}

body:not([data-page="home"]) .tool-hero {
  position: relative;
  align-items: center;
  margin-bottom: 10px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.94), rgba(234, 240, 244, 0.52)),
    var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

body:not([data-page="home"]) .tool-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 30px,
      var(--parchment-line) 30px,
      var(--parchment-line) 31px
    );
  opacity: 0.72;
  pointer-events: none;
}

body:not([data-page="home"]) .tool-hero > * {
  position: relative;
  z-index: 1;
}

body:not([data-page="home"]) .tool-hero h1 {
  max-width: 760px;
  font-size: clamp(36px, 4.4vw, 58px);
}

body:not([data-page="home"]) .tool-hero .secondary-button.primary {
  justify-self: end;
  white-space: nowrap;
}

.letter-hero-preview {
  display: grid;
  justify-items: end;
  gap: 14px;
  min-width: 230px;
}

.letter-hero-preview span {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(72px, 10vw, 132px);
  line-height: 0.82;
  text-shadow: 0 14px 36px rgba(26, 92, 122, 0.12);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

h1 {
  max-width: 830px;
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 0.96;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 250px;
}

.quick-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  color: var(--muted);
  padding: 7px 13px;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.stat-dot {
  color: var(--accent);
  font-size: 9px;
  vertical-align: middle;
  margin-right: 4px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: start;
}

.workspace,
.settings {
  min-width: 0;
}

.input-card,
.panel,
.result-card,
.worksheet-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.input-card {
  padding: 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.input-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 31px,
    var(--parchment-line) 31px,
    var(--parchment-line) 32px
  );
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

.input-card > * {
  position: relative;
  z-index: 1;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.field-head label {
  margin-bottom: 8px;
}

.field-head span {
  margin-bottom: 8px;
  white-space: nowrap;
}

.field-head span.warning {
  color: var(--danger);
  font-weight: 760;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.input-guidance,
.style-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preset-row button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.preset-row button:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--soft) 80%, var(--surface));
}

#sourceText {
  width: 100%;
  min-height: 56px;
  border: 1px solid transparent;
  border-bottom: 2px solid var(--line);
  border-radius: 7px 7px 0 0;
  outline: 0;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-family: Georgia, serif;
  font-style: italic;
  transition: border-color 160ms ease, background 160ms ease;
}

#sourceText:focus {
  border-bottom-color: var(--accent);
  background: rgba(255, 253, 247, 0.7);
}

.icon-button,
.mode,
.secondary-button,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  min-height: 54px;
  color: var(--muted);
}

.modebar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 18px 0 14px;
  padding: 5px;
  background: color-mix(in srgb, var(--bg) 70%, var(--line));
  border: 1px solid var(--line);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}

.mode {
  padding: 0 16px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.mode:hover:not(.active) {
  color: var(--ink);
  background: rgba(255, 253, 247, 0.6);
}

.mode.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(43, 33, 24, 0.08);
}

.mode-note {
  min-height: 20px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.style-summary {
  margin: -8px 0 14px;
}

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

.result-card {
  min-height: 198px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  cursor: pointer;
  border-radius: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.result-card.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 16px 38px rgba(26, 92, 122, 0.12);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.result-head,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

.result-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-stage {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 120px;
  padding: 24px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 85%, var(--bg));
}

.result-text {
  position: relative;
  z-index: 1;
  color: var(--ink);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.result-caption {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mode-image {
  background-image:
    linear-gradient(45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(-45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ecebe4 75%),
    linear-gradient(-45deg, transparent 75%, #ecebe4 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

body[data-export-background="white"] .mode-image,
body[data-export-background="white"] .mode-signature {
  background: #fff;
}

body[data-export-background="paper"] .mode-image,
body[data-export-background="paper"] .mode-signature {
  background: #f5f0e8;
}

body[data-export-size="wide"] .mode-image,
body[data-export-size="wide"] .mode-signature {
  min-height: 132px;
}

body[data-export-size="square"] .mode-image,
body[data-export-size="square"] .mode-signature {
  min-height: 178px;
}

.mode-signature::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 42px;
  height: 2px;
  background: color-mix(in srgb, var(--ink) 32%, transparent);
}

.mode-signature .result-caption {
  padding-left: 2px;
}

.mode-tattoo {
  background:
    linear-gradient(110deg, rgba(184, 126, 91, 0.2), rgba(239, 204, 176, 0.72)),
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.48), transparent 28%);
}

.mode-tattoo::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(22, 23, 22, 0.42) 0 1px, transparent 1px 14px);
}

.mode-worksheet {
  background:
    repeating-linear-gradient(var(--surface) 0 35px, var(--parchment-line) 35px 36.5px),
    var(--surface);
}

.mode-worksheet .result-caption,
.mode-tattoo .result-caption,
.mode-signature .result-caption {
  font-weight: 700;
}

.font-script {
  font-family: "Brush Script MT", "Segoe Script", "Apple Chancery", cursive;
}

.font-formal {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.font-bold {
  font-family: "Lucida Handwriting", "Segoe Script", cursive;
  font-weight: 800;
}

.font-social {
  font-family: "Trebuchet MS", ui-sans-serif, sans-serif;
  font-style: italic;
}

.font-mono-script {
  font-family: "Courier New", monospace;
  font-style: italic;
}

.result-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  border-radius: 6px;
  transition: color 140ms ease, border-color 140ms ease;
}

.small-button.primary,
.secondary-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.settings {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.panel select,
.panel input[type="range"] {
  width: 100%;
  margin-bottom: 14px;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--ink);
  padding: 0 10px;
  font-size: 14px;
}

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

.swatch {
  width: 31px;
  height: 31px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.swatch.active {
  box-shadow: 0 0 0 2px var(--accent);
}

.export-actions,
.favorites {
  display: grid;
  gap: 8px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.secondary-button.subtle {
  margin-top: 12px;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  color: var(--muted);
}

a.secondary-button {
  width: auto;
  min-width: 148px;
  padding: 0 16px;
  text-align: center;
}

.secondary-button:hover,
.small-button:hover,
.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

.secondary-button.primary:hover,
.secondary-button.primary:focus-visible,
.small-button.primary:hover,
.small-button.primary:focus-visible {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 8px 20px rgba(26, 92, 122, 0.16);
}

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

button:disabled:hover {
  border-color: var(--line);
  color: var(--muted);
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.export-summary {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 13px;
}

.worksheet-preview {
  margin-top: 14px;
  padding: 18px;
}

.worksheet-line {
  min-height: 58px;
  border-bottom: 1px dashed #b8b4a9;
  display: flex;
  align-items: center;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}

.worksheet-line span {
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 38px;
}

.worksheet-trace span {
  opacity: 0.32;
}

.worksheet-blank span {
  display: none;
}

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

.trust-strip div {
  border: 1px solid var(--line);
  border-top: 3px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 84%, var(--soft));
  padding: 18px 16px;
}

.trust-strip div::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  margin-bottom: 12px;
}

.trust-strip strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  color: var(--ink);
}

.trust-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.seo-band {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 32px;
  margin-top: 42px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.seo-band h2 {
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 12px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
}

.seo-band p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}

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

.feature {
  display: grid;
  gap: 8px;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px;
  text-decoration: none;
  align-content: start;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body:not([data-page="home"]) .feature,
body:not([data-page="home"]) .content-card,
body:not([data-page="home"]) details {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 253, 247, 0.9)),
    var(--surface);
}

a.feature:hover,
a.feature:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 10px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-2px);
}

.feature strong {
  font-size: 15px;
  font-weight: 700;
  font-family: Georgia, serif;
  font-style: italic;
  color: var(--ink);
}

.feature span {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.faq-grid {
  display: grid;
  gap: 8px;
}

details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

details[open] {
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  padding: 16px 18px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 220ms ease;
  margin-top: -3px;
}

details[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 3px;
  border-color: var(--accent);
}

details p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.content-card {
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 18px 18px 18px 16px;
  transition: border-left-color 160ms ease, box-shadow 160ms ease;
}

.content-card:hover {
  border-left-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: var(--shadow-sm);
}

.content-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.content-card p,
.content-card li {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.content-card ul {
  margin: 0;
  padding-left: 18px;
}

.content-page {
  display: grid;
  gap: 24px;
}

.content-section {
  border-top: 1px solid var(--line);
  padding-top: 32px;
  margin-top: 32px;
}

.content-section > h2 {
  font-size: 24px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.focus-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(180px, 0.65fr) minmax(220px, 0.7fr);
  align-items: center;
  gap: 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 12px;
  background:
    radial-gradient(circle at 72% 22%, rgba(26, 92, 122, 0.13), transparent 32%),
    linear-gradient(135deg, rgba(255, 253, 247, 0.98), rgba(234, 240, 244, 0.68));
  box-shadow: var(--shadow-sm);
}

.focus-feature h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.4vw, 42px);
  font-style: italic;
  line-height: 1.05;
}

.focus-feature p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.focus-feature-preview {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(82px, 11vw, 150px);
  line-height: 0.85;
  text-align: center;
  text-shadow: 0 16px 38px rgba(26, 92, 122, 0.13);
}

.focus-feature-action {
  display: grid;
  justify-items: stretch;
  gap: 14px;
}

.focus-feature-action ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 10px;
  font-size: 24px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.section-head .lede {
  max-width: 720px;
  font-size: 15px;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 8px;
}

.alphabet-guide-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(234, 240, 244, 0.54)),
    var(--surface);
}

.alphabet-guide-callout span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.guide-letter-grid .letter-tile {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 253, 247, 0.9)),
    var(--surface);
}

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

.word-practice-card {
  display: grid;
  gap: 10px;
  min-height: 112px;
  align-content: center;
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.word-practice-card:hover,
.word-practice-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.word-practice-card strong {
  color: var(--ink);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 400;
  line-height: 0.9;
}

.word-practice-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.letter-tile {
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 34px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

a.letter-tile:hover,
a.letter-tile:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 12px 26px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

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

.letter-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.letter-example {
  min-height: 160px;
  display: grid;
  gap: 8px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(68px, 12vw, 132px);
  color: var(--accent);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.letter-example span {
  line-height: 0.85;
}

.letter-example small {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

a.letter-example:hover,
a.letter-example:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 16px 34px rgba(26, 92, 122, 0.12);
  transform: translateY(-1px);
}

.letter-practice-section {
  scroll-margin-top: 90px;
}

.worksheet-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: clamp(22px, 5vw, 56px);
}

.worksheet-copy {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
}

.worksheet-copy h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.4vw, 40px);
  font-style: italic;
  line-height: 1.08;
}

.worksheet-copy .lede {
  font-size: 15px;
}

.compact-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.a4-sheet {
  width: min(100%, 760px);
  aspect-ratio: 210 / 297;
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 253, 247, 0) 0,
      rgba(255, 253, 247, 0) 33px,
      rgba(180, 160, 120, 0.18) 34px
    ),
    var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3.2vw, 34px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(14px, 2vw, 22px);
}

.worksheet-layout .a4-sheet {
  max-width: 560px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sheet-kicker,
.sheet-size {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sheet-header h3 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 50px);
  font-style: italic;
  line-height: 1;
}

.alphabet-practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  align-content: start;
}

.alphabet-practice-grid div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  column-gap: 18px;
  align-items: end;
  min-height: 33px;
  border-bottom: 1px dashed color-mix(in srgb, var(--muted) 40%, var(--line));
  overflow: hidden;
}

.alphabet-practice-grid strong {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding-right: 10px;
}

.alphabet-practice-grid span {
  color: color-mix(in srgb, var(--ink) 38%, transparent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(18px, 2.4vw, 27px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  padding-left: 2px;
}

.sheet-lines {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.sheet-lines span {
  min-height: 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 35%, var(--line));
}

.focus-practice-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 33, 24, 0.34);
  backdrop-filter: blur(14px);
}

.focus-practice-overlay[hidden] {
  display: none;
}

.focus-practice-card {
  width: min(720px, 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 253, 247, 0) 0,
      rgba(255, 253, 247, 0) 39px,
      var(--parchment-line) 40px
    ),
    var(--surface);
  box-shadow: 0 30px 90px rgba(43, 33, 24, 0.28);
  padding: clamp(24px, 5vw, 52px);
  text-align: center;
}

.focus-practice-minimal {
  width: min(860px, 92vw);
  min-height: min(560px, 78vh);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  place-items: center;
  gap: 14px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.focus-practice-card h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 48px);
  font-style: italic;
}

.focus-letter {
  margin: 18px auto;
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(150px, 28vw, 300px);
  line-height: 0.9;
  text-shadow: 0 12px 34px rgba(26, 92, 122, 0.12);
}

.focus-practice-overlay:not([hidden]) .focus-letter {
  animation:
    focusLetterReveal 1400ms ease-out both,
    focusLetterBreathe 6400ms ease-in-out 1400ms infinite;
}

.focus-stage {
  position: relative;
  width: min(760px, 100%);
  min-height: min(360px, 54vh);
  display: grid;
  place-items: center;
  margin: 0 auto;
  pointer-events: none;
}

.focus-stage .focus-letter {
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.practice-lines {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: clamp(118px, 18vw, 172px);
  transform: translateY(-48%);
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
  opacity: 0.38;
}

.practice-lines span {
  border-top: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
}

.practice-lines span:nth-child(2) {
  border-top-style: dashed;
}

.practice-lines span:last-child {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.focus-controls {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  pointer-events: auto;
}

.focus-pair-toggle,
.focus-alpha-nav,
.focus-auto-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--surface) 62%, var(--line));
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.16);
  backdrop-filter: blur(10px);
}

.focus-auto-control {
  gap: 10px;
  padding-inline: 10px;
}

.focus-auto-toggle,
.focus-interval-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: color-mix(in srgb, var(--surface) 78%, var(--ink));
  font-size: 13px;
  font-weight: 700;
}

.focus-auto-toggle input {
  accent-color: var(--accent);
}

.focus-interval-label input {
  width: 54px;
  min-height: 30px;
  border: 1px solid rgba(255, 253, 247, 0.48);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.86);
  color: var(--accent);
  text-align: center;
  font-weight: 800;
}

.focus-chip,
.focus-nav-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--surface) 78%, var(--ink));
  padding: 0 12px;
  cursor: pointer;
}

.focus-chip.active {
  background: rgba(255, 253, 247, 0.86);
  color: var(--accent);
  font-weight: 800;
}

.focus-current-letter {
  min-width: 34px;
  color: var(--surface);
  font-weight: 800;
  text-align: center;
}

.focus-exit-hint {
  position: relative;
  z-index: 3;
  margin: 0;
  color: color-mix(in srgb, var(--surface) 66%, transparent);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.focus-practice-card p:not(.eyebrow) {
  max-width: 520px;
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.65;
}

@keyframes focusLetterReveal {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.94);
    filter: blur(9px);
  }

  55% {
    opacity: 0.72;
    filter: blur(2px);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes focusLetterBreathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  50% {
    transform: translateY(-4px) scale(1.018);
    opacity: 0.92;
  }
}

.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 24px clamp(18px, 4vw, 50px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.site-footer span {
  display: contents;
}

.site-footer a {
  text-decoration: none;
  transition: color 140ms ease;
}

.site-footer a:hover {
  color: var(--accent);
}

@media print {
  .site-header,
  .tool-hero,
  .modebar,
  .result-grid,
  .settings,
  .seo-band,
  .site-footer,
  .input-card {
    display: none !important;
  }

  main {
    width: auto;
    padding: 0;
  }

  .app-shell {
    display: block;
  }

  .worksheet-preview {
    display: block !important;
    border: 0;
  }
}

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

@media (max-width: 980px) {
  .tool-hero,
  .app-shell,
  .seo-band,
  .trust-strip,
  .focus-feature,
  .worksheet-layout {
    grid-template-columns: 1fr;
  }

  .letter-hero-preview {
    justify-items: start;
  }

  .worksheet-copy {
    position: static;
  }

  .focus-feature-action {
    justify-items: start;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  body:not([data-page="home"]) .tool-hero .secondary-button.primary {
    justify-self: start;
  }

  .quick-stats {
    justify-content: flex-start;
  }

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

  .modebar {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 12px;
  }

  .site-nav {
    display: flex;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .site-nav a {
    flex: 0 0 auto;
  }

  .alphabet-guide-callout {
    display: grid;
    align-items: start;
  }

  main {
    width: min(100vw - 24px, 1240px);
    padding-top: 24px;
  }

  h1 {
    font-size: 40px;
    letter-spacing: -0.005em;
  }

  .input-card {
    position: sticky;
    top: 96px;
    z-index: 8;
  }

  .input-card::before {
    background-image: repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 27px,
      var(--parchment-line) 27px,
      var(--parchment-line) 28px
    );
  }

  .result-grid,
  .settings,
  .feature-grid,
  .content-grid,
  .word-practice-grid,
  .letter-pair {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

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

  .icon-button {
    width: 100%;
  }

  .letter-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .a4-sheet {
    padding: 16px;
    border-radius: 8px;
  }

  .alphabet-practice-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .alphabet-practice-grid div {
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 34px;
  }

  .modebar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 10px;
    width: 100%;
  }

  .modebar::-webkit-scrollbar {
    display: none;
  }
}
