:root {
  --glass: rgba(12, 22, 26, .38);
  --glass-strong: rgba(8, 20, 24, .52);
  --line: rgba(255, 255, 255, .2);
  --text: #fff;
  --soft: rgba(255, 255, 255, .78);
  --radius: 25px;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100%; }

body {
  color: var(--text);
  background: #0b151b;
  font-family: "One UI Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

/* TV-Kiosk: verhindert Text-Caret und Auswahlmarkierungen des Tizen-Browsers. */
#app,
#app * {
  caret-color: transparent;
  cursor: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app *:focus { outline: none; }

#background, #overlay { position: fixed; inset: 0; }

#background {
  z-index: -2;
  background: #15242b url("../assets/photos/weather-clear-day.jpg") center / cover no-repeat;
}

#overlay {
  z-index: -1;
  background: linear-gradient(180deg, rgba(4, 10, 14, .03), rgba(4, 10, 14, .14));
}

#app { position: relative; width: 100%; height: 100vh; padding: clamp(12px, 1.2vw, 26px); }

.dashboard {
  display: grid;
  grid-template-rows: 92px minmax(280px, 1fr) 230px 245px;
  gap: 14px;
  height: 100%;
  max-width: 2100px;
  margin: auto;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px) saturate(108%);
  -webkit-backdrop-filter: blur(5px) saturate(108%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 32px;
}

.location h1 { display: flex; align-items: center; gap: 13px; font-size: 29px; line-height: 1.1; }
.location h1 [data-location-name] { overflow: hidden; max-width: min(44vw, 620px); text-overflow: ellipsis; white-space: nowrap; }
.locationMark { position: relative; width: 18px; height: 18px; border: 3px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.locationMark::after { content: ""; position: absolute; width: 4px; height: 4px; top: 4px; left: 4px; border-radius: 50%; background: currentColor; }
.location p { margin-top: 7px; color: var(--soft); font-size: 16px; }
.clock { font-size: 56px; font-weight: 200; letter-spacing: -3px; }

.settingsButton {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.72);
  opacity: .58;
  transition: opacity .2s ease, background .2s ease, transform .2s ease;
}

#app .settingsButton { cursor: pointer; }

.settingsButton:hover,
.settingsButton:focus-visible {
  background: rgba(255,255,255,.16);
  opacity: 1;
  transform: rotate(18deg);
}

.settingsButton svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.settingsDialog {
  position: fixed;
  inset: 50% auto auto 50%;
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255,255,255,.28);
  color: var(--text);
  transform: translate(-50%, -50%);
}

.settingsDialog::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(3px); }
#app .settingsDialog,
#app .settingsDialog * {
  caret-color: auto;
  cursor: auto;
  -webkit-user-select: text;
  user-select: text;
}

#app .settingsDialog button,
#app .settingsDialog a { cursor: pointer; }

.settingsPanel { padding: 24px; }
.settingsHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.settingsHeader h2 { font-size: 26px; font-weight: 560; }
.settingsHeader p { margin-top: 4px; color: var(--soft); font-size: 14px; }
.settingsClose {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.settingsUploadLink {
  display: block;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: inherit;
  text-decoration: none;
}
.settingsUploadLink span,
.settingsField span { display: block; color: var(--soft); font-size: 13px; }
.settingsUploadLink strong { display: block; margin-top: 5px; font-size: 18px; font-weight: 520; }
.settingsDivider { height: 1px; margin: 20px 0; background: rgba(255,255,255,.16); }
.settingsField input {
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 12px;
  background: rgba(0,0,0,.24);
  color: var(--text);
  font: inherit;
}
.settingsField input::placeholder { color: rgba(255,255,255,.46); }
.settingsActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.settingsPrimary,
.settingsSecondary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font: inherit;
  font-weight: 560;
}
.settingsPrimary { border: 0; background: rgba(255,255,255,.92); color: #102027; }
.settingsSecondary { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: var(--text); }
.settingsStatus { min-height: 20px; margin-top: 12px; color: var(--soft); font-size: 14px; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding: 22px 38px 0;
  overflow: hidden;
}

.currentWeather { display: flex; align-items: center; justify-content: center; gap: 28px; }
.weatherIcon { width: 160px; height: 160px; width: clamp(120px, 12vw, 220px); height: clamp(120px, 12vw, 220px); filter: drop-shadow(0 10px 18px rgba(0,0,0,.2)); }
.temperature { font-size: 150px; font-size: clamp(105px, 10vw, 188px); font-weight: 200; line-height: .82; letter-spacing: -9px; }
.description { margin-top: 16px; font-size: 32px; font-size: clamp(25px, 2.1vw, 39px); color: var(--soft); }

.weatherDetails {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--line);
}

