:root {
  --ink: #1a1c2c;
  --dark: #333c57;
  --slate: #566c86;
  --gray: #94b0c2;
  --white: #f4f4f4;
  --navy: #29366f;
  --blue: #3b5dc9;
  --sky: #41a6f6;
  --cyan: #73eff7;
  --yellow: #ffcd75;
  --orange: #ef7d57;
  --red: #b13e53;
  --green: #38b764;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 16px 56px;
  font-family: "Courier New", ui-monospace, Consolas, Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  background-color: var(--ink);
  background-image:
    linear-gradient(45deg, #21243a 25%, transparent 25%, transparent 75%, #21243a 75%),
    linear-gradient(45deg, #21243a 25%, transparent 25%, transparent 75%, #21243a 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.wrap { max-width: 720px; margin: 0 auto; }

.pix {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- title ---------- */
.title { margin-bottom: 24px; }
.title canvas { margin: 0 auto; }
.tag {
  margin: 12px 0 0;
  text-align: center;
  color: var(--cyan);
  font-size: 12px;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 4px;
}

.controls input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 12px;
  font: inherit;
  font-size: 16px;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: var(--cyan);
  background: var(--ink);
  border: 0;
  border-radius: 0;
  box-shadow: 0 0 0 4px var(--slate);
  appearance: none;
}
.controls input::placeholder { color: var(--slate); }
.controls input:focus { outline: none; box-shadow: 0 0 0 4px var(--cyan); }

.btn {
  padding: 12px 14px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-radius: 0;
  box-shadow: inset -4px -4px 0 var(--orange), 0 0 0 4px var(--ink), 4px 4px 0 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.btn.alt { background: var(--cyan); box-shadow: inset -4px -4px 0 var(--sky), 0 0 0 4px var(--ink), 4px 4px 0 4px rgba(0, 0, 0, 0.45); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translate(2px, 2px); box-shadow: inset 4px 4px 0 var(--orange), 0 0 0 4px var(--ink); }
.btn.alt:active { box-shadow: inset 4px 4px 0 var(--sky), 0 0 0 4px var(--ink); }
.btn:focus-visible { outline: 4px solid var(--white); outline-offset: 4px; }
.btn:disabled { opacity: 0.55; cursor: wait; }

.status {
  min-height: 1.4em;
  margin: 18px 4px 6px;
  color: var(--yellow);
  font-size: 12px;
}

.matches {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 4px 6px;
  padding: 0;
}
.matches:empty { display: none; }
.matches button {
  padding: 6px 10px;
  font: inherit;
  font-size: 11px;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: var(--white);
  background: var(--navy);
  border: 0;
  box-shadow: 0 0 0 2px var(--blue);
  cursor: pointer;
}
.matches button:hover,
.matches button:focus-visible { background: var(--blue); outline: none; box-shadow: 0 0 0 2px var(--cyan); }

/* ---------- panels ---------- */
.panel {
  margin: 20px 4px 0;
  background: var(--dark);
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--white), 8px 8px 0 4px rgba(0, 0, 0, 0.5);
}

.panel-h {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--yellow);
  background: var(--ink);
}

.scene { width: 100%; border-bottom: 4px solid var(--ink); }
.view {
  margin: 0;
  padding: 8px 20px;
  font-size: 11px;
  color: var(--yellow);
  background: var(--ink);
}
.view::before { content: "▸ "; color: var(--cyan); }
.view:empty { display: none; }

.now {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.place {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.region { margin: 4px 0 16px; font-size: 11px; color: var(--gray); overflow-wrap: anywhere; }
.cond { margin: 14px 0 0; color: var(--cyan); }

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  gap: 10px;
  margin: 0;
}
.stats div {
  padding: 10px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--slate);
}
.stats dt { font-size: 10px; color: var(--gray); }
.stats dd { margin: 6px 0 0; font-size: 15px; color: var(--white); white-space: nowrap; }

/* ---------- forecast ---------- */
.forecast {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 0;
  padding: 16px;
}
.forecast li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--slate);
  font-size: 12px;
}
.forecast li:first-child { box-shadow: inset 0 0 0 2px var(--yellow); }
.forecast canvas { width: 48px; }
.forecast .hi { color: var(--yellow); }
.forecast .lo { color: var(--sky); }
.forecast .pop { color: var(--gray); font-size: 10px; }

.foot {
  margin: 28px 4px 0;
  text-align: center;
  font-size: 11px;
  color: var(--gray);
}
.foot a { color: var(--cyan); }
.foot a:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }

@media (max-width: 600px) {
  .now { grid-template-columns: 1fr; }
  .forecast { grid-template-columns: repeat(4, 1fr); }
  .controls .btn { flex: 1 1 auto; }
}
