@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;700;800&family=Comic+Neue:wght@700&family=Libre+Baskerville:wght@400;700&family=Share+Tech+Mono&display=swap");

:root {
  color-scheme: light;
  --ink: #29241e;
  --muted: #6e675f;
  --paper: #fffaf1;
  --page: #ebe4d7;
  --line: #cfc3ae;
  --accent: #82311e;
  --accent-strong: #682918;
  --ok: #2f6454;
  --shadow: 0 18px 50px rgba(72, 55, 34, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(41, 36, 30, 0.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, rgba(41, 36, 30, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--page);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--ink);
  color: #fffaf1;
  padding: 10px 14px;
  font-weight: 850;
  text-decoration: none;
}

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

.app-loading .app-shell {
  visibility: hidden;
}

.info-page {
  width: min(100% - 28px, 920px);
  margin: 0 auto;
  padding: 26px 0 56px;
}

.compact-info-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: clamp(34px, 8vw, 72px);
}

.site-nav a,
.text-action,
.example-card a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 850;
  text-decoration: none;
}

.text-action,
.example-card a {
  width: fit-content;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fffaf1;
}

.info-hero {
  display: grid;
  gap: 16px;
  margin-bottom: clamp(34px, 7vw, 62px);
}

.info-hero .brand-wordmark {
  width: min(100%, 320px);
}

.info-hero h1 {
  max-width: 15ch;
  font-size: clamp(2.15rem, 8vw, 4.7rem);
}

.info-hero p,
.info-section p,
.example-card p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.16rem);
  line-height: 1.62;
}

.info-section {
  display: grid;
  gap: 12px;
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid rgba(41, 36, 30, 0.16);
}

.info-section h2,
.example-card h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 4vw, 2.3rem);
  line-height: 1.05;
}

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

.example-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.82);
  padding: clamp(18px, 4vw, 28px);
  box-shadow: 0 12px 34px rgba(72, 55, 34, 0.1);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100% - 24px, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 18px 0 28px;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.entry-mode .workspace {
  display: none;
}

.create-mode #create-own {
  display: none;
}

.intro {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.brand-wordmark {
  width: min(100%, 360px);
  height: auto;
  display: block;
}

.eyebrow,
.dictionary-label,
.style-label,
.example-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 16ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 6vw, 2.45rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.definition-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 245, 0.9);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

select:focus-visible,
input:focus-visible,
button:focus-visible,
a:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(130, 49, 30, 0.13);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.option-picker,
.style-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.option-picker legend,
.style-picker legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.option-grid,
.style-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.option-button,
.style-option,
.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
}

.option-button,
.style-option {
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.78);
  color: var(--ink);
}

.option-button[aria-checked="true"],
.style-option[aria-checked="true"] {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fffaf1;
}

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

.secondary-action {
  border: 1px solid var(--line);
  background: #fffaf1;
  color: var(--ink);
  padding: 0 14px;
}

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

.form-error,
.share-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 750;
}

.result-panel {
  display: grid;
  gap: 14px;
  justify-items: center;
  min-width: 0;
}

.entry-mode .result-panel {
  min-height: 100vh;
  align-content: center;
  padding: 72px 0 26px;
}

.definition-card {
  width: min(100%, 620px);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  gap: clamp(12px, 3.3vw, 20px);
  padding: clamp(24px, 6vw, 52px);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.definition-card.sweet {
  border-color: #d4aaad;
  background: #fff5f2;
}

.definition-card.visual-classic {
  --paper: #fffaf1;
  --line: #cfc3ae;
  --accent: #82311e;
  --ink: #29241e;
  --muted: #6e675f;
}

.definition-card.visual-cyber {
  --paper: #050b07;
  --line: #38ff88;
  --accent: #38ff88;
  --ink: #b8ffd4;
  --muted: #63bf85;
  font-family: "Share Tech Mono", "Courier New", monospace;
  text-shadow: 0 0 12px rgba(56, 255, 136, 0.24);
}

.definition-card.visual-fun {
  --paper: #fff3b8;
  --line: #f26b38;
  --accent: #d93f87;
  --ink: #24211e;
  --muted: #6e4d38;
  font-family: "Comic Neue", "Comic Sans MS", cursive;
}

.definition-card.visual-bold {
  --paper: #f7f0ff;
  --line: #6844ff;
  --accent: #ff4d6d;
  --ink: #1d1833;
  --muted: #5d5477;
  font-family: "Bricolage Grotesque", Arial, sans-serif;
}

.definition-card.visual-noir {
  --paper: #efeee8;
  --line: #171717;
  --accent: #171717;
  --ink: #171717;
  --muted: #59564f;
  font-family: "Libre Baskerville", Georgia, serif;
}

.definition-card.visual-glow {
  --paper: #07151f;
  --line: #6de7ff;
  --accent: #ffd166;
  --ink: #e8fbff;
  --muted: #8acadd;
  font-family: "Bricolage Grotesque", Arial, sans-serif;
  text-shadow: 0 0 14px rgba(109, 231, 255, 0.18);
}

.definition-card.visual-retro {
  --paper: #ffe3ad;
  --line: #1e6f68;
  --accent: #d6422b;
  --ink: #253238;
  --muted: #735631;
  font-family: "Bricolage Grotesque", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(214, 66, 43, 0.18) 0 12%, transparent 12% 28%, rgba(30, 111, 104, 0.16) 28% 42%, transparent 42%),
    radial-gradient(circle at 82% 12%, rgba(255, 190, 79, 0.38), transparent 30%),
    var(--paper);
  box-shadow: 9px 9px 0 #1e6f68;
}

