@font-face {
  font-family: "Malvides";
  src: url("../fonts/Malvides.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Dochet Script";
  src: url("../fonts/dochet-script.regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fff8f5;
  --bg-2: #fef1eb;
  --panel: #faf6ee;
  --text: #201a17;
  --muted: #6e6460;
  --accent: #94452c;
  --accent-2: #b35c41;
  --accent-ink: #fffbff;
  --line: #e3dac9;
  --shadow: 0 8px 28px rgba(67, 59, 56, 0.08);
  --radius: 16px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --display: "Epilogue", "Plus Jakarta Sans", sans-serif;
  --cinnabar: #d97e63;
  --sage: #7a9a85;
  --walnut: #3d2b24;
  --ink: #2c2523;
  --paper: #faf6ee;
  --alabaster: #f5efeb;
  --oatmeal: #efe9dc;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0 auto;
  max-width: 1080px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
}

body {
  padding-top: 64px;
}

img {
  max-width: 100%;
  display: block;
}

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

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 20;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1080px;
  height: 64px;
  padding: 0 2.5rem;
  background: rgba(255, 248, 245, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(67, 59, 56, 0.04);
  transform: translateX(-50%);
}

body.entries-open .site-nav {
  z-index: 1;
}

.brand {
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cinnabar);
}

.brand-tag {
  display: none;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid #e4d8d2;
  color: var(--muted);
  font-family: var(--display);
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 400;
}

.site-nav nav {
  display: none;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(254, 241, 235, 0.7);
}

.site-nav nav a {
  text-decoration: none;
  color: #55433e;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}

.site-nav nav a:hover {
  color: var(--text);
  background: var(--alabaster);
}

.site-nav nav a[aria-current="page"] {
  color: #fffbff;
  background: var(--accent-2);
  box-shadow: 0 2px 10px rgba(200, 109, 81, 0.18);
}

@media (min-width: 1100px) {
  .brand-tag,
  .site-nav nav {
    display: flex;
  }
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.hero {
  --fold: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(100vh - 64px);
  margin: 0;
  padding: 56px 6vw 64px;
  overflow: visible;
  background: var(--bg);
}

.hero-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  max-width: 760px;
  margin-bottom: 28px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 22px 10px 16px;
  border-radius: 999px;
  background: #fffcfa;
  box-shadow: 0 8px 24px rgba(67, 59, 56, 0.06);
  color: #4a403c;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8a090;
  flex-shrink: 0;
}

.hero h1 {
  margin: 0;
  max-width: none;
  font-size: 58px;
  line-height: 1.08;
  font-weight: 600;
  color: var(--ink);
}

.hero h1 span {
  white-space: nowrap;
}

.hero-quote {
  margin: 0;
  max-width: 40rem;
  color: #b35c41;
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
}

.codex-stage {
  --fold: 50%;
  --fold-n: 0.5;
  --stage-pad-x: 48px;
  --stage-pad-t: 48px;
  --stage-pad-b: 56px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(640px, 100%);
  min-height: 280px;
  padding: var(--stage-pad-t) var(--stage-pad-x) var(--stage-pad-b);
  overflow: visible;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  perspective: 1100px;
  perspective-origin: 50% 50%;
}

.codex-stage.is-dragging,
.codex-rig.is-dragging {
  cursor: grabbing;
}

.hero-wash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 124%;
  height: 150%;
  z-index: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  mix-blend-mode: multiply;
}

.hero-wash svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wash-blob {
  transform-box: fill-box;
  transform-origin: center;
  animation: wash-breathe 16s ease-in-out infinite;
}

.wash-blob:nth-of-type(2) {
  animation-duration: 20s;
  animation-delay: -5s;
}

.wash-blob:nth-of-type(3) {
  animation-duration: 18s;
  animation-delay: -9s;
}

@keyframes wash-breathe {
  0%,
  100% {
    opacity: 0.88;
    transform: scale(1) translate(0, 0);
  }
  50% {
    opacity: 1;
    transform: scale(1.06) translate(8px, -6px);
  }
}

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

  .codex-verse-latin {
    clip-path: none;
  }

  .codex-face-cipher {
    display: none;
  }
}

