:root {
 color-scheme: light;
 font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
 color: #302e2c;
 background: #f7f5f1;
 font-synthesis: none;
 --paper: #fffdf9;
 --line: #d7d1c9;
 --muted: #726c66;
 --accent: #8d7884;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; text-underline-offset: 4px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { font-size: clamp(25px, 4vw, 32px); line-height: 1.4; font-weight: 600; letter-spacing: -.5px; margin: 8px 0 20px; }
h2 { font-size: 19px; font-weight: 600; margin: 0 0 20px; }
h3 { font-size: 17px; font-weight: 600; margin: 0 0 20px; }
p { line-height: 1.7; }
[hidden], .hidden { display: none !important; }
:focus-visible { outline: 3px solid #76616d; outline-offset: 4px; }
.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1080px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; font-family: Georgia, "Times New Roman", serif; font-size: 36px; font-weight: 500; letter-spacing: -2px; text-decoration: none; }
.local-label { font-size: 12px; color: var(--muted); }
.container { max-width: 1080px; margin: auto; padding: 20px 24px calc(120px + env(safe-area-inset-bottom)); }
.save-bar { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 16px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.save-bar #save-status { flex: 1; }
.save-bar button { flex-shrink: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head.compact { margin-bottom: 16px; }
.surface { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; padding: 12px 18px; border: 1px solid transparent; border-radius: 8px; font-size: 15px; font-weight: 600; line-height: 1.5; text-align: center; }
.solid { background: #302e2c; color: #fffdf9; }
.solid:hover { background: #47423e; }
.soft { background: #e7e2db; color: #302e2c; }
.soft:hover { background: #dad3ca; }
.ghost { background: transparent; border-color: #92887e; color: #49443f; }
.danger { background: transparent; border-color: #bba59d; color: #783e31; }
.small { font-size: 13px; min-height: 44px; padding: 10px 14px; }
.full { width: 100%; margin-top: 12px; }
.back { min-height: 44px; border: none; background: none; padding: 8px 0; color: #5e5751; font-size: 14px; }
.buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.text-link { min-height: 44px; padding: 8px 4px; border: 0; background: none; color: #574750; text-decoration: underline; text-underline-offset: 4px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.project-card { min-width: 0; }
.project-open { position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 198px; padding: 24px 48px 24px 24px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: #302e2c; }
.project-open:hover { border-color: #8d7884; }
.project-open:active { background: #efebe5; }
.project-status { font-size: 12px; color: #62564f; margin-bottom: 16px; }
.project-title { font-size: 20px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; margin-bottom: 12px; }
.project-meta { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.project-detail { font-size: 13px; color: var(--muted); margin-top: 8px; }
.card-arrow { position: absolute; right: 22px; bottom: 24px; font-size: 20px; color: #62564f; }
.empty { grid-column: 1/-1; padding: 44px 24px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.empty p { color: var(--muted); font-size: 15px; }
.tips { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.8; }
.tips strong { display: block; color: #49443f; font-weight: 500; }
.sub, .help, .intro { font-size: 14px; line-height: 1.8; color: var(--muted); }
.intro { margin: -8px 0 28px; }
.help { margin: 10px 0 20px; }
label { display: block; margin: 0 0 10px; font-size: 14px; font-weight: 500; line-height: 1.5; }
label:not(:first-child) { margin-top: 24px; }
.required, .optional { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
input:not([type=file]), textarea, select { width: 100%; min-height: 48px; padding: 13px 14px; border: 1px solid #92887e; border-radius: 7px; background: var(--paper); color: #302e2c; font-size: 16px; line-height: 1.5; }
textarea { display: block; min-height: 96px; resize: vertical; }
::placeholder { color: #776e65; opacity: 1; }
input[type=file] { display: block; width: 100%; min-height: 48px; color: #49443f; font-size: 14px; padding: 10px 0; }
input[type=file]::file-selector-button { min-height: 44px; border: 1px solid #92887e; border-radius: 6px; padding: 8px 12px; color: #302e2c; background: #e7e2db; margin-right: 12px; }
.form-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 28px; }
.form-layout > div { min-width: 0; }
.upload { border: 1px dashed #92887e; border-radius: 8px; padding: 18px; }
.upload strong, .upload small { display: block; }
.upload strong { font-size: 15px; font-weight: 500; }
.upload small { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 8px 0; }
.notice { padding: 16px; background: #efebe5; border-radius: 8px; font-size: 13px; line-height: 1.8; }
.notice strong { display: block; font-weight: 500; margin-top: 8px; }
.status { white-space: pre-line; font-size: 14px; line-height: 1.7; }
progress { accent-color: #62564f; }
.raw-editor { min-height: 360px; }
.reader-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.reader-title { margin-bottom: 24px; }
.reader-title h1 { margin-bottom: 8px; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 24px; align-items: start; }
.counter-card { text-align: center; }
.counter-label { font-size: 14px; color: var(--muted); }
.counter-area { display: flex; justify-content: center; align-items: center; gap: 24px; margin: 24px 0; }
.circle { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; border: 1px solid #92887e; color: #302e2c; background: transparent; font-size: 24px; }
.number-block { display: flex; align-items: baseline; gap: 8px; }
.large-number { font-size: 80px; line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -2px; }
.number-suffix { font-size: 14px; color: var(--muted); }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 8px 0; gap: 12px; }
.progress-track { height: 4px; background: #e7e2db; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: #8d7884; }
.row-instruction { text-align: left; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; }
.instruction-label { color: var(--muted); font-size: 13px; }
.instruction { font-size: 20px; line-height: 1.9; margin: 16px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.instruction-warning { font-size: 13px; line-height: 1.8; color: #62564f; }
.done { min-height: 64px; margin-top: 24px; font-size: 16px; }
.counter-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.side-panel { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.side-card { padding: 24px; }
.preview-item { display: flex; gap: 16px; border-top: 1px solid var(--line); padding: 14px 0; font-size: 14px; line-height: 1.8; }
.preview-num { white-space: nowrap; color: var(--muted); }
.preview-text { overflow-wrap: anywhere; white-space: pre-line; }
#view-free { max-width: 680px; margin: auto; }
#free-title { margin: 8px 0 20px; }
.counter-chooser { display: flex; gap: 12px; align-items: center; }
.counter-chooser select { flex: 1; min-width: 0; }
.counter-chooser button { flex-shrink: 0; white-space: nowrap; }
#view-free .surface { margin-bottom: 24px; }
.free-counter { text-align: center; margin-top: 24px; padding: 24px 20px; }
.free-counter p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
#free-count { display: block; margin-bottom: 12px; overflow-wrap: anywhere; }
#free-progress { min-height: 24px; margin-bottom: 20px; }
.free-plus { min-height: 96px; margin: 0 0 12px; font-size: 28px; font-weight: 500; }
.free-counter .buttons { justify-content: space-between; }
.danger-zone { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 24px; }
.danger-zone .help { margin-top: 0; }
.edit-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; align-items: start; }
.steps-editor { min-height: 430px; font-size: 15px; }
.mini-badge { color: var(--muted); font-size: 13px; }
.source-preview { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; line-height: 1.8; max-height: 450px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.settings-grid p { color: var(--muted); font-size: 14px; }
.settings-details { margin-top: 24px; }
.toast { position: fixed; top: 16px; right: 16px; max-width: min(460px, calc(100vw - 32px)); padding: 16px 20px; background: #302e2c; color: #fffdf9; border-radius: 8px; z-index: 40; font-size: 14px; line-height: 1.8; display: none; }
.toast.visible { display: block; }
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; display: flex; justify-content: center; background: #fffdf9; border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); z-index: 30; }
.bottom-nav button { width: 120px; min-height: 48px; border: 0; border-bottom: 2px solid transparent; padding: 10px 4px; background: transparent; color: #726c66; font-size: 14px; font-weight: 500; }
.bottom-nav button.active { color: #302e2c; border-bottom-color: #8d7884; }
@media (max-width: 760px) {
 .topbar { height: 64px; padding: 0 20px; }
 .brand { font-size: 32px; }
 .container { padding: 12px 20px calc(112px + env(safe-area-inset-bottom)); }
 .save-bar { margin-bottom: 12px; }
 .surface { padding: 24px 20px; }
 .section-head { gap: 12px; }
 .section-head .button { font-size: 14px; padding: 12px 14px; }
 .project-grid, .form-layout, .reader-layout, .edit-layout, .settings-grid { grid-template-columns: 1fr; }
 .project-open { min-height: 184px; padding: 20px 44px 20px 20px; }
 .reader-top { gap: 12px; }
 .reader-top .button { padding: 10px 12px; }
 .counter-area { gap: 16px; }
 .large-number { font-size: 76px; }
 .free-counter { padding: 20px 16px; margin-top: 20px; }
 .bottom-nav button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { scroll-behavior: auto !important; }
}

html { scroll-padding-top: 72px; scroll-padding-bottom: 104px; }
.save-bar { position: sticky; top: 0; z-index: 20; background: #f7f5f1; padding: 8px 0; }

.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
