:root {
  --ink: #1d2138;
  --muted: #656578;
  --paper: #fffaf1;
  --sand: #f6e7cc;
  --sand-2: #edd1a0;
  --violet: #4b3f72;
  --violet-dark: #31274e;
  --coral: #df6c56;
  --gold: #d8a84e;
  --mint: #b9d8c2;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(64, 45, 36, 0.12);
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 13px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(223, 108, 86, 0.12), transparent 25rem),
    var(--paper);
  font-family: Tahoma, Arial, "Noto Sans Arabic", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='5' cy='5' r='.7' fill='%23c9a36b'/%3E%3C/svg%3E");
  z-index: -1;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--white);
  background: var(--violet-dark);
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}

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

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 16px 12px 12px;
  border: 1px solid rgba(75, 63, 114, 0.11);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.88);
  box-shadow: 0 8px 30px rgba(49, 39, 78, 0.07);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  color: var(--violet-dark);
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 42% 58%;
  color: var(--white);
  background: var(--coral);
  transform: rotate(-7deg);
}

.brand-mark svg {
  width: 25px;
  transform: rotate(7deg);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--violet-dark);
  background: var(--sand);
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.hero {
  width: min(1180px, calc(100% - 32px));
  min-height: 620px;
  margin: 20px auto 0;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  align-items: center;
  gap: 40px;
  padding: clamp(44px, 7vw, 86px);
  overflow: hidden;
  position: relative;
  border-radius: 48px;
  color: var(--white);
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.14), transparent 20rem),
    radial-gradient(circle at 88% 16%, rgba(248,201,120,.13), transparent 18rem),
    linear-gradient(135deg, #514477 0%, #2d2448 78%);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -43% -8%;
  height: 65%;
  border-radius: 50% 50% 0 0;
  background: #d5a85f;
  opacity: 0.18;
  transform: rotate(-3deg);
}

.hero-copy,
.hero-art {
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hero .eyebrow {
  color: #f7c8ac;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 2px;
  background: currentColor;
}

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

h1,
h2,
h3 {
  line-height: 1.35;
  color: var(--violet-dark);
}

.hero h1 {
  max-width: 700px;
  margin-bottom: 20px;
  color: var(--white);
  font-size: clamp(2.65rem, 6vw, 5.25rem);
  letter-spacing: -0.04em;
}

.hero h1 span {
  color: #f6bb75;
}

.hero-lead {
  max-width: 650px;
  margin-bottom: 28px;
  color: rgba(255,255,255,.8);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-name-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 17px;
}

.hero-name-ribbon span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  color: rgba(255,255,255,.76);
  background: rgba(255,255,255,.07);
  font-size: .78rem;
}

.hero-name-ribbon b {
  font-size: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--violet-dark);
  background: #f8c978;
  box-shadow: 0 12px 26px rgba(9, 5, 26, 0.2);
}

.button-secondary {
  color: var(--white);
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.18);
}

.hero-note {
  margin: 16px 2px 0;
  color: rgba(255,255,255,.62);
  font-size: 0.82rem;
}

.theme-entry {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 26px;
  margin-top: -42px;
  padding: 28px 32px;
  border: 1px solid rgba(74, 50, 105, .13);
  border-radius: 28px;
  background: linear-gradient(115deg, #fffaf1 0%, #fff4df 58%, #f6e4ff 100%);
  box-shadow: 0 22px 55px rgba(53, 35, 79, .16);
}

.theme-entry-copy h2 {
  margin: 5px 0 7px;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
}

.theme-entry-copy p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.theme-entry-kicker {
  color: var(--coral);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.theme-entry-pets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 132px;
}

.theme-entry-pets span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.75);
  box-shadow: 0 5px 12px rgba(56, 37, 80, .09);
  font-size: 1rem;
}

.theme-entry-button {
  min-width: 190px;
  color: var(--white);
  background: var(--violet);
  box-shadow: 0 12px 24px rgba(75, 51, 105, .22);
}

.hero-art {
  min-height: 390px;
  display: grid;
  place-items: center;
}

