:root {
    color-scheme: light;
    font-family: "Segoe UI", "Avenir Next", Avenir, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    --ink: #183d3b;
    --ink-soft: #486966;
    --muted: #708985;
    --accent: #278f83;
    --accent-deep: #176e67;
    --line: rgba(91, 153, 144, .17);
    --panel: rgba(255, 255, 255, .76);
    --panel-solid: #fbfefd;
    --panel-shadow: 0 18px 55px rgba(56, 112, 104, .075), 0 2px 9px rgba(56, 112, 104, .035);
    --page-bg: #eff8f6;
    --focus: #188c80;
    --ease: cubic-bezier(.2, .75, .25, 1);
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--page-bg);
    background-image: radial-gradient(ellipse at 12% 4%, rgba(197, 235, 224, .72), transparent 40%),
        radial-gradient(ellipse at 94% 78%, rgba(199, 234, 241, .58), transparent 39%),
        linear-gradient(135deg, #f6fbf9, #eaf5f4);
    background-attachment: fixed;
    transition: background-color .5s ease, color .35s ease;
}

body[data-palette="1"] {
    background-image: radial-gradient(ellipse at 82% 12%, rgba(202, 234, 239, .76), transparent 42%),
        radial-gradient(ellipse at 10% 88%, rgba(205, 239, 225, .62), transparent 43%),
        linear-gradient(135deg, #f5fbf9, #e8f4f4);
}

body[data-palette="2"] {
    background-image: radial-gradient(ellipse at 18% 18%, rgba(205, 239, 224, .8), transparent 40%),
        radial-gradient(ellipse at 86% 82%, rgba(206, 230, 240, .66), transparent 44%),
        linear-gradient(145deg, #f6fbf8, #eaf3f1);
}

body[data-palette="3"] {
    background-image: radial-gradient(ellipse at 68% 80%, rgba(191, 232, 230, .72), transparent 44%),
        radial-gradient(ellipse at 15% 12%, rgba(222, 240, 226, .7), transparent 40%),
        linear-gradient(145deg, #f8fbf8, #ebf6f3);
}

body.theme-dark {
    color-scheme: dark;
    --ink: #e5f3ef;
    --ink-soft: #b1cbc4;
    --muted: #8eaaa2;
    --accent: #79c8b8;
    --accent-deep: #a1ddcf;
    --line: rgba(168, 218, 205, .14);
    --panel: rgba(20, 43, 43, .78);
    --panel-solid: #183332;
    --panel-shadow: 0 20px 60px rgba(0, 0, 0, .2), 0 2px 10px rgba(0, 0, 0, .12);
    --page-bg: #102322;
    --focus: #8bd7c6;
    background-image: radial-gradient(ellipse at 12% 4%, rgba(37, 91, 77, .45), transparent 40%),
        radial-gradient(ellipse at 94% 78%, rgba(35, 78, 91, .36), transparent 39%),
        linear-gradient(135deg, #172d2b, #102322 75%);
}

body.theme-dark[data-palette="1"] {
    background-image: radial-gradient(ellipse at 82% 12%, rgba(39, 81, 93, .48), transparent 42%),
        radial-gradient(ellipse at 10% 88%, rgba(39, 91, 73, .4), transparent 43%),
        linear-gradient(135deg, #172d2b, #102322 75%);
}

body.theme-dark[data-palette="2"] {
    background-image: radial-gradient(ellipse at 18% 18%, rgba(42, 91, 72, .45), transparent 40%),
        radial-gradient(ellipse at 86% 82%, rgba(42, 75, 93, .42), transparent 44%),
        linear-gradient(145deg, #172d2b, #102322 75%);
}

body.theme-dark[data-palette="3"] {
    background-image: radial-gradient(ellipse at 68% 80%, rgba(38, 83, 82, .47), transparent 44%),
        radial-gradient(ellipse at 15% 12%, rgba(55, 88, 68, .42), transparent 40%),
        linear-gradient(145deg, #172d2b, #102322 75%);
}

button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .6; }
svg { display: block; width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
    position: fixed;
    z-index: 10;
    top: 1rem;
    left: 1rem;
    padding: .7rem 1rem;
    transform: translateY(-160%);
    border-radius: .8rem;
    color: var(--ink);
    background: var(--panel-solid);
}

.skip-link:focus { transform: translateY(0); }

.page-shell {
    width: min(1120px, calc(100% - 64px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 34px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.glass-panel {
    position: relative;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--panel-shadow);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.topbar {
    z-index: 1;
    min-height: 84px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    border-radius: 24px;
}

.brand {
    min-width: 230px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(58, 144, 130, .2);
    border-radius: 15px 15px 15px 7px;
    color: var(--accent-deep);
    background: linear-gradient(145deg, rgba(186, 230, 214, .8), rgba(203, 235, 238, .72));
}

.brand-mark svg { width: 26px; height: 26px; }
.brand-copy { display: grid; gap: 3px; }
.brand-name { font-size: .96rem; font-weight: 750; letter-spacing: .025em; }
.brand-caption { color: var(--muted); font-size: .74rem; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.stat-list, .toolbar { display: flex; align-items: center; gap: 8px; }

.stat-chip {
    min-height: 35px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, .28);
    font-size: .74rem;
    white-space: nowrap;
}

.theme-dark .stat-chip { background: rgba(5, 19, 19, .14); }
.stat-chip strong { color: var(--accent-deep); font-weight: 700; }
.stat-label { color: var(--muted); }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #55ad92; box-shadow: 0 0 0 3px rgba(85, 173, 146, .12); }
.clock-chip { font-variant-numeric: tabular-nums; }

.icon-button {
    width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, .42);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s var(--ease);
}

.theme-dark .icon-button { background: rgba(5, 19, 19, .18); }
.icon-button:hover { color: var(--accent-deep); border-color: rgba(39, 143, 131, .35); transform: translateY(-2px); }
.icon-button[aria-pressed="true"] { color: var(--accent-deep); background: rgba(91, 181, 157, .14); }
.icon-button svg { width: 18px; height: 18px; }

.button {
    min-height: 41px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-size: .78rem;
    font-weight: 650;
    cursor: pointer;
    transition: transform .2s var(--ease), box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }
.button svg { width: 16px; height: 16px; }
.button-primary { color: #164d47; background: linear-gradient(120deg, #c9e9da, #c9e9eb); box-shadow: 0 5px 14px rgba(48, 124, 108, .11); }
.button-primary:hover { box-shadow: 0 8px 18px rgba(48, 124, 108, .17); }
.theme-dark .button-primary { color: #e7f8f1; background: linear-gradient(120deg, #28675b, #285b68); }
.morph-button { white-space: nowrap; }

.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-areas: "hero hero hero hero hero hero hero controls controls controls controls controls" "sound sound sound sound sound quote quote quote quote quote quote quote";
    gap: 20px;
}

.hero-card, .control-card, .sound-card, .quote-card { border-radius: 24px; }

.hero-card {
    min-height: 330px;
    padding: clamp(27px, 4vw, 44px);
    overflow: hidden;
    grid-area: hero;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    isolation: isolate;
    cursor: default;
    transition: transform .45s var(--ease), border-color .3s ease;
}

.hero-card::before {
    position: absolute;
    z-index: -1;
    top: -105px;
    right: -80px;
    width: 320px;
    height: 320px;
    border: 1px solid rgba(91, 173, 152, .13);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(181, 226, 207, .25), rgba(200, 230, 231, .05) 67%, transparent 68%);
    content: "";
}

.hero-card::after {
    position: absolute;
    z-index: -1;
    top: -48px;
    right: -23px;
    width: 205px;
    height: 205px;
    border: 1px solid rgba(91, 173, 152, .1);
    border-radius: 50%;
    content: "";
}

.hero-decoration { position: absolute; z-index: -1; right: 9%; bottom: 12%; width: 8px; height: 8px; border-radius: 50%; background: #a8d8c6; box-shadow: -31px 24px 0 -2px #c4e4d6, 30px -26px 0 -3px #9bcfc9; }
.card-kicker { display: flex; align-items: center; gap: 9px; color: var(--accent-deep); font-size: .72rem; font-weight: 700; letter-spacing: .095em; text-transform: uppercase; }
.kicker-mark { width: 7px; height: 7px; border-radius: 50%; background: #5cb49a; }
.kicker-sun { margin-left: 2px; color: #9abf9c; font-size: .95rem; }

.hero-card h1 {
    max-width: 560px;
    margin: 20px 0 13px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 5vw, 3.7rem);
    font-weight: 400;
    letter-spacing: -.045em;
    line-height: 1.04;
}

.hero-copy { max-width: 465px; margin: 0; color: var(--ink-soft); font-size: .96rem; line-height: 1.75; }
.hero-actions { margin-top: 27px; display: flex; flex-wrap: wrap; gap: 9px; }
.button-secondary { color: #174f49; background: #dcefe6; }
.theme-dark .button-secondary { color: #dff5ec; background: #28554b; }
.button-secondary:hover { background: #d0e9dd; }
.button-quiet { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.button-quiet:hover { border-color: rgba(39, 143, 131, .34); background: rgba(255, 255, 255, .42); }
.theme-dark .button-quiet:hover { background: rgba(255, 255, 255, .05); }
.hero-note { margin-top: 25px; color: var(--muted); font-size: .73rem; }
.hero-note span { margin-right: 5px; color: var(--accent); }

.control-card { padding: 25px; grid-area: controls; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.eyebrow { display: block; color: var(--muted); font-size: .65rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.section-heading h2, .sound-heading h2 { margin: 5px 0 0; color: var(--ink); font-size: 1.02rem; font-weight: 700; }
.heading-icon { color: var(--accent); font-size: 1.55rem; transform: rotate(-18deg); }
.intensity-field { min-width: 0; margin: 21px 0 0; padding: 0; border: 0; }
.intensity-field legend, .field-label { margin-bottom: 10px; color: var(--muted); font-size: .7rem; font-weight: 600; }
.segmented-control { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(130, 174, 160, .07); }
.segmented-control button { min-height: 33px; padding: 0 5px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: .7rem; cursor: pointer; transition: color .2s ease, background .2s ease, box-shadow .2s ease; }
.segmented-control button[aria-pressed="true"] { color: var(--accent-deep); background: var(--panel-solid); box-shadow: 0 2px 8px rgba(41, 96, 82, .09); font-weight: 700; }
.quick-actions { margin-top: 21px; display: grid; gap: 7px; }
.field-label { margin-bottom: 1px; }
.action-row { min-height: 42px; padding: 0 10px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 12px; color: var(--ink-soft); background: transparent; text-align: left; font-size: .76rem; cursor: pointer; transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease; }
.action-row:hover { transform: translateX(3px); border-color: var(--line); color: var(--accent-deep); background: rgba(255, 255, 255, .38); }
.theme-dark .action-row:hover { background: rgba(255, 255, 255, .04); }
.action-icon { width: 25px; height: 25px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--accent-deep); background: rgba(94, 173, 148, .12); font-size: 1.25rem; }
.reset-icon { font-size: 1.1rem; }
.action-arrow { margin-left: auto; color: var(--muted); font-size: .8rem; }

.sound-card { min-height: 195px; padding: 25px; grid-area: sound; display: flex; flex-direction: column; }
.sound-heading { display: flex; align-items: center; gap: 12px; }
.sound-icon { width: 40px; height: 40px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 14px; color: var(--accent-deep); background: rgba(94, 173, 148, .11); }
.sound-icon svg { width: 20px; height: 20px; }
.sound-heading h2 { font-size: .94rem; }
.sound-card > p { max-width: 410px; margin: 17px 0 20px; color: var(--ink-soft); font-size: .8rem; line-height: 1.65; }
.progress-wrap { margin-top: auto; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: rgba(110, 169, 151, .16); }
.progress-track span { width: 64%; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #80c7a9, #7ac1c2); transition: width .6s var(--ease); }
.progress-caption { display: block; margin-top: 8px; color: var(--muted); font-size: .66rem; }

.quote-card { min-height: 195px; padding: 27px 30px; grid-area: quote; display: flex; align-items: center; gap: 20px; }
.quote-mark { align-self: flex-start; color: #88c3aa; font-family: Georgia, serif; font-size: 4.5rem; line-height: .9; opacity: .72; }
.quote-card blockquote { max-width: 500px; margin: 12px 0 0; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.45; }
.quote-sparkle { margin-left: auto; align-self: flex-end; color: #91c9b2; font-size: 1.45rem; }

.footer { min-height: 54px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 17px; color: var(--muted); font-size: .7rem; }
.footer p { margin: 0; }
.footer-status { display: flex; align-items: center; gap: 9px; }
.footer-status .status-dot { width: 6px; height: 6px; }
.footer > p:last-child span { margin: 0 4px; color: var(--accent); }

#particleCanvas { position: fixed; z-index: 5; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.is-frozen .hero-card { border-color: rgba(39, 143, 131, .42); }
.gentle-shake { animation: soft-settle .32s ease-out; }
.geometry-shift { animation: geometry-shift .48s var(--ease); }

@keyframes soft-settle {
    0% { transform: translateY(2px); }
    55% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes geometry-shift {
    50% { transform: translateY(-3px) scale(1.008); }
}

@media (min-width: 1500px) {
    .page-shell { padding-top: 48px; gap: 28px; }
    .dashboard-grid { gap: 24px; }
    .hero-card { min-height: 360px; }
}

@media (max-width: 960px) {
    .page-shell { width: min(760px, calc(100% - 40px)); padding-top: 22px; gap: 18px; }
    .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .dashboard-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-areas: "hero hero hero hero hero hero" "controls controls controls sound sound sound" "quote quote quote quote quote quote"; gap: 15px; }
}

@media (max-width: 600px) {
    .page-shell { width: calc(100% - 28px); padding: 14px 0 16px; gap: 13px; }
    .topbar { padding: 13px; border-radius: 19px; gap: 13px; }
    .brand { min-width: 0; }
    .brand-mark { width: 40px; height: 40px; }
    .brand-name { font-size: .88rem; }
    .brand-caption { font-size: .68rem; }
    .topbar-right { align-items: flex-start; flex-direction: column; gap: 11px; }
    .stat-list { width: 100%; justify-content: space-between; gap: 5px; }
    .stat-chip { min-height: 32px; padding: 0 8px; font-size: .68rem; }
    .vibe-chip .stat-label { display: none; }
    .toolbar { width: 100%; gap: 7px; }
    .icon-button { width: 36px; height: 36px; }
    .morph-button { margin-left: auto; min-height: 38px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "controls" "sound" "quote"; gap: 12px; }
    .hero-card { min-height: 310px; padding: 27px 23px; border-radius: 21px; }
    .hero-card h1 { margin-top: 18px; font-size: clamp(2.35rem, 12vw, 3.1rem); }
    .hero-copy { font-size: .89rem; }
    .hero-note { margin-top: 21px; font-size: .69rem; }
    .control-card, .sound-card { padding: 21px; border-radius: 21px; }
    .sound-card { min-height: 180px; }
    .quote-card { min-height: 170px; padding: 24px 22px; gap: 13px; border-radius: 21px; }
    .quote-card blockquote { font-size: 1.2rem; }
    .quote-mark { font-size: 3.6rem; }
    .footer { align-items: flex-start; flex-direction: column; gap: 7px; padding: 13px 15px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
