* {box-sizing:border-box}
html {font-family:"Trebuchet MS",system-ui,sans-serif;color:var(--ink);background:var(--page);scroll-behavior:smooth}
body {margin:0;min-width:0;min-height:100vh;background:radial-gradient(ellipse at 88% 5%,var(--page-light),transparent 42%),linear-gradient(var(--page),var(--page-light))}
button,input,select {font:inherit}
button {cursor:pointer}
button:focus-visible,summary:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,.chart:focus-visible {outline:3px solid #e17c16;outline-offset:3px}
button[hidden],p[hidden] {display:none}
.skip {position:absolute;top:-100px;left:1rem;z-index:10;background:#fff;padding:1rem}
.skip:focus {top:1rem}
.wrap {max-width:1150px;margin:auto;padding:25px 34px 0}
.top {display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:39px}
.brand {display:flex;align-items:center;gap:10px;min-width:0}
.brand-icon {display:grid;place-items:center;flex:none;width:48px;height:48px;border-radius:15px;background:#fff2bd;border:1px solid #f5d786;font-size:27px}
h1 {font-size:clamp(1.2rem,3.5vw,2.3rem);line-height:1.04;letter-spacing:-.045em;margin:0}
h1 span:first-child {color:var(--accent)}
.profiles,.segmented {display:flex;flex:none;gap:3px;background:var(--soft);border:1px solid var(--border);padding:4px;border-radius:999px}
.profiles button,.segmented button {border:0;border-radius:999px;background:transparent;color:var(--accent-dark);font-weight:800;min-height:36px;padding:5px 13px;white-space:nowrap}
.profiles button[aria-pressed="true"],.segmented button[aria-pressed="true"] {background:var(--profile);color:#fff}
.hero-shell {position:relative;isolation:isolate;padding:7px;border-radius:30px;margin-bottom:27px}
.spikes {position:absolute;display:none;z-index:-1;left:9px;right:9px;height:30px;background:var(--spike);mask:conic-gradient(from 150deg at 50% 0,#000 60deg,#0000 0) 0 0/54px 100%}
.top-spikes {top:-24px}
.bottom-spikes {bottom:-21px;transform:rotate(180deg)}
.hero {min-height:270px;overflow:hidden;position:relative;isolation:isolate;border-radius:19px;background:linear-gradient(113deg,var(--hero),var(--hero-light));display:grid;grid-template-columns:1.23fr .77fr;color:#fff}
.current {min-width:0;padding:22px 28px 18px;z-index:2}
.hero-actions,.hero-foot {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.place,.unit,.hero-foot button {border:1px solid #ffffff80;background:#fff;color:var(--accent-dark);font-weight:800;border-radius:999px;padding:8px 12px;min-height:40px}
.place {display:flex;align-items:center;gap:7px;text-align:left;max-width:100%}
#place-name {overflow-wrap:anywhere}
.chevron {width:8px;height:8px;flex:none;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin:-4px 2px 0 3px}
.current-reading {display:flex;gap:15px;align-items:center;margin-top:13px}
.current-reading strong {font-size:clamp(3rem,8vw,5.4rem);line-height:1;letter-spacing:-.09em}
.weather-icon {font-size:clamp(2.2rem,6vw,4rem);line-height:1.2;animation:float 5s ease-in-out infinite}
.conditions {font-size:clamp(1.15rem,3vw,1.7rem);font-weight:800;margin-top:8px}
.hi-lo {font-size:1rem;font-weight:700;margin-top:4px;min-height:21px;white-space:pre-wrap}
.hero-foot {font-size:.86rem;margin-top:10px;min-height:20px}
.hero-foot button {min-height:30px;padding:4px 10px}
.mascot {position:relative;overflow:hidden;min-width:0;max-height:310px}
.mascot img {display:block;position:absolute}
.sky-effects {position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:1}
.sky-effects i {position:absolute;display:block;opacity:.58}
.hero[data-weather="rain"] .sky-effects i,.hero[data-weather="storm"] .sky-effects i {top:-18%;width:3px;height:25px;border-radius:8px;background:#d2f2ff;animation:rain 1.9s linear infinite}
.hero[data-weather="snow"] .sky-effects i {top:-10%;width:8px;height:8px;border-radius:50%;background:#fff;animation:rain 6s linear infinite}
.hero[data-weather="clear"] .sky-effects {background:radial-gradient(circle at 76% 18%,#ffe78068,transparent 32%);animation:glow 5s ease-in-out infinite}
.hero[data-weather="cloud"] .sky-effects i:nth-child(-n+3),.hero[data-weather="fog"] .sky-effects i:nth-child(-n+3) {top:24%;width:110px;height:30px;border-radius:50%;background:#fff;filter:blur(18px);animation:drift 11s ease-in-out infinite}
@keyframes float {50% {transform:translateY(-6px) rotate(-3deg)}}
@keyframes rain {to {transform:translate(-42px,360px)}}
@keyframes drift {50% {transform:translateX(55px)}}
@keyframes glow {50% {opacity:.5}}
.shortcuts {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:0 0 21px}
.shortcuts button {display:flex;justify-content:center;align-items:center;gap:8px;background:#fff;border:1px solid var(--border);border-bottom:3px solid var(--border);color:var(--accent-dark);border-radius:13px;padding:9px 5px;min-height:49px;font-weight:800;line-height:1.08}
.shortcuts button:hover,.city-results button:hover,.hour:hover {background:var(--soft)}
.shortcuts span {font-size:1.23rem}
.dashboard {display:grid;grid-template-columns:minmax(0,1.87fr) minmax(0,1fr);gap:16px;align-items:start}
.forecast-stack {display:grid;gap:12px;min-width:0}
.panel {border:1px solid var(--border);border-radius:17px;background:#fff;box-shadow:0 3px 0 var(--border);min-width:0;scroll-margin-top:15px}
summary {cursor:pointer;list-style:none;display:flex;align-items:center;gap:11px;font-weight:800}
summary::-webkit-details-marker {display:none}
summary .chevron {margin-left:auto;color:var(--accent-dark)}
details[open]>summary>.chevron {transform:rotate(225deg);margin-top:4px}
.panel>summary {padding:12px 15px;font-size:1.04rem;min-height:58px;border-radius:16px}
.tile {display:grid;place-items:center;width:32px;height:32px;border-radius:10px;font-size:1.09rem;flex:none}
.sun {background:#fff3be}.coral {background:#ffe6db}.blue {background:#ddf2ff}.green {background:#e5f4da}.purple {background:#efe3ff}
.panel-body {padding:0 15px 14px}
.stats {margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.stats div {background:var(--soft);border-radius:10px;padding:8px 10px;min-width:0}
.stats dt {font-size:.83rem;color:var(--muted)}
.stats dd {margin:3px 0 0;font-weight:800;font-size:1rem}
.chart-head {display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}
.chart-head p {margin:0;color:var(--muted);font-size:.9rem}
.segmented button {font-size:.85rem;min-height:32px;padding:5px 9px}
.chart {display:flex;overflow-x:auto;gap:4px;border:1px solid var(--border);border-radius:12px;padding:6px;scrollbar-color:var(--accent) var(--soft);min-height:64px}
.chart>p {margin:auto 8px;color:var(--muted)}
.hour {flex:0 0 65px;display:grid;justify-items:center;align-items:center;gap:3px;background:#fff;color:var(--ink);border:1px solid var(--border);border-radius:9px;padding:6px 2px}
.hour[aria-pressed="true"] {border:2px solid var(--accent);padding:5px 1px;background:var(--soft)}
.hour small {font-size:.81rem;color:var(--muted);white-space:nowrap}
.hour .bar-track {height:34px;width:13px;border-radius:5px;background:var(--soft);display:flex;align-items:flex-end}
.hour .bar {width:100%;border-radius:5px;background:#228cc6;height:var(--bar)}
#temp-chart .bar {background:#ee7945}
.hour-note {margin:9px 0 0;color:var(--accent-dark);background:var(--soft);border-radius:9px;padding:8px;font-size:.9rem}
.day {border-top:1px solid var(--border)}
.day summary {display:grid;grid-template-columns:minmax(68px,.62fr) auto minmax(80px,1fr) auto 12px;padding:10px 3px;gap:8px;font-size:.91rem;min-height:48px}
.daily-temps {white-space:nowrap}.daily-temps span {color:var(--muted)}
.day .stats {padding-bottom:9px}
.day p {margin:0 0 10px}
.moon-card {min-height:91px;border-radius:13px;background:radial-gradient(ellipse at 12% 10%,#556bb3,transparent 56%),var(--moon);color:#fff;display:flex;align-items:center;gap:12px;padding:12px}
#phase-icon {font-size:2.6rem;flex:none}
#phase-name {font-size:1.12rem}
#illumination {font-size:.9rem;margin-top:4px}
.next-moon {margin:10px 2px;color:var(--accent-dark);font-weight:700;font-size:.9rem}
.calendar {border-top:1px solid var(--border);margin-top:8px}
.calendar>summary {min-height:42px;font-size:.92rem}
.month-nav {display:flex;justify-content:space-between;align-items:center;gap:5px}
.month-nav button {background:var(--soft);color:var(--accent-dark);border:1px solid var(--border);border-radius:10px;width:36px;height:36px;font-size:1.42rem;line-height:1}
.calendar-grid {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;text-align:center;margin-top:8px}
.calendar-grid b {font-size:.78rem;padding:4px 0}
.calendar-grid button {border:1px solid transparent;background:var(--soft);border-radius:6px;color:var(--ink);min-width:0;min-height:38px;padding:1px;display:grid;justify-items:center;align-content:center;font-size:.85rem}
.calendar-grid button[aria-pressed="true"] {border-color:var(--accent);font-weight:800}
.moon-caption {display:block;color:var(--muted);font-size:.79rem;margin-top:4px}
.drawing img {width:100%;height:auto;display:block;border-radius:11px}
.customize {display:grid;gap:10px}
.customize label {display:flex;justify-content:space-between;align-items:center;gap:10px;font-weight:700}
.customize select {max-width:60%;padding:6px;border:1px solid var(--border);border-radius:7px;color:var(--ink);background:var(--soft)}
footer {display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px;margin-top:20px;padding:0 0 19px;color:var(--muted);font-size:.81rem}
footer a {color:var(--accent-dark)}
.place-picker {max-width:560px}
.place-card {padding:clamp(16px,4vw,26px);background:#fff;border:1px solid var(--border);border-radius:20px;box-shadow:0 3px 0 var(--border)}
.place-card h2 {margin:16px 0;font-size:1.55rem}
.back-to-weather,.mobile-tools button {min-height:44px;border:1px solid var(--border);border-radius:999px;background:#fff;color:var(--accent-dark);padding:6px 12px;font-weight:800}
#place-search label,.nearby-label {font-weight:800}
.search-row {display:flex;gap:7px;margin-top:7px}
.search-row input {flex:1;min-width:0;min-height:48px;font-size:16px;border:1px solid var(--border);border-radius:8px;padding:8px 10px;color:var(--ink)}
.search-row button {border:0;border-radius:8px;min-height:48px;background:var(--profile);color:#fff;padding:8px 12px;font-weight:700}
.city-results {display:grid;gap:6px}
.city-results button {min-height:48px;text-align:left;background:#fff;border:1px solid var(--border);border-radius:8px;color:var(--ink);padding:8px 10px}
.mobile-tools {display:none}
#search-status:empty {display:none}
@media(max-width:760px) {
  .wrap {padding:18px 18px 0}
  .dashboard {grid-template-columns:minmax(0,1fr)}
}
@media(max-width:480px) {
  .wrap {padding:14px 11px 0}
  .top {gap:7px;margin-bottom:34px}
  .brand {gap:6px}
  .brand-icon {width:34px;height:34px;font-size:19px;border-radius:10px}
  h1 span {display:block}
  .profiles button {font-size:.79rem;padding:4px 7px}
  .hero {grid-template-columns:minmax(0,1.3fr) minmax(0,.7fr);min-height:215px}
  .current {padding:13px 8px 10px}
  .current-reading {gap:7px}
  .place,.unit {min-height:32px;padding:5px 6px;font-size:.78rem}
  .hero-shell {padding:5px;border-radius:23px}
  .shortcuts {gap:4px}
  .shortcuts button {display:grid;gap:1px;font-size:.72rem;min-height:50px}
  .day summary {grid-template-columns:minmax(56px,.65fr) auto minmax(54px,1fr) auto 9px;gap:4px}
  .stats div {padding:7px 5px}
  .stats dt {font-size:.75rem}
}
@media(prefers-reduced-motion:reduce) {
  html {scroll-behavior:auto}
  *,*::before,*::after {animation:none!important}
}

/* Keep one scroll surface for the app's navigation and section controls. */
html,body {width:100%;height:100%;overflow:hidden}
#app-viewport {position:fixed;inset:0;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;background:radial-gradient(ellipse at 88% 5%,var(--page-light),transparent 42%),linear-gradient(var(--page),var(--page-light))}
[hidden] {display:none!important}
.wrap {padding-bottom:calc(34px + env(safe-area-inset-bottom,0px))}
.profile-home {min-height:100%;display:grid;place-items:center;padding:24px 15px calc(24px + env(safe-area-inset-bottom,0px));background:radial-gradient(ellipse at 30% 12%,#fff1b9,transparent 40%),linear-gradient(145deg,#e3f7ff 22%,#f0e6ff)}
.profile-home-card {width:min(100%,510px);text-align:center;background:#fff;border:1px solid #dee9f8;border-radius:30px;padding:clamp(22px,6vw,46px);box-shadow:0 8px 0 #d8e6fb,0 22px 55px #3c54881a;color:#203856}
.home-sky {display:block;font-size:clamp(2.5rem,10vw,4.4rem);line-height:1.2;margin-bottom:10px}
.profile-home h1 {font-size:clamp(1.8rem,6vw,3.05rem);line-height:1.04}
.home-choices {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:26px}
.home-choices button {display:grid;gap:5px;justify-items:center;align-content:center;min-height:90px;border:1px solid #215f9e;border-radius:17px;background:#1766a9;color:#fff;font-size:clamp(1rem,5vw,1.42rem);font-weight:800}
.home-choices button:last-child {background:#7752ac;border-color:#624195}
.home-choices button:hover {filter:brightness(1.12)}
.home-choices button span {font-size:1.7em;line-height:1.1}
.profile-tools {display:flex;gap:7px;align-items:center}
.return-home {border:1px solid var(--border);border-radius:999px;background:#fff;color:var(--accent-dark);width:40px;height:40px;display:grid;place-items:center;font-size:1.6rem;line-height:1;padding:0}
.chart {overscroll-behavior-x:contain}
@media(max-width:760px) {
  /* Standalone hosting needs only device safe areas, without embed offsets. */
  #app-viewport {
    --phone-bottom-clearance: calc(76px + env(safe-area-inset-bottom,0px));
    top:env(safe-area-inset-top,0px);
    left:env(safe-area-inset-left,0px);
    right:env(safe-area-inset-right,0px);
    scroll-padding:12px 0 var(--phone-bottom-clearance);
  }
  .wrap {padding-bottom:var(--phone-bottom-clearance)}
  .mobile-tools {
    position:fixed;
    right:12px;
    bottom:calc(12px + env(safe-area-inset-bottom,0px));
    z-index:3;
    display:flex;
    gap:6px;
  }
  .mobile-tools button {box-shadow:0 2px 8px #142f5529}
  .mobile-tools button:active {background:var(--soft)}
}
@media(max-width:480px) {
  .profile-tools {gap:4px}
  .return-home {width:29px;height:34px;font-size:1.2rem}
  .profiles {gap:1px;padding:3px}
  .profiles button {min-height:31px;padding-inline:5px}
}
