/* Study plan (#sec-plan) and placement check. Uses the tokens in global.css. */

.plan-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; font-family: var(--font-b); color: var(--text); }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.plan-empty { text-align: center; }
.plan-h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; color: var(--navy); margin: 4px 0 8px; line-height: 1.25; }
.plan-big { color: var(--accent); }
.plan-lead { color: var(--text2); font-size: 15px; line-height: 1.55; margin: 0 0 20px; }
.plan-note { color: var(--text2); font-size: 13px; line-height: 1.5; background: var(--surface2); border-radius: var(--radius); padding: 12px 14px; margin: 16px 0; }
.plan-note a { color: var(--accent); font-weight: 600; }
.plan-err { color: var(--danger); }
.plan-loading { color: var(--text3); padding: 32px 0; text-align: center; }
.pc-kicker { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 4px; }

/* Buttons */
.plan-btn { appearance: none; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-weight: 700; font-size: 15px; padding: 14px 22px; min-height: 48px; cursor: pointer; transition: background .15s ease, transform .12s ease; }
.plan-btn:hover { background: #047857; }
.plan-btn:active { transform: scale(0.97); }
.plan-btn[disabled] { background: var(--text3); cursor: default; transform: none; }
.plan-btn.ghost { background: var(--surface); color: var(--text2); border: 1.5px solid var(--border); }
.plan-btn.ghost:hover { background: var(--surface2); }
.plan-link { appearance: none; background: none; border: 0; padding: 10px 0; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.plan-row { display: flex; gap: 12px; margin-top: 20px; }
.plan-row .plan-btn { flex: 1; }

/* Setup form */
.plan-form { display: flex; flex-direction: column; gap: 18px; }
.plan-field { display: flex; flex-direction: column; gap: 8px; }
.plan-field > span { font-size: 13px; font-weight: 700; color: var(--text2); }
.plan-field input[type=date], .plan-field select { font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); min-height: 48px; }
.plan-field input:focus, .plan-field select:focus { outline: none; border-color: var(--accent); }
.plan-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-chip input { position: absolute; opacity: 0; pointer-events: none; }
.plan-chip span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; min-width: 48px; text-align: center; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.plan-chip span small { font-weight: 500; font-size: 11px; color: var(--text3); }
.plan-chip input:checked + span { border-color: var(--accent); background: var(--accent-lt); color: #065f46; }
.plan-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-chip.dis span { opacity: .45; cursor: not-allowed; }
.plan-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 460px; }
.plan-days .plan-chip span { min-width: 0; padding: 8px 0; }
.plan-grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-grid4 .plan-row { grid-column: 1 / -1; }

/* Placement check */
.pc-steps { display: flex; gap: 4px; margin-bottom: 16px; }
.pc-steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--border); }
.pc-steps i.on { background: var(--accent); }
.pc-audio { width: 100%; margin: 4px 0 16px; }
.pc-notes { margin-bottom: 8px; }
.pc-notes .q-grp { margin-bottom: 16px; }
.pc-notes .iinput { font-size: 16px; } /* no iOS zoom on focus */
.pc-passage { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 8px 0 14px; line-height: 1.6; font-size: 15px; }
.pc-q { font-size: 17px; font-weight: 600; line-height: 1.45; margin: 4px 0 14px; }
.pc-opts { display: flex; flex-direction: column; gap: 10px; }
.pc-opt { appearance: none; text-align: left; font: inherit; font-size: 15px; padding: 14px 16px; min-height: 48px; border: 1.5px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .12s ease; }
.pc-opt:active { transform: scale(0.98); }
.pc-opt.sel { border-color: var(--accent); background: var(--accent-lt); }

/* Bands */
.plan-bands { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; }
.plan-band { display: grid; grid-template-columns: 84px 36px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.plan-band span { color: var(--text2); font-weight: 600; }
.plan-band b { font-variant-numeric: tabular-nums; }
.plan-band i { position: relative; height: 8px; border-radius: 99px; background: var(--surface2); }
.plan-band i::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 99px; background: var(--accent); }
.plan-band.gap i::before { background: var(--gold); }
.plan-band i::after { content: ''; position: absolute; top: -4px; bottom: -4px; left: var(--t); width: 2px; background: var(--navy); border-radius: 1px; }
.plan-bands.compact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin: 0 0 16px; }

/* Plan view */
.plan-top { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.plan-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.plan-kpis div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.plan-kpis b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); }
.plan-kpis span { font-size: 12px; color: var(--text2); }