.moon {
  position: absolute;
  width: min(30vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f8c978;
  box-shadow: 0 0 0 30px rgba(248,201,120,.07), 0 0 90px rgba(248,201,120,.16);
}

.hero-animals {
  width: 115%;
  position: relative;
  transform: translateY(32px);
  filter: drop-shadow(0 25px 25px rgba(17,12,34,.3));
}

.hero-name-card {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 168px;
  padding: 10px 13px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 18px;
  color: var(--violet-dark);
  background: rgba(255,250,241,.94);
  box-shadow: 0 16px 35px rgba(16,10,36,.24);
  backdrop-filter: blur(8px);
}

.hero-name-card small,
.hero-name-card strong {
  display: block;
  line-height: 1.35;
}

.hero-name-card small {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: .66rem;
}

.hero-name-card strong {
  font-size: .92rem;
}

.hero-pet-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #f5dfbd;
  font-size: 1.45rem;
}

.card-cat {
  top: 5%;
  right: -2%;
  transform: rotate(4deg);
}

.card-dog {
  bottom: 2%;
  left: -3%;
  transform: rotate(-4deg);
}

.story-token {
  position: absolute;
  z-index: 4;
  left: 1%;
  top: 25%;
  padding: 7px 12px;
  border-radius: 999px;
  color: #f7d698;
  background: rgba(33,27,56,.75);
  border: 1px solid rgba(248,201,120,.3);
  box-shadow: 0 10px 24px rgba(16,10,36,.2);
  font-size: .75rem;
}

.story-token span {
  margin-left: 5px;
  color: var(--white);
  font-size: 1.1rem;
}

.section {
  padding: 105px 0;
}

.section-tight {
  padding: 70px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 36px;
}

.section-heading h2 {
  max-width: 640px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: -0.03em;
}

.section-heading p:last-child {
  max-width: 480px;
  margin-bottom: 2px;
  color: var(--muted);
}

.generator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  align-items: stretch;
  border: 1px solid rgba(75, 63, 114, 0.12);
  border-radius: 36px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}

.generator-controls {
  padding: clamp(26px, 4vw, 48px);
}

fieldset {
  min-width: 0;
  margin: 0 0 28px;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  margin-bottom: 14px;
  color: var(--violet-dark);
  font-weight: 800;
  font-size: 1rem;
}

.animal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.animal-option,
.mood-option {
  position: relative;
}

.animal-option input,
.mood-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.animal-option label {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid #e8e1d5;
  border-radius: 18px;
  background: #fffdf9;
  color: var(--muted);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.animal-option label:hover {
  transform: translateY(-2px);
  border-color: var(--sand-2);
}

.animal-icon {
  font-size: 1.65rem;
  line-height: 1.2;
}

.animal-option input:checked + label {
  border-color: var(--coral);
  color: var(--violet-dark);
  background: #fff1e9;
  box-shadow: inset 0 0 0 1px var(--coral);
}

.animal-option input:focus-visible + label,
.mood-option input:focus-visible + label {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.mood-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.mood-option label {
  display: block;
  padding: 9px 15px;
  border: 1px solid #e4dcd0;
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  cursor: pointer;
}

.mood-option input:checked + label {
  color: var(--white);
  border-color: var(--violet);
  background: var(--violet);
}

.generate-button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 17px;
  color: var(--white);
  background: var(--coral);
  box-shadow: 0 12px 28px rgba(223,108,86,.24);
  font-size: 1.02rem;
  font-weight: 800;
  transition: transform .18s ease, background .18s ease;
}

.generate-button:hover {
  transform: translateY(-2px);
  background: #cf5943;
}

.generator-hint {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: .8rem;
}

.result-panel {
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 56px);
  position: relative;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 80% 10%, rgba(248,201,120,.2), transparent 14rem),
    var(--violet-dark);
}

.result-panel::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  left: -80px;
  bottom: -110px;
  border-radius: 50%;
  border: 45px solid rgba(255,255,255,.035);
}

.result-kicker {
  margin-bottom: 8px;
  color: #eec47c;
  font-size: .85rem;
  font-weight: 800;
}

.result-name {
  margin-bottom: 18px;
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  letter-spacing: -0.04em;
}

.result-pronunciation {
  margin: -12px 0 24px;
  color: rgba(255,255,255,.55);
  font-size: .86rem;
}

.story-card {
  position: relative;
  padding: 23px 24px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.06);
}

.story-card::before {
  content: "❝";
  position: absolute;
  top: -18px;
  left: 20px;
  color: #efb86b;
  font-size: 3.8rem;
  line-height: 1;
}

