* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f7f2ec; color: #2b2118; }
.app-shell { max-width: 920px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.topbar h1 { margin: 6px 0 4px; font-size: 2rem; }
.brand-link { text-decoration: none; display: inline-block; }
.brand { color: #df7a2e; font-weight: 700; letter-spacing: .02em; }
.badge { background: #fff0e1; color: #a94f0e; border-radius: 999px; padding: 4px 10px; font-size: .9rem; vertical-align: middle; }
.muted { color: #78685d; margin: 0; }
.card { background: #fffdfb; border: 1px solid #eddccf; border-radius: 20px; padding: 18px; box-shadow: 0 8px 26px rgba(77, 49, 27, 0.07); }
.goal-card, .trainer, .filters, .stats, .stats-page { margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid.secondary { margin-top: 12px; }
label span { display: block; font-size: .92rem; margin-bottom: 6px; color: #5c4a3f; }
select, input[type="number"], input[type="text"] { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid #d9c5b4; background: #fff; font-size: 1rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat span { display: block; color: #78685d; margin-bottom: 8px; }
.stat strong { font-size: 1.8rem; }
.goal-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 12px; }
.goal-title { font-size: 1.1rem; font-weight: 700; }
.goal-subtitle { color: #78685d; font-size: .92rem; }
.goal-controls { display: flex; align-items: center; gap: 10px; }
.goal-controls input { width: 92px; }
.goal-progress-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #6f4728; font-weight: 600; }
.goal-bar { width: 100%; height: 14px; background: #f1e3d6; border-radius: 999px; overflow: hidden; }
.goal-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #df7a2e, #f1a766); transition: width .25s ease; }
.goal-success { margin-top: 12px; border-radius: 14px; padding: 12px 14px; background: #ecf8ef; color: #1f6a34; font-weight: 700; }
.hidden { display: none !important; }
.section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.mini-card, .chapter-card { background: #fcf6ef; border-radius: 16px; padding: 14px; }
.mini-label { color: #78685d; font-size: .92rem; margin-bottom: 6px; }
.mini-value { font-size: 1.6rem; font-weight: 700; }
.chapter-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chapter-list { color: #5c4a3f; line-height: 1.5; }
.trainer-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; background: #f7ede2; color: #7f4d28; font-size: .92rem; }
.streak-pill { background: #fff0e1; color: #a94f0e; font-weight: 700; }
.character { font-size: clamp(5rem, 16vw, 8rem); text-align: center; line-height: 1.1; margin: 16px 0 14px; min-height: 1.2em; }
.font-system { font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; }
.font-mincho { font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; }
.font-gothic { font-family: "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif; }
.font-rounded { font-family: "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "Noto Sans JP", sans-serif; }
.font-calligraphy { font-family: "HanziPen SC", "Klee One", "Yuji Mai", "Hiragino Mincho ProN", serif; font-weight: 500; letter-spacing: .03em; transform: rotate(-2deg); }
.hint-row { display: flex; justify-content: center; margin-bottom: 12px; }
.elements-box { background: #fcf6ef; border: 1px solid #eddccf; border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.elements-title { font-weight: 700; color: #7f4d28; margin-bottom: 6px; }
.elements-text { font-size: 1rem; color: #5c4a3f; }
.answer-form label { display: block; margin-bottom: 8px; font-weight: 600; }
.answer-form { margin-bottom: 14px; }
.primary-btn, .ghost-btn { border: 0; border-radius: 14px; padding: 12px 16px; font-size: 1rem; cursor: pointer; }
.primary-btn { background: #df7a2e; color: #fff; }
.ghost-btn { background: #f1e3d6; color: #6f4728; }
#actionBtn { margin-top: 10px; width: 100%; }
.result-box, .typo-box { border-radius: 16px; padding: 14px; margin: 14px 0; }
.result-box.ok { background: #ecf8ef; color: #1f6a34; }
.result-box.bad { background: #fff0ef; color: #9b3228; }
.typo-box { background: #fff3df; color: #8a5600; border: 1px solid #f0d3a2; }
.typo-title { font-weight: 700; margin-bottom: 6px; }
.details { display: grid; gap: 10px; background: #fcf6ef; border-radius: 16px; padding: 14px; margin-top: 14px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions button { flex: 1; }
.status-banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-size: .95rem; }
.status-banner.info { background: #eef5ff; color: #214b84; }
.status-banner.ok { background: #ecf8ef; color: #1f6a34; }
.status-banner.warn { background: #fff3df; color: #8a5600; }
.empty-state { text-align: center; margin-bottom: 16px; }
code { background: #f5ede6; padding: 2px 6px; border-radius: 6px; }
@media (max-width: 760px) { .topbar, .goal-head { flex-direction: column; align-items: stretch; } .grid, .stats, .stats-grid { grid-template-columns: 1fr 1fr; } .chapter-blocks { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid, .stats, .stats-grid { grid-template-columns: 1fr; } .actions, .goal-controls { flex-direction: column; } }
