:root {
  --paper: #FFFFFF;
  --ink: #0A0A0A;
  --paper-warm: #FFFFFF;
  --accent-hot: #EE4D1E;
  --accent-cold: #2E7FB8;
  --accent-neutral: #8A8A8A;
  --muted: rgba(0, 0, 0, .55);
  --muted-dark: rgba(255, 255, 255, .55);

  --font: "Google Sans Flex", "Google Sans Code", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --pad-x: clamp(1.25rem, 4vw, 3.5rem);
  --pad-y: clamp(1.25rem, 4vh, 3rem);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
}

button, select {
  font-family: inherit;
}

.app {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  height: 100dvh;
  width: 100%;
}

.half {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--pad-y) var(--pad-x);
  overflow: hidden;
}

.half__inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

@media (min-width: 768px) {
  .half__inner {
    max-width: 1100px;
    margin-inline: auto;
  }
}

.half--top {
  background: var(--paper);
  color: var(--ink);
  justify-content: flex-start;
}

.half--bottom {
  background: var(--ink);
  color: var(--paper-warm);
  justify-content: flex-start;
}

.half__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.half__label {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.place-control {
  position: relative;
}

.place-name {
  display: block;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
  padding: 0;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.place-name:hover,
.place-name:focus-visible {
  opacity: 0.7;
}

.place-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.6rem;
  z-index: 20;
  width: max(220px, min(320px, calc(100vw - 2 * var(--pad-x))));
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.place-input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: inherit;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, .15);
  padding: 0.3rem 0.1rem;
  outline: none;
}

.place-input:focus {
  border-bottom-color: var(--ink);
}

.place-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.place-result {
  padding: 0.45rem 0.3rem;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}

.place-result.is-active,
.place-result:hover {
  background: rgba(0, 0, 0, .08);
}

.place-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.place-status {
  font-size: 0.8rem;
  color: var(--muted);
}

.place-panel__footer .text-link {
  color: var(--muted);
  opacity: 0.75;
}

.place-panel__footer .text-link:hover,
.place-panel__footer .text-link:focus-visible {
  opacity: 1;
}

.half__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.temp {
  display: flex;
  align-items: flex-start;
  line-height: 0.82;
}

.temp__value {
  font-size: clamp(6rem, 22vw, 14rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.temp__deg {
  font-size: clamp(6rem, 22vw, 14rem);
  font-weight: 400;
  opacity: 0.9;
}

.temp__min {
  margin-top: clamp(0.5rem, 2vh, 1.25rem);
  font-size: 0.95rem;
  font-weight: 400;
}

.half--top .temp__min {
  color: var(--muted);
}

.half--bottom .temp__min {
  color: var(--muted-dark);
}

.half__notice {
  font-size: 0.95rem;
  font-weight: 400;
  margin-top: 0.5rem;
}

.half--top .half__notice {
  color: var(--muted);
}

.half--bottom .half__notice {
  color: var(--muted-dark);
}

.half__notice .link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.35em;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  color: inherit;
}

/* Badge */
.badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  background: var(--accent-hot);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.badge.badge--cold {
  background: var(--accent-cold);
}

.badge.badge--neutral {
  background: var(--accent-neutral);
}

/* Year control */
.year-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.1rem;
  font-weight: 400;
}

.year-arrow {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.year-arrow:hover,
.year-arrow:focus-visible {
  opacity: 1;
}

.year-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.year-current-wrap {
  position: relative;
  display: inline-flex;
}

.year-current {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.year-current:hover,
.year-current:focus-visible {
  opacity: 0.7;
}

.year-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
}

.footer-actions {
  width: 100%;
  margin-top: clamp(0.5rem, 2vh, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.footer-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.text-link {
  background: none;
  border: none;
  color: var(--muted-dark);
  font-size: 0.85rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.text-link:hover,
.text-link:focus-visible {
  opacity: 1;
}

.text-link:disabled {
  opacity: 0.35;
  cursor: default;
}

.footer-sep {
  color: var(--muted-dark);
  font-size: 0.85rem;
  opacity: 0.45;
}

/* Share panel */
.share-control {
  position: relative;
}

.share-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.6rem;
  z-index: 20;
  min-width: 160px;
  background: var(--ink);
  color: var(--paper-warm);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.share-panel__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.share-panel__row[hidden] {
  display: none;
}

.share-option {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15rem 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.share-option:hover,
.share-option:focus-visible {
  opacity: 1;
}

.share-option:disabled {
  opacity: 0.35;
  cursor: default;
}

.share-panel__status {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted-dark);
  min-height: 1em;
}

.is-loading {
  opacity: 0.45;
}

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

.noscript-notice {
  max-width: 32rem;
  margin: 3rem auto;
  padding: 0 1.5rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
}

.noscript-notice a {
  color: inherit;
}

/* Mobile */
@media (max-width: 480px) {
  .place-name {
    max-width: 40vw;
  }

  .place-panel {
    right: 0;
  }

  .badge {
    font-size: 0.95rem;
    padding: 8px 18px;
  }

  .temp__value,
  .temp__deg {
    font-size: clamp(8rem, 40vw, 12rem);
  }
}
