:root[data-theme="pastel-meadow"] {
    --ink: #3d3563; --ink-soft: #6a6291; --lav: #7c6bd6; --line: rgba(124,107,214,.15);
    --paper: rgba(255,254,253,.94); --mint: #e2f7ee; --peach: #fff0dc; --rose: #fde0e6;
    --shadow: 0 16px 38px rgba(99,81,150,.13), 0 3px 10px rgba(99,81,150,.07);
  }
  * { box-sizing: border-box; }
  body {
    font-family: var(--theme-font-interface);
    margin: 0; color: var(--ink); min-height: 100vh;
    background: var(--theme-parent-background);
    background-attachment: fixed;
  }
  main { max-width: 1040px; margin: 0 auto; padding: calc(92px + env(safe-area-inset-top)) 20px 64px; }
  h1, h2, h3, p { margin-top: 0; }
  h1 { margin-bottom: 8px; font-size: clamp(1.9rem, 5vw, 2.65rem); line-height: 1.05; letter-spacing: -.035em; }
  h2 { margin: 0 0 5px; font-size: clamp(1.45rem, 3vw, 1.9rem); letter-spacing: -.025em; }
  h3 { margin-bottom: 4px; font-size: 1.05rem; }
  .hero { margin-bottom: 22px; }
  .hero .eyebrow { margin-bottom: 9px; }
  .eyebrow, .section-label { color: var(--lav); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .lead { max-width: 680px; margin-bottom: 14px; color: var(--ink-soft); line-height: 1.55; }
  .session-notice { max-width: 680px; margin: 14px 0 0; padding: 11px 14px; border: 1px solid rgba(124,107,214,.18); border-radius: 14px; background: rgba(255,255,255,.58); color: var(--ink-soft); font-size: .82rem; line-height: 1.45; }
  .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; color: var(--ink-soft); font-size: .84rem; }
  .tool-link { color: var(--lav); font-weight: 700; text-decoration: none; }
  .tool-link:hover { text-decoration: underline; }
  .meta button, .meta select { border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; background: rgba(255,255,255,.72); color: var(--ink); font: inherit; font-weight: 700; }
  .portal-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 10; min-height: calc(56px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 18px 9px; display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 10px; background: rgba(255,254,253,.78); border-bottom: 1px solid rgba(124,107,214,.1); box-shadow: 0 4px 18px rgba(75,61,121,.06); -webkit-backdrop-filter: blur(18px) saturate(1.25); backdrop-filter: blur(18px) saturate(1.25); }
  .portal-nav .back-home { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(var(--theme-accent-rgb),.28); border-radius: 999px; padding: 7px 10px; background: rgba(255,255,255,.82); color: var(--ink-soft); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
  .portal-nav .back-home:hover, .portal-nav .back-home:focus-visible { color: var(--ink); text-decoration: underline; }
  .logout-action { grid-column: 3; justify-self: end; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid rgba(168,59,91,.24); border-radius: 999px; padding: 7px 10px; background: rgba(253,224,230,.72); color: #a83b5b; font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
  .logout-action:hover, .logout-action:focus-visible { border-color: rgba(168,59,91,.38); background: rgba(253,224,230,.72); }
  .logout-action:disabled { opacity: .55; cursor: wait; }
  .portal-theme-toggle { grid-column: 2; justify-self: center; min-width: 0; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(var(--theme-accent-rgb),.28); border-radius: 999px; padding: 5px 10px 5px 6px; background: rgba(255,255,255,.82); color: var(--ink-soft); font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
  .portal-theme-toggle[hidden] { display: none; }
  .portal-theme-toggle img { width: 24px; height: 24px; object-fit: contain; }
  .portal-theme-toggle:hover, .portal-theme-toggle:focus-visible { border-color: rgba(var(--theme-accent-rgb),.55); background: white; }
  .portal-theme-toggle:disabled { opacity: .6; cursor: wait; }
  .portal-nav .back-home svg, .logout-action svg { width: 18px; height: 18px; flex: none; }
  .hero-title { max-width: 760px; }
  .child-context { margin: 0 3px 20px; }
  .child-context .section-label { margin: 0 0 4px; }
  .child-context-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 .18em; margin: 0; font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.15; letter-spacing: -.025em; }
  .title-child-control { position: relative; display: inline-block; max-width: min(70vw,520px); }
  .title-child-button { max-width: 100%; display: inline-flex; align-items: center; gap: .16em; border: 0; border-bottom: 2px solid transparent; padding: 0 0 .03em; background: transparent; color: inherit; font: inherit; font-weight: inherit; line-height: inherit; text-align: left; }
  .title-child-control.switchable .title-child-button { border-bottom-style: dotted; border-bottom-color: rgba(124,107,214,.38); cursor: pointer; }
  .title-child-button:disabled { opacity: 1; cursor: default; }
  .title-child-button:focus-visible { outline: 3px solid rgba(124,107,214,.35); outline-offset: 4px; border-radius: 4px; }
  #childName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .title-child-cue { flex: none; display: block; width: .48em; height: .32em; color: var(--lav); }
  .title-child-menu { display: block; position: absolute; z-index: 30; top: calc(100% + 10px); left: 0; min-width: min(230px,82vw); padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.98); box-shadow: 0 14px 34px rgba(75,61,121,.2); font-size: 1rem; }
  .title-child-option { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 0; border-radius: 10px; padding: 10px 12px; background: transparent; color: var(--ink); font: inherit; font-weight: 750; text-align: left; cursor: pointer; }
  .title-child-option:hover, .title-child-option:focus-visible { background: rgba(239,235,252,.85); outline: none; }
  .title-child-option[aria-selected="true"]::after { content: "✓"; color: var(--lav); }
  .add-child-quick { position: relative; align-self: center; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(124,107,214,.26); border-radius: 50%; padding: 0; background: rgba(255,255,255,.72); color: var(--lav); font: inherit; font-size: 1rem; font-weight: 900; cursor: pointer; }
  .add-child-quick:hover, .add-child-quick:focus-visible { border-color: rgba(124,107,214,.5); background: white; }
  .add-child-quick::after { content: attr(data-tooltip); position: absolute; left: 50%; top: calc(100% + 8px); z-index: 3; width: max-content; max-width: 190px; transform: translate(-50%, -3px); border-radius: 9px; padding: 6px 8px; background: #3d3563; color: white; font-size: .7rem; font-weight: 700; line-height: 1.25; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
  .add-child-quick:hover::after, .add-child-quick:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
  [hidden] { display: none!important; }
  .nav-action { border: 0; background: transparent; color: var(--lav); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; white-space: nowrap; }
  .nav-action:hover, .nav-action:focus-visible { text-decoration: underline; }
  .modal-close { position: absolute; top: 14px; right: 16px; border: 0!important; padding: 6px!important; background: transparent!important; box-shadow: none!important; color: var(--ink-soft)!important; }
  .gate-card { position: relative; }
  .account-mark .i { display: inline-block; width: 1em; height: 1em; }
  .gate { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 22px; background: linear-gradient(135deg, #fdf4f4, #eee9fa); }
  .gate.hidden { display: none; }
  .gate-card { width: min(430px, 100%); padding: 30px; border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
  .gate-card form { display: grid; gap: 12px; margin-top: 20px; }
  .gate-card input { width: 100%; padding: 13px; border: 2px solid rgba(124,107,214,.3); border-radius: 15px; background: white; color: var(--ink); font: inherit; font-size: 1.3rem; text-align: center; letter-spacing: .22em; }
  .gate-card select { width: 100%; padding: 12px; border: 2px solid rgba(124,107,214,.3); border-radius: 15px; background: white; color: var(--ink); font: inherit; }
  .gate-card button { border: 0; border-radius: 16px; padding: 13px 18px; background: linear-gradient(160deg,#e8e2fb,#cfc5f4); color: var(--ink); font: inherit; font-weight: 850; cursor: pointer; }
  .gate-card .development-reset { justify-self: center; padding: 8px 4px; border-radius: 0; background: transparent; box-shadow: none; color: #a83b5b; font-size: .78rem; text-decoration: underline; }
  .gate-card .development-reset:disabled { opacity: .55; cursor: wait; }
  .dialog-actions { display: flex; justify-content: center; gap: 10px; }
  .gate-card .dialog-actions button { width: auto; min-width: 130px; }
  .gate-card .dialog-actions .dialog-cancel { border: 1px solid rgba(124,107,214,.22); background: transparent; color: var(--ink-soft); }
  .gate-card .dialog-actions .dialog-cancel:hover, .gate-card .dialog-actions .dialog-cancel:focus-visible { background: rgba(239,235,252,.65); color: var(--ink); }
  .gate-status { min-height: 22px; color: #a83b5b; font-size: .86rem; }
  .gate-hint { color: var(--ink-soft); font-size: .78rem; }
  .portal-tabs { width: fit-content; max-width: 100%; display: inline-grid; grid-template-columns: repeat(3, auto); gap: 5px; margin-bottom: 24px; padding: 5px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.52); }
  .portal-tab { min-width: 132px; border: 0; border-radius: 14px; padding: 11px 18px; color: var(--ink-soft); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
  .portal-tab.active { color: var(--ink); background: white; box-shadow: 0 5px 16px rgba(99,81,150,.12); }
  .portal-tab:focus-visible { outline: 3px solid rgba(124,107,214,.35); outline-offset: 2px; }
  .portal-view { display: none; }
  .portal-view.active { display: block; }
  .area-tabs { width: fit-content; max-width: 100%; display: flex; gap: 24px; margin: 24px 0 28px; padding: 0 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
  .area-tab { position: relative; border: 0; border-radius: 0; padding: 10px 2px 9px; color: var(--ink-soft); background: transparent; font: inherit; font-size: 1.05rem; font-weight: 800; cursor: pointer; }
  .pairing-code { margin: 18px 0 8px; font-size: clamp(2.2rem,10vw,3.5rem); font-weight: 900; letter-spacing: .18em; color: var(--lav); }
  .device-tools { margin-bottom: 8px; }
  .management-panel { margin-bottom: 30px; padding: 22px; border: 1px solid rgba(255,255,255,.8); border-radius: 26px; background: rgba(255,254,253,.82); box-shadow: var(--shadow); }
  .management-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
  .management-head h2 { margin-top: 3px; }
  .management-head p { max-width: 620px; margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }
  .management-action { flex: 0 0 auto; border: 1px solid rgba(124,107,214,.24); border-radius: 14px; padding: 10px 14px; background: white; color: var(--lav); font: inherit; font-size: .86rem; font-weight: 800; cursor: pointer; }
  .management-action:hover, .management-action:focus-visible { border-color: rgba(124,107,214,.48); background: #faf8ff; }
  .management-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .management-action.danger { border-color: rgba(168,59,91,.22); color: #a83b5b; }
  .management-action.danger:hover, .management-action.danger:focus-visible { border-color: rgba(168,59,91,.42); background: rgba(253,224,230,.48); }
  .management-action:disabled { opacity: .55; cursor: wait; }
  .data-status { min-height: 1.2em; margin-top: 7px!important; color: var(--ink-soft); font-size: .78rem; }
  .management-body { padding-top: 15px; border-top: 1px solid var(--line); }
  .progress-head { margin: 0 0 0 3px; }
  .setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
  .setting-row:first-of-type { margin-top: 18px; }
  .setting-row p { margin: 4px 0 0; }
  .theme-setting { padding: 18px 0; border-top: 1px solid var(--line); }
  .theme-setting h3 { margin: 0 0 4px; }
  .theme-options { display: grid; grid-template-columns: repeat(2,minmax(0,220px)); gap: 12px; margin-top: 14px; }
  .theme-option { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 11px; border: 2px solid transparent; border-radius: 17px; padding: 11px; background: rgba(255,255,255,.72); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .theme-option:hover, .theme-option:focus-visible { border-color: rgba(var(--theme-accent-rgb),.36); outline: none; }
  .theme-option[aria-pressed="true"] { border-color: var(--lav); box-shadow: 0 5px 16px rgba(var(--theme-accent-rgb),.16); }
  .theme-option img { width: 48px; height: 48px; object-fit: contain; }
  .theme-option strong, .theme-option small { display: block; }
  .theme-option small { margin-top: 2px; color: var(--ink-soft); font-size: .72rem; line-height: 1.3; }
  .theme-status { min-height: 1.1em; margin: 9px 0 0; color: var(--ink-soft); font-size: .78rem; }
  .information-panel { max-width: 900px; padding: 22px; border: 1px solid rgba(255,255,255,.8); border-radius: 26px; background: rgba(255,254,253,.82); box-shadow: var(--shadow); }
  .information-panel > h2 { margin: 3px 0 6px; }
  .information-intro { max-width: 720px; margin: 0 0 24px; color: var(--ink-soft); line-height: 1.55; }
  .information-intro p { margin: 0; }
  .information-intro p + p { margin-top: 10px; font-size: .84rem; color: #777096; }
  .learning-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
  .learning-card { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.7); }
  .learning-card h3 { margin: 0 0 6px; }
  .learning-card > p { margin: 0 0 14px; color: var(--ink-soft); font-size: .88rem; line-height: 1.5; }
  .learning-card ul { margin: 0; padding-left: 1.15rem; color: var(--ink-soft); font-size: .86rem; line-height: 1.55; }
  .learning-card li + li { margin-top: 8px; }
  .learning-card strong { color: var(--ink); }
  .portal-status { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--rose); color: #8b2948; font-size: .84rem; font-weight: 700; }
  .progress-head h2 { margin: 3px 0 4px; }
  .progress-head p { margin: 0; color: var(--ink-soft); font-size: .88rem; }
  .device-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .device-row:last-child { border-bottom: 0; }
  .device-remove { border: 0; background: transparent; color: #a83b5b; font: inherit; font-size: .8rem; font-weight: 750; cursor: pointer; }
  .area-tab.active { color: var(--ink); background: transparent; box-shadow: none; }
  .area-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 3px; background: var(--lav); }
  .area-tab:focus-visible { outline: 3px solid rgba(124,107,214,.35); outline-offset: 2px; }
  .area { display: none; }
  .area.active { display: block; }
  .area-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
  .area-icon { flex: 0 0 54px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; background: white; color: var(--lav); box-shadow: var(--shadow); font-size: 1.25rem; font-weight: 900; }
  .area-head p { margin: 0; color: var(--ink-soft); line-height: 1.45; }
  .section-label { margin: 0 0 9px 3px; }
  .panel { margin-bottom: 18px; padding: 20px; border: 1px solid rgba(255,255,255,.75); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
  .stat { min-height: 96px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.72); }
  .stat b { display: block; margin-bottom: 3px; font-size: clamp(1.65rem, 4vw, 2.15rem); line-height: 1; }
  .stat span { color: var(--ink-soft); font-size: .82rem; line-height: 1.25; }
  .focus-panel { background: linear-gradient(145deg, rgba(255,252,245,.97), rgba(250,246,255,.96)); }
  .panel-head { margin-bottom: 14px; }
  .panel-head p { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }
  .focus-list { display: grid; gap: 8px; }
  .focus-item { display: grid; grid-template-columns: minmax(90px, auto) 1fr auto; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.7); }
  .focus-item b { font-size: 1.05rem; }
  .focus-item small { color: var(--ink-soft); line-height: 1.35; }
  .empty-note { padding: 12px 0; color: #2b7a62; font-weight: 700; }
  .muted { color: var(--ink-soft); font-size: .86rem; line-height: 1.5; }
  .pill { display: inline-block; white-space: nowrap; border-radius: 999px; padding: 4px 9px; font-size: .72rem; font-weight: 800; color: var(--ink); }
  .l-hard { background: var(--rose); }
  .l-mid { background: var(--peach); }
  .l-good { background: var(--mint); }
  .number-strip { display: flex; flex-wrap: wrap; gap: 8px; }
  .nbox { width: 76px; min-height: 62px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 850; background: rgba(255,255,255,.75); }
  .nbox.l-hard { background: var(--rose); }
  .nbox.l-mid { background: var(--peach); }
  .nbox span { width: 100%; margin-top: 2px; text-align: center; white-space: nowrap; font-size: .64rem; font-weight: 700; color: var(--ink-soft); }
  details.data-section { margin: 12px 0; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.55); }
  details.data-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; list-style: none; font-weight: 800; }
  details.data-section > summary::-webkit-details-marker { display: none; }
  details.data-section > summary::after { content: "+"; flex: 0 0 auto; color: var(--lav); font-size: 1.35rem; }
  details.data-section[open] > summary::after { content: "–"; }
  details.data-section > summary small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .75rem; font-weight: 500; }
  .detail-body { padding: 0 18px 18px; overflow-x: auto; }
  .legend { margin-top: 12px; color: var(--ink-soft); font-size: .8rem; line-height: 1.75; }
  table { border-collapse: collapse; width: 100%; font-size: .88rem; }
  th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
  th { color: var(--ink-soft); font-size: .75rem; font-weight: 800; }
  .ok { color: #2b7a62; font-weight: 700; }
  .bad { color: #a83b5b; font-weight: 700; }
  .matrix-wrap { overflow-x: auto; }
  #heat { border-collapse: separate; border-spacing: 5px; width: auto; }
  #heat th { text-align: center; padding: 2px 6px; border: 0; }
  #heat td { width: 46px; height: 38px; padding: 0; border: 0; border-radius: 12px; text-align: center; font-size: .72rem; font-weight: 800; background: #efecf5; }
  details.sess { border-bottom: 1px solid var(--line); padding: 11px 0; }
  details.sess summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: baseline; }
  details.sess .tbl { margin: 10px 0 4px; }
  .live { background: var(--mint); color: #1f5f4d; font-weight: 800; border-radius: 999px; padding: 3px 9px; font-size: .72rem; }
  .method-note { margin-top: 22px; padding: 14px 16px; border-left: 4px solid rgba(124,107,214,.35); color: var(--ink-soft); font-size: .82rem; line-height: 1.55; }
  .i { display: block; width: 1em; height: 1em; overflow: visible; }
  @media (max-width: 1200px) {
    .portal-nav .back-home,
    .portal-theme-toggle,
    .logout-action { width: 40px; height: 40px; min-width: 40px; padding: 0; justify-content: center; gap: 0; }
    .back-home-label,
    .portal-theme-toggle-label,
    .logout-action-label { display: none; }
  }
  @media (max-width: 640px) {
    main { padding: calc(78px + env(safe-area-inset-top)) 14px 48px; }
    .portal-nav { min-height: calc(54px + env(safe-area-inset-top)); padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 6px; }
    .portal-nav .back-home { width: 40px; height: 40px; padding: 0; font-size: 13px; }
    .logout-action { width: 40px; height: 40px; padding: 0; font-size: 13px; }
    .portal-theme-toggle { padding: 5px; }
    .portal-theme-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .child-context { margin-bottom: 18px; }
    .child-context-title { gap: 0 .14em; }
    .title-child-control { max-width: 62vw; }
    .add-child-quick { width: 28px; height: 28px; }
    .stats { grid-template-columns: 1fr; gap: 8px; }
    .stat { min-height: 0; display: flex; align-items: baseline; gap: 10px; }
    .focus-item { grid-template-columns: 1fr auto; }
    .focus-item small { grid-column: 1 / -1; }
    .portal-tabs { width: 100%; }
    .portal-tab { min-width: 0; padding: 10px 8px; font-size: .86rem; }
    .area-tabs { gap: 18px; }
    .area-tab { padding: 9px 1px 8px; font-size: 1rem; }
    .dialog-actions { flex-wrap: wrap; }
    .gate-card .dialog-actions button { min-width: 118px; }
    .management-head { align-items: stretch; flex-direction: column; }
    .management-action { align-self: flex-start; }
    .setting-row { align-items: flex-start; flex-direction: column; gap: 12px; }
    .setting-row .management-action { width: 100%; }
    .theme-options { grid-template-columns: 1fr; }
    .learning-grid { grid-template-columns: 1fr; }
  }
