:root { --ink: #253f3b; --muted: #66736c; --green: #286452; --line: #dedfd4; --paper: #fffef9; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Noto Sans JP", sans-serif; background: #f5f3eb; color: var(--ink); min-height: 100vh; line-height: 1.6; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #c18c3d; outline-offset: 4px; }
.container { max-width: 1060px; margin: auto; padding: 0 32px; }
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; text-decoration: none; letter-spacing: -.5px; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 38px; background: var(--green); color: white; border-radius: 8px 8px 13px 8px; font-size: 21px; }
.auth-bar, .auth-links, .language-switcher { display: flex; align-items: center; gap: 15px; font-size: 12px; }
.auth-bar { gap: 24px; }
.auth-links { gap: 8px; }
.auth-links a { text-decoration: none; }
.user-pic { width: 26px; height: 26px; border-radius: 50%; }
.language-switcher { gap: 2px; }
.language-switcher a { text-decoration: none; padding: 6px 8px; color: var(--muted); border-radius: 6px; }
.language-switcher a.active { background: #e4e9df; color: var(--green); font-weight: 700; }
header { margin: 40px 0 28px; }
header h1 { font-size: 30px; line-height: 1.35; }
.subtitle { color: var(--muted); margin-top: 16px; font-size: 15px; line-height: 1.9; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 40px; margin: 58px 0 48px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: 1.7px; margin-bottom: 20px; }
.hero h1 { font-family: Georgia, "Noto Sans JP", serif; font-size: clamp(32px, 4.4vw, 49px); letter-spacing: -1.6px; font-weight: 500; white-space: pre-line; line-height: 1.18; }
.hero .subtitle { max-width: 420px; }
.steps { display: flex; flex-wrap: wrap; gap: 18px; list-style: none; margin-top: 26px; font-size: 12px; }
.steps li { display: flex; align-items: center; gap: 7px; }
.steps span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #bac8bb; border-radius: 50%; font-size: 10px; color: var(--green); }
.worksheet-scene { position: relative; height: 310px; background: #e9eadd; border-radius: 50%; margin: 0 20px; }
.paper { position: absolute; width: 245px; height: 282px; left: 50%; top: 12px; border: 1px solid #e1dfd1; background: var(--paper); box-shadow: 0 12px 25px #35463712; }
.paper-back { transform: translateX(-50%) rotate(-9deg); background: #f8f7ee; }
.paper-front { transform: translateX(-50%) rotate(5deg); padding: 23px; }
.paper-heading { font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; }
.paper-heading span { color: #9ba999; font-size: 10px; }
.paper-rule { height: 2px; background: var(--green); margin: 10px 0 19px; }
.practice-row { display: flex; align-items: center; margin: 9px 0; }
.practice-row b { font-size: 9px; font-weight: 400; width: 36px; }
.practice-row span { width: 48px; height: 48px; border: 1px solid #bfcabe; margin-left: -1px; display: grid; place-items: center; font-family: serif; font-size: 32px; background: linear-gradient(90deg, transparent 49%, #dde2d9 50%, transparent 51%), linear-gradient(transparent 49%, #dde2d9 50%, transparent 51%); }
.practice-row .trace { color: #cbd3c6; }
.paper-bottom { display: flex; align-items: center; gap: 8px; margin-top: 17px; font-size: 9px; color: #778873; }
.paper-bottom span { flex: 1; border-bottom: 1px solid #d1d8cd; }
.pencil { position: absolute; bottom: 5px; right: 4px; width: 12px; height: 183px; background: linear-gradient(90deg,#c78e3c 33%,#e8b664 33%,#e8b664 70%,#d79f4b 70%); transform: rotate(26deg); border-radius: 4px 4px 0 0; box-shadow: 5px 4px 5px #35463716; }
.pencil::after { content: ''; position: absolute; top: 100%; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 22px solid #9b7651; }
.drill-builder { max-width: 820px; margin: 0 auto; }
.category-focused .hero { display: none; }
.category-focused .drill-builder { margin-top: 32px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 26px; margin-bottom: 18px; box-shadow: 0 3px 0 #33452d03; }
.section-heading { display: flex; gap: 13px; align-items: center; margin-bottom: 22px; }
.section-number { font-size: 11px; font-weight: 700; color: var(--green); background: #eaf0e6; border-radius: 8px; padding: 8px 10px; }
.card h2 { font-size: 17px; font-weight: 700; }
.section-heading p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.breadcrumb { font-size: 12px; margin-bottom: 16px; color: var(--muted); }
.crumb { text-decoration: none; }
.crumb:hover { text-decoration: underline; }
.crumb-sep { margin: 0 7px; }
.drill-types { display: grid; gap: 10px; }
.subject-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.drill-type-btn { width: 100%; text-align: left; padding: 17px 19px; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.drill-type-btn:hover { border-color: #829d87; background: #f4f7ef; }
.drill-type-btn.selected { border-color: var(--green); background: #edf3e9; box-shadow: inset 3px 0 var(--green); }
.category-btn { display: flex; align-items: center; gap: 15px; }
.name { font-size: 15px; font-weight: 700; }
.desc { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.chevron { margin-left: auto; font-size: 24px; color: #7b8c7b; }
.subject-icon { flex-shrink: 0; width: 48px; height: 52px; display: grid; place-items: center; background: #e9eee0; color: var(--green); border-radius: 9px; font-family: serif; font-size: 29px; }
.subject-math .subject-icon { background: #f5e8d5; color: #9a642e; }
.param-group { margin-bottom: 18px; }
.param-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.param-group select, .param-group input:not([type=checkbox]):not([type=range]), .param-group textarea { width: 100%; padding: 11px 13px; border: 1px solid #c9d0c4; border-radius: 8px; background: white; color: var(--ink); font-size: 14px; }
.param-group textarea { resize: vertical; line-height: 1.7; }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--green); }
.checkbox-row label { margin: 0; }
.generate-btn { display: block; width: 100%; padding: 15px; background: var(--green); color: white; border: 0; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s; }
.generate-btn:hover { background: #1d503f; }
.generate-btn:disabled { background: #e0e3d9; color: #697164; cursor: not-allowed; }
.anon-notice { text-align: center; font-size: 11px; color: var(--muted); margin-top: 13px; }
.login-prompt { text-align: center; padding: 16px; }
.login-prompt p { margin-bottom: 12px; }
.htmx-indicator { display: none; text-align: center; padding: 16px; color: var(--muted); }
.htmx-request .htmx-indicator { display: block; }
footer { display: flex; justify-content: space-between; gap: 15px; padding: 22px 0; margin-top: 55px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
@media (max-width: 760px) {
  .container { padding: 0 20px; }
  .site-nav { flex-wrap: wrap; gap: 16px; padding: 20px 0; }
  .auth-bar { flex: 1; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
  .hero { gap: 20px; margin-top: 35px; }
  .worksheet-scene { transform: scale(.8); margin: 0 -25px; }
  .hero h1 { font-size: 36px; }
  .subject-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .auth-bar { flex-basis: 100%; }
  .hero { grid-template-columns: 1fr; gap: 20px; margin-bottom: 28px; }
  .hero h1 { font-size: 40px; }
  .hero .subtitle { font-size: 14px; }
  .worksheet-scene { width: 280px; height: 310px; margin: -12px auto -24px; transform: scale(.8); }
  .steps { gap: 13px; }
  .card { padding: 20px; }
  footer { flex-direction: column; gap: 5px; margin-top: 35px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
