/* House Weather — dark OLED theme, wall-tablet first.
   Target: old Android WebView. Conservative CSS: grid + flex (no flex gap),
   no clamp(), no aspect-ratio, no backdrop-filter reliance. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: #000000;
  color: #ffffff;
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------ layout */

.app {
  display: grid;
  grid-gap: 16px;
  gap: 16px;
  padding: 16px;
  width: 100%;
  grid-template-columns: 1fr;
}

/* Landscape tablet: everything on one screen, no page scroll */
@media (orientation: landscape) and (min-width: 900px) {
  html, body { overflow: hidden; }
  .app {
    height: 100vh;
    padding: 18px;
    grid-template-columns: minmax(300px, 372px) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "hero  hourly hourly"
      "daily tiles  radar";
  }
  .hero         { grid-area: hero; }
  .hourly-panel { grid-area: hourly; }
  .daily-panel  { grid-area: daily; }
  .tiles        { grid-area: tiles; }
  .radar-panel  { grid-area: radar; }
}

.panel {
  background: #0d1015;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 20px;
  padding: 16px 18px;
  min-width: 0;
  min-height: 0;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa0a6;
  margin-bottom: 10px;
}

/* ------------------------------------------------------------ hero */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  min-width: 0;
}

.hero-loc {
  font-size: 18px;
  font-weight: 500;
  color: #e8eaed;
  margin-bottom: 2px;
}

.hero-temp {
  font-size: 102px;
  font-weight: 200;
  line-height: 1.02;
  letter-spacing: -3px;
  margin-left: -5px;
}

.hero-cond {
  font-size: 21px;
  font-weight: 500;
  color: #e8eaed;
  margin-top: 2px;
}

.hero-hilo {
  font-size: 16px;
  font-weight: 500;
  color: #e8eaed;
  margin-top: 8px;
}

.hero-hilo .lo { color: #9aa0a6; }

.hero-feels {
  font-size: 14px;
  color: #9aa0a6;
  margin-top: 3px;
}

.hero-icon {
  width: 148px;
  height: 148px;
  flex: none;
  margin-left: 10px;
}

/* ------------------------------------------------------------ hourly strip */

.hourly-panel {
  display: flex;
  flex-direction: column;
}

.hourly-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
  white-space: nowrap;
}

.hourly-scroll::-webkit-scrollbar { display: none; }

.hourly-track {
  position: relative;
  display: inline-flex;
  min-width: 100%;
  vertical-align: top;
  padding-bottom: 58px; /* room for the temp chart canvas */
}

.hcell {
  flex: none;
  width: 62px;
  text-align: center;
  padding-top: 4px;
}

.h-time {
  font-size: 12.5px;
  font-weight: 500;
  color: #9aa0a6;
  white-space: nowrap;
}

.hcell-now .h-time { color: #ffffff; font-weight: 700; }

.h-icon {
  width: 30px;
  height: 30px;
  margin: 6px auto 2px;
}

.h-precip {
  font-size: 11.5px;
  font-weight: 600;
  color: #6db3f2;
  min-height: 15px;
}

.h-temp {
  font-size: 16.5px;
  font-weight: 500;
  margin-top: 1px;
}

.hcell-sun .h-temp {
  font-size: 11.5px;
  font-weight: 600;
  color: #ffcf54;
  margin-top: 5px;
}

.hourly-chart {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 54px;
  pointer-events: none;
}

/* ------------------------------------------------------------ 10-day list */

.daily-panel {
  display: flex;
  flex-direction: column;
}

.daily-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.daily-list::-webkit-scrollbar { display: none; }

.drow {
  flex: 1;
  display: grid;
  grid-template-columns: 50px 28px 36px 36px minmax(40px, 1fr) 36px;
  grid-gap: 9px;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 15px;
}

.drow:first-child { border-top: none; }

.d-name { font-weight: 600; color: #e8eaed; }

.d-icon { width: 26px; height: 26px; }

.d-precip {
  font-size: 12px;
  font-weight: 600;
  color: #6db3f2;
  text-align: right;
}

.d-lo { color: #9aa0a6; font-weight: 500; text-align: right; }
.d-hi { font-weight: 500; text-align: left; }

.d-bar {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
}

.d-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
}

.d-bar-now {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #000000;
}

/* ------------------------------------------------------------ detail tiles */

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 16px;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.tile {
  background: #0d1015;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 106px;
  min-width: 0;
  overflow: hidden;
}

.tile-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa0a6;
}

.tile-value {
  font-size: 30px;
  font-weight: 300;
  margin-top: 6px;
  white-space: nowrap;
}

.tile-value .unit {
  font-size: 15px;
  font-weight: 500;
  color: #9aa0a6;
  margin-left: 4px;
}

.tile-badge {
  font-size: 14px;
  font-weight: 600;
  margin-left: 8px;
}

.tile-sub {
  font-size: 12.5px;
  color: #9aa0a6;
  margin-top: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uv-track {
  position: relative;
  height: 5px;
  border-radius: 3px;
  margin-top: 11px;
  background: linear-gradient(90deg, #7ad37a, #f2d34c, #f2984c, #ef5f5f, #c07ef2);
}

.uv-dot {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #000000;
}

.wind-row {
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.wind-arrow {
  width: 28px;
  height: 28px;
  flex: none;
  margin-right: 10px;
}

.sun-rows { margin-top: 6px; }

.sun-row {
  display: flex;
  align-items: center;
  font-size: 17px;
  margin-top: 7px;
  white-space: nowrap;
}

.sun-row .sun-ic {
  width: 24px;
  height: 24px;
  flex: none;
  margin-right: 10px;
}

.sun-row .sun-lab {
  width: 52px;
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9aa0a6;
}

/* ------------------------------------------------------------ radar */

.radar-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.radar-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  border-radius: 14px;
  overflow: hidden;
  background: #05070a;
}

#radarMap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #05070a;
}

.radar-controls {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 800;
  display: flex;
  align-items: center;
}

.radar-btn {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 12, 17, 0.82);
  color: #ffffff;
  cursor: pointer;
}

.radar-btn svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: #ffffff;
}