.detail {
  display: flex;
  align-items: flex-start;
  gap: 17px;
  min-height: 90px;
  padding: 14px 24px;
}

.detail:nth-child(odd) { border-right: 1px solid var(--line); }
.detail > img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 14px;
  background: rgba(3,13,18,.48);
  box-shadow: 0 4px 14px rgba(0,0,0,.24), inset 0 0 0 1px rgba(0,0,0,.12);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.65));
}
.detail p, .astroDetails p { color: var(--soft); font-size: 15px; }
.detail strong, .astroDetails strong { display: block; margin-top: 5px; color: var(--text); font-size: 27px; font-weight: 450; }
.detail small { display: block; margin-top: 3px; color: var(--soft); font-size: 14px; }

.astroDetails {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.astroDetails::before {
  content: "";
  position: absolute;
  top: 0;
  left: 11%;
  right: 11%;
  height: 1px;
  background: var(--line);
}

.astroDetails > div { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 17px; }
.astroDetails > div + div { border-left: 1px solid var(--line); }
.astroDetails img { width: 52px; height: 52px; }
.astroDetails strong { font-size: 23px; }
.moonDates { display: flex; gap: 14px; margin-top: 5px; color: rgba(255,255,255,.68); font-size: 13px; white-space: nowrap; }

.forecast { min-width: 0; overflow: hidden; padding: 15px 26px 17px; }
.forecast h2 { margin-bottom: 10px; font-size: 22px; font-weight: 500; }
.hourlyPanel { background: var(--glass-strong); border-color: rgba(255,255,255,.3); box-shadow: 0 18px 60px rgba(0,0,0,.38); }
.dailyPanel { background: rgba(10, 26, 23, .58); }

.forecastRow {
  display: flex;
  height: calc(100% - 34px);
  overflow: hidden;
  scrollbar-width: none;
}

.forecastRow::-webkit-scrollbar { display: none; }

.hourCard, .dayCard {
  flex: 1 0 122px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 8px 17px;
  text-align: center;
}

.hourCard { flex-basis: 210px; padding-inline: 18px; }

.hourCard + .hourCard, .dayCard + .dayCard { border-left: 1px solid var(--line); }
.hourCard.isCurrent { background: rgba(255,255,255,.11); border-radius: 15px; }
.hourCard time { color: var(--soft); font-size: 17px; font-weight: 600; }
.hourCard img { width: 76px; height: 76px; }
.hourCard strong { font-size: 29px; font-weight: 500; }

.dayCard { flex-basis: 145px; padding-block: 3px; }
.dayCard > strong { font-size: 17px; }
.dayCard time { color: var(--soft); font-size: 14px; }
.dayCard img { width: 62px; height: 62px; }
.dayCard p { font-size: 23px; font-weight: 600; }
.dayCard small { color: var(--soft); font-size: 18px; font-weight: 400; }

/* Seite 2: Radar und ausführliche 10-Tage-Vorhersage. */
.dashboard,
.secondaryPage {
  transition: opacity 1.5s ease;
}

.secondaryPage {
  position: absolute;
  inset: clamp(12px, 1.2vw, 26px);
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(560px, 1fr);
  grid-template-rows: 92px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

.secondaryTopbar { grid-column: 1 / -1; }

#app.showSecondary .dashboard { opacity: 0; pointer-events: none; }
#app.showSecondary .secondaryPage { opacity: 1; pointer-events: auto; }

.secondaryTopbar { min-width: 0; padding: 14px 30px; }
.secondaryTitle h1 { font-size: 31px; font-weight: 600; }
.secondaryTitle p { margin-top: 3px; color: var(--soft); font-size: 15px; }
.secondaryClock { font-size: 54px; }

.radarPanel,
.detailedForecastPanel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.radarPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
  padding: 14px 20px 18px;
}

.radarHeader,
.detailedForecastHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.radarHeader h2,
.detailedForecastHeader h2 { font-size: 22px; font-weight: 500; }
.radarHeader p { color: var(--soft); font-size: 14px; }
.detailedForecastHeader p { color: var(--soft); font-size: 13px; }

.radarMap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 15px;
  background: #172126;
}

