/* ============================================================================
   claudia-gengo-core.css  ·  The Japanese Gengo — master stylesheet
   Fuses the chira-schoolbook baseline (legibility: callouts, bento, strips)
   with the SparkleSnap brand (matcha-zen, sakura, frosted glass, prism, mascots).
   Author: Ms. Claudia · for Cesar Borgenkrans / sparklesnap.dev
   Target: JIS-B5 (182×257mm), print-first. Link AFTER the vendor/chira-*.css files.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;600;700;900&family=Noto+Sans+JP:wght@400;500;700&family=Lexend:wght@300;400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ---- 1. Fused design tokens ---- */
:root {
  /* brand + chira palette */
  --ink:        #2D2926;
  --ink-soft:   #5b534d;
  --paper:      #fbfaf7;
  --paper-2:    #f4f1ea;
  --card:       #ffffff;
  --line:       #334155;

  --teal:       #0f766e;  --teal-bg:  #f0fdfa;
  --rose:       #be123c;  --rose-bg:  #fff1f2;
  --amber:      #b45309;  --amber-bg: #fffbeb;
  --matcha:     #2b4c3e;  --matcha-bg:#e8ede3;
  --kyoto-red:  #BB1E2C;
  --sunset-a:   #ff7e5f;  --sunset-b: #feb47b;
  --sakura:     #FFB7C5;  --sakura-2: #ffe3ea;
  --violet:     #6d28d9;

  --gold:       #c79a3a;

  /* type */
  --f-serif-jp: 'Noto Serif JP', serif;
  --f-sans-jp:  'Noto Sans JP', sans-serif;
  --f-body:     'Lexend', system-ui, sans-serif;
  --f-mono:     'Space Mono', monospace;

  /* geometry (JIS-B5) */
  --pg-w: 182mm;
  --pg-h: 257mm;
  --pg-pad: 13mm;
  --radius: 14px;
  --shadow-soft: 0 10px 30px rgba(45,41,38,.10);
  --shadow-pop:  8px 8px 0 rgba(51,65,85,.22);
}

/* ---- 2. Screen scaffold (ignored/overridden in print) ---- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #d9d4cb;
  background-image:
    radial-gradient(circle at 15% 10%, #e7e2d8 0, transparent 45%),
    radial-gradient(circle at 85% 90%, #e2ded4 0, transparent 45%);
  font-family: var(--f-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding: 28px 0 60px;
}
.screen-only {
  max-width: 182mm; margin: 0 auto 22px; padding: 10px 16px;
  font-family: var(--f-mono); font-size: 12px; color: #6b6358;
  background: rgba(255,255,255,.7); border: 1px dashed #b7af9f; border-radius: 10px;
  text-align: center;
}

/* ---- 3. The page (one JIS-B5 sheet) ---- */
.page {
  position: relative;
  width: var(--pg-w);
  min-height: var(--pg-h);
  margin: 0 auto 26px;
  padding: var(--pg-pad);
  background:
    radial-gradient(135% 90% at 0% 0%, var(--pg-tint, rgba(122,160,108,.12)) 0, transparent 46%),
    radial-gradient(135% 90% at 100% 100%, var(--pg-tint, rgba(122,160,108,.12)) 0, transparent 46%),
    var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex; flex-direction: column;
}
/* subtle page-edge flair — the corner colour shifts in a calm 3-page cycle */
.page:nth-of-type(3n+1) { --pg-tint: rgba(122,160,108,.12); }  /* matcha  */
.page:nth-of-type(3n+2) { --pg-tint: rgba(243,168,196,.13); }  /* sakura  */
.page:nth-of-type(3n)   { --pg-tint: rgba(212,168,92,.13);  }  /* dawn-gold */
.page__body { flex: 1 1 auto; }