.radar-time {
  margin-left: 10px;
  padding: 8px 13px;
  border-radius: 16px;
  background: rgba(9, 12, 17, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12.5px;
  font-weight: 500;
  color: #e8eaed;
  white-space: nowrap;
}

.leaflet-container { background: #05070a; font-family: inherit; }

.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.55) !important;
  color: #5f6368 !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a { color: #80868b !important; }

/* ------------------------------------------------------------ stamp */

.stamp {
  position: fixed;
  right: 12px;
  bottom: 7px;
  z-index: 1200;
  font-size: 11px;
  color: #5f6368;
}

.stamp.stale::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f2b84c;
  margin-right: 6px;
  vertical-align: 1px;
}

/* ------------------------------------------------------------ icons */

#heroIcon svg, .h-icon svg, .d-icon svg,
.wind-arrow svg, .sun-ic svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Subtle animation, hero icon only (.anim wrapper) */

@keyframes spinRays {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.anim svg.i-sun .p-rays {
  animation: spinRays 60s linear infinite;
  transform-origin: 32px 32px;
}

@keyframes cloudDrift {
  from { transform: translateX(-1.6px); }
  to   { transform: translateX(1.6px); }
}

.anim .p-cloud  { animation: cloudDrift 6s ease-in-out infinite alternate; }
.anim .p-cloudb { animation: cloudDrift 8s ease-in-out infinite alternate-reverse; }

@keyframes dropFall {
  0%   { transform: translateY(-3px); opacity: 0; }
  30%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(5px); opacity: 0; }
}

.anim .p-drop  { animation: dropFall 1.3s linear infinite; }
.anim .p-drop1 { animation-delay: 0.45s; }
.anim .p-drop2 { animation-delay: 0.9s; }

@keyframes flakeFall {
  0%   { transform: translateY(-3px); opacity: 0; }
  25%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(5px); opacity: 0; }
}

.anim .p-flake  { animation: flakeFall 2.4s linear infinite; }
.anim .p-flake1 { animation-delay: 0.8s; }
.anim .p-flake2 { animation-delay: 1.6s; }

@keyframes boltFlash {
  0%, 52%, 100% { opacity: 1; }
  56%, 68%      { opacity: 0.25; }
  62%           { opacity: 1; }
}

.anim .p-bolt { animation: boltFlash 3.2s linear infinite; }

@keyframes fogSlide {
  from { transform: translateX(-2.5px); }
  to   { transform: translateX(2.5px); }
}

.anim .p-fog0 { animation: fogSlide 5s ease-in-out infinite alternate; }
.anim .p-fog1 { animation: fogSlide 6s ease-in-out infinite alternate-reverse; }
.anim .p-fog2 { animation: fogSlide 7s ease-in-out infinite alternate; }

@media (prefers-reduced-motion: reduce) {
  .anim svg * { animation: none !important; }
}

/* ------------------------------------------------------------ size tweaks */

/* Big wall tablets (1920x1200) */
@media (min-width: 1600px) {
  .app { grid-gap: 20px; gap: 20px; padding: 24px; }
  .hero-temp { font-size: 128px; }
  .hero-cond { font-size: 24px; }
  .hero-hilo { font-size: 18px; }
  .hero-icon { width: 180px; height: 180px; }
  .hcell { width: 70px; }
  .h-temp { font-size: 18px; }
  .drow { font-size: 17px; grid-template-columns: 58px 30px 40px 40px minmax(40px, 1fr) 40px; }
  .d-icon { width: 30px; height: 30px; }
  .tile-value { font-size: 36px; }
  .tile-sub { font-size: 14px; }
  .panel-title { font-size: 13px; }
}

/* Phones */
@media (max-width: 480px) {
  .app { padding: 12px; grid-gap: 12px; gap: 12px; }
  .hero-temp { font-size: 84px; }
  .hero-icon { width: 110px; height: 110px; }
  .tiles { grid-gap: 12px; gap: 12px; }
  .radar-wrap { min-height: 320px; }
}

/* Portrait: give the radar a real height since nothing constrains it */
@media (orientation: portrait) {
  .radar-wrap { min-height: 360px; }
  .drow { min-height: 48px; }
}