.radarBaseLayer,
.radarDataLayer,
.mapLayer { position: absolute; inset: 0; overflow: hidden; }
.radarBaseLayer { z-index: 1; }
.radarDataLayer { z-index: 2; opacity: .9; }
.mapTile { position: absolute; width: 256px; height: 256px; user-select: none; }
.dwdRadarImage { width: 100%; height: 100%; object-fit: fill; }

.radarLocation {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translate(-7px, -7px);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 5px #000;
}

.radarLocation span {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #ff453a;
  box-shadow: 0 0 0 4px rgba(255,69,58,.25), 0 2px 8px #000;
}

.radarError {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(8,20,24,.7);
  color: rgba(255,255,255,.86);
  font-size: 18px;
  text-align: center;
}

.radarError[hidden] { display: none; }
.radarAttribution {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 5;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0,0,0,.62);
  color: rgba(255,255,255,.78);
  font-size: 10px;
}
.radarAttribution a { color: inherit; }
.radarFrameTime {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  min-width: 174px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 9px;
  background: rgba(0,0,0,.62);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}
.radarFrameTime.isForecast { border-color: rgba(255,193,7,.65); background: rgba(75,48,0,.78); }

.detailedForecastPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
  padding: 13px 20px 17px;
}

.detailedForecastGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 9px;
  min-height: 0;
}

.detailedDayCard {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  background: rgba(5,17,21,.25);
}