.codex-rig {
  position: relative;
  z-index: 1;
  width: 100%;
  transform-style: preserve-3d;
}

.codex-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow: hidden;
  transform-style: preserve-3d;
  transform-origin: var(--fold) 50%;
  background-color: #f4f1ea;
  background-image: url("../assets/paper-texture.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(210, 196, 180, 0.7);
  box-shadow:
    0 1px 2px rgba(70, 52, 42, 0.04),
    0 6px 12px rgba(70, 52, 42, 0.05),
    0 16px 32px rgba(70, 52, 42, 0.07),
    0 32px 56px rgba(70, 52, 42, 0.08);
  will-change: transform;
  transition: transform 0.4s ease;
}

.codex-stage.is-dragging .codex-sheet {
  transition: none;
}

.codex-sheet::before {
  content: none;
}

.codex-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(48, 32, 24, 0.14) 0%,
    rgba(48, 32, 24, 0.04) calc(var(--fold) - 8%),
    rgba(255, 255, 255, 0.2) var(--fold),
    rgba(48, 32, 24, 0.05) calc(var(--fold) + 8%),
    rgba(48, 32, 24, 0.12) 100%
  );
  mix-blend-mode: multiply;
}

.codex-face-latin {
  position: relative;
  z-index: 1;
  clip-path: inset(0 calc(100% - var(--fold)) 0 0);
}

.codex-face-cipher {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  clip-path: inset(0 0 0 var(--fold));
}

.codex-type {
  position: relative;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
}

.codex-cipher {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("../assets/asemic-cipher.png");
  background-repeat: no-repeat;
  background-size: 118% 118%;
  background-position: center;
  mix-blend-mode: multiply;
  filter: contrast(1.12);
}

.codex-page {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  padding: 36px 40px;
}

.codex-verse {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  color: var(--ink);
  font-family: "Malvides", var(--display);
  font-size: 28px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.28;
  letter-spacing: 0.02em;
  text-align: center;
}

.codex-verse span {
  display: block;
  white-space: nowrap;
}

.codex-verse-sizer {
  visibility: hidden;
}

.codex-aside {
  margin: 0;
  max-width: 28rem;
  color: #6e6460;
  font-family: var(--display);
  font-size: 16px;
  font-style: italic;
  line-height: 1.5;
  text-align: center;
}

.codex-caption {
  margin: 8px 0 0;
  color: #9a8d84;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-scan {
  position: absolute;
  top: calc(var(--stage-pad-t) - 16px);
  bottom: calc(var(--stage-pad-b) - 16px);
  left: calc(var(--stage-pad-x) + (100% - 2 * var(--stage-pad-x)) * var(--fold-n));
  z-index: 20;
  width: 16px;
  background: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.hero-scan-stroke {
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 100%;
  transform: translateX(-50%);
  object-fit: fill;
  object-position: center;
  image-rendering: auto;
}

.codex-hint {
  position: absolute;
  left: calc(var(--stage-pad-x) + (100% - 2 * var(--stage-pad-x)) * var(--fold-n));
  bottom: 10px;
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  transform: translateX(-50%);
  color: #b35c41;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: hint-breathe 2.4s ease-in-out infinite;
}

.codex-hint span {
  font-size: 11px;
  letter-spacing: 0;
  opacity: 0.7;
}

.codex-stage.is-dragging .codex-hint,
.codex-stage.has-revealed .codex-hint {
  opacity: 0;
  animation: none;
}

@keyframes hint-breathe {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .codex-hint {
    animation: none;
    opacity: 0.8;
  }
}

.hero-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.lede,
.process-intro p,
.page-head p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero .hero-actions {
  justify-content: center;
  margin-top: 28px;
}

.panel .row-actions {
  margin-top: 14px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  background: transparent;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  border: 1px solid #c4b09d;
  color: var(--walnut);
  background: #fff;
  box-shadow: 0 1px 0 rgba(67, 59, 56, 0.05);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: var(--accent);
  background: #fff8f5;
}

.process {
  padding: 48px 2.5rem 72px;
  background: var(--paper);
}

.process-intro,
.page-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px 48px;
  align-items: center;
  margin-bottom: 28px;
}

