/* ==========================================================================
   CursiveStudio - Formal Design System
   Visual baseline: DESIGN.md (2026-09-14)
   ========================================================================== */

/* 1. Font Definitions */
@font-face {
  font-family: "Cal Sans";
  src: url("fonts/CalSansVF.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Dancing Script";
  src: url("fonts/DancingScript.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Birthstone";
  src: url("fonts/Birthstone.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Allura";
  src: url("fonts/Allura.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Parisienne";
  src: url("fonts/Parisienne.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "MonteCarlo";
  src: url("fonts/MonteCarlo.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Lobster";
  src: url("fonts/Lobster.woff2") format("woff2");
  font-display: swap;
}

/* 2. Color Tokens & Design Constants */
:root {
  --ink: #000000;
  --text-ink: #3a3a3a;
  --muted: #707070;
  --line: #e7e7e7;
  --soft: #d6d9db;
  --wash: #f7f7f7;
  --surface: #ffffff;
  --accent: #f1ff00;
  --guide-base: #8c8c8c;
  --max: 1180px;

  /* Style rail component variables */
  --style-card-width: 130px;
  --style-card-height: 148px;
  --style-glyph-height: 90px;
}

/* 3. Base & Typography */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}
body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font: 400 16px/1.5 "Cal Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
}
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin: auto;
}
@media (max-width: 640px) {
  .wrap {
    width: calc(100% - 28px);
  }
}
h1, h2, h3, p {
  margin-top: 0;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(44px, 5.8vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 600;
}
h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  font-weight: 600;
}
h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.intro {
  max-width: 660px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  text-wrap: pretty;
}
.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--ink);
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-radius: 4px;
}
.badge-inline {
  position: static;
  margin-bottom: 12px;
}

/* Primary Button */
.btn {
  min-height: 46px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn:hover {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--ink);
}
.btn.secondary {
  background: #fff;
  color: var(--ink);
}
.btn.secondary:hover {
  background: var(--accent);
  color: var(--ink);
}

/* 4. Header & Navigation */
.header {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header .nav {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 auto;
}
.nav-links {
  display: flex;
  gap: 30px;
  font-size: 14px;
  color: var(--muted);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}
.header-action {
  justify-self: end;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
@media (max-width: 700px) {
  .header .nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .header .nav-links {
    display: none;
  }
  .header-action {
    font-size: 13px;
  }
}

/* 5. Hero Section */
.hero {
  padding-top: 42px;
  padding-bottom: 72px;
}
.hero-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}
.letter-profile {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 22px;
  align-items: baseline;
  margin: 0 0 34px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}
.letter-profile-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.letter-profile-copy {
  margin: 0;
  color: var(--text-ink);
  font-size: 14px;
  line-height: 1.6;
}
@media (max-width: 700px) {
  .letter-profile {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}
.hero-heading > div:first-child {
  min-width: 0;
}
.hero-heading .case-switch {
  flex: 0 0 auto;
  margin: 0 0 4px;
}
@media (max-width: 700px) {
  .hero-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-heading .case-switch {
    margin-top: 16px;
    width: 100%;
  }
}

/* Case Switcher */
.case-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #e7e7e7;
}
.case-button {
  min-width: 104px;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.case-button:hover:not([aria-pressed="true"]) {
  background: #f0f0f0;
}
.case-button[aria-pressed="true"] {
  background: var(--ink) !important;
  color: #fff;
}
@media (max-width: 700px) {
  .case-switch {
    display: flex;
    width: 100%;
  }
  .case-button {
    flex: 1;
    min-width: 0;
  }
}

/* Case visibility filter */
body.case-upper .lower,
body.case-upper .demo-low,
body.case-upper .rail-glyph .low {
  display: none !important;
}
body.case-lower .capital,
body.case-lower .demo-cap,
body.case-lower .rail-glyph .cap {
  display: none !important;
}

/* 6. Style Studio Container */
.style-studio {
  position: relative;
  margin-top: 38px;
  padding: 25px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.03);
}
@media (max-width: 700px) {
  .style-studio {
    padding: 14px;
    border-radius: 14px;
  }
}

/* Style Selector Rail */
.hero .style-studio .alternate-trigger {
  position: relative;
  margin: -25px -18px 18px !important;
  padding: 25px 18px 18px !important;
  border-radius: 17px 17px 0 0;
  background: #e7e7e7 !important;
  display: block;
}
@media (max-width: 700px) {
  .hero .style-studio .alternate-trigger {
    margin: -25px -14px 18px !important;
    padding: 25px 14px 16px !important;
  }
}
.rail-head {
  position: absolute;
  z-index: 2;
  left: 24px;
  top: 0;
  margin: 0;
  padding: 0 10px;
  background: #fff;
  transform: translateY(-50%);
  border-radius: 4px;
}
.rail-head strong {
  font-size: 13px;
  font-weight: 600;
}
.style-viewport {
  overflow-x: auto;
  padding: 0;
  scrollbar-width: none;
}
.style-viewport::-webkit-scrollbar {
  display: none;
}
.style-rail {
  display: flex;
  flex-flow: row nowrap;
  gap: 10px;
  width: max-content;
  min-width: 0;
}

/* Rail Style Card */
.rail-card {
  display: grid;
  grid-template-rows: var(--style-glyph-height) 20px 14px;
  align-content: start;
  width: var(--style-card-width);
  min-width: var(--style-card-width);
  height: var(--style-card-height);
  min-height: var(--style-card-height);
  padding: 11px 10px 12px;
  border: 1px solid var(--line) !important;
  border-radius: 11px;
  background: #fff;
  position: relative;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease;
}
.rail-card:hover {
  background: #fff;
  border-color: #9f9f9f !important;
}
.rail-card::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 102px;
  height: 1px;
  background: var(--soft);
}
.rail-card[aria-pressed="true"] {
  padding: 11px 10px 12px;
  background: #fff;
  border: 2px solid var(--ink) !important;
  box-shadow: inset 0 0 0 1px #000;
}
.rail-card[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  right: 9px;
  top: 9px;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  border: 1px solid #000;
  border-radius: 50%;
  background: #000;
  color: var(--accent);
  display: grid;
  place-items: center;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
.rail-glyph {
  position: relative;
  width: 100%;
  height: var(--style-glyph-height);
  margin: 0;
  border: 0;
  background: transparent !important;
  display: grid;
  place-items: center;
  justify-self: stretch;
  overflow: hidden;
  text-align: center;
}
.rail-glyph .cap,
.rail-glyph .low {
  display: block;
  width: 100%;
  color: #000;
  font-size: 54px;
  line-height: 1;
  text-align: center;
}
.style-card[data-style="2"] .rail-glyph .cap { transform: scale(1.08); }
.style-card[data-style="3"] .rail-glyph .cap,
.style-card[data-style="4"] .rail-glyph .cap { transform: translateY(4px); }

.rail-name {
  position: relative;
  align-self: end;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 6px 0 0;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  line-height: 13px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
}
.rail-note {
  width: 100%;
  height: 14px;
  margin: -1px 0 0;
  padding: 0;
  font-size: 7px;
  color: var(--muted);
  line-height: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 7. Letter Preview Card */
.style-studio > .standard-card {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  height: 480px;
  min-height: 480px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
  margin-top: 0;
}
.style-studio > .standard-card .standard-visual {
  height: 480px;
  min-height: 480px;
  border-right: 1px solid var(--line);
  background: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.style-studio > .standard-card .standard-visual .letter-guide {
  width: 104%;
  height: 104%;
  max-width: none;
  flex: 0 0 104%;
}
.style-studio > .standard-card .standard-visual .guide-label {
  display: block;
}
.style-studio > .standard-card .standard-copy {
  padding: 32px 32px 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.style-studio > .standard-card .standard-copy h3 {
  margin: 10px 0 7px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.style-role {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
}
.style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.style-tags span {
  padding: 5px 9px;
  border: 1px solid var(--soft);
  border-radius: 999px;
  background: #f4f4f4;
  color: var(--ink);
  font-size: 11px;
}
.style-guidance {
  margin: 24px 0 30px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
  color: rgba(0, 0, 0, 0.76);
  font-size: 14px;
  line-height: 1.5;
}
.style-studio > .standard-card .actions {
  display: grid;
  gap: 9px;
  margin-top: auto;
  margin-bottom: 6px;
}
.style-studio > .standard-card .actions .btn {
  width: 100%;
}
@media (max-width: 850px) {
  .style-studio > .standard-card {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .style-studio > .standard-card .standard-visual {
    height: 420px;
    min-height: 420px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* 8. Handwriting Four-line Guide System (Fixed standards) */
.letter-guide {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.guide-outer, .guide-x {
  stroke: var(--soft);
  stroke-width: 1;
}
.guide-x {
  stroke-dasharray: 5 5;
}
.guide-base {
  stroke: var(--guide-base);
  stroke-width: 1.35;
}
.guide-label {
  font: 10px "Cal Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  fill: var(--muted);
  letter-spacing: 0.04em;
}
.guide-text {
  text-anchor: middle;
}

/* 9. Practice Builder Section */
.section {
  border-top: 1px solid var(--line);
  padding: 72px 0 84px;
  background: #fff;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  margin-bottom: 32px;
}

#practice {
  position: relative;
  background: #f5f5f5;
  box-shadow: 0 0 0 100vmax #f5f5f5;
  clip-path: inset(0 -100vmax);
  padding-top: 48px;
  padding-bottom: 62px;
}
#practice .section-head {
  margin-bottom: 32px;
}

.practice-builder {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.practice-controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
}
.practice-controls .sheet-head {
  margin-bottom: 16px;
  color: var(--muted);
}
.practice-style {
  margin: 0 0 24px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.practice-style strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--accent);
}

.practice-controls .sheet-options {
  display: grid;
  gap: 20px;
  margin-bottom: 16px;
}
.option-row {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 8px;
}
.option-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.practice-controls .segmented {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #000;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
}
.practice-controls .segment {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid #d6d6d6;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease;
  font-family: inherit;
  box-sizing: border-box;
}
.practice-controls .segment:nth-child(even) {
  border-right: 0;
}
.practice-controls .segment:nth-last-child(-n+2) {
  border-bottom: 0;
}
.practice-controls .segment:hover:not([aria-pressed="true"]) {
  background: #e7e7e7;
}
.practice-controls .segment[aria-pressed="true"] {
  background: #000 !important;
  color: #fff !important;
}
.sheet-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.print-actions {
  margin-top: 24px;
  display: grid;
}
.print-actions .btn {
  width: 100%;
}

/* Worksheet Preview Column */
.sheet-column {
  min-width: 0;
  padding: 24px;
  border: 0;
  background: #e7e7e7;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sheet-column > .sheet-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.sheet {
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px 18px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), aspect-ratio 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.portrait {
  width: 76%;
  aspect-ratio: 210/297;
  align-self: center;
}
.sheet.landscape {
  width: 100%;
  aspect-ratio: 297/210;
  align-self: center;
  min-height: 0;
  height: auto;
}
.sheet .sheet-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.worksheet-rows {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}
.worksheet-rows .row {
  flex: 1;
  height: auto;
  margin-bottom: 3px;
  display: block;
  overflow: visible;
}
.worksheet-rows .row:last-child {
  margin-bottom: 0;
}
.worksheet-rows .row .letter-guide {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.row .sheet-text {
  font-size: 42px;
  text-anchor: start;
  fill: var(--ink);
}
.row .sheet-text.sheet-sample {
  text-anchor: middle;
}
.row.trace .sheet-text,
.sheet-text.sample-trace {
  opacity: 0.22;
}
.row.faint .sheet-text {
  opacity: 0.08;
}
.row.blank .sheet-text {
  display: none;
}
.alphabet-pager {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 5px 0 8px;
  font-size: 10px;
  color: var(--muted);
}
.alphabet-pager.visible {
  display: flex;
}
.pager-button {
  width: 28px;
  height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
}
.pager-button:hover:not(:disabled) {
  background: #e7e7e7;
  border-color: var(--muted);
}
.pager-button:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (max-width: 900px) {
  .sheet.portrait {
    width: min(78%, 460px);
  }
}
@media (max-width: 800px) {
  .practice-builder {
    grid-template-columns: 1fr;
  }
  .practice-controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .practice-controls .print-actions {
    margin-top: 24px;
  }
}

/* 10. Connections Section */
.connections-section {
  position: relative;
  padding-top: 62px;
  padding-bottom: 62px;
  background: #f5f5f5;
  box-shadow: 0 0 0 100vmax #f5f5f5;
  clip-path: inset(0 -100vmax);
}
.connections-section .section-head {
  margin-bottom: 32px;
}
.connection-studio {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.03);
}
@media (max-width: 700px) {
  .connection-studio {
    padding: 14px;
    border-radius: 14px;
  }
}
.connection-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "stage choices"
    "stage footer";
  min-height: 380px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
}
.connection-card .connection-stage {
  grid-area: stage;
  min-height: 380px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.connection-stage .letter-guide {
  width: 104%;
  height: 104%;
  max-width: none;
  flex: 0 0 104%;
  display: block;
}
.connection-text {
  position: relative;
  z-index: 2;
  font-size: 155px;
}
.connection-card .chips {
  grid-area: choices;
  margin: 0;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.chips .chip {
  min-width: 58px;
  min-height: 42px;
  border: 1px solid #000;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.chips .chip:hover:not([aria-pressed="true"]) {
  background: #e7e7e7;
}
.chips .chip[aria-pressed="true"] {
  background: #000 !important;
  color: #fff;
}
.connection-footer {
  grid-area: footer;
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
}
.connection-caption {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.connection-footer .btn {
  width: 100%;
}
@media (max-width: 850px) {
  .connection-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "choices"
      "stage"
      "footer";
    min-height: 0;
  }
  .connection-card .connection-stage {
    min-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .connection-card .chips {
    border-bottom: 1px solid var(--line);
  }
}

/* 11. Alphabet Section (A-Z Links) */
#alphabet {
  padding: 62px 0;
  background: #f5f5f5;
  border-top: 1px solid #e7e7e7;
}
#alphabet .letters {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 8px;
  margin-top: 24px;
}
#alphabet .letters a {
  min-height: 46px;
  background: #fff;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  font-weight: 650;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
#alphabet .letters a:hover {
  background: #e7e7e7;
  border-color: #b9b9b9;
  color: var(--ink);
}
#alphabet .letters a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
#alphabet .letters .current {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
@media (max-width: 620px) {
  #alphabet .letters {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* 12. Footer */
footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  text-align: left;
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 22px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover,
.footer-links a[aria-current="page"] { color: var(--ink); }
@media (max-width: 620px) {
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-links { justify-content: flex-start; }
}

/* 14. Alphabet Collection Page */
.alphabet-studio {
  position: relative;
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.03);
}
@media (max-width: 700px) {
  .alphabet-studio {
    padding: 16px;
    border-radius: 14px;
  }
}

.alphabet-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.alphabet-controls .control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.control-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.worksheet-actions .segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.worksheet-actions .segment {
  min-height: 42px;
  padding: 8px 18px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
}
.worksheet-actions .segment:last-child {
  border-right: 0;
}
.worksheet-actions .segment[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}
.worksheet-actions .segment:hover:not([aria-pressed="true"]) {
  background: #f4f4f4;
}

.alphabet-style-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.alphabet-style-rail::-webkit-scrollbar {
  display: none;
}
.style-btn {
  min-width: 140px;
  min-height: 54px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.18s ease;
  font-family: inherit;
}
.style-btn:hover {
  border-color: #9f9f9f;
}
.style-btn[aria-pressed="true"] {
  border: 2px solid var(--ink) !important;
  padding: 7px 13px;
  box-shadow: inset 0 0 0 1px #000;
}
.style-btn[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  right: 6px;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.style-btn-glyph {
  font-size: 26px;
  line-height: 1;
  min-width: 30px;
  text-align: center;
  color: var(--ink);
}
.style-btn-info {
  display: flex;
  flex-direction: column;
}
.style-btn-info strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.style-btn-info span {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.2;
}

.alphabet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 18px 4px 20px;
  flex-wrap: wrap;
}
.alphabet-title-group h2 {
  margin: 0 0 4px;
}
.alphabet-summary {
  font-size: 15px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Primary CTA & Download Buttons (Unified with .btn and high-contrast hover) */
.btn,
.primary-cta,
.btn-download,
#downloadBtn,
#printButton {
  min-height: 46px;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink) !important;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn:hover,
.primary-cta:hover,
.btn-download:hover,
#downloadBtn:hover,
#printButton:hover {
  background: var(--accent) !important;
  color: #000 !important;
  border: 1px solid #000 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.btn:active,
.primary-cta:active,
.btn-download:active,
#downloadBtn:active,
#printButton:active {
  transform: translateY(0);
  box-shadow: none;
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
@media (max-width: 1080px) {
  .alphabet-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (max-width: 768px) {
  .alphabet-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
}
@media (max-width: 540px) {
  .alphabet-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 380px) {
  .alphabet-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.letter-card {
  background: #fff;
  border: 1px solid #dfdfdf;
  border-radius: 12px;
  min-height: 154px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  padding: 10px 10px 10px;
  position: relative;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  overflow: hidden;
}
.letter-card:hover {
  border-color: #000;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}
.letter-card:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}
.card-index {
  font-size: 11px;
  font-weight: 700;
  color: #9c9c9c;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.card-corner-arrow {
  font-size: 12px;
  font-weight: 700;
  color: #b8b8b8;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}
.letter-card:hover .card-corner-arrow {
  color: #000;
  transform: translate(2px, -2px);
}

.card-stage {
  position: relative;
  width: 100%;
  height: 86px;
  background: #fbfbfb;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  overflow: hidden;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.letter-card:hover .card-stage {
  background: #f4f4f4;
  border-color: rgba(0, 0, 0, 0.08);
}

.letter-card .letter-glyph {
  position: relative;
  z-index: 1;
  font-size: 58px;
  line-height: 1;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.18s ease;
}
.letter-card:hover .letter-glyph {
  transform: scale(1.04);
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 2px 0;
}
.card-letter-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.letter-card .letter-action {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: #efefef;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.letter-card:hover .letter-action {
  background: var(--accent);
  color: #000;
}

/* 15. Worksheet Workspace (Alphabet Collection) */
.worksheet-workspace {
  position: relative;
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.03);
}
@media (max-width: 700px) {
  .worksheet-workspace {
    padding: 16px;
    border-radius: 14px;
  }
}

.worksheet-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.worksheet-info {
  flex: 1;
  min-width: 280px;
}
.worksheet-actions {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  .worksheet-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .worksheet-actions .btn,
  .worksheet-actions .btn-download {
    width: 100%;
  }
}

.sheet-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pager-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}
.pager-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--accent);
  color: var(--ink);
  transform: scale(1.05);
}
.pager-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pager-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.paper-stage {
  background: #f0f0f0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 28px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: auto;
  min-height: 520px;
}
.paper-stage .sheet {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.worksheet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.worksheet-note {
  font-size: 13px;
  color: var(--muted);
}

/* 15.5 Homepage & Interactive Cursive Generator Components */
.home-hero {
  padding: 48px 0 28px;
}
.home-hero-header {
  max-width: 720px;
  margin-bottom: 24px;
}
.home-hero-header h1 {
  margin-bottom: 12px;
}
.home-hero-header .intro {
  font-size: 18px;
  max-width: 680px;
}

/* Interactive Generator Card */
.generator-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: none;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.generator-card > * {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 640px) {
  .generator-card {
    padding: 16px;
    gap: 16px;
  }
}

/* Input Area */
.generator-input-row {
  position: relative;
  display: flex;
  align-items: center;
}
.generator-input {
  width: 100%;
  font-family: inherit;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  background: #fdfdfd;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 16px 52px 16px 20px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.generator-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}
.generator-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--line);
  border: none;
  color: var(--text-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.18s ease;
}
.generator-clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
.generator-clear-btn:hover {
  background: var(--soft);
}

/* Presets Chips */
.generator-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.preset-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}
.preset-chip {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-ink);
  transition: all 0.15s ease;
  cursor: pointer;
}
.preset-chip:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Font Style Pills in Generator */
.generator-fonts-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.generator-fonts-nav-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.generator-fonts-pills {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
@media (max-width: 900px) {
  .generator-fonts-pills {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 500px) {
  .generator-fonts-pills {
    grid-template-columns: repeat(2, 1fr);
  }
}
.font-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}
.font-pill:hover {
  border-color: var(--line);
  background: var(--wash);
}
.font-pill.active {
  background: #fff;
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.font-pill-sample {
  font-size: 23px;
  line-height: 1.1;
  margin-bottom: 4px;
  color: var(--ink);
}
.font-pill-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-ink);
}

/* Controls Bar (Size, Case, Guidelines) */
.generator-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--wash);
  border-radius: 10px;
  flex-wrap: wrap;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.control-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-ink);
}
.size-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.size-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 6px;
  background: var(--soft);
  border-radius: 3px;
  outline: none;
}
.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.size-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.size-val {
  font-size: 12px;
  font-weight: 700;
  min-width: 38px;
  color: var(--muted);
}
.case-pills {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
}
.case-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--text-ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.case-pill.active {
  background: var(--ink);
  color: #fff;
}
.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.toggle-btn:hover {
  border-color: var(--soft);
}
.toggle-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Generator Display Stage */
.generator-stage-wrap {
  position: relative;
  min-height: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}