.plan-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; }
.plan-day.today { border: 2px solid var(--accent); }
.plan-day.rest .plan-lead { margin: 6px 0 0; }
.plan-day-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.plan-day-h b { font-size: 15px; }
.plan-day.today .plan-day-h b { color: var(--accent); font-size: 17px; }
.plan-day-h span { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.plan-day ul { list-style: none; margin: 0; padding: 0; }
.plan-s { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.plan-s:first-child { border-top: 0; }
.plan-s-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-s-txt b { font-size: 14px; font-weight: 600; }
.plan-s-txt span { font-size: 12px; color: var(--text2); }
.plan-s.done .plan-s-txt b { color: var(--text3); text-decoration: line-through; }
.plan-tick { appearance: none; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: #fff; cursor: pointer; position: relative; transition: background .15s ease, border-color .15s ease; }
.plan-tick::after { content: ''; position: absolute; inset: -9px; } /* 44px tap target */
.plan-s.done .plan-tick { background: var(--accent); border-color: var(--accent); }
.plan-s.done .plan-tick::before { content: ''; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.plan-start { appearance: none; flex: none; border: 0; border-radius: 50px; background: var(--accent-lt); color: #065f46; font: inherit; font-size: 13px; font-weight: 700; padding: 0 16px; min-height: 36px; cursor: pointer; transition: background .15s ease, transform .12s ease; }
.plan-start:hover { background: #a7f3d0; }
a.plan-start { display: inline-flex; align-items: center; text-decoration: none; }
.plan-start:active { transform: scale(0.97); }
.plan-start.lock { background: var(--surface2); color: var(--text2); }
.plan-s[data-type="full"] .plan-s-txt b { color: #be185d; }

.plan-pace { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; font-size: 13px; color: var(--text2); font-weight: 600; }
.plan-chip-btn { appearance: none; font: inherit; font-size: 13px; font-weight: 600; padding: 0 14px; min-height: 36px; border-radius: 50px; border: 1.5px solid var(--border); background: #fff; color: var(--text2); cursor: pointer; }
.plan-chip-btn.on { border-color: var(--accent); background: var(--accent-lt); color: #065f46; }
.plan-chip-btn[disabled] { opacity: .45; cursor: not-allowed; }

.plan-week { margin-bottom: 12px; }
.plan-week summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 700; font-size: 15px; padding: 12px 4px; list-style: none; }
.plan-week summary::-webkit-details-marker { display: none; }
.plan-week summary::before { content: '›'; display: inline-block; margin-right: 8px; color: var(--text3); transition: transform .15s ease; }
.plan-week[open] summary::before { transform: rotate(90deg); }
.plan-week summary span { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text3); }
.plan-actions { display: flex; flex-direction: column; align-items: flex-start; margin-top: 8px; }

@media (min-width: 640px) {
  .plan-wrap { padding: 32px 24px 80px; }
  .plan-card { padding: 32px; }
  .plan-h2 { font-size: 28px; }
  .plan-top { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .plan-kpis { min-width: 320px; }
  .plan-grid4 { grid-template-columns: repeat(4, 1fr); }
  .plan-actions { flex-direction: row; gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .plan-btn, .plan-start, .pc-opt, .plan-tick, .plan-week summary::before { transition: none; }
}

/* Study Center → English Articles */
.art-intro { color: var(--text2); line-height: 1.6; margin: 0 0 12px; }
.art-intro a { color: var(--accent); font-weight: 600; }
.art-progress { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; }
.art-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.art-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.art-week { font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text3); margin: 24px 0 8px; }
.art-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.art-tick { appearance: none; flex: none; width: 26px; height: 26px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--border); background: #fff; cursor: pointer; position: relative; }
.art-tick::after { content: ''; position: absolute; inset: -9px; }
.art-item.read .art-tick { background: var(--accent); border-color: var(--accent); }
.art-item.read .art-tick::before { content: ''; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.art-link { flex: 1; min-width: 0; display: flex; gap: 10px; color: inherit; text-decoration: none; }
.art-n { flex: none; min-width: 24px; font-size: 13px; font-weight: 700; color: var(--text3); font-variant-numeric: tabular-nums; padding-top: 2px; }
.art-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.art-title { font-weight: 600; line-height: 1.4; color: var(--navy); text-align: left; }
.art-link:hover .art-title { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.art-item.read .art-title { color: var(--text2); }
.art-he { font-size: 14px; color: var(--text2); line-height: 1.5; }
.art-src { font-size: 12px; color: var(--text3); text-align: left; }
[dir="rtl"] .art-src, .study-tab-pane[style*="rtl"] .art-src, .study-tab-pane[style*="rtl"] .art-title { text-align: right; }

/* Study Center → Writing Guide (js/knowledge/writing_guide.js) */
.plan-guide { color: var(--accent); font-weight: 600; }
.wg { max-width: 760px; text-align: left; }
.wg-bar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.wg-seg { display: inline-flex; align-self: flex-start; background: var(--surface2); border: 1px solid var(--border); border-radius: 50px; padding: 4px; }
.wg-seg button, .wg-chips button { appearance: none; border: 0; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; border-radius: 50px; min-height: 36px; padding: 0 16px; background: transparent; color: var(--text2); transition: background .15s ease, color .15s ease; }
.wg-seg button.on { background: var(--accent); color: #fff; }
.wg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wg-chips button { border: 1.5px solid var(--border); background: #fff; }
.wg-chips button.on { border-color: var(--accent); background: var(--accent-lt); color: #065f46; }
.wg-title { margin-bottom: 4px; }
.wg-meta { color: var(--text2); font-size: 14px; margin: 0 0 8px; }
.wg-h { font-size: 18px; font-weight: 800; color: var(--navy); margin: 32px 0 12px; }
.wg-steps { margin: 0; padding-left: 22px; line-height: 1.6; color: var(--text); }
.wg-steps li { margin-bottom: 8px; }
.wg-timing { display: grid; grid-template-columns: 1fr; gap: 12px; }
.wg-time { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.wg-time b { display: block; margin-bottom: 6px; font-size: 14px; }
.wg-time div { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; border-top: 1px solid var(--surface2); font-variant-numeric: tabular-nums; }
.wg-card, .wg-model { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
.wg-label { font-size: 12px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--accent); }
.wg-model summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; min-height: 32px; }
.wg-model summary::-webkit-details-marker { display: none; }
.wg-model summary .wg-label::before { content: '›'; display: inline-block; margin-right: 8px; transition: transform .15s ease; }
.wg-model[open] summary .wg-label::before { transform: rotate(90deg); }
.wg-words { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.wg-prompt { font-style: italic; color: var(--text2); line-height: 1.6; margin: 12px 0; padding: 10px 14px; background: var(--surface2); border-radius: var(--radius); }
.wg-img { display: block; max-width: 100%; height: auto; margin: 12px auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.wg-part { margin-top: 12px; }
.wg-part-l { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text3); margin-bottom: 4px; }
.wg-part p { margin: 0; line-height: 1.7; }
.wg-part b { color: #065f46; background: var(--accent-lt); border-radius: 3px; padding: 0 2px; }
.wg-notes { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 14px; line-height: 1.5; }
.wg-notes dt { font-weight: 700; }
.wg-notes dd { margin: 0; color: var(--text2); }
.wg-more { margin: 10px 0 0; font-size: 14px; }
.wg a { color: var(--accent); font-weight: 600; }
.wg-links { margin: 0; padding-left: 20px; line-height: 1.9; }
@media (min-width: 640px) { .wg-timing { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { .wg-model summary .wg-label::before { transition: none; } }
.wg-practise { background: var(--accent-lt); border-color: #a7f3d0; }
.wg-practise p { margin: 0 0 12px; line-height: 1.6; }

/* Test overview (js/plan/overview.js) */
.ov { --l-bg: #e0f2fe; --l-ink: #075985; --r-bg: #dcfce7; --r-ink: #166534; --w-bg: #fee2e2; --w-ink: #991b1b; --s-bg: #ede9fe; --s-ink: #5b21b6; }
.ov-head { margin-bottom: 8px; }
.ov-head .plan-lead { max-width: 62ch; }
.ov-sec { margin-top: 36px; }
.ov-h { font-size: 19px; font-weight: 800; letter-spacing: -0.2px; color: var(--navy); margin: 0 0 14px; }
.ov-h4 { font-size: 15px; font-weight: 800; color: var(--navy); margin: 24px 0 8px; }
.ov-p { color: var(--text2); line-height: 1.65; margin: 0 0 16px; max-width: 65ch; }

/* The test to scale: a column on phones (height ∝ minutes), a row from 640px (width ∝ minutes).
   The first three parts sit in one bracketed group: they are one sitting. */
.ov-scale { display: flex; flex-direction: column; gap: 16px; height: 380px; }
.ov-group { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.ov-group-s { flex-grow: 0 !important; }
.ov-segs { flex: 1; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.ov-cap { font-size: 12px; font-weight: 600; color: var(--text2); }
.ov-seg { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 0 14px; border-radius: 8px; font-size: 14px; }
.ov-seg b { font-weight: 800; }
.ov-seg span { font-variant-numeric: tabular-nums; font-weight: 600; }
.ov-listening.ov-seg { background: var(--l-bg); color: var(--l-ink); }
.ov-reading.ov-seg { background: var(--r-bg); color: var(--r-ink); }
.ov-writing.ov-seg { background: var(--w-bg); color: var(--w-ink); }
.ov-speaking.ov-seg { background: var(--s-bg); color: var(--s-ink); }
@keyframes ov-draw { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.ov-scale { animation: ov-draw 700ms cubic-bezier(0.23, 1, 0.32, 1) both; }

/* Parts */
.ov-part { border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
.ov-part.ov-listening { background: var(--l-bg); --ink: var(--l-ink); }
.ov-part.ov-reading { background: var(--r-bg); --ink: var(--r-ink); }
.ov-part.ov-writing { background: var(--w-bg); --ink: var(--w-ink); }
.ov-part.ov-speaking { background: var(--s-bg); --ink: var(--s-ink); }
.ov-part-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; color: var(--ink); }
.ov-part-h b { font-size: 17px; font-weight: 800; }
.ov-part-h span { font-size: 13px; font-weight: 600; }
.ov-part dl { display: grid; grid-template-columns: 1fr; gap: 2px 14px; margin: 0; font-size: 14px; line-height: 1.55; }
.ov-part dt { font-weight: 700; color: var(--ink); margin-top: 6px; }
.ov-part dd { margin: 0; color: var(--text); }
.ov-note { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink); font-weight: 600; }

/* Score calculator */
.ov-calc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.ov-calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-step { display: flex; flex-direction: column; gap: 6px; }
.ov-step-name { font-size: 13px; font-weight: 700; color: var(--text2); }
.ov-step-ctl { display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 3px; }
.ov-step-ctl button { appearance: none; width: 40px; height: 40px; border: 0; border-radius: 8px; background: var(--surface2); color: var(--navy); font: inherit; font-size: 20px; font-weight: 700; cursor: pointer; transition: background .15s ease, transform .12s ease; }
.ov-step-ctl button:hover { background: var(--accent-lt); }
.ov-step-ctl button:active { transform: scale(0.94); }
.ov-step-ctl button[disabled] { opacity: .35; cursor: default; transform: none; }
.ov-step-ctl output { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); }
.ov-result { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ov-result > div { display: flex; flex-direction: column; }
.ov-result-l { font-size: 12px; font-weight: 700; color: var(--text2); }
.ov-result b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text2); }
.ov-result b.ov-big { font-size: 34px; color: var(--navy); line-height: 1.1; }
.ov-result.met b.ov-big { color: var(--accent); }
.ov-arrow { width: 28px; height: 2px; background: var(--border); position: relative; }
.ov-arrow::after { content: ''; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--border); border-right: 0; }
.ov-verdict { flex-basis: 100%; margin: 0; font-size: 14px; font-weight: 600; color: var(--text2); }
.ov-result.met .ov-verdict { color: #065f46; }

.ov-facts { margin: 0; padding-left: 20px; line-height: 1.65; max-width: 65ch; }
.ov-facts li { margin-bottom: 8px; }
.ov-done { margin-top: 32px; width: 100%; }

@media (min-width: 640px) {
  .ov-scale { flex-direction: row; height: auto; }
  .ov-group { flex-basis: 0; }
  .ov-group-s { flex: 0 0 120px; }
  .ov-segs { flex-direction: row; height: 72px; flex: none; }
  .ov-cap { padding-top: 6px; border-top: 2px solid var(--border); }
  .ov-seg { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 0 12px; min-width: 0; flex-basis: 0; }
  @keyframes ov-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
  .ov-part dl { grid-template-columns: 150px 1fr; }
  .ov-part dt { margin-top: 0; }
  .ov-calc-grid { grid-template-columns: repeat(4, 1fr); }
  .ov-done { width: auto; }
}
@media (prefers-reduced-motion: reduce) { .ov-scale { animation: none; } .ov-step-ctl button { transition: none; } }
