:root {
  --ink: #21302c;
  --muted: #67736f;
  --paper: #f7f7f2;
  --card: #fffef9;
  --line: #d9ded8;
  --green: #236b52;
  --green-dark: #174c3a;
  --green-soft: #dcebe4;
  --gold: #b98533;
  --reason: #d87852;
  --breakdown: #c49a45;
  --solution: #559982;
  --task: #246b54;
  --shadow: 0 12px 32px rgba(39, 57, 50, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(184, 133, 51, .09), transparent 30rem),
    linear-gradient(180deg, #fafaf6 0%, #f2f4ef 100%);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  height: 82px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(35, 107, 82, .12);
  background: rgba(250, 250, 246, .88);
  backdrop-filter: blur(12px);
}

.brand, .top-actions, .goal-input-row, .examples, .legend, .node-topline, .node-actions, .dialog-head, .dialog-actions { display: flex; align-items: center; }
.brand { gap: 0; }
.brand-logo { width: 174px; height: 58px; margin: 3px 0 -6px; }
.brand-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand .eyebrow { color: var(--ink); font-size: 10px; font-weight: 800; line-height: 1.3; letter-spacing: .04em; white-space: nowrap; }
.eyebrow { margin: 0; color: var(--muted); font: 700 10px/1.2 system-ui, sans-serif; letter-spacing: .18em; }
.eyebrow.accent { color: var(--gold); }
.version { margin-left: 12px; padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 700; }
.top-actions { gap: 10px; }
.save-status { color: var(--muted); font-size: 12px; }
.menu-button { width: 44px; height: 44px; display: grid; place-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); cursor: pointer; }
.menu-button span { width: 19px; height: 2px; border-radius: 2px; background: var(--ink); }

