/* ── Kanji Module Shared Styles ──
   Used by all Materi/Kanji-*.html pages.
   Replaces per-page inline <style> blocks. */

/* Hero */
.hero{background:linear-gradient(135deg,var(--primary,#1565c0),var(--primary-dark,#1976d2));color:#fff;padding:48px 20px 32px;text-align:center}
.hero h1{font-family:'Noto Serif JP',serif;font-size:clamp(34px,5vw,62px);line-height:1.1;margin-bottom:1rem}
.hero p{max-width:860px;color:rgba(255,255,255,.68);font-size:16px;line-height:1.9}
.hero-inner{max-width:1160px;margin:0 auto;position:relative;z-index:1}
.kicker{display:inline-flex;padding:5px 12px;border-radius:8px;background:rgba(232,83,74,.18);color:var(--red-soft);font-size:11px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;margin-bottom:1rem}
.bdg{display:inline-block;background:rgba(255,255,255,.25);border-radius:20px;padding:4px 12px;font-size:.8rem;margin-bottom:12px}

/* Hero Stats */
.hero-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:2rem}
.hero-stat{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12);border-radius:8px;padding:1rem}
.hero-stat strong{font-family:'Noto Serif JP',serif;font-size:30px;display:block;line-height:1}
.hero-stat span{font-size:12px;color:rgba(255,255,255,.58)}

/* Layout */
.wrap{max-width:1160px;margin:0 auto;padding:2.5rem 5vw}
.section-head{display:flex;justify-content:space-between;gap:1rem;align-items:flex-end;margin-bottom:1.25rem}
.section-label{font-size:11px;font-weight:800;letter-spacing:.16em;text-transform:uppercase;color:var(--red);margin-bottom:.4rem}
.section-title{font-family:'Noto Serif JP',serif;font-size:clamp(24px,3vw,36px);line-height:1.2}
.section-sub{color:var(--ink-soft);font-size:14px;max-width:690px}

/* Kanji Grid */
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}
.card{background:var(--white);border:.5px solid var(--border-mid);border-radius:8px;padding:1.25rem;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.card h3{font-size:16px;margin-bottom:.5rem}
.card p,.card li{font-size:13px;color:var(--ink-mid)}
.card ul{padding-left:1.1rem;display:grid;gap:.35rem}

/* Quick Kanji Cards */
.quick{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:.75rem;margin-top:1rem}
.qcard{background:var(--white);border:.5px solid var(--border-mid);border-radius:8px;padding:.85rem;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.qchar{font-family:'Noto Serif JP',serif;font-size:40px;color:var(--red);line-height:1}
.qmean{font-size:11px;color:var(--ink-soft);font-weight:700;margin-top:.35rem}

/* Buttons */
.btn-sm{background:var(--red);color:#fff;padding:8px 18px;border-radius:100px;font-size:13px;font-weight:700;border:none;cursor:pointer}

/* Source / Embed */
.source-frame{width:100%;height:760px;border:1px solid var(--border-mid);border-radius:8px;background:var(--white);box-shadow:0 2px 8px rgba(0,0,0,.08)}
.source-actions{display:flex;gap:.75rem;flex-wrap:wrap;margin-bottom:1rem}
.source-actions a{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:8px;background:var(--red);color:#fff;font-size:13px;font-weight:800;text-decoration:none}
.source-actions a.secondary{background:var(--white);color:var(--ink);border:1px solid var(--border-mid)}

/* Note */
.note{background:var(--blue-pale);border:1px solid rgba(47,111,237,.18);border-radius:8px;padding:1rem;color:var(--ink-mid);font-size:13px;margin-top:1rem}

/* Stroke Animation */
.kanji-stroke-wrap{display:inline-flex;flex-direction:column;align-items:center;gap:.35rem;cursor:pointer}
.kanji-stroke-wrap:hover .stroke-hint{opacity:1}
.stroke-svg{width:80px;height:80px;border:1.5px solid var(--border,#e0e0e0);border-radius:8px;background:#fdfcf8}
.stroke-hint{opacity:0;font-size:10px;color:var(--ink-soft,#888);transition:opacity .2s;text-align:center;max-width:80px;line-height:1.4}
.stroke-anim-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:400;align-items:center;justify-content:center;padding:1rem}
.stroke-anim-modal.open{display:flex}
.stroke-anim-card{background:white;border-radius:16px;padding:2rem;max-width:360px;width:100%;text-align:center;position:relative}
.stroke-anim-char{font-family:"Noto Serif JP",serif;font-size:96px;color:#15161a;line-height:1;margin-bottom:.5rem}
.stroke-anim-svg{width:200px;height:200px;border:2px solid #e0e0e0;border-radius:12px;background:#fdfcf8;margin:0 auto .75rem}
.stroke-number{display:inline-flex;width:24px;height:24px;border-radius:50%;background:var(--red,#be3428);color:#fff;font-size:11px;font-weight:700;align-items:center;justify-content:center;margin:0 2px}
.stroke-progress{display:flex;gap:.3rem;justify-content:center;flex-wrap:wrap;margin-bottom:.75rem}
.stroke-controls{display:flex;gap:.5rem;justify-content:center}
.stroke-btn{height:36px;padding:0 14px;border-radius:8px;border:1.5px solid #e0e0e0;background:white;cursor:pointer;font-family:sans-serif;font-size:13px;font-weight:600;transition:all .15s}
.stroke-btn:hover{border-color:var(--red,#be3428);color:var(--red,#be3428)}
.stroke-btn.primary{background:var(--red,#be3428);border-color:var(--red,#be3428);color:white}
.stroke-close{position:absolute;top:12px;right:12px;width:28px;height:28px;border-radius:50%;border:none;background:#f5f5f5;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center}
@keyframes drawLine{from{stroke-dashoffset:200}to{stroke-dashoffset:0}}

/* Responsive */
@media(max-width:900px){.hero-stats,.grid{grid-template-columns:1fr 1fr}.section-head{display:block}.source-frame{height:640px}}
@media(max-width:560px){.hero-stats,.grid{grid-template-columns:1fr}.source-frame{height:540px}}

/* Dark Mode */
[data-theme="dark"] .hero{background:linear-gradient(135deg,#1a237e,#283593)}
[data-theme="dark"] .card,.sec{background:#1e1e2e;border-color:#333}
[data-theme="dark"] .qcard{background:#1e1e2e;border-color:#333}
[data-theme="dark"] .stroke-anim-card{background:#1e1e2e}
[data-theme="dark"] .stroke-svg,.stroke-anim-svg{background:#2a2a3e;border-color:#444}
[data-theme="dark"] .source-frame{background:#1e1e2e;border-color:#444}
[data-theme="dark"] .btn-sm{background:var(--red)}
[data-theme="dark"] .source-actions a.secondary{background:#1e1e2e;border-color:#444;color:#ccc}
[data-theme="dark"] .note{background:rgba(47,111,237,.1)}
