:root {
  color-scheme: dark;
  --bg: #090d1f;
  --bg-soft: #111735;
  --text: #ecf0ff;
  --muted: #a9b1d1;
  --line: #25306d;
  --primary: #7b8dff;
  --primary-soft: #5565c6;
  --good: #22c55e;
  --mid: #eab308;
  --bad: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #1b245e, var(--bg) 55%);
  color: var(--text);
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 84px;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 12px 0 6px;
}

.hero p {
  margin: 0 0 16px;
  color: var(--muted);
}

.ad-slot {
  border: 1px dashed #4f5cb3;
  background: rgba(90, 105, 190, 0.14);
  color: #c9d2ff;
  padding: 10px;
  text-align: center;
  border-radius: 12px;
  font-size: 0.9rem;
}

.top-ad,
.mid-ad {
  margin-bottom: 16px;
}

.input-card,
.share-wrap,
.affiliate-box {
  background: linear-gradient(180deg, rgba(26, 35, 81, 0.85), rgba(15, 21, 51, 0.92));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-btn,
.quick-times button,
.cta {
  border: 1px solid #4452a6;
  background: #121a45;
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 12px;
}

.mode-btn.active {
  background: linear-gradient(90deg, var(--primary), #9986ff);
  border-color: transparent;
  color: #fff;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: #d9def9;
  margin-bottom: 12px;
}

input[type="text"],
select {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
}

input[type="range"] {
  width: 100%;
}

.row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.quick-times,
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cta {
  background: linear-gradient(90deg, var(--primary), var(--primary-soft));
  border: none;
  text-decoration: none;
  font-weight: 600;
}

.cta.ghost {
  background: #121a45;
  border: 1px solid #3d4a99;
}

.results-wrap h2,
.share-wrap h2,
.affiliate-box h2 {
  margin-top: 0;
}

.is-hidden {
  display: none;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 17, 43, 0.95);
  padding: 14px;
  position: relative;
}

.result-card.best {
  border-color: #8ea1ff;
  box-shadow: 0 0 0 1px #8ea1ff70 inset;
}

.best-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #8ea1ff;
  color: #18204f;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.result-time {
  font-size: 1.6rem;
  margin: 6px 0;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  margin: 0 0 8px;
}

.rating {
  margin: 0 0 10px;
  font-weight: 700;
}

.energy-card {
  border-top: 1px solid #27316c;
  padding-top: 10px;
}

.energy-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 9px;
  background: #1f2857;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
}

.score-poor {
  color: var(--bad);
  background: var(--bad);
}

.score-mid {
  color: var(--mid);
  background: var(--mid);
}

.score-high {
  color: var(--good);
  background: var(--good);
}

.energy-label {
  margin: 8px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.share-text {
  color: #e6ebff;
  font-size: 1.02rem;
}

.error {
  color: #ffd7d7;
  background: rgba(190, 55, 55, 0.2);
  border: 1px solid #9c3f3f;
  border-radius: 10px;
  padding: 10px;
}

.sticky-ad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  border-radius: 0;
  z-index: 30;
}

.app-footer {
  margin-top: 40px;
  padding: 24px 0 80px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-footer p {
  color: #94a3b8;
  font-size: 0.9rem;
}

@media (min-width: 820px) {
  .app-shell {
    padding-top: 26px;
  }
}
