:root {
  color-scheme: dark;
  font-family: ui-monospace, "DejaVu Sans Mono", Consolas, monospace;
  background: #171521;
  color: #f5ecdf;
  --muted: #bdb3c5;
  --accent: #ffbd8d;
  --edge: #484052;
  --panel: #211d2c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.station {
  width: min(100% - 48px, 976px);
  margin: clamp(28px, 7vh, 76px) auto 40px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 27px;
}

.brand { display: flex; align-items: center; gap: 17px; }
.brand h1 { font-size: clamp(2.45rem, 6vw, 3.45rem); line-height: .98; margin: 0; letter-spacing: -.085em; }
.brand-period { color: var(--accent); }
.brand p { margin: 9px 0 0; color: var(--muted); font-size: .875rem; }
.brand-mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  color: #ffd39a;
  background: currentColor;
  clip-path: polygon(38% 0, 62% 0, 62% 12%, 76% 12%, 76% 24%, 88% 24%, 88% 38%, 100% 38%, 100% 62%, 88% 62%, 88% 76%, 76% 76%, 76% 88%, 62% 88%, 62% 100%, 38% 100%, 38% 88%, 24% 88%, 24% 76%, 12% 76%, 12% 62%, 0 62%, 0 38%, 12% 38%, 12% 24%, 24% 24%, 24% 12%, 38% 12%);
}
.brand-mark::after { content: ""; display: block; height: 50%; margin-top: 50%; background: repeating-linear-gradient(to bottom, #f99e7e 0 4px, #171521 4px 6px); }

.search { position: relative; width: min(100%, 362px); }
.search-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.search label { font-size: .875rem; color: var(--muted); }
#language {
  background: var(--panel);
  color: inherit;
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 4px 6px;
  font-size: .8125rem;
}
.search-field { display: flex; gap: 7px; }
.search-field input { flex: 1; min-width: 0; }
.search input, .search-field button, .retry { border: 1px solid var(--edge); padding: 11px 12px; border-radius: 3px; }
.search input { background: var(--panel); color: inherit; }
.search input::placeholder { color: var(--muted); }
.search-field button { background: var(--accent); color: #2b1b26; border-color: var(--accent); font-weight: 700; }
.search-field button:hover { background: #ffcfaa; }
.search-status:empty { display: none; }
.search-status, .search-results {
  position: absolute;
  inset: calc(100% + 6px) 0 auto;
  z-index: 2;
  margin: 0;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: #292333;
  box-shadow: 0 8px 20px #0b0812a6;
}
.search-status { padding: 12px; font-size: .875rem; }
.search-results { list-style: none; padding: 4px; }
.search-results button { display: block; text-align: left; width: 100%; padding: 9px; color: inherit; background: transparent; border: 0; border-radius: 2px; overflow-wrap: anywhere; }
.search-results button:hover, .search-results button:focus-visible { background: #41344b; outline-offset: -2px; }
.search-results small { display: block; color: var(--muted); margin-top: 4px; }

.console { display: grid; grid-template-columns: minmax(0, 664px) minmax(228px, 1fr); gap: 22px; }
.display { padding: 11px; border: 1px solid var(--edge); border-radius: 5px; background: #211d2a; box-shadow: 0 4px 0 #100e17; }
.screen { position: relative; isolation: isolate; container-type: inline-size; overflow: hidden; aspect-ratio: 4 / 3; background: #321d46; }
.screen canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.screen-top, .screen-reading {
  position: absolute;
  left: 5%;
  right: 5%;
  color: #fff6e7;
  text-shadow: .27cqw .36cqw #1e1729, 0 1px 5px #1e1729;
  pointer-events: none;
}
.screen-top { top: 5.5%; }
.screen-top h2 { margin: 0; font-size: clamp(1rem, 4.6cqw, 2.4rem); line-height: 1.1; overflow-wrap: anywhere; }
.screen p { margin: 0; }
.screen-top p { margin-top: .45em; font-size: clamp(.75rem, 2.5cqw, 1.13rem); }
.screen-reading { bottom: 5.5%; }
#scene-day { color: #ffdcad; font-weight: 700; font-size: clamp(.75rem, 2.45cqw, 1.125rem); }
#scene-condition { font-weight: 700; font-size: clamp(1.02rem, 4.1cqw, 2.2rem); margin: .16em 0; }
#scene-details { font-size: clamp(.75rem, 2.6cqw, 1.2rem); }
.display-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 2px 0; font-size: .75rem; color: var(--muted); }
.display-meta button { background: transparent; color: inherit; padding: 4px; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.display-meta button:hover { color: var(--accent); }
.sky-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sky-actions button, .sky-info button {
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: #1c1826;
  color: inherit;
  padding: 6px 9px;
  font-size: .8125rem;
}
.sky-actions button:hover, .sky-info button:hover { background: #332940; }
.sky-actions button[aria-pressed="true"] { background: #3c2b3b; border-color: var(--accent); color: var(--accent); }
.sky-info {
  position: relative;
  margin-top: 8px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 11px;
  background: #1c1826;
  font-size: .8125rem;
}
.sky-info h3 { margin: 0 78px 9px 0; color: var(--accent); font-size: .9375rem; }
.sky-info dl { margin: 0; display: grid; grid-template-columns: fit-content(55%) 1fr; gap: 5px 10px; }
.sky-info dt { color: var(--muted); }
.sky-info dd { margin: 0; }
.sky-info > button { position: absolute; top: 6px; right: 6px; }
.sky-nav { display: flex; gap: 6px; margin-top: 10px; }
.sky-nav[hidden] { display: none; }
.sky-nav button { min-width: 38px; font-size: 1rem; line-height: 1; }

.forecast { display: flex; flex-direction: column; align-items: start; padding: 17px; border: 1px solid var(--edge); border-radius: 5px; background: var(--panel); }
.forecast h2 { font-size: .95rem; margin: 0 0 15px; }
.days { align-self: stretch; display: grid; gap: 9px; }
.day {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 11px 8px 11px 10px;
  text-align: left;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: #1c1826;
  color: inherit;
}
.day:hover { background: #332940; }
.day[aria-pressed="true"] { background: #3c2b3b; border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.day canvas { width: 24px; height: 24px; image-rendering: pixelated; }
.day span, .day small { display: block; }
.day small { color: var(--muted); margin-top: 4px; font-size: .75rem; }
.day strong { font-size: .95rem; text-align: right; }
#forecast-status { color: var(--muted); font-size: .875rem; line-height: 1.55; margin: 0 0 12px; }
#forecast-status:empty { display: none; }
.days:not([hidden]) + #forecast-status:not(:empty) { margin-top: 12px; }
.retry { color: var(--accent); background: transparent; font-size: .875rem; }
.retry:hover { background: #3c2b3b; }
.source { padding-top: 17px; margin-top: auto; color: var(--muted); font-size: .8125rem; }
.source a { color: inherit; text-underline-offset: 3px; }
.source a:hover { color: var(--accent); }

@media (max-width: 760px) {
  .station { width: min(100% - 32px, 664px); }
  .console { grid-template-columns: 1fr; gap: 15px; }
}

@media (min-width: 630px) and (max-width: 760px) {
  .days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 510px) {
  .masthead { flex-direction: column; align-items: stretch; gap: 20px; margin-bottom: 15px; }
  .search { width: 100%; }
  .display { padding: 7px; }
  .forecast { padding: 13px; }
}