.detailedDayHeader { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.detailedDayHeader strong { font-size: 18px; font-weight: 600; }
.detailedDayHeader time { color: var(--soft); font-size: 14px; }
.detailedDayBody { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 0; }
.detailedDayOverview { text-align: center; }
.detailedDayOverview img { width: 62px; height: 62px; }
.detailedTemperatures { margin-top: -3px; font-size: 21px; font-weight: 600; white-space: nowrap; }
.detailedTemperatures small { color: var(--soft); font-size: 16px; font-weight: 400; }
.detailedDescription { overflow: hidden; color: rgba(255,255,255,.92); font-size: 15px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.detailedMetrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 7px; }
.detailedMetric { min-width: 0; }
.detailedMetric span { display: block; color: var(--soft); font-size: 11px; line-height: 1.15; }
.detailedMetric strong { display: block; margin-top: 1px; overflow: hidden; font-size: 15px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.forecastError { grid-column: 1 / -1; display: grid; place-items: center; color: var(--soft); font-size: 18px; }

/* Full-HD-TV: 1920 × 1080 mit Sicherheitsrand für möglichen Overscan. */
@media (min-width: 1600px) and (min-height: 900px) {
  #app { padding: 20px 24px; }

  .dashboard {
    grid-template-rows: 96px minmax(0, 1fr) 218px 238px;
    gap: 12px;
    max-width: 1920px;
  }

  .topbar { padding-inline: 34px; }
  .location h1 { font-size: 32px; }
  .location p { font-size: 17px; }
  .clock { font-size: 60px; }

  .hero { padding: 22px 44px 0; }
  .weatherIcon { width: 190px; height: 190px; }
  .temperature { font-size: 174px; }
  .description { font-size: 35px; }
  .detail { min-height: 84px; }

  .forecast { padding-inline: 28px; }
  .forecast h2 { font-size: 24px; }
  .hourCard { flex: 1 1 0; min-width: 0; }
  .hourCard time { font-size: 19px; }
  .hourCard img { width: 72px; height: 72px; }
  .hourCard strong { font-size: 30px; }

  .dayCard { flex: 1 1 0; min-width: 0; }
  .dayCard > strong { font-size: 18px; }
  .dayCard time { font-size: 15px; }
  .dayCard img { width: 62px; height: 62px; }
  .dayCard p { font-size: 24px; }

  .secondaryPage {
    inset: 20px 24px;
    grid-template-columns: minmax(0, 1.65fr) minmax(620px, 1fr);
    grid-template-rows: 96px minmax(0, 1fr);
  }
  .secondaryTopbar { padding-inline: 34px; }
  .secondaryTitle h1 { font-size: 32px; }
  .secondaryClock { font-size: 60px; }
  .radarHeader h2, .detailedForecastHeader h2 { font-size: 24px; }
  .detailedDayHeader strong { font-size: 19px; }
  .detailedDescription { font-size: 16px; }
  .detailedMetric strong { font-size: 16px; }
}

/* Samsung The Frame / Tizen: UHD-Webfläche mit konservativen TV-Fallbacks. */
.tizen-tv body { width: 1920px; height: 1080px; overflow: hidden; }
.tizen-tv #app { width: 1920px; height: 1080px; padding: 24px 30px; }
.tizen-tv .dashboard {
  width: 1860px;
  height: 1032px;
  grid-template-rows: 96px 446px 218px 236px;
  gap: 12px;
}
.tizen-tv .secondaryPage {
  inset: 24px 30px;
  width: 1860px;
  height: 1032px;
  grid-template-columns: 1138px 710px;
  grid-template-rows: 96px 924px;
  gap: 12px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(8, 20, 24, .65); }
  .hourlyPanel { background: rgba(5, 17, 21, .78); }
  .dailyPanel { background: rgba(7, 23, 20, .72); }
}

@media (max-height: 900px) and (min-width: 1000px) {
  .dashboard { grid-template-rows: 80px minmax(245px, 1fr) 190px 205px; gap: 10px; }
  .topbar { padding-block: 10px; }
  .clock { font-size: 48px; }
  .hero { padding-top: 12px; }
  .detail { min-height: 68px; padding-block: 8px; }
  .astroDetails > div { padding: 10px; }
  .hourCard img { width: 58px; height: 58px; }
  .dayCard img { width: 50px; height: 50px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  #app { width: 100%; height: auto; min-height: 100vh; padding: 12px; }
  .dashboard { height: auto; grid-template-rows: auto; }
  .topbar { padding: 16px 20px; }
  .location h1 { font-size: 23px; }
  .clock { font-size: 42px; }
  .hero { grid-template-columns: 1fr; padding: 30px 20px 0; }
  .weatherDetails { margin-top: 28px; border-left: 0; border-top: 1px solid var(--line); }
  .astroDetails { grid-template-columns: 1fr; }
  .astroDetails::before { left: 0; right: 0; }
  .astroDetails > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .forecast { height: 230px; }
  .dailyPanel { height: 245px; }
  .hourCard, .dayCard { flex-grow: 0; }
  .forecastRow { overflow-x: auto; }
  .secondaryPage { position: fixed; inset: 12px; grid-template-columns: 1fr; grid-template-rows: 80px 42vh minmax(610px, auto); overflow-y: auto; }
  .secondaryTopbar { grid-column: 1; }
  .detailedForecastGrid { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, 170px); }
}

@media (max-width: 560px) {
  .location p { font-size: 13px; }
  .clock { font-size: 34px; }
  .currentWeather { gap: 15px; }
  .weatherIcon { width: 82px; height: 82px; }
  .temperature { font-size: 82px; letter-spacing: -4px; }
  .description { font-size: 21px; }
  .weatherDetails { grid-template-columns: 1fr; }
  .detail:nth-child(odd) { border-right: 0; }
}