/* running furniture */
.page__header {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em;
  color: var(--ink-soft); text-transform: uppercase;
  border-bottom: 1.5px solid var(--matcha-bg); padding-bottom: 6px; margin-bottom: 14px;
}
.page__header .chap-glyph { font-family: var(--f-serif-jp); font-size: 16px; color: var(--matcha); }
.page__footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 8px; border-top: 1.5px solid var(--matcha-bg);
  font-family: var(--f-mono); font-size: 10px; color: var(--ink-soft);
}
.page__footer .brand { color: var(--matcha); font-weight: 700; }
.page__num {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--matcha); color: #fff; font-weight: 700; font-size: 11px;
}

/* ---- 4. Headings & base type ---- */
.page h1, .page h2, .page h3 { font-family: var(--f-serif-jp); color: var(--matcha); line-height: 1.2; }
.page h1 { font-size: 2.1rem; margin: .2em 0 .3em; letter-spacing: -.5px; }
.page h2 { font-size: 1.5rem; margin: .1em 0 .5em; }
.page h3 { font-size: 1.15rem; margin: 1em 0 .4em; color: var(--ink); }
.page p  { font-family: var(--f-body); line-height: 1.75; font-size: 1rem; margin: 0 0 1em; }
.lead { font-size: 1.12rem; color: var(--ink-soft); line-height: 1.7; }
.eyebrow {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--kyoto-red); font-weight: 700; margin: 0 0 6px;
}
.jp-serif { font-family: var(--f-serif-jp); }
em.note { color: var(--ink-soft); }
.hr-soft { border: 0; border-top: 2px dotted #d8d2c6; margin: 18px 0; }
mark.hl { background: linear-gradient(transparent 55%, var(--sakura-2) 55%); padding: 0 2px; }

/* ---- 5. Japanese line block (the 4-layer system) ---- */
.jp-main { font-family: var(--f-sans-jp); font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.6; }
.jp-main.big { font-size: 2rem; }
ruby rt { font-family: var(--f-sans-jp); font-size: .52em; font-weight: 500; color: var(--teal); }
.romaji { font-family: var(--f-mono); font-size: .82rem; color: var(--ink-soft); letter-spacing: .02em; margin-top: 2px; }
.gloss  { font-family: var(--f-body); font-size: .95rem; color: var(--ink-soft); font-style: italic; }
.jp-line { margin: 10px 0; }
.jp-line .jp-main { margin-bottom: 1px; }

/* ---- 6. Brand overrides for the chira callouts (relabel + JP font fallback) ---- */
.chira-core, .chira-accent, .chira-grammar, .chira-drill { font-family: var(--f-body) !important; }
.chira-core .jp-main, .chira-accent .jp-main, .chira-grammar .jp-main { font-family: var(--f-sans-jp); }
/* Ms. Claudia's teacher voice = a core callout with a sensei seal */
.sensei-says { position: relative; }
.sensei-says::after {
  content: "先生"; position: absolute; bottom: -10px; left: 16px;
  background: var(--kyoto-red); color: #fff; font-family: var(--f-serif-jp); font-size: 11px;
  padding: 2px 10px; border-radius: 6px; border: 1px solid var(--line);
}

/* ---- 7. Chips & seals ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 50px;
  background: var(--matcha-bg); color: var(--matcha); border: 1px solid rgba(43,76,62,.25);
}
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.chip--waifu    { background: var(--sakura-2); color: var(--rose);  border-color: rgba(190,18,60,.3); }
.chip--husbando { background: #e8eef6; color: #1d4ed8; border-color: rgba(29,78,216,.3); }
.chip--dobutsu  { background: #f0fdf4; color: #15803d; border-color: rgba(21,128,61,.3); }
.chip--kami     { background: #f5f0ff; color: var(--violet); border-color: rgba(109,40,217,.3); }
.chip--cake     { background: #fff1ea; color: #b9603f; border-color: rgba(185,96,63,.35); }
.chip--origin   { background: #eef6f1; color: var(--matcha); border-color: rgba(43,76,62,.32); }
.chip--memory   { background: #fff7ed; color: #9a3412; border-color: rgba(154,52,18,.28); }
.chip--family   { background: #eef2ff; color: #3730a3; border-color: rgba(55,48,163,.26); }
.chip--motion   { background: #ecfeff; color: #0e7490; border-color: rgba(14,116,144,.28); }
.chip--sky      { background: #eff6ff; color: #1d4ed8; border-color: rgba(29,78,216,.24); }
.chip--element  { background: #f7fee7; color: #4d7c0f; border-color: rgba(77,124,15,.28); }
.chip--transport{ background: #f1f5f9; color: #334155; border-color: rgba(51,65,85,.28); }
.chip--n5       { background: var(--kyoto-red); color: #fff; border-color: var(--line); }

.seal {
  display: inline-grid; place-items: center; width: 64px; height: 64px; transform: rotate(-8deg);
  border: 3px solid var(--kyoto-red); border-radius: 12px; color: var(--kyoto-red);
  font-family: var(--f-serif-jp); font-weight: 900; font-size: 1.6rem; background: rgba(255,255,255,.6);
  box-shadow: inset 0 0 0 2px rgba(187,30,44,.25);
}

/* ---- 8. Cover & heroes ---- */
.cover { justify-content: center; align-items: center; text-align: center;
  background:
    radial-gradient(circle at 22% 18%, var(--sakura-2) 0, transparent 42%),
    radial-gradient(circle at 82% 84%, #d9e6d2 0, transparent 46%),
    linear-gradient(160deg, #fff 0%, var(--paper) 60%, var(--matcha-bg) 100%);
}
.cover__kanji-bg { position: absolute; inset: 0; pointer-events: none; opacity: .06;
  font-family: var(--f-serif-jp); color: var(--matcha); overflow: hidden; }
.cover__kanji-bg span { position: absolute; line-height: 1; }
.cover__inner { position: relative; z-index: 2; padding: 0 8mm; }
.cover__mark { font-family: var(--f-serif-jp); font-size: 3.1rem; font-weight: 900; color: var(--matcha);
  letter-spacing: -1px; margin: 0; line-height: 1.05; }
.cover__mark .accent { color: var(--kyoto-red); }
.cover__jp { font-family: var(--f-serif-jp); font-size: 1.5rem; color: var(--kyoto-red); letter-spacing: .5em;
  margin: 6px 0 0; padding-left: .5em; }
.cover__sub { font-family: var(--f-body); font-weight: 600; font-size: 1.15rem; color: var(--ink-soft);
  margin: 18px 0 0; }
.cover__rule { width: 70px; height: 4px; background: linear-gradient(90deg, var(--sunset-a), var(--sunset-b));
  border-radius: 4px; margin: 22px auto; }
.cover__cast { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.cover__foot { position: absolute; bottom: 12mm; left: 0; right: 0; text-align: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); z-index: 2; }

.hero { background: linear-gradient(135deg, var(--matcha-bg), #fff 70%); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px; border: 2px solid #e3e9dc; position: relative; overflow: hidden; }
.hero .eyebrow { color: var(--matcha); }
.hero h1 { margin-top: 0; }

/* ---- 9. Mascot sprite system (3×3 sheets) ---- */
.mascot { display: inline-block; background-repeat: no-repeat; background-size: 300% 300%;
  image-rendering: auto; flex: 0 0 auto; }
.mascot--tsuki  { background-image: url('../assets/mascots/tsuki_expr.png'); }
.mascot--tsuki-kanji { background-image: url('../assets/mascots/tsuki_kanji.png'); }
.mascot--tsuki-tea   { background-image: url('../assets/mascots/tsuki_tea.png'); }
.mascot--selene { background-image: url('../assets/mascots/selene_master.png'); }
.mascot--marina { background-image: url('../assets/mascots/marina_master.png'); }
.mascot--marina-snap { background-image: url('../assets/mascots/marina_snap.png'); }
.mascot--sol  { background-image: url('../assets/mascots/sol.png'); }   /* Part 2 · the Craftsman */
.mascot--fuku { background-image: url('../assets/mascots/fuku.png'); }  /* Part 2 · the Observer */
.mascot.sz-sm { width: 64px;  height: 64px; }
.mascot.sz-md { width: 92px;  height: 92px; }
.mascot.sz-lg { width: 130px; height: 130px; }
.mascot.sz-xl { width: 170px; height: 170px; }
/* frame helpers: .f{col}{row} → background-position */
.f00{background-position:0% 0%}    .f10{background-position:50% 0%}    .f20{background-position:100% 0%}
.f01{background-position:0% 50%}   .f11{background-position:50% 50%}   .f21{background-position:100% 50%}
.f02{background-position:0% 100%}  .f12{background-position:50% 100%}  .f22{background-position:100% 100%}

/* ---- 10. Meet-the-cast cards ---- */
.cast-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cast-card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center; position: relative; }
.cast-card .mascot { margin: 0 auto; }
.cast-card h3 { margin: 8px 0 2px; color: var(--matcha); }
.cast-card .role { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--kyoto-red); font-weight: 700; }
.cast-card p { font-size: .86rem; line-height: 1.55; margin: 8px 0 0; color: var(--ink-soft); }
.cast-card.t-tsuki  { border-top: 7px solid #7bbf9e; }
.cast-card.t-selene { border-top: 7px solid var(--violet); }
.cast-card.t-marina { border-top: 7px solid var(--sakura); }

/* ---- 11. The Kanji Story Card (signature feature) ---- */
.kanji-card { border: 2.5px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-pop); margin: 8px 0 0; }
.kanji-card__top { display: grid; grid-template-columns: 168px 1fr; }
.kanji-card__glyph { position: relative; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 35%, #fff 0, var(--matcha-bg) 100%); border-right: 2.5px solid var(--line); }
.kanji-card__glyph .glyph { font-family: var(--f-serif-jp); font-weight: 900; font-size: 6.4rem; color: var(--ink); line-height: 1; }
.kanji-card__glyph .strokes { position: absolute; bottom: 8px; right: 10px; font-family: var(--f-mono); font-size: 10px; color: var(--ink-soft); }
.kanji-card__id { padding: 14px 16px; }
.kanji-card__name { font-family: var(--f-serif-jp); font-size: 1.45rem; font-weight: 700; color: var(--matcha); margin: 6px 0 4px; }
.kanji-card__meaning { font-size: .95rem; color: var(--ink-soft); margin: 0 0 8px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.facts .f { font-size: .82rem; display: flex; gap: 6px; }
.facts .f b { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-soft); min-width: 56px; padding-top: 2px; }
.facts .f .v { font-family: var(--f-sans-jp); color: var(--ink); font-weight: 500; }
.kanji-card__story { padding: 14px 16px; background: var(--paper); border-top: 2px dashed #d8d2c6; }
.kanji-card__story .story-h { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal); font-weight: 700; margin-bottom: 4px; }
.kanji-card__story p { margin: 0 0 8px; font-size: .95rem; line-height: 1.7; }
.kanji-card__hook { font-style: italic; color: var(--matcha); border-left: 4px solid var(--sakura); padding-left: 10px; }
.wild { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding: 12px 16px; background: var(--card); border-top: 2.5px solid var(--line); }
.wild .w { background: var(--teal-bg); border: 1.5px solid rgba(15,118,110,.3); border-radius: 9px; padding: 8px; text-align: center; }
.wild .w .wjp { font-family: var(--f-sans-jp); font-weight: 700; font-size: 1.05rem; }
.wild .w .wro { font-family: var(--f-mono); font-size: .72rem; color: var(--ink-soft); }
.wild .w .wen { font-size: .76rem; color: var(--ink-soft); }
.recruited { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--matcha);
  color: #fff; font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; }
.recruited .tick { width: 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--matcha);
  display: grid; place-items: center; font-weight: 900; }

/* ---- 12. Dialogue blocks ---- */
.dialogue { border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.dialogue__scene { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--matcha); color: #fff; padding: 8px 14px; display: flex; justify-content: space-between; }
.turn { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1.5px solid var(--matcha-bg); align-items: flex-start; }
.turn:last-child { border-bottom: 0; }
.turn .av { width: 62px; height: 62px; border-radius: 12px; border: 2px solid var(--line); background-color: #fff; }
.turn .bubble { position: relative; flex: 1; background: var(--paper); border: 2px solid var(--line);
  border-radius: 12px; padding: 9px 12px; }
.turn .bubble::before { content: ""; position: absolute; left: -9px; top: 16px; width: 14px; height: 14px;
  background: var(--paper); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.turn .who { font-family: var(--f-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }
.turn .jp-main { font-size: 1.25rem; }
.t-tsuki  .who { color: #2f8f63; }  .t-tsuki  .bubble { background: #f3fbf6; }  .t-tsuki  .bubble::before { background: #f3fbf6; }
.t-selene .who { color: var(--violet); } .t-selene .bubble { background: #f7f3ff; } .t-selene .bubble::before { background: #f7f3ff; }
.t-marina .who { color: var(--rose); } .t-marina .bubble { background: var(--rose-bg); } .t-marina .bubble::before { background: var(--rose-bg); }
.t-claudia .who { color: var(--kyoto-red); } .t-claudia .bubble { background: #fff; border-style: dashed; } .t-claudia .bubble::before { background:#fff; }
.your-turn { margin-top: 12px; }

/* ---- 13. Quest (autonomy-supportive gamification) ---- */
.quest { border: 2px solid var(--gold); border-radius: var(--radius); background:
  linear-gradient(135deg, #fffdf5, #fff); padding: 16px 18px; position: relative; box-shadow: var(--shadow-soft); }
.quest::before { content: "⭐ QUEST"; position: absolute; top: -12px; left: 16px; background: var(--gold);
  color: #fff; font-family: var(--f-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; padding: 3px 12px; border-radius: 6px; }
.quest h3 { color: var(--gold); margin-top: 4px; }
.cando { list-style: none; padding: 0; margin: 8px 0 0; }
.cando li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: .98rem; border-bottom: 1px dotted #e4dcc4; }
.cando li:last-child { border-bottom: 0; }
.cando .box { width: 20px; height: 20px; border: 2px solid var(--gold); border-radius: 5px; flex: 0 0 auto; }

/* ---- 14. CTA buttons (print-degrade to calm pill) ---- */
.cta { display: inline-block; text-decoration: none; font-family: var(--f-body); font-weight: 800;
  letter-spacing: .04em; padding: 13px 28px; border-radius: 50px; }
.cta--sunset { color: #fff; background: linear-gradient(135deg, var(--sunset-a), var(--sunset-b));
  box-shadow: 0 10px 24px rgba(255,126,95,.28); }
.cta--glass { color: var(--matcha); background: rgba(255,255,255,.65); border: 1.5px solid #cdd8c4; }

/* ---- 15. Zen culture frame & polaroid (chimg flair, standalone) ---- */
.zen-frame { background:
    radial-gradient(circle at 20% 25%, #d3dfca 0, transparent 55%),
    radial-gradient(circle at 82% 80%, #cbd8bf 0, transparent 55%), var(--matcha-bg);
  border-radius: var(--radius); padding: 18px; }
.polaroid { display: inline-block; background: #fff; padding: 10px 10px 30px; border: 1px solid #e7e2d8;
  box-shadow: var(--shadow-pop); transform: rotate(-1.6deg); position: relative; }
.polaroid img { display: block; width: 100%; height: auto; border-radius: 2px; }
.polaroid figcaption { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); }
.polaroid.placeholder { width: 100%; }
.polaroid.placeholder .ph { aspect-ratio: 4/3; border-radius: 2px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sakura-2), #fff 60%, var(--matcha-bg));
  color: var(--matcha); font-family: var(--f-serif-jp); font-size: 2rem; }

.haiku { font-family: var(--f-serif-jp); font-size: 1.25rem; line-height: 2; color: var(--matcha); text-align: center; }
.haiku .ro { font-family: var(--f-mono); font-size: .85rem; color: var(--ink-soft); letter-spacing: .03em; }

/* ---- 16. Small utilities ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2.lean { grid-template-columns: 1.3fr 1fr; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.stack-sm > * + * { margin-top: 8px; }
.petal { position: absolute; width: 12px; height: 12px; background: var(--sakura); border-radius: 50% 0 50% 50%;
  opacity: .8; pointer-events: none; }
