/* Ripetia: a quiet, warm workspace. Loaded after the feature styles.
   Canvas geometry and object typography intentionally stay in concept-maps.css. */
:root {
  --bg: #F4F3EE;
  --paper: #FFFEFA;
  --ink: #344B44;
  --muted: #626D66;
  --line: #DDDFD6;
  --control-line: #849181;
  --teal-dim: #E5EDE5;
  --motivation-bg: #E5EDE5;
  --motivation-line: #B9CABB;
  --radius-panel: 16px;
  --radius-control: 9px;
  --surface-soft: #EEEFE8;
  --shadow-raised: 0 8px 28px #18302D0A;
  --motion-fast: 160ms;
  --ui-type-page: 28px;
  --ui-type-section: 20px;
  --ui-type-body: 14px;
  --ui-type-meta: 13px;
  --ui-type-metric: 20px;
}

body { background: var(--bg); }
.wrap { padding: 28px clamp(24px, 3vw, 48px) 72px; }
.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 0;
  margin-bottom: 32px;
  border-bottom: 0;
  gap: 0;
}
.brand-row { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; width: 100%; padding: 4px 0 24px; }
.topbar .logo { gap: 12px; font-size: 40px; line-height: 1.2; grid-column: auto; grid-row: auto; }
.topbar .logo img { width: 46px; height: 46px; }
.brand-row .plan { position: static; align-self: center; }
.plan, .plan.pro {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
}
.topbar-actions { display: flex; margin: 0; width: 100%; justify-content: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.topbar #main-navigation { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 12px; }
#main-navigation .btn { min-height: 40px; min-width: 0; width: 100%; white-space: normal; }
#main-navigation .btn { background: transparent; border-color: transparent; }
#main-navigation .btn:hover { background: var(--surface-soft); border-color: transparent; }
#main-navigation .btn[aria-current="page"] {
  background: var(--teal-dim);
  border-color: transparent;
  color: var(--teal);
}
h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.16; letter-spacing: -.035em; margin-bottom: 16px; }
h2, h3 { color: var(--title); }
.lede { line-height: 1.7; margin-bottom: 24px; }

/* Solid surfaces, neutral rules and consistent spacing, without decorative effects. */
.panel { padding: 24px; margin-bottom: 20px; }
.hero { padding: 28px; border-radius: var(--radius-panel); box-shadow: var(--shadow-raised); }
.home-grid { gap: 24px; margin-top: 22px; }
.home-start-actions { order: 0; gap: 12px; }
#ai-off-notice {
  order: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.home-progress-heading { margin-top: 0; margin-bottom: 16px; }
.home-progress-heading .section-label::after { display: none; }
.home-projects .library-heading { margin-bottom: 18px; }
.home-projects { padding-top: 0; }
.home-projects-empty { margin: 0; color: var(--muted); }
#peso-dati:empty, #home-reset-progress-status:empty { display: none; }
.project-panel { padding: 24px; box-shadow: var(--shadow-raised); }
.project-title { color: var(--title); font-size: 19px; letter-spacing: -.02em; }
.project-meta { margin-top: 6px; }
.project-actions { padding-top: 18px; margin: 18px 0; gap: 10px; }
.project-exam .btn { border-color: var(--line); }
.block-card { border-radius: 12px; padding: 16px 18px; margin-bottom: 10px; }
.block-card.empty-state { border-style: solid; padding: 32px 24px; }
.install-card { padding: 22px; border-radius: var(--radius-panel); background: var(--paper); }
.home-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.home-install-banner { margin: 0 0 24px; box-shadow: none; }
.home-side .panel { margin-bottom: 0; }
.home-side .home-support { grid-column: 1 / -1; }
.home-side .foot-note p { line-height: 1.7; }
.dual { gap: 16px; margin-top: 20px; margin-bottom: 16px; }
.dual-card { border-radius: var(--radius-panel); padding: 22px; }
.dual-card.hot { background: var(--title); border-color: var(--title); }
.dual-card.hot:nth-child(2) { background: var(--paper); border-color: var(--line); color: var(--ink); }
#screen-home .dual-card.hot:nth-child(2) .dual-t { color: var(--title); }
.dual-card.hot:nth-child(2) .dual-num { color: var(--teal); }
.dual-card.hot:nth-child(2) .dual-s { color: var(--muted); }
.dual-card.hot:nth-child(2) .btn-light { border-color: var(--control-line); background: var(--paper); }
.dual-card.hot:nth-child(2) .btn-light:hover { background: var(--surface-soft); }
.quota, .stats { border-radius: 12px; }
.stat { padding: 16px; }
.pill { background: var(--surface-soft); color: var(--ink); }
.pill.zero { background: var(--surface-soft); }