.definition-card.visual-zine {
  --paper: #fbfbf2;
  --line: #222222;
  --accent: #ff2f7d;
  --ink: #151515;
  --muted: #555555;
  font-family: "Libre Baskerville", Georgia, serif;
  border-style: dashed;
  background:
    repeating-linear-gradient(-2deg, rgba(21, 21, 21, 0.035) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, rgba(255, 47, 125, 0.12) 0 18px, transparent 18px),
    var(--paper);
  box-shadow: 7px 7px 0 rgba(21, 21, 21, 0.92);
}

.definition-card.funny {
  border-color: #d0ba67;
  background: #fff8dc;
}

.definition-card.dramatic {
  border-color: #a9b5c8;
  background: #f4f7fb;
}

.card-masthead {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  border-bottom: 1px solid rgba(41, 36, 30, 0.35);
  padding-bottom: 12px;
}

.style-label {
  display: none;
  text-align: right;
}

.definition-card h2 {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 17vw, 6.5rem);
  line-height: 1.04;
  padding-bottom: 0.08em;
}

.word-rule {
  width: 100%;
  height: clamp(3px, 0.8vw, 5px);
  margin: clamp(-10px, -1.5vw, -4px) 0 clamp(2px, 0.8vw, 8px);
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.85;
  transform-origin: left center;
}

.visual-cyber h2,
.visual-cyber .phonetic-line,
.visual-cyber blockquote {
  font-family: "Share Tech Mono", "Courier New", monospace;
}

.visual-fun h2,
.visual-fun .phonetic-line,
.visual-fun blockquote {
  font-family: "Comic Neue", "Comic Sans MS", cursive;
}

.visual-bold h2,
.visual-bold .phonetic-line,
.visual-bold blockquote {
  font-family: "Bricolage Grotesque", Arial, sans-serif;
}

.visual-noir h2,
.visual-noir .phonetic-line,
.visual-noir blockquote {
  font-family: "Libre Baskerville", Georgia, serif;
}

.visual-glow h2 {
  font-family: "Share Tech Mono", "Courier New", monospace;
}

.visual-glow .phonetic-line,
.visual-glow blockquote,
.visual-retro h2,
.visual-retro .phonetic-line,
.visual-retro blockquote {
  font-family: "Bricolage Grotesque", Arial, sans-serif;
}

.visual-retro h2 {
  text-transform: uppercase;
}

.visual-retro .card-masthead {
  border-bottom-width: 3px;
}

.visual-zine .card-masthead {
  border-bottom-style: dashed;
}

.visual-zine h2 {
  transform: rotate(-1deg);
  transform-origin: left center;
}

.visual-zine h2,
.visual-zine .phonetic-line,
.visual-zine blockquote {
  font-family: "Libre Baskerville", Georgia, serif;
}

.typing-cursor {
  display: inline-block;
  width: 0.12em;
  height: 0.8em;
  margin-left: 0.08em;
  transform: translateY(0.08em);
  background: var(--accent);
  vertical-align: baseline;
}

.phonetic-line {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 4.8vw, 1.42rem);
  line-height: 1.2;
}

.phonetic-line span + span::before {
  content: "  ";
  white-space: pre;
}

.definition-card ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
  font-size: clamp(1.02rem, 4.3vw, 1.25rem);
  line-height: 1.35;
}