.button { border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; font-weight: 700; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(35, 107, 82, .2); }
.button.primary:hover { background: var(--green-dark); }
.button.ghost { border: 1px solid var(--line); background: rgba(255,255,255,.65); }
.button.danger { color: #9c4b3f; }
.ai-usage-status { padding: 7px 10px; border: 1px solid rgba(87,77,142,.2); border-radius: 999px; color: #554b8f; background: #f4f1ff; font-size: 10px; font-weight: 800; white-space: nowrap; }
.ai-usage-status.warning { border-color: rgba(185,133,51,.3); color: #8d661f; background: #fff9e9; }
.ai-usage-status.reached { border-color: rgba(166,83,56,.3); color: #a65338; background: #fff0ea; }
.ai-usage-banner { margin: 16px clamp(18px, 4vw, 64px) 0; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid rgba(185,133,51,.25); border-radius: 10px; color: #765718; background: #fffbef; font-size: 11px; line-height: 1.6; }
.ai-usage-banner strong { font-size: 12px; }
.ai-usage-banner.reached { align-items: flex-start; flex-direction: column; gap: 3px; border-color: rgba(166,83,56,.28); color: #914a34; background: #fff3ee; }
.ai-usage-banner[hidden], .ai-usage-status[hidden] { display: none !important; }

main { min-height: calc(100vh - 82px); }
.auth-gate { width: min(760px, calc(100% - 40px)); min-height: calc(100vh - 82px); margin: 0 auto; display: flex; align-items: center; justify-content: center; padding: 36px 0; }
.auth-gate-inner { width: min(620px, 100%); display: grid; gap: 12px; }
.auth-gate-card { width: 100%; padding: clamp(30px, 6vw, 58px); border: 1px solid rgba(35,107,82,.15); border-radius: 24px; background: rgba(255,254,249,.9); box-shadow: var(--shadow); text-align: center; }
.auth-gate-card h2 { margin: 15px 0 18px; font: 500 clamp(34px, 5vw, 52px)/1.35 Georgia, "Yu Mincho", serif; letter-spacing: .02em; }
.auth-kept-message { margin: -5px 0 15px; color: var(--green-dark); font-size: 15px; font-weight: 800; }
.auth-gate-copy { max-width: 34em; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.9; }
.auth-gate-actions { max-width: 360px; margin: 30px auto 0; display: grid; gap: 10px; }
.auth-gate-actions .button { min-height: 50px; }
.auth-gate-actions .text-button { margin-top: 4px; }
.auth-gate-status { min-height: 20px; margin: 16px 0 0; color: var(--muted); font-size: 11px; }
.guest-notice { margin: 18px clamp(18px, 4vw, 64px) 0; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(185,133,51,.25); border-radius: 11px; background: #fffbef; }
.guest-notice > div { display: flex; align-items: center; gap: 9px; }
.guest-notice strong { color: var(--gold); font-size: 12px; }
.guest-notice span { color: var(--muted); font-size: 11px; }
.guest-notice .button { padding: 8px 10px; font-size: 10px; white-space: nowrap; }
.start-screen { width: min(1080px, calc(100% - 40px)); min-height: calc(100vh - 82px); margin: 0 auto; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: clamp(40px, 8vw, 120px); }
.start-copy h2 { margin: 14px 0 20px; font: 500 clamp(34px, 4.5vw, 62px)/1.35 Georgia, "Yu Mincho", serif; letter-spacing: .02em; }
.start-kept-message { margin: -7px 0 12px; color: var(--green-dark); font-size: clamp(15px, 1.4vw, 18px); font-weight: 800; }
.start-copy > p:last-child { max-width: 32em; color: var(--muted); line-height: 1.9; }
.migi-first-guide { grid-column: 1; max-width: 34em; margin-top: -72px; padding: 12px 14px; display: grid; gap: 4px; border-left: 3px solid var(--gold); border-radius: 8px; color: var(--muted); background: #fffbef; font-size: 11px; line-height: 1.7; }
.migi-first-guide strong { color: var(--gold); font-size: 11px; }
.goal-form { grid-column: 2; grid-row: 1 / span 2; padding: clamp(24px, 4vw, 44px); border: 1px solid rgba(35,107,82,.13); border-radius: 22px; background: rgba(255,254,249,.86); box-shadow: var(--shadow); }
.goal-form > label, .dialog label { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.goal-input-row { align-items: stretch; gap: 10px; }
.goal-input-row input, .dialog input, .dialog select { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
.goal-input-row input:focus, .dialog input:focus, .dialog select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35,107,82,.11); }
.password-field { position: relative; display: block; }
.dialog .password-field { margin-bottom: 18px; }
.dialog .password-field > input { margin-bottom: 0; padding-right: 50px; }
.password-visibility-toggle { position: absolute; top: 50%; right: 8px; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; transform: translateY(-50%); border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.password-visibility-toggle:hover, .password-visibility-toggle:focus-visible { color: var(--green); background: var(--green-soft); outline: none; }
.password-visibility-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility-toggle.is-visible::after { content: ""; position: absolute; width: 25px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-45deg); }
.goal-input-row .button { white-space: nowrap; }
.examples { flex-wrap: wrap; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.examples button { padding: 5px 8px; border: 0; border-radius: 6px; background: #eef1ec; cursor: pointer; font-size: 11px; }

.workspace { padding: 34px clamp(18px, 4vw, 64px) 46px; }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.workspace-head h2 { margin: 7px 0 0; font: 500 clamp(24px, 3vw, 38px)/1.3 Georgia, "Yu Mincho", serif; }
.mobile-step { display: none; }
.legend { flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: var(--muted); font-size: 11px; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.dot.goal { color: var(--green); } .dot.reason { color: var(--reason); } .dot.breakdown { color: var(--breakdown); } .dot.solution { color: var(--solution); } .dot.task { color: var(--task); }
.progress-wrap { margin-top: 24px; }
.journey-steps { margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; }
.journey-steps li { position: relative; display: grid; justify-items: center; gap: 5px; color: #9aa39f; font-size: 9px; text-align: center; }
.journey-steps li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 12px; left: calc(50% + 15px); width: calc(100% - 30px); height: 1px; background: #dce1dc; }
.journey-steps span { position: relative; z-index: 1; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #dce1dc; border-radius: 50%; background: #fafaf6; font-size: 11px; font-weight: 800; }
.journey-steps li.done { color: var(--green); }
.journey-steps li.done span { border-color: var(--green); color: white; background: var(--green); }
.journey-steps li.done:not(:last-child)::after { background: rgba(35,107,82,.45); }
.journey-steps li.current { color: var(--green-dark); }
.journey-steps li.current span { border: 2px solid var(--green); color: var(--green); background: white; box-shadow: 0 0 0 4px rgba(35,107,82,.08); }
.progress-wrap::before { content: ""; display: block; height: 3px; border-radius: 3px; background: #e1e5df; }
.progress-bar { height: 3px; max-width: 100%; margin-top: -3px; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--green)); transition: width .35s; }
.progress-wrap p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.progress-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.progress-stat { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.62); font-size: 10px; font-weight: 700; }
.progress-stat.warn { border-color: rgba(216,120,82,.35); color: #a65338; background: #fff5f0; }
.progress-stat.good { border-color: rgba(35,107,82,.25); color: var(--green); background: #eef7f2; }

.map-scroll { min-height: 440px; margin: 22px calc(clamp(18px, 4vw, 64px) * -1) 0; padding: 10px clamp(18px, 4vw, 64px) 28px; overflow-x: auto; }
.map { position: relative; width: max-content; min-width: 100%; }
.columns { position: relative; z-index: 2; display: flex; align-items: flex-start; gap: 68px; }
.column { width: 250px; flex: 0 0 250px; }
.column-title { min-height: 28px; margin: 0 0 13px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.column-nodes { display: flex; flex-direction: column; gap: 14px; }
.connections { position: absolute; z-index: 1; inset: 0; overflow: visible; pointer-events: none; }
.connections path { fill: none; stroke: #cbd2cc; stroke-width: 1.5; }

.node-card { position: relative; min-height: 136px; padding: 17px; border: 1px solid #dce1dc; border-top: 3px solid var(--node-color, var(--green)); border-radius: 12px; background: var(--card); box-shadow: 0 5px 16px rgba(38,55,49,.055); }
.node-card.is-task { background: #f1f8f4; }
.task-reached-label { margin: 11px 0 -4px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.node-card.is-editing { box-shadow: 0 0 0 3px rgba(35,107,82,.1), var(--shadow); }
.node-topline { justify-content: space-between; gap: 10px; }
.node-type { color: var(--node-color); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.node-menu { border: 0; color: #9aa39f; background: transparent; cursor: pointer; }
.node-text { min-height: 42px; margin: 13px 0 15px; font-size: 15px; font-weight: 700; line-height: 1.65; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: -6px 0 12px; }
.task-meta:empty { display: none; }
.task-meta span { padding: 4px 7px; border-radius: 5px; color: var(--green-dark); background: var(--green-soft); font-size: 10px; }
.branch-status { margin: -6px 0 11px; }
.branch-status:empty { display: none; }
.branch-status span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 6px; color: #a65338; background: #fff0ea; font-size: 10px; font-weight: 800; }
.branch-status span.complete { color: var(--green); background: var(--green-soft); }
.decomposition-guide { margin: 0 0 11px; padding: 10px 11px; border-left: 3px solid var(--gold); border-radius: 7px; color: #5f5436; background: #fffbef; }
.decomposition-guide[hidden] { display: none; }
.decomposition-guide strong { display: block; color: #745f26; font-size: 11px; line-height: 1.55; }
.decomposition-guide p { display: none; }
.node-actions { flex-wrap: wrap; gap: 6px; }
.node-actions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: white; cursor: pointer; font-size: 10px; font-weight: 700; }
.node-actions .add-button { border-color: transparent; color: white; background: var(--node-color); }
.node-actions .ai-button { border-color: rgba(87,77,142,.22); color: #554b8f; background: #f2effd; }
.node-actions .ai-button[disabled] { cursor: wait; opacity: .62; }
.node-actions .ai-button.limit-reached { cursor: not-allowed; color: #8b6257; background: #f5eeeb; }
.node-editor { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.node-editor textarea { width: 100%; min-height: 70px; resize: vertical; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 7px; }
.node-editor button { padding: 6px 9px; border: 0; border-radius: 6px; cursor: pointer; font-size: 10px; font-weight: 700; }
.node-editor .save-child { color: white; background: var(--green); }
.ai-suggestions { margin-top: 12px; padding: 12px; border: 1px solid #ded8f2; border-radius: 9px; background: #faf8ff; }
.ai-suggestions[hidden] { display: none; }
.ai-suggestions-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #554b8f; font-size: 10px; font-weight: 800; }
.ai-suggestions-stage { margin-left: auto; padding: 3px 6px; border-radius: 999px; color: #554b8f; background: #ece8f8; font-size: 8px; white-space: nowrap; }
.ai-suggestions-head button { border: 0; background: transparent; cursor: pointer; }
.ai-suggestions-intro { margin: 0 0 5px; color: #6d6587; font-size: 10px; line-height: 1.65; }
.ai-suggestion { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid #ebe7f6; }
.ai-suggestion p { margin: 0; font-size: 12px; line-height: 1.55; }
.ai-suggestion-tools { flex: 0 0 auto; display: grid; gap: 5px; }
.ai-suggestion button { padding: 6px 8px; border: 0; border-radius: 6px; color: #fff; background: #675aa2; cursor: pointer; font-size: 10px; font-weight: 800; white-space: nowrap; }
.ai-suggestion button.edit-suggestion { border: 1px solid #d7d0ec; color: #554b8f; background: white; }
.ai-suggestions-manual { width: 100%; margin-top: 7px; padding: 8px 10px; border: 1px dashed #bbb2d7; border-radius: 7px; color: #554b8f; background: white; cursor: pointer; font-size: 10px; font-weight: 800; }
.ai-error { margin: 0; color: #a65338; font-size: 11px; line-height: 1.6; }
.mobile-child-nav { display: none; }

.coach { max-width: 840px; margin: 8px auto 0; padding: 17px 20px; display: flex; gap: 14px; border: 1px solid rgba(185,133,51,.22); border-radius: 12px; background: #fffbef; }
.coach-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--gold); font-family: Georgia, serif; font-weight: 700; }
.coach-label { margin: 0 0 3px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.coach p:last-child { margin: 0; font-size: 13px; line-height: 1.7; }

.home-utilities { width: min(760px, calc(100% - 40px)); margin: 14px auto 0; display: grid; gap: 12px; }
.resume-card, .update-card { min-width: 0; padding: 14px 16px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,254,249,.92); box-shadow: 0 5px 16px rgba(38,55,49,.04); }
.utility-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 13px; font-weight: 800; }
.utility-icon.info { color: var(--green); background: var(--green-soft); }
.resume-card p, .update-card p { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
.resume-card strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.resume-card .button { padding: 8px 11px; font-size: 10px; white-space: nowrap; }
.update-card ul { margin: 3px 0 0; padding: 0; color: var(--muted); font-size: 10px; line-height: 1.55; list-style: none; }
.update-card li::before { content: "・"; }
.update-card .text-button { margin: 0; white-space: nowrap; }
.auth-update-card { padding: 10px 14px; background: rgba(255,254,249,.72); box-shadow: none; }
.stop-button { margin-left: auto; padding: 8px 12px; font-size: 10px; white-space: nowrap; }
.dialog-content { padding: 28px; }
.compact-dialog { width: min(480px, calc(100% - 28px)); }
.changelog-list { max-height: 55vh; margin-top: 18px; overflow-y: auto; }
.changelog-entry { padding: 14px 0; border-top: 1px solid var(--line); }
.changelog-entry:first-child { border-top: 0; }
.changelog-entry h3 { margin: 0 0 7px; font-size: 13px; }
.changelog-entry time { margin-left: 8px; color: var(--muted); font-size: 10px; font-weight: 500; }
.changelog-entry ul { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: 11px; line-height: 1.7; }
.app-toast { position: fixed; z-index: 100; right: 20px; bottom: 112px; max-width: min(380px, calc(100% - 40px)); padding: 13px 16px; border-radius: 10px; color: white; background: var(--green-dark); box-shadow: 0 14px 40px rgba(20,38,31,.24); font-size: 12px; font-weight: 700; line-height: 1.55; }
.next-action-nudge { position: fixed; z-index: 95; left: 50%; bottom: 22px; width: min(520px, calc(100% - 32px)); min-height: 74px; padding: 12px 14px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; border: 2px solid #b9d9c9; border-radius: 17px; color: var(--ink); background: #fffef9; box-shadow: 0 18px 48px rgba(23,76,58,.22); text-align: left; transform: translateX(-50%); animation: nudge-pop .38s cubic-bezier(.2,.9,.25,1.15); }
.next-action-nudge[hidden] { display: none; }
.next-action-nudge.is-actionable { cursor: pointer; }
.next-action-nudge.is-actionable:hover { border-color: #7fb69e; box-shadow: 0 20px 52px rgba(23,76,58,.28); }
.next-action-nudge.is-actionable:focus-visible { outline: 3px solid rgba(35,107,82,.28); outline-offset: 3px; }
.nudge-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--green); font-size: 22px; font-weight: 900; }
.nudge-message { min-width: 0; }
.nudge-message strong { display: block; overflow: hidden; color: var(--green-dark); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.nudge-message small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.nudge-action { padding: 7px 9px; border-radius: 9px; color: #fff; background: var(--green); font-size: 10px; font-weight: 800; white-space: nowrap; }
.next-action-nudge:not(.is-actionable) .nudge-action { display: none; }
@keyframes nudge-pop { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes guidance-target-pulse { 0%,100% { box-shadow: var(--shadow); } 45% { box-shadow: 0 0 0 5px rgba(35,107,82,.2), 0 16px 42px rgba(23,76,58,.2); } }
.node-card.guidance-target { animation: guidance-target-pulse .8s ease 2; }
@keyframes added-node-pulse { 0% { transform: translateY(8px); opacity: .55; } 35% { transform: translateY(0); opacity: 1; box-shadow: 0 0 0 5px rgba(103,90,162,.18), var(--shadow); } 100% { box-shadow: var(--shadow); } }
.node-card.just-added { animation: added-node-pulse .75s ease 2; }

.dialog { width: min(540px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 24px 80px rgba(20,40,32,.25); }
.dialog::backdrop { background: rgba(25,39,34,.42); backdrop-filter: blur(3px); }
.dialog form { padding: 28px; }
.dialog-head { justify-content: space-between; gap: 20px; }
.dialog h2 { margin: 5px 0 0; font: 500 25px/1.35 Georgia, "Yu Mincho", serif; }
.dialog-intro { margin: 14px 0 22px; color: var(--muted); font-size: 13px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eef1ec; cursor: pointer; font-size: 20px; }
.dialog input, .dialog select { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 8px; }
.goal-summary { margin: 18px 0 8px; padding: 12px 14px; border-left: 3px solid var(--green); color: var(--ink); background: #f1f6f3; font-size: 14px; font-weight: 700; line-height: 1.6; }
.optional { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 500; }
.date-nudge { margin: -9px 0 20px; color: var(--gold); font-size: 11px; }
.form-error { min-height: 20px; margin: -6px 0 8px; color: #a33e35; font-size: 12px; }
.form-message { min-height: 20px; margin: -6px 0 8px; color: var(--green); font-size: 12px; line-height: 1.6; }
.text-button { margin: -3px 0 12px; padding: 3px 0; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }

.drawer-layer { position: fixed; z-index: 60; inset: 0; display: flex; justify-content: flex-end; }
.drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(22,35,30,.38); backdrop-filter: blur(2px); cursor: pointer; }
.drawer { position: relative; width: min(460px, 100%); height: 100%; padding: 26px; overflow-y: auto; background: #fafaf6; box-shadow: -18px 0 60px rgba(20,38,31,.18); animation: drawer-in .22s ease-out; }
@keyframes drawer-in { from { transform: translateX(22px); opacity: .4; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.drawer-head h2 { margin: 6px 0 0; font: 500 28px/1.3 Georgia, "Yu Mincho", serif; }
.account-summary { margin: 20px 0; padding: 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 13px; font-weight: 800; }
.account-summary strong, .account-summary small { display: block; }
.account-summary strong { font-size: 13px; }
.account-summary small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.account-summary .button { padding: 8px 10px; font-size: 10px; }
.plan-summary { margin: -10px 0 14px; padding: 11px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; border: 1px solid #dce5df; border-radius: 11px; background: #f7faf8; }
.plan-summary[hidden] { display: none; }
.plan-summary div { display: flex; align-items: baseline; gap: 7px; }
.plan-summary small { color: var(--muted); font-size: 9px; font-weight: 800; }
.plan-summary strong { color: var(--green-dark); font-size: 16px; }
.plan-summary span { padding: 2px 6px; border-radius: 999px; color: var(--green-dark); background: #e4efe9; font-size: 8px; font-weight: 800; }
.plan-summary p { margin: 0; color: var(--muted); font-size: 9px; }
.plan-summary .button { grid-column: 2; grid-row: 1 / span 3; padding: 8px 10px; font-size: 10px; }
.drawer-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 5px; border-radius: 10px; background: #e9ede8; }
.drawer-nav button { min-height: 38px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.drawer-nav button.active { color: var(--green-dark); background: white; box-shadow: 0 2px 8px rgba(30,48,40,.08); }
.plans-dialog { width: min(860px, calc(100% - 28px)); }
.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.plan-card.current { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: #f7faf8; }
.plan-card h3 { margin: 0; font-size: 19px; }
.plan-price { margin: 9px 0 13px; color: var(--muted); font-size: 11px; }
.plan-price strong { color: var(--ink); font-size: 23px; }
.plan-card ul { min-height: 94px; margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.plan-card .button { width: 100%; min-height: 38px; padding: 8px; font-size: 11px; }
.selected-plan-price { margin: 18px 0 0; color: var(--green-dark); font-size: 19px; font-weight: 800; }
.admin-page-link { margin-top: 8px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(209,122,80,.28); border-radius: 9px; color: var(--green-dark); background: #fff8f3; font-size: 11px; font-weight: 800; text-decoration: none; }
.admin-page-link:hover { border-color: rgba(209,122,80,.5); background: #fff3ea; }
.drawer-content { min-height: 280px; padding: 20px 0; }
.drawer-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.drawer-section-title h3 { margin: 0; font-size: 14px; }
.drawer-section-title span { color: var(--muted); font-size: 10px; }
.goal-list, .task-list { display: grid; gap: 9px; }
.goal-list-item, .task-list-item { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.goal-list-item.active { border-color: rgba(35,107,82,.42); box-shadow: 0 0 0 2px rgba(35,107,82,.08); }
.goal-list-item button.goal-switch { width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.goal-list-item strong, .task-list-item strong { display: block; font-size: 13px; line-height: 1.55; }
.goal-list-meta, .task-list-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.task-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.task-check { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--green); cursor: pointer; }
.task-list-item.done strong { color: var(--muted); text-decoration: line-through; }
.task-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.task-tools button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf7; cursor: pointer; font-size: 10px; font-weight: 700; }
.empty-message { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }
.drawer-footer { position: sticky; bottom: -26px; margin: 0 -26px -26px; padding: 15px 26px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 7px; border-top: 1px solid var(--line); background: rgba(250,250,246,.96); backdrop-filter: blur(8px); }
.drawer-footer .button { flex: 1 1 auto; padding: 10px 11px; font-size: 10px; }
.account-panel { display: grid; gap: 12px; }
.account-panel-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.account-panel-card h3 { margin: 0 0 8px; font-size: 13px; }
.account-panel-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.account-panel-card .account-email { margin-top: 11px; padding-top: 10px; display: grid; gap: 3px; border-top: 1px solid var(--line); }
.account-email span { color: var(--muted); font-size: 10px; font-weight: 700; }
.account-email strong { color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.guide-panel { display: grid; gap: 10px; }
.guide-intro { margin: 0 0 2px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.guide-flow { padding: 12px; border-radius: 9px; color: var(--green-dark); background: var(--green-soft); text-align: center; font-size: 11px; font-weight: 800; line-height: 1.8; }
.guide-step { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.guide-step h4 { margin: 0 0 6px; color: var(--green-dark); font-size: 12px; }
.guide-step p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.guide-tip { padding: 13px 14px; border: 1px solid rgba(185,133,51,.24); border-radius: 10px; background: #fffbef; }
.guide-tip strong { display: block; margin-bottom: 5px; color: var(--gold); font-size: 11px; }
.guide-tip p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.mobile-outline { display: grid; gap: 7px; }
.mobile-outline-node { width: calc(100% - min(calc(var(--outline-depth) * 16px), 112px)); margin-left: min(calc(var(--outline-depth) * 16px), 112px); padding: 10px 11px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; color: var(--ink); background: white; cursor: pointer; text-align: left; }
.mobile-outline-node small { color: var(--muted); font-size: 9px; font-weight: 800; }
.mobile-outline-node span { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mobile-outline-node b { color: var(--green); font-size: 9px; }
.mobile-outline-node.current { border-color: var(--green); background: #f1f8f4; box-shadow: 0 0 0 2px rgba(35,107,82,.08); }
.mobile-outline-node.task { border-left-color: var(--green); }

@media (max-width: 780px) {
  body { background: linear-gradient(180deg, #fafaf6 0%, #f4f5f1 100%); }
  .topbar { height: auto; min-height: 74px; padding: 14px 18px; }
  .topbar { position: sticky; z-index: 20; top: 0; }
  .brand { gap: 0; }
  .brand-logo { width: 138px; height: 46px; margin: 4px 0 -4px; }
  .brand .eyebrow { font-size: 9px; line-height: 1.3; letter-spacing: .02em; }
  .version, #export-button { display: none; }
  .save-status { display: inline; max-width: 96px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .ai-usage-status { padding: 6px 8px; font-size: 9px; }
  .top-actions { margin-left: auto; }
  .auth-gate { min-height: calc(100vh - 74px); width: calc(100% - 28px); padding: 28px 0; }
  .auth-gate-card { padding: 34px 20px; border-radius: 18px; }
  .auth-gate-card h2 { font-size: 34px; }
  .auth-gate-copy { font-size: 13px; }
  .guest-notice { margin: 12px 14px 0; align-items: stretch; flex-direction: column; }
  .ai-usage-banner { margin: 12px 14px 0; align-items: flex-start; flex-direction: column; gap: 3px; }
  .ai-suggestion { align-items: stretch; flex-direction: column; }
  .ai-suggestion-tools { display: flex; flex-wrap: wrap; }
  .guest-notice > div { justify-content: space-between; }
  .guest-notice > div:first-child { align-items: flex-start; flex-direction: column; gap: 3px; }
  #reset-button { min-height: 42px; padding: 8px 11px; font-size: 11px; }
  .start-screen { min-height: calc(100vh - 74px); grid-template-columns: 1fr; align-content: center; gap: 34px; padding: 42px 0; }
  .start-copy h2 { font-size: 36px; }
  .start-copy br { display: none; }
  .start-copy > p:last-child { margin-bottom: 0; font-size: 14px; }
  .migi-first-guide { grid-column: 1; margin: -18px 0 0; }
  .goal-form { padding: 22px 18px; border-radius: 16px; }
  .goal-form { grid-column: 1; grid-row: auto; }
  .goal-input-row { flex-direction: column; }
  .goal-input-row input { min-height: 54px; font-size: 16px; }
  .goal-input-row .button { min-height: 50px; }
  .examples { align-items: flex-start; flex-direction: column; }
  .examples button { min-height: 34px; text-align: left; }
  .workspace { padding: 8px 16px 32px; display: flex; flex-direction: column; scroll-margin-top: 74px; }
  .workspace-head { order: 5; margin-top: 16px; align-items: center; justify-content: flex-end; }
  .workspace-head > div { display: none; }
  .workspace-head h2 { font-size: 28px; }
  .legend { justify-content: flex-start; }
  .mobile-step { position: sticky; z-index: 12; top: 74px; margin: 0 -16px; padding: 10px 16px 12px; display: block; border-top: 1px solid rgba(35,107,82,.08); border-bottom: 1px solid rgba(35,107,82,.12); background: rgba(250,250,246,.96); box-shadow: 0 7px 16px rgba(33,48,44,.04); backdrop-filter: blur(10px); }
  .mobile-step-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .mobile-nav-button { padding: 5px 0; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 10px; font-weight: 800; }
  .mobile-nav-button:disabled { visibility: hidden; }
  .mobile-breadcrumbs { margin-top: 6px; padding-bottom: 3px; display: flex; align-items: center; gap: 5px; overflow-x: auto; overflow-y: hidden; color: #a1aaa5; font-size: 9px; scrollbar-width: none; }
  .mobile-breadcrumbs::-webkit-scrollbar { display: none; }
  .mobile-breadcrumbs > span { flex: 0 0 auto; }
  .mobile-breadcrumbs button { flex: 0 0 auto; max-width: none; padding: 2px 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
  .mobile-breadcrumbs button.current { color: var(--green-dark); cursor: default; font-weight: 900; text-decoration: none; }
  .mobile-breadcrumbs button:disabled { opacity: 1; }
  .mobile-path { margin-top: 9px; display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .mobile-path::-webkit-scrollbar { display: none; }
  .mobile-path-chip { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 9px; font-weight: 800; }
  .mobile-path-chip.current { border-color: var(--green); color: white; background: var(--green); }
  .mobile-path-arrow { flex: 0 0 auto; color: #aeb8b2; font-size: 10px; }
  .mobile-stage-text { margin: 7px 0 0; color: var(--green-dark); font-size: 10px; font-weight: 800; }
  .progress-wrap { margin: 10px 0 0; }
  .progress-wrap::before, .progress-bar, #progress-text { display: none; }
  .journey-steps { display: none; }
  .journey-steps strong { max-width: 58px; line-height: 1.25; }
  .progress-stats { margin-top: 0; gap: 5px; }
  .progress-stat { padding: 4px 7px; font-size: 8px; }
  .workspace-head .stop-button { width: auto; margin-left: auto; padding: 7px 10px; font-size: 9px; }
  .home-utilities { width: calc(100% - 28px); margin-top: 10px; grid-template-columns: 1fr; }
  .resume-card { padding: 10px 12px; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  .resume-card .utility-icon { display: none; }
  .resume-card .button { width: auto; margin: 0; padding: 7px 9px; font-size: 9px; }
  .update-card { grid-template-columns: auto minmax(0,1fr); }
  .update-card .text-button { grid-column: 1 / -1; width: 100%; margin: 0; }
  .map-scroll { min-height: 0; margin: 14px 0 0; padding: 0; overflow: visible; }
  .map { width: 100%; min-width: 0; }
  .columns { width: 100%; display: block; }
  .column { position: relative; width: 100%; flex: none; padding-bottom: 22px; }
  .column:not(.has-mobile-active) { display: none; }
  .column::after { display: none; }
  .column-title { min-height: 0; margin: 0 0 8px; padding-left: 3px; font-size: 10px; }
  .column-nodes { gap: 10px; }
  .node-card:not(.mobile-active) { display: none; }
  .connections { display: none; }
  .node-card { min-height: 0; padding: 15px; border-radius: 11px; }
  .node-card.mobile-enter-forward { animation: mobile-forward .24s ease-out; }
  .node-card.mobile-enter-back { animation: mobile-back .2s ease-out; }
  @keyframes mobile-forward { from { opacity: .3; transform: translateX(18px); } }
  @keyframes mobile-back { from { opacity: .3; transform: translateX(-18px); } }
  .node-text { min-height: 0; margin: 10px 0 13px; font-size: 15px; }
  .node-actions button { min-height: 40px; padding: 9px 12px; font-size: 11px; }
  .node-actions .add-button { flex: 1 1 160px; }
  .node-editor textarea { min-height: 86px; font-size: 16px; }
  .node-editor button { min-height: 40px; padding: 8px 12px; font-size: 11px; }
  .mobile-child-nav { margin-top: 15px; padding-top: 13px; display: grid; gap: 7px; border-top: 1px dashed var(--line); }
  .mobile-child-nav > strong { color: var(--muted); font-size: 9px; letter-spacing: .06em; }
  .mobile-child-nav button { min-height: 42px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid rgba(35,107,82,.2); border-radius: 8px; color: var(--green-dark); background: #f2f8f4; cursor: pointer; font-size: 11px; font-weight: 800; text-align: left; }
  .mobile-child-nav button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-child-nav button b { font-size: 15px; }
  .task-reached-label { padding: 7px 9px; border-radius: 7px; color: white; background: var(--green); text-align: center; }
  .coach { margin: 10px 0 0; padding: 11px 12px; display: flex; gap: 9px; }
  .coach-icon { width: 26px; height: 26px; flex-basis: 26px; }
  .coach p:last-child { font-size: 11px; line-height: 1.55; }
  .dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .dialog form { max-height: 88vh; padding: 24px 18px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .dialog-content { max-height: 88vh; padding: 24px 18px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .dialog input, .dialog select { min-height: 52px; font-size: 16px; }
  .dialog-actions { position: sticky; bottom: 0; padding-top: 10px; background: white; }
  .dialog-actions .button { min-height: 46px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .drawer { padding: 20px 16px; }
  .drawer-footer { bottom: -20px; margin: 0 -16px -20px; padding-right: 16px; padding-left: 16px; }
  .account-summary { grid-template-columns: auto 1fr; }
  .account-summary .button { grid-column: 1 / -1; }
  .plan-summary { margin-top: -10px; }
  .plan-summary .button { grid-column: auto; grid-row: 1 / span 3; }
  .drawer-nav { grid-template-columns: repeat(2, 1fr); }
  .plan-cards { grid-template-columns: 1fr; }
  .plan-card { padding: 15px; }
  .plan-card ul { min-height: 0; }
  .app-toast { right: 14px; bottom: calc(94px + env(safe-area-inset-bottom)); max-width: calc(100% - 28px); }
  .next-action-nudge { bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(100% - 28px); min-height: 68px; padding: 10px 12px; grid-template-columns: 38px minmax(0,1fr) auto; gap: 8px; border-radius: 15px; }
  .nudge-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
  .nudge-message strong { font-size: 13px; }
  .nudge-message small { font-size: 9px; }
  .nudge-action { max-width: 62px; padding: 6px 7px; font-size: 8px; white-space: normal; text-align: center; }
  .mobile-outline-dialog { max-height: 92vh; }
}

@media (max-width: 390px) {
  .save-status { display: none; }
  .start-copy h2 { font-size: 31px; }
  .workspace-head h2 { font-size: 25px; }
  .legend { gap: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