.generator-stage-svg {
  height: 200px;
  display: block;
  flex-shrink: 0;
  margin: auto;
  overflow: visible;
}
.stage-guides-group {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.stage-guides-group.visible {
  opacity: 1;
}
.stage-guide-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 9px;
  font-weight: 700;
  fill: #b5b5b5;
  letter-spacing: 0.08em;
  user-select: none;
  pointer-events: none;
}
.generator-output-svg {
  user-select: all;
  cursor: text;
  transition: font-size 0.12s ease;
}

/* Generator Action Buttons */
.generator-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.actions-left, .actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.generator-primary-action {
  display: flex;
  justify-content: flex-end;
}
.generator-primary-action .btn {
  min-width: 170px;
}
.generator-visible-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 10px;
}
.generator-visible-actions .btn {
  width: 100%;
  padding-inline: 10px;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .generator-visible-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .generator-visible-actions { grid-template-columns: 1fr; }
}
.generator-more {
  border-top: 1px solid var(--line);
}
.generator-more summary {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 34px 0 0;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
}
.generator-more summary::-webkit-details-marker { display: none; }
.generator-more summary::after {
  content: "+";
  position: absolute;
  right: 3px;
  top: 13px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 500 18px/22px Arial, sans-serif;
  text-align: center;
}
.generator-more[open] summary::after { content: "−"; }
.generator-more summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.generator-more-body {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}
.generator-secondary-actions {
  padding-top: 2px;
}

