:root {
    --glass-rim: inset 0 1.5px 1px #ffffffed, inset 1px 0 1px #ffffff80, inset 0 -1px 1px #abbfe078, 0 8px 28px #20365620;
    --glass-surface: linear-gradient(133deg, #fffffff2, #eef5ffe3 44%, #e0edffc7 76%, #ffffffdc);
    --glass-nav-ink: #132b49;
    --glass-nav-blue: #084db9;
}
.glass-bar, .glass-dock {
    color: var(--glass-nav-ink);
    background: var(--glass-surface);
    box-shadow: var(--glass-rim);
    border: 1px solid #ffffffc9;
    backdrop-filter: blur(18px) saturate(120%);
    border-radius: 2.25rem;
}
.glass-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: .75rem; padding: .45rem .85rem; position: relative; z-index: 5;
}
.glass-brand {
    display: inline-flex; align-items: center; gap: .65rem; font-weight: 700;
    line-height: 1.2; color: inherit; text-decoration: none; min-width: 0;
}
.glass-brand img {
    flex: none; width: 46px; height: 46px; padding: 0; border-radius: 0;
    object-fit: contain; box-sizing: border-box; background: transparent;
}
.glass-dock {
    position: fixed; inset: auto 0 max(.65rem, env(safe-area-inset-bottom)); z-index: 8;
    margin-inline: auto; padding: 5px 10px; width: fit-content; max-width: calc(100% - 16px);
    display: flex; gap: 12px; align-items: center; justify-content: center;
}
.glass-dock > :is(a,button), .glass-dock > details > summary, .glass-fan > summary {
    display: inline-grid; place-items: center; box-sizing: border-box; margin: 0;
    min-width: 44px; min-height: 44px; padding: 8px; color: #344a66;
    background: transparent; border: 0; border-radius: 1rem; cursor: pointer;
    list-style: none; text-decoration: none; font: inherit;
}
.glass-fan > summary::-webkit-details-marker { display: none; }
.glass-dock [aria-current], .glass-fan[open] > summary { color: var(--glass-nav-blue); }
.glass-dock :is(a,button,summary):focus-visible, .glass-fan :focus-visible { outline: 3px solid #165ec2; outline-offset: 2px; }
.glass-glyph { display: inline-grid; place-items: center; font: 700 1.4rem/1 system-ui; min-width: 1.3em; }
.glass-fan { position: relative; margin: 0; padding: 0; border: 0; }
.glass-fan > summary { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.glass-fan .glass-petals {
    position: absolute; inset: calc(100% + 12px) 0 auto auto; z-index: 10;
    display: grid; grid-auto-flow: row; direction: rtl; gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(17rem, calc(100vw - 2.5rem));
    pointer-events: none;
}
.glass-fan .glass-petals:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, 1fr); width: min(11rem, calc(100vw - 2.5rem)); }
.glass-fan .glass-petals:has(> :only-child) { grid-template-columns: 1fr; width: 5.25rem; }
.glass-petals > * {
    --drop: 0px; direction: ltr; pointer-events: auto; transform: translateY(var(--drop)); margin: 0;
}
.glass-petals > :nth-child(3n + 2) { --drop: 28px; }
.glass-petals > :nth-child(3n) { --drop: 78px; }
.glass-fan .glass-petals :is(a,button) {
    width: 100%; min-height: 56px; padding: .48rem .25rem; margin: 0;
    display: grid; align-content: center; justify-items: center; gap: .2rem;
    background: linear-gradient(145deg,#fff,#ecf4ff 65%,#dce9f9);
    color: #18395f; border: 1px solid #e9f2ff; border-radius: 1.2rem;
    box-shadow: var(--glass-rim), 0 2px 8px #142f4d33;
    text-align: center; text-decoration: none; 
    font-family: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere;
}
.glass-petals > form { display: flex; }
.glass-fan .glass-petals :is(a,button):hover { background: #fff; color: var(--glass-nav-blue); }
.glass-dock .glass-fan .glass-petals { inset-block: auto calc(100% + 12px); }
.glass-dock .glass-petals > * { transform: translateY(calc(0px - var(--drop))); }
@media (prefers-reduced-motion: no-preference) {
     .glass-fan[open] .glass-petals > * { animation: glass-open .17s ease-out both; }
    .glass-fan[open] .glass-petals > :nth-child(3n + 2) { animation-delay: .025s; }
    .glass-fan[open] .glass-petals > :nth-child(3n) { animation-delay: .05s; }
    @keyframes glass-open { from { opacity: 0; scale: .83; } }
}
@media (max-height: 30rem), (max-width: 19rem) {
    .glass-fan .glass-petals { max-height: 52svh; padding: 5px; overflow: auto; pointer-events: auto; }
    .glass-fan .glass-petals > * { transform: none; }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
    .glass-bar, .glass-dock, .glass-fan .glass-petals :is(a,button) { backdrop-filter: none; background: Canvas; color: CanvasText; border: 1px solid; }
}

.glass-dock .glass-fan { position: static; }
.glass-dock .glass-fan .glass-petals { inset-inline: 50% auto; translate: -50% 0; }
.glass-petals .portal-icon { width: 20px; height: 20px; }

/* The embroidery supplies the colour. White bevels and fine coloured edges catch the light. */
@media screen and (prefers-reduced-transparency: no-preference) and (forced-colors: none) {
    html:not(.comfortable-reading) {
        --crystal: linear-gradient(135deg, rgb(255 255 255 / 45%), rgb(255 255 255 / 14%) 48%, rgb(255 255 255 / 28%));
        --crystal-reading: linear-gradient(135deg, rgb(255 255 255 / 76%), rgb(246 251 255 / 52%) 48%, rgb(255 255 255 / 62%));
        --crystal-control: linear-gradient(135deg, #ffffffcf, #eff8ff9c 48%, #ffffffe0);
        --crystal-rim: inset 0 2px 2px #fffffffa, inset 0 -1.5px 1.5px #ffffff66,
            inset 1.5px 0 2px #38bdf859, inset -1.5px 0 2px #c084fc4d,
            0 16px 36px -10px #0f172a30, 0 1px 3px #0f172a12;
        --glass: var(--crystal);
        --glass-surface: var(--crystal);
        --reading-glass: var(--crystal-reading);
        --edge: var(--crystal-rim);
        --glass-rim: var(--crystal-rim);
        --portal-text: #101b30;
        --portal-muted: #304059;
    }
    html:not(.comfortable-reading) :is(.portal-panel, .portal-scope, .portal-hero, .office-panel,
        .legacy-workspace .card, .legacy-workspace .setup-aside, .legacy-workspace .page-heading,
        .legacy-workspace .welcome-hero, .legacy-workspace .demo-hero,
        main > .panel, .shell .panel, .shell .hero, .shell .simple-heading,
        .calendar-dialog, body:has(.shell) > dialog, .family-record,
        main:has(.mast) > h1, .legacy-workspace .detail-banner) {
        background: var(--crystal-reading);
        border: 1px solid rgb(255 255 255 / 85%);
        box-shadow: var(--crystal-rim);
        -webkit-backdrop-filter: blur(10px) saturate(175%);
        backdrop-filter: blur(10px) saturate(175%);
    }
    html:not(.comfortable-reading) :is(.portal-topbar,.portal-mobile-nav,.glass-bar,.glass-dock) {
        background: var(--crystal), linear-gradient(#f5faff55,#eff8ff55);
        border: 1px solid rgb(255 255 255 / 85%);
        box-shadow: var(--crystal-rim);
        -webkit-backdrop-filter: blur(8px) saturate(190%);
        backdrop-filter: blur(8px) saturate(190%);
    }
    html:not(.comfortable-reading) .portal-panel.family-calendar {
        background: var(--crystal), linear-gradient(#f5faff55,#f5faff55);
        -webkit-backdrop-filter: blur(7px) saturate(190%);
        backdrop-filter: blur(7px) saturate(190%);
    }
    html:not(.comfortable-reading) .family-calendar .portal-calendar {
        background: linear-gradient(135deg,#f8fbff5c,#f4f9ff66 48%,#f8fbff57);
    }
    html:not(.comfortable-reading) .family-calendar .portal-calendar th { color: #192c46; }
    html:not(.comfortable-reading) .family-calendar td.portal-calendar-outside { color: #28394f; }
    html:not(.comfortable-reading) .portal-panel.family-feed-panel {
        padding: 0; background: none; border: 0; box-shadow: none;
        -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    html:not(.comfortable-reading) .family-feed-panel > .portal-section-header h2 {
        padding: .33rem .75rem; width: fit-content; border-radius: 1rem;
        color: #101b30; background: var(--crystal-reading);
        box-shadow: inset 0 1px 1px #ffffffd9; backdrop-filter: blur(8px);
    }
    html:not(.comfortable-reading) :is(.family-agenda-preview button,.family-period a:not([aria-current]),
        .portal-button-secondary,.calendar-entries > div,.glass-fan .glass-petals :is(a,button),
        .portal-mobile-nav .dock-fan a) {
        background: var(--crystal-control); color: #173450;
        border: 1px solid #ffffffc9; box-shadow: var(--crystal-rim);
        -webkit-backdrop-filter: blur(12px) saturate(160%);
        backdrop-filter: blur(12px) saturate(160%);
    }
    html:not(.comfortable-reading) .family-calendar .portal-calendar-today time {
        border-radius: .8rem; box-shadow: 0 0 0 2px #fffffff0, 0 2px 6px #17427b44;
    }
    html:not(.comfortable-reading) :is(.portal-form,.family-tools-form,.teacher-form,.office-panel,
        .legacy-workspace .form-card,.panel .stack,.panel .row,.calendar-form) :is(
        input:not([type=hidden],[type=checkbox],[type=radio],[type=file]),select,textarea) {
        background: linear-gradient(135deg,#ffffffe8,#f6faffab);
        color: #132039; border: 1px solid #6e81988c;
        box-shadow: inset 0 1px 1px #fff, inset 0 -1px 1px #ffffff8c;
    }
    html:not(.comfortable-reading) :is(.portal-button:not(.portal-button-secondary), .legacy-workspace .button:not(.secondary),
        .shell .primary, .family-period a[aria-current]) {
        background: linear-gradient(145deg,#2267d4,#0745a7 65%,#1251b2);
        color: white; box-shadow: inset 0 1.5px 1px #ffffff6e, 0 3px 8px #153c6829;
    }
}

/* The top layer lets every trigger fan out beyond its own glass stacking context. */
html body > dialog.radial-menu[open] {
    position: fixed; inset: 0; box-sizing: border-box; margin: 0; padding: 0;
    width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden;
    border: 0; border-radius: 0; background: transparent; box-shadow: none;
    backdrop-filter: none; color: white; font-family: inherit;
}
dialog.radial-menu::backdrop { background: rgb(7 17 37 / 76%); }
html:has(.radial-menu[open]) { overflow: hidden; scrollbar-gutter: stable; }
.radial-menu .radial-item, .radial-menu .radial-dismiss {
    position: absolute; left: var(--radial-x); top: var(--radial-y);
    translate: -50% -50%; margin: 0;
}
.radial-menu form.radial-item { display: block; padding: 0; border: 0; background: transparent; }
.radial-menu .radial-action {
    box-sizing: border-box; display: flex; flex-direction: column; align-items: center;
    width: clamp(68px, 19vw, 88px); height: auto; min-height: 44px; margin: 0; padding: 0;
    gap: 5px; border: 0; border-radius: 8px; background: transparent; color: white;
    box-shadow: none; font-family: inherit;
    font-weight: 600; font-size: .875rem; line-height: 1.2; letter-spacing: normal;
    text-align: center; white-space: normal; overflow-wrap: anywhere; text-decoration: none; cursor: pointer;
}
.radial-menu .radial-icon, .radial-menu .radial-dismiss {
    box-sizing: border-box; display: grid; place-items: center; width: 46px; height: 46px;
    padding: 0; border: 1px solid #ffffffdb; border-radius: 50%; color: #1053ac;
    background: linear-gradient(145deg,#fff,#edf6ffdc 72%,#cbdff5);
    box-shadow: inset 0 2px 1px white, 0 3px 12px #05122f42;
}
.radial-menu .radial-icon { position: relative; font: 600 1.4rem/1 system-ui; }
.radial-menu .radial-icon :is(svg,.portal-icon) { width: 23px; height: 23px; }
.radial-menu .radial-action[aria-current] .radial-icon { background: #1255be; color: white; }
.radial-menu .radial-action[aria-current] .portal-icon { --portal-icon: var(--selected-icon); }
.radial-menu .radial-action[data-unread]::after { content: none; }
.radial-menu [data-unread] .radial-icon::after {
    content: ''; position: absolute; right: 1px; top: 1px; width: 8px; height: 8px;
    border: 2px solid white; border-radius: 50%; background: #c32135;
}
.radial-menu .radial-dismiss {
    appearance: none; color: white; background: #163969; cursor: pointer;
    box-shadow: 0 2px 8px #05122f38;
}
.radial-menu .radial-dismiss::before, .radial-menu .radial-dismiss::after {
    content: ''; grid-area: 1 / 1; width: 18px; height: 2px; border-radius: 2px;
    background: currentColor; transform: rotate(45deg);
}
.radial-menu .radial-dismiss::after { transform: rotate(-45deg); }
.radial-menu .radial-dismiss:focus-visible {
    outline: 2px solid currentColor; outline-offset: -3px; border-color: transparent;
}
.radial-menu :focus-visible { outline: 3px solid #ffdc7a; outline-offset: 3px; }
.radial-menu .radial-action:hover .radial-icon { background: white; color: #084697; }
.radial-menu .radial-action:is(:disabled,[aria-disabled=true]) { opacity: .65; cursor: default; }
@media (prefers-reduced-motion: no-preference) {
    .radial-menu:not(.radial-compact) .radial-icon {
        animation: radial-unfold .2s cubic-bezier(.2,.8,.25,1) both;
    }
    @keyframes radial-unfold { from { transform: translate(var(--from-x),var(--from-y)) scale(.55); opacity: 0; } }
}
/* Extreme zoom or a short landscape viewport can leave too little room for a full arc. */
.radial-menu.radial-compact .radial-options {
    position: absolute; inset: 8px 8px 72px; overflow: auto; display: flex; flex-wrap: wrap;
    align-content: safe center; justify-content: center; gap: 14px; padding: 5px;
}
.radial-menu.radial-compact .radial-item { position: static; translate: none; }
.radial-menu.radial-compact .radial-dismiss { left: 50% !important; top: auto !important; bottom: 10px; translate: -50% 0; }
@media (forced-colors: active) {
    .radial-menu .radial-dismiss::before, .radial-menu .radial-dismiss::after {
        forced-color-adjust: none; background: ButtonText;
    }
    .radial-menu::backdrop { background: Canvas; }
    .radial-menu .radial-action { color: ButtonText; }
    .radial-menu .radial-icon, .radial-menu .radial-dismiss { border: 1px solid ButtonText; }
}

:root {
    --ui-font: "DM Sans", "Myanmar Text", "Noto Sans Myanmar", sans-serif;
    --ui-title: clamp(1.55rem, 1.4rem + .6vw, 1.875rem);
    --ui-section: clamp(1.18rem, 1.13rem + .25vw, 1.32rem);
    --ui-subtitle: 1.0625rem;
}
body, button, input, select, textarea, summary { font-family: var(--ui-font); }
:is(.portal-shell,.entry-main,.office-shell,.family-auth-card,main:has(.mast)) h1,
.shell :is(.hero,.simple-heading) h1 { font-size: var(--ui-title); line-height: 1.22; }
:is(.portal-shell,.entry-main,.office-shell,.family-auth-card,main:has(.mast)) h2,
.shell :is(.panel-header,.side-panel,.feature-group,.backup-form) h2 { font-size: var(--ui-section); line-height: 1.3; }
:is(.portal-shell,.entry-main,.office-shell,main:has(.mast)) h3 { font-size: var(--ui-subtitle); line-height: 1.38; }
.legacy-workspace :is(.button,.text-link,.back-link),.portal-button { white-space: normal; overflow-wrap: anywhere; }
.legacy-workspace .quote-mark,.radial-menu .radial-dismiss,.radial-menu .radial-icon { font-family:var(--ui-font); }
.portal-shell .family-clock time { font-size:var(--ui-title); letter-spacing:-.025em; }
.portal-shell .portal-mobile-brand small { white-space:normal; overflow-wrap:anywhere; }