.page-head-stack {
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  justify-items: start;
}

.process h2,
.page-head h1 {
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  margin: 0;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.steps li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.step-index {
  display: block;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  color: rgba(148, 69, 44, 0.4);
  margin-bottom: 8px;
}

.steps h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

.process-foot {
  margin-top: 28px;
}

.page {
  padding: 32px 2.5rem 72px;
}

.page-head {
  max-width: none;
}

.ref-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.ref-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 1px 8px rgba(67, 59, 56, 0.05);
  text-align: left;
  cursor: pointer;
}

.ref-card:hover {
  background: #faf3ea;
}

.ref-card.selected {
  border-color: var(--accent);
  background: rgba(148, 69, 44, 0.08);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ref-card-tag {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--alabaster);
  color: var(--walnut);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ref-card.selected .ref-card-tag {
  background: var(--accent);
  color: var(--accent-ink);
}

.ref-card-letters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ref-letter-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--paper);
}

.ref-glyph {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: brightness(0);
}

.ref-glyph-text {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  color: #111;
  font-size: 1.2rem;
  line-height: 1;
}

.ref-actions {
  margin-top: 20px;
  justify-content: space-between;
}

.make-split {
  display: grid;
  gap: 24px;
  max-width: 720px;
}

.make-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.asemic-guide {
  display: grid;
  gap: 12px;
}

.asemic-guide h2 {
  margin: 2rem 0 0;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  color: var(--text);
}

.asemic-guide h2:first-child {
  margin-top: 0;
}

.asemic-guide p,
.asemic-guide li {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.asemic-guide .guide-lead {
  color: var(--text);
  font-size: 1.12rem;
  line-height: 1.45;
}

.asemic-guide .guide-aside {
  margin-bottom: 8px;
  color: var(--accent-2);
  font-size: 1.02rem;
}

.asemic-guide ul {
  margin: 0;
  padding-left: 1.15em;
  display: grid;
  gap: 8px;
}

.asemic-guide .guide-close {
  color: var(--text);
}

.guide-examples {
  margin: 4px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.example-thumb {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4efe6;
  cursor: zoom-in;
  overflow: hidden;
}

.example-thumb:focus-visible {
  outline: 2px solid rgba(148, 69, 44, 0.7);
  outline-offset: 2px;
}

.guide-examples img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.upload-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.upload-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(7, 32, 42, 0.84);
  cursor: pointer;
}

.lightbox-frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  max-width: min(920px, 100%);
}

.lightbox-figure {
  margin: 0;
}

.lightbox-figure img {
  display: block;
  max-width: min(78vw, 820px);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e1820;
}

.lightbox-caption {
  margin-top: 10px;
  color: var(--accent-2);
  font-size: 0.88rem;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
}

.lightbox-close {
  position: absolute;
  top: -8px;
  right: 44px;
  padding: 6px 12px;
  font-size: 0.88rem;
}

.lightbox-nav {
  width: 40px;
  height: 40px;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid rgba(148, 69, 44, 0.7);
  outline-offset: 2px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 8px;
}

.choice-card {
  display: grid;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.choice-card:hover {
  border-color: var(--accent);
}

.choice-kicker {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 600;
}

.choice-card h2 {
  margin: 0;
  font-size: 1.45rem;
}

.choice-card p {
  margin: 0;
  color: var(--muted);
}

.choice-card .choice-note {
  color: var(--accent-2);
  font-size: 0.88rem;
}

.choice-cta {
  margin-top: 8px;
  color: var(--accent-2);
  font-weight: 600;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.howto {
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.howto li {
  margin-bottom: 8px;
}

.draw-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
  margin-bottom: 16px;
}

.alphabet-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.2fr);
  gap: 18px;
}