@media (max-width: 640px) {
  .home-hero {
    padding: 28px 0 18px;
  }
  .home-hero-header h1 {
    font-size: clamp(34px, 9.5vw, 44px);
  }
  .generator-card {
    padding: 16px;
    gap: 16px;
    border-radius: 12px;
  }
  .generator-input {
    font-size: 17px;
    padding: 13px 42px 13px 14px;
  }
  .generator-presets {
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
  }
  .preset-chip {
    font-size: 12px;
    padding: 4px 10px;
  }
  .generator-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    min-width: 0;
    max-width: 100%;
  }
  .control-group {
    justify-content: space-between;
    width: 100%;
    min-width: 0;
  }
  .generator-stage-wrap {
    padding: 20px 10px;
    min-height: 160px;
    min-width: 0;
    max-width: 100%;
  }
  .generator-stage-wrap { overflow: hidden; }
  .generator-stage-svg {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 180px;
  }
  .generator-actions-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
  }
  .generator-primary-action .btn { width: 100%; }
  .generator-more summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .actions-left, .actions-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }
  .actions-left .btn, .actions-right .btn {
    width: 100%;
    justify-content: center;
  }
  .gateway-card {
    padding: 20px;
    min-width: 0;
  }
  .gateway-visual-letters {
    font-size: 18px;
    letter-spacing: 1px;
    text-align: center;
    overflow-wrap: anywhere;
  }
}

