:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-2: #111d33;
  --card: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f4f8ff;
  --muted: #9fb0c9;
  --accent: #7cc4ff;
  --accent-2: #a78bfa;
  --danger: #ff9b9b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(124, 196, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 88% 2%, rgba(167, 139, 250, 0.18), transparent 30rem),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(124, 196, 255, 0.35), rgba(167, 139, 250, 0.35));
  border: 1px solid var(--card-border);
  font-size: 1.2rem;
}

.search-area {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.25rem 0.25rem 0.25rem 2.4rem;
  backdrop-filter: blur(12px);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.95rem;
  opacity: 0.8;
}

.search-form input {
  width: min(19rem, 48vw);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.6rem 0.5rem;
}

.search-form input::placeholder {
  color: var(--muted);
}

.search-button,
.geo-button,
.install-button {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.search-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1220;
  border-color: transparent;
}

.search-button:hover,
.geo-button:hover {
  transform: translateY(-1px);
}

.search-button:active,
.geo-button:active,
.install-button:active {
  transform: translateY(0);
}

.install-button {
  background: linear-gradient(135deg, rgba(124, 196, 255, 0.22), rgba(167, 139, 250, 0.22));
  border-color: rgba(124, 196, 255, 0.45);
  color: #dff1ff;
}

.install-button:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 10;
  width: min(24rem, 92vw);
  padding: 0.4rem;
  border-radius: 1rem;
  background: rgba(15, 24, 42, 0.97);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.search-results button:hover,
.search-results button:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  outline: none;
}

.search-results small {
  display: block;
  color: var(--muted);
  margin-top: 0.15rem;
}

.loading-state {
  display: grid;
  place-items: center;
  gap: 1rem;
  padding: 6rem 1rem;
  color: var(--muted);
}

.spinner {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 155, 155, 0.35);
  background: rgba(255, 155, 155, 0.12);
  color: var(--danger);
  font-size: 0.92rem;
}

.place-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.place-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  letter-spacing: -0.04em;
}

.place-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.place-meta {
  text-align: right;
}

.place-meta p:first-child {
  color: var(--text);
  font-weight: 650;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.current-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem;
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.current-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.current-icon {
  font-size: clamp(3.5rem, 9vw, 5.5rem);
  line-height: 1;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.25));
}

.current-temp {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.current-desc {
  margin-top: 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.current-range {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.forecast-section {
  margin-bottom: 2rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 0.85rem;
  padding: 0 0.25rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.section-title span {
  color: var(--muted);
  font-size: 0.82rem;
}

.hourly-list {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 0.9rem;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  scrollbar-width: thin;
}

.hour-card {
  flex: 0 0 6.6rem;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 1rem 0.5rem;
  border-radius: 1.15rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
}

.hour-card.is-now {
  border-color: rgba(124, 196, 255, 0.7);
  background: rgba(124, 196, 255, 0.14);
}

.hour-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.hour-icon {
  font-size: 1.75rem;
}

.hour-temp {
  font-weight: 750;
  font-size: 1.05rem;
}

.hour-rain {
  font-size: 0.75rem;
  color: var(--accent);
}

.daily-list {
  display: grid;
  gap: 0.55rem;
  padding: 0.35rem;
  border-radius: 1.5rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
}

.day-row {
  display: grid;
  grid-template-columns: 6.5rem 2.2rem minmax(0, 1fr) 5.5rem;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-radius: 1rem;
}

.day-row + .day-row {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.day-name {
  font-weight: 650;
  font-size: 0.92rem;
}

.day-desc {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}

.day-icon {
  font-size: 1.5rem;
  text-align: center;
}

.range-bar {
  position: relative;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.range-fill {
  position: absolute;
  inset-block: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ffd166);
}

.day-temps {
  text-align: right;
  font-size: 0.88rem;
}

.day-temps .low {
  color: var(--muted);
  margin-left: 0.35rem;
}

.footer {
  margin-top: 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.install-dialog {
  width: min(24rem, calc(100% - 2rem));
  padding: 1.6rem;
  border-radius: 1.4rem;
  border: 1px solid var(--card-border);
  background: #14213a;
  color: var(--text);
  box-shadow: var(--shadow);
}

.install-dialog::backdrop {
  background: rgba(5, 10, 20, 0.65);
  backdrop-filter: blur(4px);
}

.install-dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.install-dialog p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.dialog-close {
  width: 100%;
  border: 0;
  border-radius: 0.8rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1220;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1.2rem, 1080px);
    padding-top: 1rem;
  }

  .search-form {
    width: 100%;
  }

  .search-form input {
    width: 100%;
  }

  .search-button {
    flex: 0 0 auto;
  }

  .search-area {
    width: 100%;
  }

  .current-card {
    grid-template-columns: 1fr;
    padding: 1.35rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .place-meta {
    text-align: left;
  }

  .day-row {
    grid-template-columns: 5.5rem 1.7rem minmax(0, 1fr) 4.8rem;
    gap: 0.5rem;
    padding: 0.75rem 0.6rem;
  }
}
