:root {
  --primary: #3b82f6;
  --secondary: #06b6d4;
  --background: #0e1628;
  --card: #1b2436;
  --text-main: #f9fafb;
  --text-subtle: #cbd5e1;
  --error: #ef4444;

  --card-h: 460px;
  --radius: 20px;
  --gap: 32px;
  --ring: rgba(59, 130, 246, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  background: var(--background);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 48px 24px 32px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.12),
    rgba(59, 130, 246, 0.05)
  );
}
header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}
header .tagline {
  font-size: 16px;
  color: var(--text-subtle);
}

main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.search-section {
  margin: 20px 0 40px;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}
.search-form input {
  flex: 1;
  padding: 18px 22px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-main);
}
.search-form input::placeholder {
  color: var(--text-subtle);
}
.search-form input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--ring);
}
.search-form button {
  padding: 18px 22px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
}
.search-form button:hover {
  background: var(--secondary);
  transform: translateY(-2px);
}
.search-form button:active {
  transform: none;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  align-items: stretch;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 36px;
  min-height: var(--card-h);
  max-height: var(--card-h);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.card-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
}
.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  overflow: hidden;
}

.temp-main {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
}
.weather-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.detail-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 10px;
}
.detail-item .label {
  font-size: 13px;
  color: var(--text-subtle);
}
.detail-item .value {
  font-weight: 700;
}

.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.news-item {
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
}
.news-title {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
}
.news-title:hover {
  color: var(--secondary);
}
.news-source {
  color: var(--text-subtle);
  font-size: 14px;
  margin-top: 2px;
}

.photo-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}
.photo-container img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}
.photo-credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  font-size: 13px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: var(--text-main);
}
.photo-credit a {
  color: var(--text-main);
  text-decoration: none;
}
.photo-credit a:hover {
  color: var(--primary);
}

.pc {
  position: relative;
}
.pc-view {
  overflow: hidden;
  border-radius: 12px;
}
.pc-track {
  display: flex;
  transition: transform 300ms ease;
}
.pc-slide {
  min-width: 100%;
  position: relative;
}
.pc-slide img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}
.pc-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
}
.pc-btn.prev {
  left: 8px;
}
.pc-btn.next {
  right: 8px;
}
.pc-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

footer {
  text-align: center;
  padding: 22px;
  color: var(--text-subtle);
  font-size: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.error {
  color: var(--error);
  font-weight: 600;
  margin-top: 10px;
}

@media (max-width: 1024px) {
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .search-form {
    flex-direction: column;
    align-items: stretch;
    max-width: 420px;
    margin: 0 auto;
    gap: 10px;
  }
  .search-form label {
    text-align: center;
    margin-bottom: 4px;
    white-space: nowrap;
  }
  .search-form button {
    align-self: center;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }
  .card {
    min-height: 300px;
    padding: 22px;
  }
}