.story-card p {
  margin: 0;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.result-meta span {
  padding: 6px 11px;
  border-radius: 999px;
  color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.08);
  font-size: .77rem;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.result-actions button {
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  color: var(--white);
  background: rgba(255,255,255,.07);
}

.result-actions button:hover {
  background: rgba(255,255,255,.13);
}

.result-actions button:first-child {
  color: var(--violet-dark);
  background: #f8c978;
  border-color: #f8c978;
}

.status-message {
  min-height: 24px;
  margin: 10px 2px 0;
  color: #f0cf97;
  font-size: .82rem;
}

.species-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}

.species-card {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 8px;
  border-radius: 70px 70px 20px 20px;
  color: var(--violet-dark);
  background: var(--sand);
  text-align: center;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}

.species-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(64,45,36,.1);
}

.species-card:nth-child(2n) { background: #efe8f2; }
.species-card:nth-child(3n) { background: #f8dfd5; }
.species-card:nth-child(4n) { background: #ddeadd; }

.species-card span {
  font-size: 2.2rem;
}

.species-card small {
  color: var(--muted);
  font-size: .73rem;
}

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

.feature-card {
  padding: 28px;
  border: 1px solid rgba(75,63,114,.1);
  border-radius: 24px;
  background: rgba(255,255,255,.66);
}

.feature-number {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: 14px;
  color: var(--white);
  background: var(--violet);
  font-weight: 800;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.feature-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .93rem;
}

.note-band {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 25px;
  padding: 28px 32px;
  border-radius: 26px;
  color: var(--violet-dark);
  background: #f2e4c8;
}

.note-band .note-icon {
  font-size: 2.8rem;
}

.note-band h2 {
  margin-bottom: 5px;
  font-size: 1.3rem;
}

.note-band p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}

.content-hero {
  padding: 95px 0 55px;
  text-align: center;
}

.content-hero .eyebrow {
  justify-content: center;
}

.content-hero h1 {
  max-width: 780px;
  margin: 0 auto 18px;
  color: var(--violet-dark);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
}

.content-hero > .container > p:last-child {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.prose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 70px;
  align-items: start;
  padding-bottom: 100px;
}

.prose {
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgba(75,63,114,.1);
  border-radius: 30px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 22px 50px rgba(64,45,36,.07);
}

.prose h2 {
  margin-top: 38px;
  margin-bottom: 12px;
  font-size: 1.45rem;
}

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

.prose h3 {
  margin-top: 26px;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.prose p,
.prose li {
  color: #555568;
}

.prose ul,
.prose ol {
  padding-right: 1.25rem;
}

.prose a {
  color: var(--coral);
  text-underline-offset: 3px;
}

.page-index {
  position: sticky;
  top: 24px;
  padding: 22px;
  border-radius: 22px;
  background: var(--sand);
}

.page-index strong {
  display: block;
  margin-bottom: 10px;
  color: var(--violet-dark);
}

.page-index a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
}

.page-index a:hover {
  color: var(--coral);
}

.info-panel {
  padding: 25px;
  border-radius: 22px;
  background: #eee8f5;
  color: var(--violet-dark);
}

.info-panel p:last-child {
  margin-bottom: 0;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 24px;
  padding: 44px;
  border-radius: 36px;
  color: rgba(255,255,255,.76);
  background: var(--violet-dark);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.footer-brand .brand {
  color: var(--white);
}

.footer-brand p {
  max-width: 480px;
  margin: 14px 0 0;
  color: rgba(255,255,255,.6);
  font-size: .9rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
}

.footer-links a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .9rem;
}

.footer-links a:hover {
  color: #f8c978;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  font-size: .78rem;
}

.footer-bottom p {
  margin: 0;
}

.not-found {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.not-found-code {
  margin: 0;
  color: var(--coral);
  font-size: clamp(6rem, 20vw, 13rem);
  font-weight: 900;
  line-height: .9;
  opacity: .2;
}

.not-found h1 {
  margin-top: -30px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.not-found p {
  max-width: 560px;
  margin-inline: auto;
  color: var(--muted);
}

/* Themed name guides */
.theme-hub-hero,
.theme-detail-hero {
  width: min(1180px, calc(100% - 32px));
  margin: 20px auto 0;
  position: relative;
  overflow: hidden;
  border-radius: 42px;
  color: var(--white);
  background:
    radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--theme-accent, #df6c56) 42%, transparent), transparent 25rem),
    linear-gradient(135deg, #504377, #2d2448 78%);
  box-shadow: var(--shadow);
}

.theme-hub-hero {
  padding: clamp(54px, 8vw, 94px);
}

.theme-detail-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 40px;
  padding: clamp(46px, 7vw, 78px);
}

.theme-hub-hero h1,
.theme-detail-hero h1 {
  max-width: 820px;
  margin-bottom: 18px;
  color: var(--white);
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  letter-spacing: -.035em;
}

.theme-hub-hero p,
.theme-detail-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255,255,255,.76);
}

.theme-hero-icon {
  display: grid;
  place-items: center;
  width: clamp(130px, 18vw, 210px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 46% 54% 48% 52%;
  background: color-mix(in srgb, var(--theme-accent, #df6c56) 32%, rgba(255,255,255,.08));
  font-size: clamp(4.5rem, 9vw, 7.5rem);
  transform: rotate(-5deg);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 15px;
  color: rgba(255,255,255,.58);
  font-size: .78rem;
}

.breadcrumbs a {
  color: inherit;
  text-underline-offset: 3px;
}

.theme-count {
  display: inline-flex;
  margin-bottom: 15px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: #f8d28e;
  background: rgba(255,255,255,.07);
  font-size: .78rem;
  font-weight: 800;
}

.theme-hub-section {
  padding: 82px 0 30px;
  scroll-margin-top: 20px;
}

.theme-hub-section + .theme-hub-section {
  padding-top: 60px;
}

.theme-category-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.theme-category-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: var(--sand);
  font-size: 2rem;
}

.theme-category-heading h2,
.theme-category-heading p {
  margin-bottom: 0;
}

.theme-category-heading p {
  color: var(--muted);
  font-size: .9rem;
}

.theme-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.theme-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid rgba(75,63,114,.1);
  border-radius: 24px;
  color: inherit;
  background:
    radial-gradient(circle at 95% 5%, color-mix(in srgb, var(--card-accent, #df6c56) 19%, transparent), transparent 9rem),
    rgba(255,255,255,.72);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.theme-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--card-accent, #df6c56) 55%, white);
  box-shadow: 0 18px 38px rgba(64,45,36,.1);
}

.theme-card small {
  color: var(--coral);
  font-weight: 800;
}

.theme-card h3 {
  margin: 12px 0 8px;
  font-size: 1.28rem;
}

.theme-card p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: .88rem;
}

.theme-card em {
  margin-top: auto;
  color: var(--violet);
  font-style: normal;
  font-size: .82rem;
  font-weight: 800;
}

.theme-page-main {
  padding: 70px 0 100px;
}

.theme-generator-shell {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  overflow: hidden;
  border: 1px solid rgba(75,63,114,.12);
  border-radius: 32px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.theme-generator-form {
  padding: clamp(28px, 4vw, 46px);
}

.theme-generator-form h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.theme-generator-form > p {
  color: var(--muted);
}

.tone-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin: 22px 0;
}

.tone-option {
  position: relative;
}

.tone-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tone-option label {
  display: block;
  padding: 10px 12px;
  border: 1px solid #e7dfd2;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.tone-option input:checked + label {
  border-color: var(--theme-accent, var(--coral));
  color: var(--violet-dark);
  background: color-mix(in srgb, var(--theme-accent, #df6c56) 14%, white);
  box-shadow: inset 0 0 0 1px var(--theme-accent, var(--coral));
}

.tone-option input:focus-visible + label {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.theme-generator-result {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 56px);
  color: var(--white);
  background:
    radial-gradient(circle at 84% 12%, color-mix(in srgb, var(--theme-accent, #df6c56) 42%, transparent), transparent 18rem),
    var(--violet-dark);
}

.theme-generator-result h3 {
  margin-bottom: 8px;
  color: var(--white);
  font-size: clamp(2.25rem, 5vw, 4rem);
}

.theme-generator-result > p {
  color: rgba(255,255,255,.62);
}

.theme-result-story {
  padding: 22px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 20px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.06);
}

.theme-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.theme-result-actions button {
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  color: var(--white);
  background: rgba(255,255,255,.08);
}

.theme-result-actions button:first-child {
  color: var(--violet-dark);
  border-color: #f8c978;
  background: #f8c978;
}

.theme-guide-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 22px;
  margin-top: 70px;
}

.theme-guide-article,
.theme-guide-aside,
.theme-story-map,
.theme-example-block {
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid rgba(75,63,114,.1);
  border-radius: 28px;
  background: rgba(255,255,255,.7);
}

.theme-guide-article h2,
.theme-guide-aside h2,
.theme-story-map h2,
.theme-example-block h2 {
  font-size: clamp(1.55rem, 3vw, 2.3rem);
}

.theme-guide-article p,
.theme-guide-aside p,
.theme-story-map p {
  color: var(--muted);
}

.theme-guide-aside {
  background: color-mix(in srgb, var(--theme-accent, #df6c56) 11%, white);
}

.theme-name-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.theme-name-cloud span {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--violet-dark);
  background: var(--sand);
  font-size: .86rem;
}

.theme-story-map,
.theme-example-block {
  margin-top: 22px;
}

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

.story-step {
  padding: 18px;
  border-radius: 18px;
  background: var(--paper);
}

.story-step small {
  color: var(--coral);
  font-weight: 800;
}

.story-step strong {
  display: block;
  margin-top: 5px;
  color: var(--violet-dark);
}

.related-themes {
  margin-top: 70px;
}

.related-themes h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.related-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.related-theme-grid a {
  padding: 20px;
  border: 1px solid rgba(75,63,114,.1);
  border-radius: 20px;
  color: var(--violet-dark);
  background: var(--white);
  text-decoration: none;
  font-weight: 800;
}

.related-theme-grid a:hover {
  border-color: var(--theme-accent, var(--coral));
}

@media (max-width: 980px) {
  .site-header {
    border-radius: 28px;
    align-items: flex-start;
  }

  .site-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 310px;
  }

  .moon { width: 260px; }
  .hero-animals { width: min(530px, 110%); }

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

  .result-panel {
    min-height: 520px;
  }

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

  .prose-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .page-index {
    position: static;
    order: -1;
  }

  .theme-card-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-generator-shell,
  .theme-guide-grid { grid-template-columns: 1fr; }

  .theme-entry {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .theme-entry-pets { display: none; }
}

@media (max-width: 720px) {
  .site-header {
    width: calc(100% - 20px);
    margin-top: 10px;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }

  .brand { align-self: center; }

  .site-nav {
    justify-content: center;
    gap: 2px;
  }

  .site-nav a {
    padding: 6px 9px;
    font-size: .82rem;
  }

  .hero {
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 42px 24px 30px;
    border-radius: 30px;
  }

  .hero h1 { font-size: 2.35rem; }
  .hero-art { min-height: 240px; }
  .moon { width: 200px; }
  .hero-name-ribbon { gap: 6px; }
  .hero-name-ribbon span { padding: 5px 8px; font-size: .72rem; }
  .hero-name-ribbon span:nth-child(3) { display: none; }
  .hero-name-card { min-width: 145px; padding: 8px 10px; }
  .hero-pet-avatar { width: 36px; height: 36px; font-size: 1.2rem; }
  .card-cat { top: 2%; right: 0; }
  .card-dog { bottom: 0; left: 0; }
  .story-token { top: 38%; left: 0; }

  .theme-entry {
    width: calc(100% - 20px);
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 14px;
    padding: 24px 22px;
    border-radius: 24px;
  }

  .theme-entry-button { width: 100%; }

  .section { padding: 78px 0; }
  .section-tight { padding: 52px 0; }

  .section-heading {
    display: block;
  }

  .section-heading h2 { margin-bottom: 12px; }

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

  .generator-controls { padding: 25px 20px; }
  .result-panel { padding: 38px 24px; }

  .species-strip {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .note-band {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
  }

  .site-footer {
    width: calc(100% - 20px);
    padding: 30px 24px;
    border-radius: 28px;
  }

  .theme-hub-hero,
  .theme-detail-hero {
    width: calc(100% - 20px);
    margin-top: 10px;
    border-radius: 30px;
  }

  .theme-detail-hero {
    grid-template-columns: 1fr;
  }

  .theme-hero-icon {
    width: 110px;
    grid-row: 1;
  }

  .theme-card-grid,
  .story-steps,
  .related-theme-grid { grid-template-columns: 1fr; }

  .tone-options { grid-template-columns: 1fr; }
  .theme-generator-result { min-height: 440px; }
}

@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;
  }
}

@media print {
  .site-header,
  .site-footer,
  .page-index,
  .hero-actions,
  .result-actions { display: none; }
  body { background: #fff; }
  .prose { box-shadow: none; border: 0; padding: 0; }
}