.journal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.journal-head {
  display: flex;
  justify-content: flex-end;
  align-items: start;
}

.entries-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.entries-drawer.open {
  pointer-events: auto;
}

.entries-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(6, 14, 20, 0.55);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.22s ease;
}

.entries-drawer.open .entries-backdrop {
  opacity: 1;
}

.entry-list-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 92vw);
  margin: 0;
  border-radius: 0;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  overflow: auto;
  box-shadow: var(--shadow);
}

.entries-drawer.open .entry-list-panel {
  transform: translateX(0);
}

.entry-drawer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.hint,
.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  min-height: 1.2em;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 132px;
  border: 1px dashed rgba(148, 69, 44, 0.35);
  border-radius: 12px;
  background: rgba(148, 69, 44, 0.08);
  cursor: pointer;
  text-align: center;
  padding: 18px;
}

.dropzone.dragover {
  border-color: var(--accent);
  border-color: var(--accent);
  background: rgba(148, 69, 44, 0.14);
}

.dropzone span {
  color: var(--muted);
  font-size: 0.88rem;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.draw-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.pen-tools,
.draw-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pen-btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text);
  cursor: pointer;
}

.pen-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: #ffdbd0;
  color: var(--accent);
}

.draw-page {
  width: 100%;
  background-color: #f3eee3;
  background-image:
    linear-gradient(rgba(120, 130, 140, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 130, 140, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid rgba(16, 34, 44, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

#draw-canvas {
  display: block;
  width: 100%;
  height: min(68vh, 720px);
  background: transparent;
  cursor: crosshair;
  touch-action: none;
}

.draw-tips summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-2);
}

.draw-tips ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.draw-tips li {
  margin-bottom: 10px;
}

.draw-tips li:last-child {
  margin-bottom: 0;
}

.hoard,
.letter-slots {
  display: grid;
  gap: 10px;
}

.hoard {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  min-height: 180px;
}

.letter-slots {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}

.glyph-card,
.slot {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  min-height: 92px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.glyph-card {
  cursor: pointer;
  aspect-ratio: 1;
}

.glyph-card.selected {
  outline: 2px solid var(--accent);
}

.glyph-card img,
.slot img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.slot {
  min-height: 110px;
  cursor: pointer;
}

.slot.filled {
  border-color: var(--cinnabar);
}

.slot-key {
  position: absolute;
  left: 8px;
  top: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.upload-only {
  max-width: 640px;
}

.slots-panel {
  margin-top: 0;
}

.seal-row {
  margin-top: 8px;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  background: var(--panel);
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.entry-list button {
  width: 100%;
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
}

.entry-list button.active {
  border-color: var(--accent);
}

.entry-list small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field > span {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input:not(.glyph-composer-src),
.field textarea:not(.glyph-composer-src) {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
}

.field input:not(.glyph-composer-src):focus,
.field textarea:not(.glyph-composer-src):focus,
.pen-btn:focus-visible {
  outline: 2px solid rgba(148, 69, 44, 0.45);
  outline-offset: 1px;
}

.field textarea:not(.glyph-composer-src) {
  font-size: 1.02rem;
  line-height: 1.55;
}

.glyph-composer {
  position: relative;
  min-height: 280px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.glyph-composer-title {
  min-height: 64px;
}

.glyph-composer-title .glyph-composer-face {
  min-height: 64px;
  padding: 10px 14px;
}

.glyph-composer:focus-within {
  outline: 2px solid rgba(148, 69, 44, 0.4);
  outline-offset: 1px;
}

.glyph-composer-src {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

.journal-layout.is-latin .glyph-composer-face {
  display: none;
}

.journal-layout.is-latin .glyph-composer-src {
  position: static;
  width: 100%;
  height: 100%;
  min-height: inherit;
  opacity: 1;
  overflow: auto;
  pointer-events: auto;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  padding: 14px 16px;
  resize: none;
}

.journal-layout.is-latin .glyph-composer-title .glyph-composer-src {
  min-height: 64px;
  padding: 10px 14px;
}

.btn-ghost[aria-pressed="true"] {
  border-color: var(--accent-2);
  color: var(--accent);
  background: #fff8f5;
}

.glyph-composer-face {
  min-height: 280px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 2px 1px;
  cursor: text;
}

.glyph-composer-face .word {
  display: inline-flex;
  flex-wrap: wrap;
  margin-right: 14px;
  margin-bottom: 8px;
}

.glyph-composer-face .break {
  flex-basis: 100%;
  height: 10px;
}

.glyph-composer-face .glyph {
  width: 34px;
  height: 44px;
  display: grid;
  place-items: center;
}

.glyph-composer-face .glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.glyph-space {
  width: 16px;
  height: 36px;
}

.glyph-caret {
  width: 2px;
  height: 34px;
  margin: 0 1px;
  background: var(--accent);
  border-radius: 1px;
  animation: glyph-caret 1s step-end infinite;
}

@keyframes glyph-caret {
  50% {
    opacity: 0;
  }
}

.composer-placeholder {
  margin: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pillars {
  padding: 48px 2.5rem 64px;
  background: var(--paper);
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-kicker-sage {
  color: var(--sage);
}

.pillars h2 {
  margin: 0 0 28px;
  max-width: 28rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

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

.pillar-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border-radius: 20px;
  background: var(--alabaster);
  box-shadow: 0 1px 8px rgba(67, 59, 56, 0.05);
}

.pillar-card-alt {
  background: var(--oatmeal);
}

.pillar-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--paper);
  color: var(--accent);
  font-size: 26px;
}

.pillar-index {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pillar-card h3 {
  margin: 0;
}

.pillar-card p {
  margin: 0;
  color: #433b38;
}

.process-intro-center {
  grid-template-columns: 1fr;
  text-align: center;
  justify-items: center;
}

.process-foot-center {
  margin-top: 40px;
  text-align: center;
}

.process-foot-center h3 {
  margin: 0 0 16px;
}

.cipher-demo {
  margin-top: 36px;
  padding: 24px;
  border-radius: 20px;
  background: #fef1eb;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: center;
}

.cipher-demo h3 {
  margin: 0 0 8px;
}

.cipher-demo p {
  margin: 0;
  color: #433b38;
}

.cipher-demo-fields {
  display: grid;
  gap: 10px;
}

.cipher-demo input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--paper);
  box-shadow: 0 1px 6px rgba(67, 59, 56, 0.06);
}

.cipher-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(250, 246, 238, 0.9);
}

.cipher-ribbon > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#asemic-output-ribbon {
  display: block;
  min-width: 0;
  text-align: right;
  color: var(--accent);
  font-family: "Dochet Script", var(--display);
  font-size: 1.45rem;
  font-style: normal;
  line-height: 1.35;
  letter-spacing: 0.02em;
  word-break: break-word;
}

#asemic-output-ribbon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

#asemic-output-ribbon.is-mapped {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.cipher-space {
  width: 10px;
}

.atelier-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.atelier-path .material-symbols-outlined {
  font-size: 18px;
  color: var(--accent);
}

.atelier-flow {
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  font-family: var(--display);
  font-style: italic;
}

.path-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #f8ebe5;
}

.path-chip {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

.path-chip.is-current {
  background: var(--accent);
  color: var(--accent-ink);
}

.ref-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.ref-seed-count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--alabaster);
  color: var(--muted);
  font-size: 0.85rem;
}

.ref-seed-count strong {
  color: var(--accent);
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-btn .material-symbols-outlined {
  font-size: 18px;
}

.studio-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 0.8rem;
  color: var(--muted);
}

.step-now {
  color: var(--ink);
  font-weight: 600;
}

.step-next {
  color: var(--accent);
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.memory-layout.key-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.memory-layout > .panel {
  height: 100%;
}

.match-key {
  min-height: 100%;
}

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

.match-key-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-key .match-latin {
  cursor: default;
}

.fluency-card {
  min-width: 240px;
  padding: 14px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 1px 8px rgba(67, 59, 56, 0.05);
}

.fluency-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.fluency-bar {
  margin: 10px 0 6px;
  height: 8px;
  border-radius: 999px;
  background: #f3e6e0;
  overflow: hidden;
}

#fluency-fill {
  height: 100%;
  width: 0;
  background: var(--accent-2);
  border-radius: inherit;
}

.workshop-head .fluency-card {
  max-width: 320px;
  margin-top: 8px;
}

.match-board {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: 140px;
  justify-content: start;
  align-items: start;
  margin: 20px 0;
}

.match-target-pair {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: 6px;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.match-slot.is-over {
  border-color: var(--accent);
  background: rgba(148, 69, 44, 0.1);
}

.match-tile,
.match-slot {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.match-latin {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: grab;
}

.match-latin.is-dragging {
  opacity: 0.4;
}

.match-slot {
  border-style: dashed;
  color: var(--text);
  font-family: var(--display);
  font-weight: 600;
}

.match-slot.is-filled {
  border-style: solid;
  background: rgba(148, 69, 44, 0.08);
}

.match-glyph img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: brightness(0);
}

.draw-prompt {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.draw-prompt strong {
  font-size: 1.8rem;
}

.recall-word {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 80px;
  margin: 8px 0 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--paper);
}

.recall-word img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: brightness(0);
}

.flashcard {
  width: 100%;
  min-height: 260px;
  border: 0;
  border-radius: 16px;
  background: #fdfbf7;
  cursor: pointer;
  box-shadow: 0 1px 8px rgba(67, 59, 56, 0.05);
  padding: 28px 20px;
}

.flash-latin {
  display: block;
  font-family: var(--display);
  font-size: 3.4rem;
  font-weight: 600;
  color: var(--ink);
}

.flash-hint {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

#card-glyph {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  object-fit: contain;
}

.memory-roster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.roster-tile {
  position: relative;
  min-height: 64px;
  border: 0;
  border-radius: 10px;
  background: var(--alabaster);
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.roster-tile span {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.roster-tile img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.roster-tile.is-current {
  background: #ffdbd0;
  outline: 2px solid var(--accent);
}

.roster-tile.is-empty {
  opacity: 0.45;
  cursor: not-allowed;
}

.roster-tile.is-mastered span {
  color: var(--sage);
}

.trace-wrap {
  position: relative;
  height: 200px;
  border-radius: 14px;
  background: #fdfbf7;
  overflow: hidden;
}

#strokeCanvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.ghost-guide {
  position: absolute;
  inset: 20%;
  width: 60%;
  height: 60%;
  object-fit: contain;
  opacity: 0.18;
  pointer-events: none;
}

.blindfold-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.blindfold-label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.88rem;
}

.journal-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 2.5rem 40px;
  background: var(--paper);
  box-shadow: 0 -1px 12px rgba(67, 59, 56, 0.03);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.footer-brand strong {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 500;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

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

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

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

@media (max-width: 900px) {
  .guide-examples {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .process-intro,
  .page-head,
  .steps,
  .make-split,
  .choice-grid,
  .alphabet-layout,
  .journal-layout,
  .memory-layout,
  .pillar-grid,
  .cipher-demo,
  .draw-layout {
    grid-template-columns: 1fr;
  }

  .site-nav,
  .process,
  .pillars,
  .page,
  .site-footer {
    padding-left: 5vw;
    padding-right: 5vw;
  }

  .hero h1 {
    font-size: 38px;
    max-width: none;
  }

  .codex-stage {
    --stage-pad-x: 20px;
    --stage-pad-t: 36px;
    --stage-pad-b: 44px;
    min-height: 240px;
    padding: var(--stage-pad-t) var(--stage-pad-x) var(--stage-pad-b);
  }

  .codex-page {
    padding: 28px 20px;
  }

  .codex-verse {
    font-size: 22px;
  }

  .memory-roster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .match-board {
    column-gap: 48px;
  }

  .match-key-list {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  }
}