/* Showcase Section */
.home-section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}
.section-header-compact {
  max-width: 640px;
  margin-bottom: 36px;
}
.styles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 960px) {
  .styles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .styles-grid {
    grid-template-columns: 1fr;
  }
}
.style-showcase-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.style-showcase-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.05);
  border-color: var(--ink);
}
.style-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.style-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}
.style-card-role {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.style-card-specimen {
  font-size: 43px;
  line-height: 1.15;
  color: var(--ink);
  margin: 17px 0 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.style-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.style-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--wash);
  border-radius: 4px;
  padding: 2px 8px;
}
.style-use-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.actions-left #downloadPngBtn {
  order: -1;
}

/* Feature Gateway Cards */
.gateways-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 820px) {
  .gateways-grid {
    grid-template-columns: 1fr;
  }
}
.gateway-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.gateway-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}
.gateway-card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 16px;
  width: fit-content;
}
.gateway-card h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
}
.gateway-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 24px;
}
.gateway-preview-visual {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.gateway-visual-letters {
  font-size: 32px;
  color: var(--ink);
  letter-spacing: 4px;
}
.gateway-phrase-preview {
  font-size: 36px;
}
.gateway-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* FAQ Section */
.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 860px;
  border-top: 1px solid var(--line);
}
.faq-item {
  display: grid;
  grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr);
  gap: 34px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.faq-item h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}
