:root {
    color-scheme: dark;
    --ink: #f4f3ea;
    --ink-soft: rgba(244, 243, 234, 0.66);
    --glass: rgba(24, 32, 34, 0.58);
    --glass-border: rgba(255, 255, 255, 0.18);
    --accent: #d6e995;
    --accent-strong: #e7f6b4;
    --ease: 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
    min-width: 320px;
    overflow: hidden;
    background: #26353d;
    color: var(--ink);
    font-family: "Manrope", sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }

.focus-scene {
    position: relative;
    width: 100%;
    min-height: 100svh;
    isolation: isolate;
    overflow: hidden;
}

.sky {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background: linear-gradient(180deg, #455a64 0%, #708489 45%, #b3b7ac 100%);
    transition: background 1.5s ease, filter 1.5s ease;
}

body[data-weather="sun"] .sky {
    background: linear-gradient(180deg, #7ab9d0 0%, #c2d9d3 54%, #f3d7a6 100%);
}

body[data-weather="cloudy"] .sky {
    background: linear-gradient(180deg, #788b91 0%, #a7b1ae 52%, #d0c8b6 100%);
}

.sun {
    position: absolute;
    top: 11%;
    right: 13%;
    width: clamp(6rem, 11vw, 10rem);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff1ba;
    box-shadow: 0 0 3rem 1rem rgba(255, 227, 148, 0.42), 0 0 9rem 4rem rgba(255, 222, 134, 0.2);
    opacity: 0.15;
    transform: translateY(2rem) scale(0.82);
    transition: opacity 1.5s ease, transform 1.5s ease, box-shadow 1.5s ease;
}

.sun span {
    position: absolute;
    inset: -55%;
    border-radius: inherit;
    background: repeating-conic-gradient(from 0deg, rgba(255,240,184,.12) 0 7deg, transparent 7deg 18deg);
    animation: sunTurn 40s linear infinite;
}

body[data-weather="sun"] .sun { opacity: 1; transform: translateY(0) scale(1); }
body[data-weather="cloudy"] .sun { opacity: .4; transform: translateY(1rem) scale(.92); }

.cloud {
    position: absolute;
    width: clamp(18rem, 38vw, 36rem);
    height: clamp(4rem, 8vw, 7rem);
    border-radius: 50%;
    background: rgba(202, 211, 210, .73);
    filter: blur(3px);
    opacity: .92;
    transition: opacity 1.2s ease, transform 1.4s ease, background 1.4s ease;
    animation: cloudDrift 28s ease-in-out infinite alternate;
}

.cloud::before, .cloud::after {
    content: "";
    position: absolute;
    bottom: 8%;
    border-radius: 50%;
    background: inherit;
}

.cloud::before { left: 16%; width: 42%; height: 175%; }
.cloud::after { right: 12%; width: 36%; height: 135%; }
.cloud-one { top: 10%; left: -8%; }
.cloud-two { top: 5%; left: 32%; transform: scale(.8); animation-delay: -8s; }
.cloud-three { top: 21%; right: -15%; transform: scale(.62); animation-delay: -17s; }

body[data-weather="rain"] .cloud { background: rgba(49, 65, 72, .82); }
body[data-weather="sun"] .cloud { opacity: .36; transform: translateY(-2rem) scale(.85); background: rgba(247,249,239,.9); }
body[data-weather="sun"] .cloud-two { opacity: .12; }
body[data-weather="cloudy"] .cloud { background: rgba(218, 222, 216, .68); }

.rain-layer { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
body[data-weather="rain"] .rain-layer { opacity: .72; }

.raindrop {
    position: absolute;
    top: -12vh;
    width: 1px;
    height: var(--length, 5rem);
    border-radius: 999px;
    background: linear-gradient(180deg, transparent, rgba(225, 240, 238, .7));
    transform: rotate(10deg);
    animation: rainfall var(--speed, .85s) linear infinite;
    animation-delay: var(--delay, 0s);
}

.mountain { position: absolute; left: -5%; width: 110%; transition: filter 1.4s ease, background 1.4s ease; }
.mountain-back {
    bottom: 20%;
    height: 48%;
    background: #617272;
    opacity: .72;
    clip-path: polygon(0 100%, 0 73%, 9% 52%, 15% 70%, 27% 36%, 36% 63%, 49% 25%, 58% 57%, 67% 39%, 77% 65%, 89% 28%, 100% 59%, 100% 100%);
}
.mountain-front {
    bottom: 8%;
    height: 48%;
    background: #324a48;
    clip-path: polygon(0 100%, 0 68%, 12% 40%, 20% 62%, 32% 28%, 42% 65%, 55% 38%, 64% 69%, 74% 30%, 84% 60%, 94% 39%, 100% 54%, 100% 100%);
}

body[data-weather="sun"] .mountain-back { background: #7e9b8a; filter: saturate(1.1); }
body[data-weather="sun"] .mountain-front { background: #466c58; }
body[data-weather="cloudy"] .mountain-back { background: #788681; }
body[data-weather="cloudy"] .mountain-front { background: #4d6259; }

.ground { position: absolute; left: -5%; right: -5%; bottom: -8%; height: 31%; border-radius: 50% 50% 0 0; background: #172c29; transition: background 1.4s ease; }
body[data-weather="sun"] .ground { background: #2f543e; }
body[data-weather="cloudy"] .ground { background: #354b41; }

.tree-line { position: absolute; left: -2%; width: 104%; height: 24%; bottom: 4%; opacity: .92; background: #203834; clip-path: polygon(0 100%,0 70%,2% 70%,3% 37%,4% 70%,7% 70%,8% 20%,9% 70%,12% 70%,14% 45%,15% 70%,19% 70%,21% 28%,23% 70%,27% 70%,29% 12%,31% 70%,36% 70%,38% 35%,40% 70%,44% 70%,46% 23%,48% 70%,53% 70%,55% 38%,57% 70%,62% 70%,64% 18%,66% 70%,71% 70%,73% 30%,75% 70%,79% 70%,81% 11%,83% 70%,88% 70%,90% 34%,92% 70%,96% 70%,98% 22%,100% 70%,100% 100%); transition: background 1.4s ease; }
.tree-line-back { bottom: 15%; opacity: .42; transform: scale(.8); transform-origin: bottom; }
.tree-line-front { bottom: -1%; }
body[data-weather="sun"] .tree-line { background: #294d37; }
body[data-weather="cloudy"] .tree-line { background: #394f43; }

.mist { position: absolute; left: -20%; width: 140%; height: 14%; border-radius: 50%; background: rgba(225, 231, 222, .2); filter: blur(1.8rem); animation: mistMove 17s ease-in-out infinite alternate; transition: opacity 1.2s ease; }
.mist-one { bottom: 24%; }
.mist-two { bottom: 9%; animation-delay: -8s; opacity: .5; }
body[data-weather="sun"] .mist { opacity: .13; }

.scene-vignette { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, transparent 25%, rgba(8, 17, 19, .16) 72%, rgba(7, 13, 15, .5) 120%), linear-gradient(180deg, rgba(8,16,18,.04), rgba(8,16,18,.24)); transition: opacity 1.2s ease; }
body[data-weather="sun"] .scene-vignette { opacity: .5; }

.scene-header {
    position: absolute;
    z-index: 10;
    inset: 0 0 auto;
    min-height: 5.8rem;
    padding: 1.3rem clamp(1.2rem, 3vw, 2.6rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.back-link, .sound-button, .weather-picker {
    border: 1px solid rgba(255,255,255,.17);
    background: rgba(17, 25, 27, .28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 30px rgba(5,12,14,.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.back-link {
    min-height: 2.9rem;
    padding: 0 .95rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: rgba(255,255,255,.78);
    font: 500 .72rem "DM Mono", monospace;
    letter-spacing: .04em;
    text-decoration: none;
    transition: transform var(--ease), background var(--ease), color var(--ease);
}
.back-link:hover { transform: translateX(-3px); color: #fff; background: rgba(17,25,27,.48); }

.ambient-controls { display: flex; align-items: center; gap: .65rem; }
.weather-picker { display: flex; gap: .15rem; padding: .28rem; border-radius: 999px; }
.weather-button, .sound-button { border: 0; cursor: pointer; }
.weather-button { min-height: 2.35rem; padding: 0 .75rem; display: inline-flex; align-items: center; gap: .38rem; border-radius: 999px; background: transparent; color: rgba(255,255,255,.56); font-size: .73rem; font-weight: 600; transition: color var(--ease), background var(--ease), transform var(--ease); }
.weather-button:hover { color: #fff; }
.weather-button.active { color: #17231f; background: rgba(244,243,234,.9); box-shadow: 0 4px 16px rgba(4,10,11,.15); }
.weather-button:active, .sound-button:active { transform: scale(.96); }

.sound-button { min-height: 2.9rem; padding: 0 .9rem; display: inline-flex; align-items: center; gap: .52rem; border-radius: 999px; color: rgba(255,255,255,.72); font-size: .72rem; font-weight: 600; }
.sound-button[aria-pressed="true"] { color: #1d2a23; background: var(--accent); border-color: rgba(222,245,153,.7); }
.sound-icon { width: 1.1rem; font-size: 1.2rem; transform: rotate(180deg); }
.sound-button[aria-pressed="true"] .sound-icon { animation: soundPulse 1.6s ease-in-out infinite; }

.timer-wrap { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 6.8rem 1.1rem 5rem; transition: opacity .55s ease, transform .55s cubic-bezier(.22,1,.36,1), visibility .55s; }
.timer-wrap.is-hidden { opacity: 0; transform: translateY(1.5rem) scale(.95); visibility: hidden; pointer-events: none; }

.timer-card {
    width: min(92vw, 28rem);
    padding: 1.2rem 1.2rem 1.15rem;
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    background: linear-gradient(145deg, rgba(36,48,48,.64), rgba(13,23,24,.52));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 35px 90px rgba(5,12,13,.28);
    backdrop-filter: blur(28px) saturate(1.12);
    -webkit-backdrop-filter: blur(28px) saturate(1.12);
}

.timer-topline { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .15rem .2rem 1rem; }
.session-count { display: inline-flex; align-items: center; gap: .55rem; color: rgba(255,255,255,.58); font: 500 .66rem "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.session-count i { width: .45rem; height: .45rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 .3rem rgba(214,233,149,.1); }
.hide-button { border: 0; background: transparent; color: rgba(255,255,255,.47); cursor: pointer; font-size: .68rem; font-weight: 600; letter-spacing: .02em; transition: color var(--ease); }
.hide-button:hover { color: #fff; }

.mode-tabs { display: grid; grid-template-columns: .8fr 1.15fr 1.15fr; padding: .28rem; border-radius: 999px; background: rgba(5,14,16,.24); border: 1px solid rgba(255,255,255,.08); }
.mode-button { min-height: 2.2rem; padding: 0 .5rem; border: 0; border-radius: 999px; background: transparent; color: rgba(255,255,255,.48); cursor: pointer; font-size: .69rem; font-weight: 600; transition: background var(--ease), color var(--ease), transform var(--ease); }
.mode-button:hover { color: #fff; }
.mode-button.active { color: #18231e; background: rgba(244,243,234,.9); box-shadow: 0 4px 15px rgba(3,10,11,.13); }

.timer-kicker { margin-top: 2rem; color: var(--ink-soft); font-size: .78rem; text-align: center; letter-spacing: .02em; }
.timer-display { display: block; margin: .2rem 0 .75rem; color: #fff; font: 400 clamp(4.7rem, 13vw, 7rem)/1 "DM Mono", monospace; letter-spacing: -.09em; text-align: center; text-shadow: 0 8px 28px rgba(2,8,9,.14); font-variant-numeric: tabular-nums; }
.progress-track { width: 74%; height: 2px; margin: 0 auto 1.7rem; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 1rem rgba(214,233,149,.65); transition: width .5s linear; }

.timer-actions { display: flex; justify-content: center; align-items: center; gap: 1rem; }
.timer-actions button { border: 0; cursor: pointer; transition: transform var(--ease), background var(--ease), color var(--ease), box-shadow var(--ease); }
.timer-actions button:hover { transform: translateY(-2px); }
.reset-button, .skip-button { width: 2.8rem; height: 2.8rem; border-radius: 50%; background: rgba(255,255,255,.075); color: rgba(255,255,255,.6); font-size: 1.1rem; }
.start-button { min-width: 8.8rem; min-height: 3.4rem; padding: 0 1.5rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: .65rem; background: var(--accent); color: #18231e; font-weight: 700; box-shadow: 0 10px 28px rgba(1,8,9,.2), inset 0 1px 0 rgba(255,255,255,.5); }
.start-button:hover { background: var(--accent-strong); box-shadow: 0 14px 36px rgba(1,8,9,.26); }
.start-button.is-running .play-symbol { font-size: 0; }
.start-button.is-running .play-symbol::after { content: "Ⅱ"; font-size: .8rem; }
.play-symbol { font-size: .72rem; }
.shortcut-hint { margin-top: 1.25rem; color: rgba(255,255,255,.3); font: .56rem "DM Mono", monospace; letter-spacing: .02em; text-align: center; }
kbd { font: inherit; color: rgba(255,255,255,.56); }

.show-timer { position: absolute; z-index: 7; left: 50%; bottom: 2rem; min-height: 3.3rem; padding: 0 1.1rem; display: flex; align-items: center; gap: .75rem; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; color: rgba(255,255,255,.72); background: rgba(15,25,26,.46); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 15px 40px rgba(3,10,11,.18); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); cursor: pointer; opacity: 0; visibility: hidden; transform: translate(-50%, 1rem); transition: opacity var(--ease), transform var(--ease), visibility var(--ease), background var(--ease); }
.show-timer.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.show-timer:hover { background: rgba(15,25,26,.7); }
.mini-time { color: #fff; font: 500 .75rem "DM Mono", monospace; }

.weather-caption { position: absolute; z-index: 3; left: clamp(1.2rem, 3vw, 2.6rem); bottom: 1.7rem; display: flex; align-items: center; gap: .6rem; color: rgba(255,255,255,.48); font: .62rem "DM Mono", monospace; letter-spacing: .04em; }
.caption-dot { width: .38rem; height: .38rem; border-radius: 50%; background: rgba(255,255,255,.45); animation: captionPulse 2.4s ease-in-out infinite; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

@keyframes rainfall { to { transform: translate(12vw, 120vh) rotate(10deg); } }
@keyframes cloudDrift { to { translate: 4vw 1.2rem; } }
@keyframes mistMove { to { transform: translateX(7%); } }
@keyframes sunTurn { to { transform: rotate(360deg); } }
@keyframes soundPulse { 50% { opacity: .45; transform: rotate(180deg) scale(.8); } }
@keyframes captionPulse { 50% { opacity: .35; } }

@media (max-width: 700px) {
    .scene-header { align-items: flex-start; padding: 1rem; }
    .back-link span:last-child { display: none; }
    .back-link { width: 2.8rem; justify-content: center; padding: 0; }
    .ambient-controls { align-items: flex-end; flex-direction: column-reverse; }
    .sound-button { min-height: 2.55rem; }
    .weather-picker { margin-top: .1rem; }
    .weather-button { padding: 0 .65rem; }
    .weather-button .control-label { display: none; }
    .timer-wrap { padding-top: 8.8rem; }
    .timer-card { border-radius: 1.65rem; padding: 1rem; }
    .timer-display { font-size: clamp(4.4rem, 23vw, 6.2rem); }
    .shortcut-hint { display: none; }
    .weather-caption { display: none; }
    .show-timer { bottom: 1.25rem; }
}

@media (max-height: 680px) {
    .timer-wrap { padding-top: 6rem; padding-bottom: 1rem; }
    .timer-card { transform: scale(.9); }
    .weather-caption { bottom: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
    .raindrop { display: none; }
}
