:root {
  color-scheme: light dark;
  --bg-1: #1e3c72;
  --bg-2: #2a5298;
  --card-bg: rgba(255, 255, 255, 0.12);
  --card-border: rgba(255, 255, 255, 0.25);
  --text: #f5f7fb;
  --text-muted: rgba(245, 247, 251, 0.75);
  --accent: #ffd166;
  --radius: 18px;
  --transition: 0.6s ease;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  transition: background var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---------- themes ---------- */
body.theme-clear.is-day       { background: linear-gradient(160deg, #4facfe, #00c6ff, #ffd166); }
body.theme-clear.is-night     { background: linear-gradient(160deg, #0f1c3f, #1b2a4a, #2c3e6b); }
body.theme-cloudy.is-day      { background: linear-gradient(160deg, #757f9a, #d7dde8); }
body.theme-cloudy.is-night    { background: linear-gradient(160deg, #232526, #414345); }
body.theme-rain.is-day        { background: linear-gradient(160deg, #3a6186, #89253e21, #506883); }
body.theme-rain.is-night      { background: linear-gradient(160deg, #131f2c, #2c3e50); }
body.theme-snow.is-day        { background: linear-gradient(160deg, #83a4d4, #b6fbff); }
body.theme-snow.is-night      { background: linear-gradient(160deg, #1a2a3a, #3a4a5a); }
body.theme-fog.is-day         { background: linear-gradient(160deg, #949e9c, #d3d9d8); }
body.theme-fog.is-night       { background: linear-gradient(160deg, #2b2f33, #4a4f54); }
body.theme-storm.is-day,
body.theme-storm.is-night     { background: linear-gradient(160deg, #0f0c29, #302b63, #24243e); }

.wrap {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin: 0 0 10px; }
.subtitle { color: var(--text-muted); margin: 0; font-size: 1.02rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

label { font-size: 0.88rem; color: var(--text-muted); font-weight: 600; }

input {
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.9);
  color: #1a1a2e;
  outline: none;
}
input:focus { box-shadow: 0 0 0 3px rgba(255,209,102,0.5); }

.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #2b2200;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  margin-top: 6px;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.15);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-secondary:hover { background: rgba(255,255,255,0.25); }

.btn-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 14px;
  padding: 4px 0;
}
.btn-reset:hover { color: var(--text); }

.status {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  font-size: 0.92rem;
}
.status-error { background: rgba(220, 60, 60, 0.35); }

.picker { margin-top: 18px; }
.picker-title { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 10px; }
.picker-list { display: flex; flex-direction: column; gap: 8px; }
.picker-item {
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.1);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}
.picker-item:hover { background: rgba(255,255,255,0.22); }
.flag { margin-right: 6px; }

.result-header { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.result-icon { font-size: 3rem; line-height: 1; }
.result-header h2 { margin: 0 0 4px; font-size: 1.3rem; }
.result-subtitle { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.result-sentence {
  font-size: 1.08rem;
  line-height: 1.5;
  margin: 18px 0 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}
.stat-value { font-size: 1.15rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.extra-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.extra-pill {
  background: rgba(255,209,102,0.22);
  border: 1px solid rgba(255,209,102,0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.88rem;
}

.actions { margin-bottom: 14px; }
.fine-print { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.footer {
  text-align: center;
  margin-top: 34px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer a { color: var(--accent); }
.tiny { font-size: 0.75rem; opacity: 0.8; margin-top: 6px; }

/* ---------- particles ---------- */
#particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.drop {
  position: absolute;
  top: -20px;
  width: 2px;
  height: 18px;
  background: rgba(180, 210, 255, 0.55);
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes fall {
  to { transform: translateY(105vh); }
}

.flake {
  position: absolute;
  top: -20px;
  color: rgba(255,255,255,0.85);
  animation-name: snowfall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes snowfall {
  0% { transform: translateY(-5vh) translateX(0); }
  50% { transform: translateY(50vh) translateX(20px); }
  100% { transform: translateY(105vh) translateX(-10px); }
}

.sun {
  position: absolute;
  top: 8vh;
  right: 10vw;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c8, #ffd166 60%, transparent 72%);
  box-shadow: 0 0 60px 30px rgba(255, 209, 102, 0.45);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px 1px rgba(255,255,255,0.8);
  animation: twinkle 2.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.cloud {
  position: absolute;
  left: -220px;
  width: 200px;
  height: 60px;
  background: rgba(255,255,255,0.55);
  border-radius: 50px;
  animation-name: drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
}
.cloud::before { width: 70px; height: 70px; top: -32px; left: 20px; }
.cloud::after { width: 90px; height: 90px; top: -42px; right: 20px; }
@keyframes drift {
  to { transform: translateX(140vw); }
}

.lightning {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  opacity: 0;
  animation: strike 6s ease-in-out infinite;
}
@keyframes strike {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: 0.8; }
  94% { opacity: 0; }
  95% { opacity: 0.6; }
  96% { opacity: 0; }
}

@media (max-width: 480px) {
  .field-row { flex-direction: column; gap: 16px; }
  .card { padding: 20px; }
}