.faq-item p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-ink);
  margin: 0;
}

@media (max-width: 640px) {
  .faq-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
  z-index: 100;
}
.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.practice-preview[hidden] { display: none; }
.practice-preview {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .55);
}
.practice-preview-dialog {
  position: relative;
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: #fff;
}
.practice-preview-dialog h2 { max-width: 430px; }
.practice-preview-note {
  max-width: 470px;
  color: var(--muted);
}
.practice-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--wash);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.practice-preview-sample {
  display: grid;
  min-height: 150px;
  margin: 24px 0;
  padding: 26px;
  place-items: center;
  border: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 36px, #e4e4e4 36px 37px);
  font-size: 48px;
  overflow-wrap: anywhere;
  text-align: center;
}
.practice-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.practice-preview-open { overflow: hidden; }
@media (max-width: 520px) {
  .practice-preview-dialog { padding: 28px 20px 20px; }
  .practice-preview-actions { flex-direction: column-reverse; }
  .practice-preview-actions .btn { width: 100%; }
}

/* 16. Print Styles & Multi-page Output */
#printContainer {
  display: none;
}

@media print {
  @page {
    margin: 0;
  }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Hide all screen interface elements */
  header,
  .header,
  footer,
  nav,
  .hero,
  .alphabet-studio,
  .worksheet-workspace,
  .connections-section,
  #alphabet,
  #practice,
  .practice-builder,
  .practice-controls,
  .style-grid,
  .alphabet-pager,
  .toolbar,
  .section,
  .section-head,
  .letter-nav,
  .btn,
  button {
    display: none !important;
  }
  body > main,
  .practice-preview,
  .toast-msg {
    display: none !important;
  }

  /* Show Print Container in natural document flow */
  #printContainer {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  /* Individual Print Page Setup */
  .print-page {
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    overflow: hidden !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-page:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  /* Exact A4 Portrait Dimensions */
  .print-page.portrait {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    padding: 14mm 16mm 12mm 16mm !important;
  }

  /* Exact A4 Landscape Dimensions */
  .print-page.landscape {
    width: 297mm !important;
    height: 210mm !important;
    min-height: 210mm !important;
    max-height: 210mm !important;
    padding: 12mm 16mm 10mm 16mm !important;
  }

  .print-page .sheet-title {
    margin: 0 0 6mm !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #111111 !important;
    letter-spacing: -0.01em !important;
  }

  .print-page .worksheet-rows {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    flex: 1 !important;
    min-height: 0 !important;
    width: 100% !important;
    gap: 2mm !important;
  }

  .print-page .worksheet-rows .row {
    flex: 1 !important;
    max-height: 32mm !important;
    margin: 0 !important;
    display: block !important;
  }

  .print-page .letter-guide {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
  }

  .print-page .guide-outer,
  .print-page .guide-x {
    stroke: #b5b5b5 !important;
    stroke-width: 1px !important;
  }

  .print-page .guide-x {
    stroke-dasharray: 4 4 !important;
  }

  .print-page .guide-base {
    stroke: #444444 !important;
    stroke-width: 1.4px !important;
  }

  .print-page .sheet-text {
    fill: #000000 !important;
  }

  .print-page .sheet-text.sample-trace,
  .print-page .row.trace .sheet-text {
    opacity: 0.22 !important;
    fill: #000000 !important;
  }

  .print-page .row.faint .sheet-text {
    opacity: 0.08 !important;
    fill: #000000 !important;
  }

  .print-page .row.blank .sheet-text {
    display: none !important;
  }

  /* Fallback if a standalone .sheet is printed without #printContainer */
  body:not(:has(#printContainer > .print-page)) .sheet {
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    width: 210mm !important;
    height: 297mm !important;
    padding: 14mm 16mm 12mm 16mm !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
  body:not(:has(#printContainer > .print-page)) .sheet.landscape {
    width: 297mm !important;
    height: 210mm !important;
    padding: 12mm 16mm 10mm 16mm !important;
  }
}