/* Hover feedback never fades or moves the target under the pointer. */
.btn {
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease,
    color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.btn-outline, .library-action-menu > summary { border-color: var(--line); }
.btn-outline:hover:not(:disabled) { background: var(--surface-soft); border-color: #7A8B7F; }
.btn-primary { box-shadow: 0 2px 4px #18302D14; }
.btn-primary:hover:not(:disabled) { background: #125B53; box-shadow: 0 3px 8px #18302D1F; }
.btn:disabled { box-shadow: none; }
.btn-sm { min-height: 40px; }
.preferences-nav { gap: 4px; margin: 0; }
.preferences-nav .btn { border-color: var(--line); }
.preferences-section-title { margin-bottom: 12px; }
.preferences-nav .btn[aria-current="page"] { border-color: var(--teal); }
textarea, input[type=text], input[type=email] { background: var(--paper); border-color: var(--control-line); }
textarea, input, select {
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
textarea:focus, input:focus { box-shadow: 0 0 0 4px var(--teal-dim); }
.type-card { padding: 24px; }
.type-card:hover { background: var(--surface-soft); border-color: var(--control-line); }
.drop { border-radius: 12px; }
.simple-details { border-radius: 12px; }
.simple-details > summary { padding: 18px 20px; }
.simple-details-body { padding: 20px; }
.warn { border-color: #DAC9AE; }
.msg.ok { border-color: var(--motivation-line); }
.notif { padding: 20px 24px; }
.notif-icon { background: var(--teal-dim); color: var(--teal); }
.app-footer { margin-top: 40px; padding-top: 18px; }

/* Feature-specific polish stays outside the editable whiteboard itself. */
.map-save-bar { gap: 10px; margin-bottom: 20px; }
.map-save-bar input { background: var(--paper); }
.map-tools { gap: 8px; padding-bottom: 16px; margin-bottom: 18px; }
.map-tools .btn { border-color: var(--line); }
.map-tools .btn { min-height: 40px; }
.map-tools .btn.active { border-color: var(--teal); }
.map-scroll { border-radius: 12px; background: #fff; }
.map-library-list { gap: 10px; }
.map-library-item { padding-top: 14px; padding-bottom: 6px; }
.map-shape-options, .map-node-actions, .map-stroke-actions { border-color: var(--line); }
.help-heading { margin-bottom: 28px; }
.help-topic { margin-bottom: 14px; }
.help-topic summary { padding: 22px 24px; }
.help-topic summary:hover { background: var(--surface-soft); }
.help-topic-body { padding: 0 24px 24px; }
.help-choice { padding: 22px 24px; }
.help-choice.selected { border-color: var(--motivation-line); box-shadow: none; }
.quiz-set { padding: 24px; }
.dialog-box, .install-dialog { border-radius: 18px; padding: 28px; }
.language-menu { padding: 7px; border-radius: 12px; box-shadow: 0 12px 32px #18302D1A; }
.language-menu button { min-height: 44px; border-radius: 7px; }

/* An editorial note: readable prose, with handwriting only as a closing accent. */
.home-mission { width: 100%; max-width: none; margin: 36px auto 0; padding-top: 32px; border-top: 1px solid var(--line); }
#screen-home .home-mission > h2 { margin: 0; text-align: center; font-size: 22px; letter-spacing: -.02em; }
.mission-letter {
  width: 100%;
  max-width: none;
  margin: 24px auto 0;
  text-align: center;
  color: var(--ink);
  font: 400 17px/1.85 var(--font-ui);
  overflow-wrap: break-word;
}
.mission-letter p { margin: 0 0 1.2em; font: inherit; color: inherit; }
.mission-letter p:last-child { margin-bottom: 0; }
.mission-emphasis {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #B5C7BE;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  text-decoration-skip-ink: auto;
}
.mission-letter .mission-closing {
  max-width: none;
  margin: 32px auto 0;
  padding: 8px 12px 0;
  color: var(--title);
  font: 400 28px/1.85 "Amsterdam Four", "Ripetia Kalam", "Segoe Print", cursive;
  text-align: center;
}
@media (min-width: 770px) {
  .mission-letter .mission-closing { white-space: nowrap; font-size: clamp(19px, 2vw, 28px); }
}

/* The focused study surface keeps its light controls on a dark background. */
body.study-mode .topbar-actions { border-color: #47726B; }
body.study-mode .topbar .mobile-menu-toggle { background: #214C46; color: #F4F7F5; border-color: #47726B; }
body.study-mode .logo span { color: #F4F7F5; }
body.study-mode #main-navigation .btn, body.study-mode .topbar #language-select { color: #F4F7F5; }
body.study-mode #main-navigation .btn:hover,
body.study-mode #main-navigation .btn[aria-current="page"],
body.study-mode .topbar #language-select:hover,
body.study-mode .topbar #language-select[aria-expanded="true"] { background: #24554D; color: #F4F7F5; }
body.study-mode .mobile-menu #main-navigation .btn { color: var(--ink); background: var(--paper); }
body.study-mode .mobile-menu #main-navigation .btn:hover,
body.study-mode .mobile-menu #main-navigation .btn[aria-current="page"] { color: var(--teal); background: var(--teal-dim); }
body.study-mode .topbar #preferences-options .btn { color: var(--ink); background: var(--paper); }
body.study-mode .topbar #preferences-options .btn:hover,
body.study-mode .topbar #preferences-options .btn[aria-current="page"] { color: var(--teal); background: var(--teal-dim); }

/* Entry motion is brief and never tied to scrolling. No canvas or study motion. */
.screen.active:not(#screen-concept-map):not(#screen-study):not(#screen-pause):not(#screen-done) {
  animation: workspace-enter 180ms ease-out;
}
.language-menu:not([hidden]), .dialog-backdrop.show .dialog-box, .install-dialog[open] {
  animation: workspace-enter 140ms ease-out;
}
.help-topic[open] .help-topic-body { animation: workspace-enter 140ms ease-out; }
@keyframes workspace-enter { from { opacity: .7; } to { opacity: 1; } }
.bar-fill, .quota-fill, .progress-fill { transition: width 240ms ease-out; }

@media (max-width: 1099px) {
  .home-grid { display: grid; }
  .home-grid .hero { margin-bottom: 0; }
  .home-projects { margin-top: 0; }
  .home-side .foot-note { margin-top: 0; padding-top: 0; border-top: 0; }
}
@media (max-width: 769px) {
  .btn, .btn-sm { min-height: 44px; }
  .map-tools .btn { min-height: 44px; }
  .wrap { padding: 20px 16px 56px; }
  .topbar { flex-direction: row; align-items: center; padding-bottom: 18px; margin-bottom: 24px; border-bottom: 1px solid var(--line); gap: 12px; }
  .brand-row { flex: 1; min-width: 0; width: auto; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 0; }
  .topbar .logo { font-size: 22px; gap: 8px; }
  .topbar .logo img { width: 28px; height: 28px; }
  .brand-row .plan { position: static; align-self: center; }
  .topbar .topbar-actions { display: none; }
  .topbar .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 9px; }
  .plan, .plan.pro { font-size: 11px; padding: 4px 8px; }
  .mobile-menu .right .btn { border-color: var(--line); background: var(--paper); }
  .mobile-menu #main-navigation > .btn { min-height: 48px; }
  .mobile-menu .right .btn[aria-current="page"] { border-color: var(--teal); background: var(--teal-dim); }
  .panel, .project-panel, .hero, .type-card, .quiz-set { padding: 20px; }
  .home-grid { margin-top: 22px; }
  .home-side { grid-template-columns: minmax(0, 1fr); }
  .home-start-actions { gap: 10px; }
  .help-topic summary, .help-choice { padding: 20px; }
  .help-topic-body { padding: 0 20px 20px; }
  .dialog-box, .install-dialog { padding: 22px; }
  .app-footer { margin-top: 30px; }
  .mission-letter { font-size: 16px; }
  .mission-letter .mission-closing { font-size: 25px; margin-top: 24px; }
}
@media (max-width: 420px) {
  .wrap { padding-inline: 12px; }
  .home-start-actions .btn { width: 100%; }
}
/* Material entry: four equally weighted, editorial choices. */
.material-input-options { gap: 24px; }
.material-input-options > section { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 28px; min-height: 294px; padding: 32px; box-shadow: var(--shadow-raised); }
.material-choice-emblem { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 24px; background: var(--teal-dim); border: 1px solid #D5E2D8; }
.material-choice-emblem .material-source-icon { width: 56px; height: 56px; stroke-width: 1.35; }
.material-choice-content { min-width: 0; display: flex; flex-direction: column; }
.material-input-options h2 { font-size: 24px; line-height: 1.2; margin: 2px 0 14px; letter-spacing: -.025em; }
.material-choice-content > p { font-size: 15px; line-height: 1.7; margin-bottom: 16px; max-width: 62ch; }
.material-card-action { padding-top: 20px; min-height: 70px; }
.material-card-action .btn { min-height: 48px; padding: 12px 22px; background: var(--teal); border-color: var(--teal); color: #FFFEFA; font-weight: 650; }
.material-card-action .btn:hover { background: #125D55; border-color: #125D55; color: #FFFEFA; }
.material-file-details { margin-bottom: 0; }
.material-file-details summary { min-height: 32px; padding: 4px 0; }
.material-file-details summary:focus-visible { outline-offset: 4px; border-radius: 4px; }
.study-preparation-note { max-width: none; margin: 0 0 24px; padding: 18px 24px; border-left: 3px solid var(--teal); border-radius: 0 12px 12px 0; background: var(--teal-dim); color: var(--ink); font-size: 16px; line-height: 1.65; }

/* Focused study: a generous card and a quiet, aligned control area. */
#screen-study { --study-width: 880px; }
body.study-mode .topbar { margin-bottom: 24px; }
body.study-mode .brand-row { padding-bottom: 16px; gap: 8px; }
body.study-mode .topbar .logo { font-size: 30px; }
body.study-mode .topbar .logo img { width: 36px; height: 36px; }
#screen-study > .eyebrow { max-width: none; margin: 0 0 20px; }
#screen-study .round-head { max-width: var(--study-width); font-size: 14px; margin-bottom: 12px; }
#screen-study .round-head b { font-size: 17px; font-weight: 600; }
#screen-study .round-head-actions { gap: 16px; }
#screen-study .round-bar { max-width: var(--study-width); height: 5px; margin-bottom: 24px; }
#screen-study .round-outcome-summary { max-width: var(--study-width); }
#screen-study .stage { max-width: var(--study-width); margin: 0 auto; }
#screen-study .card-stack { max-width: none; height: clamp(360px, 43vh, 470px); }
#screen-study .face { border-radius: 22px; padding: 30px 40px; box-shadow: 0 18px 50px #02141124; }
#screen-study .stack-layer { border-radius: 22px; }
#screen-study .stack-layer.l1 { opacity: .5; }
#screen-study .stack-layer.l2 { opacity: .25; }
#screen-study .face-text { font-size: clamp(22px, 2.1vw, 30px); font-weight: 500; line-height: 1.55; margin: 20px 0; align-items: safe center; }
#screen-study .face-hint { font-size: 12px; line-height: 1.5; }
#screen-study .card-media, #screen-study .card-media img { max-height: 140px; }
#screen-study .btn-reveal { max-width: none; min-height: 54px; margin-top: 26px; background: #C6DBCF; border: 1px solid #C6DBCF; color: #173F3A; font-weight: 650; }
#screen-study .btn-reveal:hover { background: #D5E5DD; }
#screen-study .eval-buttons { max-width: none; gap: 16px; margin-top: -54px; min-height: 54px; }
#screen-study .eval-buttons .btn { min-height: 54px; white-space: normal; font-weight: 650; }
#screen-study .batch-rail { max-width: var(--study-width); margin: 16px auto 0; justify-content: center; }
#screen-study .study-status { border: 0; border-radius: 0; background: transparent; color: #C0D0CC; padding: 0; text-align: center; font-size: 12px; }
#screen-study .study-status::before { display: none; }
#screen-study .study-sound { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; max-width: none; margin: 32px 0 0; padding: 22px 0 0; border: 0; border-top: 1px solid #47726B; border-radius: 0; color: #D6E5E1; }
.study-sound-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.study-sound-copy > div { display: flex; flex-direction: column; gap: 4px; }
.study-sound-icon { flex: none; width: 26px; height: 26px; fill: none; stroke: #A9D2C5; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#screen-study .study-sound label { font-size: 13px; font-weight: 550; line-height: 1.5; }
[data-sound-status] { font-size: 12px; line-height: 1.5; color: #C0D0CC; }
.study-sound-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.study-sound-volume { display: flex; align-items: center; gap: 10px; }
#screen-study .study-sound select, #screen-study .study-sound .btn-outline { min-height: 44px; border-color: #75968B; background: #214C46; color: #F4F7F5; border-radius: 9px; padding: 10px 14px; font-size: 13px; }
#screen-study .study-sound select option { background: #214C46; color: #F4F7F5; }
#screen-study .study-sound input[type=range] { width: 100px; min-height: 44px; margin: 0; }
#screen-study .study-sound select:focus-visible, #screen-study .study-sound input:focus-visible, #screen-study .study-sound button:focus-visible { outline: 2px solid #C6DBCF; outline-offset: 4px; }

@media (max-width: 1100px) {
  .material-input-options > section { grid-template-columns: 76px minmax(0, 1fr); padding: 28px; gap: 22px; }
  .material-choice-emblem { width: 76px; height: 76px; border-radius: 20px; }
  .material-choice-emblem .material-source-icon { width: 46px; height: 46px; }
  #screen-study .study-sound { flex-direction: column; align-items: stretch; gap: 16px; }
  .study-sound-controls { justify-content: space-between; }
}
@media (max-width: 600px) {
  .material-input-options { gap: 18px; }
  .material-input-options > section { grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto 1fr auto auto; min-height: 310px; gap: 16px; padding: 24px; }
  .material-choice-emblem { grid-column: 1; grid-row: 1; width: 64px; height: 64px; border-radius: 18px; }
  .material-choice-emblem .material-source-icon { width: 38px; height: 38px; }
  .material-choice-content { display: contents; }
  .material-input-options h2 { grid-column: 2; grid-row: 1; align-self: center; font-size: 22px; margin: 0; }
  .material-choice-content > p { grid-column: 1 / -1; grid-row: 2; font-size: 15px; margin: 0; }
  .material-file-details { grid-column: 1 / -1; grid-row: 3; }
  .material-card-action { grid-column: 1 / -1; grid-row: 4; padding: 0; min-height: 48px; margin-top: 0; }
  .material-card-action .btn { width: 100%; }
  .material-choice-content > .drop-feedback, .material-choice-content > .msg, .material-choice-content > #pptx-opts { grid-column: 1 / -1; }
  .study-preparation-note { font-size: 14px; padding: 16px 18px; }
  body.study-mode .brand-row { padding-bottom: 0; }
  body.study-mode .topbar .logo { font-size: 22px; }
  body.study-mode .topbar .logo img { width: 28px; height: 28px; }
  #screen-study .round-head b { font-size: 15px; }
  #screen-study .round-head-actions { gap: 10px; }
  #screen-study .round-bar { margin-bottom: 20px; }
  #screen-study .card-stack { height: clamp(320px, 48vh, 420px); }
  #screen-study .face { padding: 22px; border-radius: 18px; }
  #screen-study .face-text { font-size: 22px; line-height: 1.5; margin: 16px 0; }
  #screen-study .study-sound { margin-top: 26px; padding-top: 20px; }
  .study-sound-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .study-sound-volume { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  #screen-study .study-sound input[type=range] { width: min(65%, 230px); }
  #screen-study .study-sound select, #screen-study .study-sound .btn-outline { width: 100%; min-width: 0; padding-inline: 10px; white-space: normal; }
}

/* Phone settings and project library: consistent grids for navigation and actions. */
@media (max-width: 769px) {
  #home-projects .library-heading { gap: 14px; margin-bottom: 18px; }
  #home-projects-title { font-size: 26px; }
  #screen-home .home-library-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; align-items: stretch; }
  #screen-home .home-library-tools .home-start-actions { min-width: 0; height: 100%; }
  #screen-home .home-library-tools .btn, #home-quick-study > summary { width: 100%; height: 100%; min-height: 46px; padding: 11px 10px; font-size: 13px; line-height: 1.4; white-space: normal; }
  #home-quick-study { min-width: 0; }
  #home-quick-study > summary { border-color: var(--line); }
  #screen-home .project-panel { padding: 18px; }
  #screen-home .project-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #screen-home .project-title { font-size: 20px; line-height: 1.35; }
  #screen-home .project-meta { margin-top: 4px; font-size: 12px; }
  #screen-home .project-exam { display: flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 12px; width: 100%; max-width: none; margin-left: 0; padding: 3px 10px; border-radius: 9px; background: var(--bg); }
  #screen-home .project-exam .btn { min-height: 44px; padding: 8px 0 8px 8px; border-color: transparent; background: transparent; color: var(--teal); font-size: 13px; }
  #screen-home .project-exam .btn:hover { background: var(--teal-dim); }
  #screen-home .project-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-top: 16px; margin: 16px 0 0; }
  #screen-home .project-study-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #screen-home .project-study-actions > .btn { width: 100%; min-height: 46px; padding: 11px 8px; font-size: 13px; line-height: 1.4; }
  #screen-home .project-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; align-items: stretch; }
  #screen-home .project-tools:not(:has(.project-edit)) { grid-template-columns: minmax(0, 1fr); }
  #screen-home .project-tools > .project-edit, #screen-home .project-tools > .project-manage > summary { width: 100%; height: 100%; min-height: 44px; padding: 10px 8px; border: 1px solid var(--line); border-radius: var(--radius-control); background: transparent; font-size: 13px; line-height: 1.4; }
  #screen-home .project-manage { width: 100%; min-width: 0; }
  #screen-home .project-tools > .project-manage[open] > summary, #screen-home .project-tools > .project-manage > summary:hover, #screen-home .project-tools > .project-edit:hover { border-color: var(--teal); background: var(--teal-dim); }
  #screen-home .project-progress { margin-top: 16px; padding-top: 16px; }
  #screen-home .library-block-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #screen-home .library-part-tools { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: stretch; gap: 8px; }
  #screen-home .library-part-tools > .block-edit { border-color: var(--line); }
}

/* Shared interface scale. Student content, whiteboard objects and study cards keep
   their reading sizes; semantic warnings and action colours remain untouched. */
.social-heading,.social-form-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.social-heading { justify-content:space-between; align-items:flex-start; margin:16px 0 24px; }
.social-heading h1 { display:flex; align-items:center; min-height:44px; margin:0; }
.social-heading > div { min-width:0; }
#social-profile-line { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:8px; }
#social-profile-line .link-btn { min-height:44px; }
.social-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px; margin:0 0 24px; border:1px solid var(--line); border-radius:var(--radius-control); background:var(--surface-soft); }
.social-tabs button { min-width:0; min-height:44px; padding:10px 8px; border:1px solid transparent; border-radius:6px; background:transparent; color:var(--ink); font:inherit; font-weight:600; cursor:pointer; }
.social-tabs button:hover { background:var(--paper); }
.social-tabs button[aria-selected="true"] { border-color:var(--line); background:var(--paper); color:var(--teal); }
#social-content [role="tabpanel"] { min-width:0; }
#social-access p { max-width:60ch; }
.social-form-row input { flex:1 1 200px; min-width:0; }
.social-check { display:flex; align-items:center; gap:10px; margin:16px 0 0; min-height:44px; font-weight:400; }
.social-check input { flex:none; width:18px; height:18px; }
.social-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 0; border-bottom:1px solid var(--line); content-visibility:auto; contain-intrinsic-size:auto 88px; }
.social-row:last-child { border-bottom:0; }
.social-row-copy { display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; }
.social-row-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.social-error { color:var(--danger); }
.profile-avatar { display:inline-flex; flex:none; align-items:center; justify-content:center; width:44px; height:44px; overflow:hidden; border:1px solid var(--line); border-radius:50%; background:var(--surface-soft); color:var(--teal); font-size:18px; font-weight:600; line-height:1; }
.profile-avatar img { display:block; width:100%; height:100%; object-fit:cover; border-radius:50%; }
.profile-avatar-large { width:72px; height:72px; font-size:26px; }
.account-profile-heading,.social-person { display:flex; align-items:center; gap:12px; min-width:0; }
.account-profile-heading > div,.social-person > .social-row-copy { min-width:0; }
.account-profile-heading #account-profile-summary { margin:0; }
.profile-photo-editor { display:flex; align-items:center; gap:16px; margin:0 0 16px; }
.profile-photo-copy { min-width:0; }
.profile-photo-label { display:block; font-weight:600; }
.profile-photo-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:8px; }
.profile-photo-actions .link-btn { min-height:44px; padding:8px; }
.account-profile { margin:20px 0; padding:20px 0; border-block:1px solid var(--line); }
.account-profile h2 { margin:0 0 8px; font-size:var(--ui-type-section); }
.account-profile p { margin:8px 0; overflow-wrap:anywhere; }
.account-profile details > summary { min-height:44px; display:flex; align-items:center; cursor:pointer; }
.account-profile .profile-required > summary { display:none; }
.account-profile form { margin-top:12px; }
#account-registration { margin:12px 0 20px; }
#account-register-toggle { margin-bottom:12px; min-height:44px; }
#share-dialog .dialog-box { max-height:calc(100dvh - 48px); overflow-y:auto; width:min(560px,calc(100vw - 32px)); overscroll-behavior:contain; }
#share-dialog select { display:block; width:100%; min-height:44px; padding:10px; margin-bottom:16px; border:1px solid var(--control-line); border-radius:9px; color:var(--ink); background:var(--paper); }
#share-material-title { font-weight:650; overflow-wrap:anywhere; }
#share-friend-area .link-btn { display:inline-flex; align-items:center; min-height:44px; margin-bottom:8px; }
@media(max-width:600px) {
 .social-form-row > .btn { width:100%; }
 .social-row { align-items:flex-start; flex-direction:column; gap:12px; }
 .social-row-actions { justify-content:flex-start; }
 #share-dialog .share-link-row { flex-wrap:wrap; }
 #share-dialog .share-link-row input { flex-basis:100%; }
}
#home-projects #home-projects-title, #preferences-heading > h1,
#app-shell .screen > h1, #app-shell .help-heading h1, #app-shell .trash-page-head h1, #app-shell .social-heading h1 {
  font-size: var(--ui-type-page); line-height: 1.25; font-weight: 700; color: var(--ink); letter-spacing: -.025em;
}
#screen-home #home-progress-label, #screen-home .project-title, #screen-home .home-mission > h2,
#app-shell .screen > h2, #screen-import .material-input-options h2, #screen-account h2,
#screen-help h2, #screen-lessons h2, #screen-data .data-settings-panel h3,
#screen-quizzes h2, #screen-concept-map .map-library-heading h2, #screen-social h2 {
  font-size: var(--ui-type-section); line-height: 1.35; font-weight: 650; color: var(--ink); letter-spacing: -.015em;
}
#main-navigation > .btn, #nav-preferences, #main-navigation .preferences-nav>.btn, #screen-home .btn, #screen-home .home-library-tools .btn, #home-quick-study > summary,
#screen-home .project-study-actions > .btn, #screen-home .project-tools > .project-edit,
#screen-home .project-tools > .project-manage > summary, #screen-home .project-exam .btn,
#screen-home .library-block-actions > .btn, #app-shell .screen .btn-sm,
#preferences-heading .preferences-nav > .btn {
  font-size: var(--ui-type-body); line-height: 1.4;
}
#screen-home .global-progress-wrap .prog-row, #screen-home .project-meta,
#screen-home .library-block-copy .block-meta,
#screen-home .library-parts-heading,
#screen-home .project-progress-statuses, #screen-home .study-time-strip,
#app-shell .toggle-desc, #app-shell .simple-details-note, #app-shell .card-import-note,
#app-shell .quiz-note, #app-shell .lesson-tip, #app-shell .lesson-text-status {
  font-size: var(--ui-type-meta); line-height: 1.55; color: var(--muted);
}
#screen-home .project-progress h3, #screen-home .study-time-strip strong {
  font-size: var(--ui-type-body); line-height: 1.4; color: var(--ink); font-weight: 650;
}
#screen-home .global-progress-wrap .prog-row > strong, #screen-home .project-progress-head > strong {
  font-size: var(--ui-type-metric); line-height: 1.3; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums;
}
#app-shell .lede, #screen-import .material-choice-content > p,
#screen-data .data-settings-panel > p, #app-shell .account-copy, #app-shell .toggle-name,
#screen-help .help-topic-body, #screen-home .mission-letter {
  font-size: var(--ui-type-body); line-height: 1.65;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  /* Essential waiting feedback: slow rotation without restoring decorative motion. */
  .app-startup-spinner { animation: startup-spin 2.4s linear infinite !important; }
  /* Explicit card-turn interaction retains its physical front/back feedback. */
  .flashcard.is-flipping .flashcard-inner { transition: transform .7s cubic-bezier(.4,.2,.2,1) !important; }
}