.example-label {
  align-self: end;
}

blockquote {
  margin: 0;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 4.8vw, 1.45rem);
  line-height: 1.32;
}

.sweet blockquote {
  border-color: #a94764;
}

.funny blockquote {
  border-color: #8a691f;
}

.dramatic blockquote {
  border-color: #315e81;
}

.share-controls {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.entry-mode .share-controls {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 2;
  width: min(100% - 24px, 680px);
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(207, 195, 174, 0.85);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: 0 10px 28px rgba(72, 55, 34, 0.12);
  backdrop-filter: blur(8px);
}

.entry-mode.animating-entry .share-controls {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px);
}

.share-status {
  grid-column: 1 / -1;
  color: var(--ok);
  min-height: 0;
  padding: 0 4px;
}

.share-status:empty {
  display: none;
}

.action-links,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.action-links {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.site-footer {
  grid-column: 1 / -1;
  padding: 4px 0 0;
}

.create-mode .action-links {
  display: none;
}

.create-mode .site-footer {
  display: flex;
}

.entry-mode .site-footer {
  display: none;
}

.action-links a,
.site-footer a {
  color: inherit;
  text-decoration: none;
}

.action-links a:hover,
.action-links a:focus-visible,
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.export-progress {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(41, 36, 30, 0.12);
}

.export-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.12s linear;
}

@media (min-width: 760px) {
  .app-shell {
    grid-template-columns: minmax(300px, 420px) minmax(360px, 1fr);
    align-items: center;
    column-gap: clamp(28px, 6vw, 76px);
    padding: 32px 0;
  }

  .entry-mode .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
  }

  .create-mode .workspace {
    align-self: center;
    max-width: 420px;
    overflow: hidden;
  }

  .create-mode .result-panel {
    align-self: center;
    justify-self: stretch;
    max-width: 680px;
  }

  .create-mode .result-panel[hidden] {
    display: none;
  }

  .create-mode .definition-card {
    width: min(100%, 620px);
    max-height: calc(100vh - 180px);
  }

  .create-mode h1 {
    max-width: 13ch;
    font-size: clamp(1.65rem, 2.8vw, 2.25rem);
  }

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

  .share-status {
    text-align: center;
  }
}

@media (min-width: 980px) {
  .entry-mode .definition-card {
    width: min(62vw, 720px);
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 420px);
    gap: 12px;
    padding-top: 10px;
  }

  .workspace {
    gap: 12px;
  }

  .intro {
    gap: 4px;
  }

  h1 {
    max-width: 17ch;
    font-size: clamp(1.35rem, 6.4vw, 1.85rem);
    line-height: 1;
  }

  .definition-form {
    gap: 9px;
  }

  .field {
    gap: 5px;
  }

  select,
  input {
    min-height: 42px;
    padding: 0 12px;
  }

  .option-picker legend,
  .style-picker legend {
    margin-bottom: 6px;
  }

  .option-grid,
  .style-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .option-button,
  .style-option,
  .primary-action,
  .secondary-action {
    min-height: 34px;
    padding-inline: 6px;
    font-size: 0.84rem;
  }

  .entry-mode .result-panel {
    min-height: auto;
    padding-top: 16px;
    padding-bottom: 156px;
  }

  .entry-mode .share-controls {
    top: auto;
    bottom: 12px;
    grid-template-columns: 1fr 1fr;
  }

  .entry-mode.animating-entry .share-controls {
    transform: translate(-50%, 18px);
  }

  .definition-card {
    gap: 9px;
    padding: 16px 18px;
  }

  .card-masthead {
    padding-bottom: 8px;
  }

  .definition-card h2 {
    font-size: clamp(2.45rem, 13vw, 3.5rem);
  }

  .word-rule {
    height: 3px;
    margin: -6px 0 2px;
  }

  .phonetic-line {
    font-size: 0.98rem;
  }

  .definition-card ol {
    gap: 7px;
    padding-left: 20px;
    font-size: 0.96rem;
    line-height: 1.28;
  }

  blockquote {
    padding-left: 10px;
    font-size: 0.98rem;
    line-height: 1.26;
  }

  .info-page {
    width: min(100% - 20px, 420px);
    padding-top: 16px;
  }

  .site-nav {
    justify-content: flex-start;
    margin-bottom: 36px;
  }

  .info-hero {
    gap: 12px;
  }

  .info-hero h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .example-grid {
    grid-template-columns: 1fr;
  }

  .example-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
