:root {
  --paper: #fffaf1;
  --paper-deep: #f5ecdd;
  --ink: #24252b;
  --muted: #65646a;
  --line: #d9d1c4;
  --indigo: #353f80;
  --indigo-soft: #e5e7f6;
  --coral: #c95e50;
  --coral-soft: #f8e0da;
  --gold: #d7ad55;
  --shadow: 0 20px 55px rgba(35, 37, 43, .09);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { display: flex; min-width: 0; min-height: 100vh; margin: 0; flex-direction: column; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.55; }
main { flex: 1 0 auto; }
a { color: inherit; }
button, select, input { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.skip-link { position: fixed; z-index: 10; top: 10px; left: 10px; min-height: 44px; padding: 10px 14px; color: #fff; background: var(--indigo); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid rgba(217, 209, 196, .8); background: rgba(255, 250, 241, .92); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font-weight: 780; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px 9px 14px 9px; color: #fff; background: var(--indigo); font-size: .72rem; letter-spacing: .04em; }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.main-nav a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: 9px; color: #393940; text-decoration: none; font-size: .93rem; font-weight: 650; }
.main-nav a:hover, .main-nav a:focus-visible { color: var(--indigo); background: var(--indigo-soft); outline: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr); align-items: center; gap: clamp(36px, 7vw, 92px); padding-top: clamp(52px, 6vw, 80px); padding-bottom: clamp(52px, 6vw, 80px); }
.eyebrow, .section-label { margin: 0 0 13px; color: var(--coral); font-size: .78rem; font-weight: 800; letter-spacing: .105em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 22px; font-size: clamp(2.8rem, 5.3vw, 5.25rem); line-height: .99; letter-spacing: -.065em; }
h2 { margin-bottom: 18px; font-size: clamp(2rem, 3.4vw, 3.15rem); line-height: 1.08; letter-spacing: -.045em; }
h3 { margin-bottom: 8px; font-size: 1.14rem; line-height: 1.25; letter-spacing: -.018em; }
.lede { max-width: 630px; margin-bottom: 28px; color: #4c4c54; font-size: clamp(1.05rem, 1.5vw, 1.27rem); line-height: 1.65; }
.copy-sentence { display: block; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd, label, legend, figcaption, .copy-sentence { text-wrap: pretty; }
.resource-next { margin: 24px 0 0; }
.resource-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 50px; padding: 12px 18px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 760; line-height: 1.2; text-align: center; text-decoration: none; }
.button-primary { color: #fff; background: var(--indigo); box-shadow: 0 9px 0 #262e64; }
.button-primary:hover, .button-primary:focus-visible { background: #4450a1; outline: 3px solid rgba(53, 63, 128, .2); outline-offset: 3px; }
.button-secondary { color: var(--indigo); border-color: var(--indigo); background: transparent; }
.button-secondary:hover, .button-secondary:focus-visible { background: var(--indigo-soft); outline: 3px solid rgba(53, 63, 128, .15); outline-offset: 3px; }
.hero-action { margin-bottom: 24px; }
.privacy-note { display: flex; align-items: flex-start; gap: 9px; max-width: 540px; margin-bottom: 0; color: var(--muted); font-size: .91rem; }
.privacy-dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: .42em; border-radius: 999px; background: var(--coral); }
.time-sketch { margin: 0; padding: clamp(24px, 4vw, 42px); border: 1px solid #dfd6c8; border-radius: 34px 14px 34px 14px; background: #f8f1e6; box-shadow: var(--shadow); transform: rotate(1.5deg); }
.sketch-topline, .sketch-key, .allocation-row-heading, .panel-heading, .result-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sketch-topline { padding-bottom: 18px; color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.week-blocks { display: grid; grid-template-columns: 1.9fr .85fr 1.35fr .95fr 1fr; align-items: stretch; min-height: 140px; overflow: hidden; border-radius: 12px; background: #e1d8c9; }
.block { min-width: 0; border-right: 3px solid #f8f1e6; }
.block-kana { background: #d7ad55; }
.block-words { background: #e1846b; }
.block-grammar { background: #4b579e; }
.block-listening { background: #7598ae; }
.block-practice { border-right: 0; background: #8e9a68; }
.sketch-key { flex-wrap: wrap; justify-content: flex-start; padding-top: 17px; color: #5d5b58; font-size: .77rem; }
.sketch-key span { display: inline-flex; align-items: center; gap: 6px; }
.sketch-key i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.sketch-key .key-grammar { background: #4b579e; }
.sketch-key .key-listening { background: #7598ae; }
figcaption { margin-top: 20px; color: #585756; font-size: .93rem; }
.planner-section { padding: clamp(52px, 6vw, 72px) 0; border-block: 1px solid #ded5c7; background: #f4eadc; }
.planner-grid { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); gap: clamp(34px, 6vw, 90px); align-items: start; }
.planner-intro h2 { font-size: clamp(2rem, 3vw, 2.7rem); }
.planner-intro p:not(.section-label) { max-width: 480px; color: #55545a; }
.text-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--indigo); font-weight: 780; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.text-link:hover, .text-link:focus-visible { color: #5663b6; outline: none; }
.plan-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: clamp(20px, 3vw, 34px); border-radius: var(--radius); background: #fffdf9; box-shadow: var(--shadow); }
.field-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-group legend { padding: 0; margin-bottom: 4px; color: var(--indigo); font-size: .76rem; font-weight: 840; letter-spacing: .08em; text-transform: uppercase; }
.field-group label { display: block; min-height: 50px; color: #45454b; font-size: .95rem; font-weight: 650; }
.field-group select, .field-group input { width: 100%; min-width: 0; min-height: 52px; padding: 10px 38px 10px 13px; border: 1px solid #bdb5aa; border-radius: 10px; color: var(--ink); background: #fff; }
.field-group select:focus-visible, .field-group input:focus-visible { border-color: var(--indigo); outline: 3px solid rgba(53, 63, 128, .18); outline-offset: 2px; }
.field-group select[aria-invalid="true"], .field-group input[aria-invalid="true"] { border-color: var(--coral); background: #fff9f8; }
.number-field { position: relative; }
.number-field input { padding-right: 68px; }
.number-field span { position: absolute; top: 50%; right: 13px; color: var(--muted); font-size: .87rem; font-weight: 650; transform: translateY(-50%); pointer-events: none; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.form-error { grid-column: 1 / -1; padding: 12px 14px; border-left: 4px solid var(--coral); color: #7b3028; background: var(--coral-soft); font-weight: 690; }
.submit-button { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }
.result-section { padding-top: clamp(58px, 9vw, 104px); padding-bottom: clamp(58px, 9vw, 104px); }
.result-section[hidden], .speaking-support[hidden] { display: none; }
.result-heading { align-items: end; margin-bottom: 28px; }
.result-heading h2 { margin-bottom: 0; }
.result-summary { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 28px; align-items: center; margin-bottom: 24px; padding: clamp(22px, 4vw, 36px); border: 1px solid #d5dbef; border-radius: var(--radius); background: var(--indigo-soft); }
.total-time { display: grid; gap: 1px; }
.total-label { color: #494d67; font-size: .88rem; font-weight: 730; }
.total-time strong { color: var(--indigo); font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.total-time span:last-child { color: #565a70; font-size: .92rem; }
.result-summary p { margin-bottom: 0; color: #44485d; font-size: 1.02rem; }
.allocation-panel { padding: clamp(22px, 4vw, 38px); border: 1px solid #e1d8ca; border-radius: var(--radius); background: #fffdf9; box-shadow: 0 16px 42px rgba(35, 37, 43, .05); }
.panel-heading { align-items: end; margin-bottom: 24px; }
.panel-heading h3 { margin-bottom: 3px; font-size: 1.35rem; }
.panel-heading p { margin-bottom: 0; color: var(--muted); font-size: .92rem; }
.allocation-key { color: var(--muted); font-size: .8rem; font-weight: 700; }
.allocation-list { display: grid; gap: 17px; }
.allocation-row { display: grid; grid-template-columns: minmax(150px, .78fr) minmax(160px, 1.42fr) minmax(185px, 1.1fr); gap: 16px; align-items: center; padding-top: 17px; border-top: 1px solid #e6dfd4; }
.allocation-row:first-child { padding-top: 0; border-top: 0; }
.allocation-row-heading { justify-content: flex-start; }
.allocation-row-heading strong { font-size: .97rem; }
.allocation-row-heading span { color: var(--indigo); font-size: .91rem; font-weight: 800; white-space: nowrap; }
.allocation-bar { height: 12px; overflow: hidden; border-radius: 999px; background: #ece8e0; }
.allocation-bar span { display: block; height: 100%; min-width: 10px; border-radius: inherit; background: var(--gold); }
.allocation-words .allocation-bar span { background: #e1846b; }
.allocation-grammar .allocation-bar span { background: #4b579e; }
.allocation-listening .allocation-bar span { background: #7598ae; }
.allocation-practice .allocation-bar span { background: #8e9a68; }
.allocation-row p { margin-bottom: 0; color: var(--muted); font-size: .88rem; }
.result-lower-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-top: 22px; }
.action-card, .limit-card { padding: 28px; border-radius: var(--radius); }
.action-card { background: var(--coral-soft); }
.limit-card { border: 1px solid #dfd8ce; background: #fffdf9; }
.action-card h3, .limit-card h3 { font-size: 1.34rem; }
.action-card p:last-child, .limit-card p { margin-bottom: 0; color: #4d4545; }
.limit-card .text-link { margin-top: 13px; }
.speaking-support { display: flex; align-items: center; justify-content: space-between; gap: 26px; margin-top: 22px; padding: 28px; border: 1px solid #e5c1b9; border-radius: var(--radius); background: #fff7f4; }
.speaking-support h3 { margin-bottom: 7px; font-size: 1.34rem; }
.speaking-support p:last-child { max-width: 700px; margin-bottom: 0; color: #5c4a49; }
.method-strip { padding: clamp(58px, 9vw, 102px) 0; background: #24252b; color: #fcf8ef; }
.method-grid { display: grid; grid-template-columns: minmax(0, .76fr) minmax(0, 1.24fr); gap: clamp(34px, 6vw, 88px); }
.method-grid h2 { max-width: 450px; margin-bottom: 0; }
.method-grid .section-label { color: #f2a796; }
.path-list { display: grid; gap: 20px; margin: 0; padding: 0; list-style: none; }
.path-list li { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 15px; row-gap: 2px; padding-top: 20px; border-top: 1px solid #55565d; }
.path-list span { grid-row: span 2; color: #f2a796; font-weight: 850; }
.path-list strong { font-size: 1.08rem; }
.path-list p { margin-bottom: 0; color: #d1d0d2; }
.site-footer { padding: 36px 0; color: #48474b; background: #ede3d4; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.footer-brand { margin-bottom: 8px; }
.footer-grid p { max-width: 400px; margin-bottom: 0; color: #66636a; font-size: .91rem; }
.footer-grid nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 15px; }
.footer-grid nav a { display: inline-flex; align-items: center; min-height: 44px; color: #45444a; font-size: .9rem; font-weight: 680; text-decoration: none; }
.footer-grid nav a:hover, .footer-grid nav a:focus-visible { color: var(--indigo); text-decoration: underline; text-underline-offset: 4px; outline: none; }
.info-main { padding: clamp(55px, 9vw, 104px) 0; }
.info-intro { max-width: 760px; margin-bottom: 46px; }
.info-intro h1 { margin-bottom: 18px; font-size: clamp(2.6rem, 5vw, 4.7rem); }
.info-intro p { max-width: 680px; color: #54535a; font-size: 1.08rem; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.info-card { padding: 27px; border: 1px solid #e0d7c9; border-radius: var(--radius); background: #fffdf9; }
.info-card h2 { margin-bottom: 11px; font-size: 1.42rem; }
.info-card p:last-child, .info-card ul:last-child { margin-bottom: 0; }
.info-card li + li { margin-top: 9px; }
.info-card-wide { grid-column: 1 / -1; }
.quiet-note { padding: 24px; border-left: 4px solid var(--coral); border-radius: 0 14px 14px 0; background: #fff0eb; }
.quiet-note p:last-child { margin-bottom: 0; }
.source-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.source-list li { padding-top: 14px; border-top: 1px solid #e6ded2; }
.source-list li:first-child { padding-top: 0; border-top: 0; }
.source-list strong, .source-list span { display: block; }
.source-list span { color: #5c5a60; font-size: .92rem; }
.source-location { display: flex; align-items: center; min-height: 44px; margin-top: 5px; padding: 8px 9px; border-radius: 7px; color: #343450; background: #f0eef7; font-size: .79rem; font-weight: 700; text-decoration: none; }
.source-location:hover, .source-location:focus-visible { color: var(--indigo); background: var(--indigo-soft); text-decoration: underline; text-underline-offset: 3px; outline: none; }
.not-found { min-height: 57vh; display: grid; place-items: center; padding: 70px 0; }
.not-found-card { max-width: 640px; padding: clamp(30px, 6vw, 60px); border: 1px solid #e0d7c9; border-radius: 28px 12px 28px 12px; background: #fffdf9; box-shadow: var(--shadow); text-align: center; }
.not-found-card p { color: var(--muted); }
.not-found-card .button { margin-top: 8px; }

@media (max-width: 780px) {
  .shell { width: min(100% - 32px, 680px); }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 4px; padding: 11px 0; }
  .main-nav { width: 100%; justify-content: space-between; }
  .main-nav a { padding-inline: 8px; }
  .hero, .planner-grid, .method-grid, .result-summary { grid-template-columns: 1fr; }
  .hero { gap: 36px; padding-top: 50px; padding-bottom: 58px; }
  h1 { font-size: clamp(2rem, 8.2vw, 2.4rem); line-height: 1.12; text-wrap: balance; }
  .info-intro h1 { font-size: clamp(2rem, 8vw, 2.4rem); line-height: 1.15; }
  .time-sketch { transform: none; }
  .week-blocks { min-height: 105px; }
  .plan-form { grid-template-columns: 1fr; padding: 20px; }
  .field-group label { min-height: auto; margin-bottom: 8px; }
  .not-found-card h1 { font-size: clamp(1.8rem, 8vw, 2.3rem); }
  .result-heading, .panel-heading, .speaking-support { align-items: flex-start; flex-direction: column; }
  .result-heading .button, .speaking-support .button { width: 100%; }
  .allocation-row { grid-template-columns: 1fr; gap: 8px; }
  .allocation-row-heading { justify-content: space-between; }
  .allocation-row p { margin-top: 1px; }
  .result-lower-grid, .info-grid, .footer-grid { grid-template-columns: 1fr; }
  .footer-grid nav { justify-content: flex-start; }
  .info-card-wide { grid-column: auto; }
}

@media (max-width: 390px) {
  .shell { width: min(100% - 28px, 680px); }
  .main-nav a { font-size: .86rem; }
  .sketch-topline { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sketch-key { gap: 6px 10px; }
  .button { width: 100%; }
  .submit-button { justify-self: stretch; }
}

.study-days-field { grid-column: 1 / -1; }
.day-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.day-choices label { display: flex; align-items: center; gap: 7px; padding: 7px 10px; min-height: 44px; border: 1px solid #d8d1c7; border-radius: 8px; margin: 0; cursor: pointer; }
.plan-form .day-choices input, .done-control input { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--indigo); }
.restore-control { grid-column: 1 / -1; }
.restore-title { margin: 0 0 8px; font-weight: 760; }
.restore-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.restore-picker .button { min-width: 220px; }
.restore-file-name { color: var(--muted); font-size: .9rem; word-break: break-word; }
.visually-hidden-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.visually-hidden-file:focus-visible + .button { outline: 3px solid rgba(53, 63, 128, .18); outline-offset: 3px; }
.selected-conditions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; }
.selected-conditions div { padding-top: 10px; border-top: 1px solid #c9cee5; }
.selected-conditions dt { color: #5a5e73; font-size: .76rem; font-weight: 760; text-transform: uppercase; letter-spacing: .05em; }
.selected-conditions dd { margin: 2px 0 0; color: #34384f; font-size: .9rem; font-weight: 680; }
.week-panel { margin: 26px 0; }
.week-schedule { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.study-day { border: 1px solid #ddd5c8; background: #fffdf9; padding: 20px; border-radius: 12px; }
.study-day-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #d7b56f; }
.study-day-heading h3 { font-size: 1.28rem; }
.study-day-heading span { white-space: nowrap; font-weight: 700; }
.study-task { padding: 10px 0; border-bottom: 1px solid #e9e2d7; }
.study-task:last-child { border-bottom: 0; }
.study-task summary { display: flex; gap: 14px; align-items: baseline; justify-content: space-between; min-height: 44px; cursor: pointer; font-weight: 750; }
.study-task summary > span:first-child::before { content: '+ '; color: var(--indigo); }
.study-task[open] summary > span:first-child::before { content: '− '; }
.task-duration { flex-shrink: 0; font-size: .86rem; color: var(--muted); }
.study-task p { margin: 9px 0; font-size: .95rem; }
.task-check { color: #465a43; }
.done-control { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; }
.week-tools { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 10px; }
.resource-match { margin: 32px 0; }
.matched-resources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.matched-resource { padding: 20px; border-top: 3px solid #c2ad72; background: #f0eadf; }
.matched-resource h3 { font-size: 1.2rem; }
.matched-resource p { margin-bottom: 12px; }
@media (max-width: 780px) {
  .week-schedule, .matched-resources { grid-template-columns: 1fr; }
  .study-day { padding: 16px; }
  .week-tools .button { width: 100%; }
  .day-choices { gap: 6px; }
  .selected-conditions { grid-template-columns: 1fr; }
}
@media print {
  @page { size: auto; margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .hero, .planner-section, .method-strip, .week-tools, .resource-next, .result-heading .button, .speaking-support { display: none; }
  .shell { width: 100%; }
  .result-section { padding: 0; }
  .week-schedule { grid-template-columns: 1fr; }
  .study-day { break-inside: auto; }
  .study-task, .allocation-panel, .result-summary { break-inside: avoid; }
  .study-task summary > span:first-child::before { content: ''; }
}

/* Preserve the reviewed layout; improve phrase flow and touch targets. */
p,li,dd,label,legend,figcaption,.copy-sentence { text-wrap: pretty; }
h1,h2,h3 { text-wrap: balance; }
.footer-grid nav a { min-width:44px; }
