:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #d9e2ef;
  --primary: #3b6eea;
  --primary-strong: #2a54b2;
  --text: #1f2a37;
  --muted: #6b7280;
  --shadow: 0 12px 24px rgba(31, 41, 51, 0.08);
  --radius: 14px;
  --max-width: 980px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #f5f7fb 0%, #edf2f7 100%);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 16px 32px;
}

header {
  text-align: center;
  margin-bottom: 22px;
  position: relative;
}

header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header p {
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: 8px;
}

#help-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: transparent;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(59, 110, 234, 0.35);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

#help-btn:hover {
  background: rgba(59, 110, 234, 0.12);
  transform: translateY(-1px);
}

#help-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  margin-bottom: 20px;
  border: 1px solid rgba(29, 41, 55, 0.08);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.3s ease,
    max-height 0.3s ease,
    padding 0.3s ease;
}

#help-section.open {
  opacity: 1;
  max-height: 2000px; /* Adjust based on content */
  padding: 22px;
}

#help-section h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--primary);
}

#help-section h3 {
  font-size: 1.1rem;
  margin-top: 18px;
  margin-bottom: 10px;
}

#help-section ol,
#help-section ul {
  margin-left: 18px;
  margin-bottom: 10px;
}

#help-section li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.ad-placeholder {
  background: var(--card);
  border: 2px dashed rgba(32, 40, 57, 0.18);
  border-radius: var(--radius);
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #9ca3af;
  margin: 24px 0;
}

section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin-bottom: 22px;
  border: 1px solid rgba(29, 41, 55, 0.08);
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(217, 226, 239, 1);
  padding-bottom: 10px;
}

.input-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(217, 226, 239, 1);
  border-radius: 12px;
  font-size: 1.1rem;
  background: white;
  transition:
    border 0.2s ease,
    box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(59, 110, 234, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 110, 234, 0.15);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(209, 213, 219, 1);
  transition: background 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  margin-top: -7px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
}

input[type="range"]:focus {
  outline: none;
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.range-ticks span {
  flex: 1;
  text-align: center;
}

#urgency-value,
#urgency-label {
  font-weight: 600;
  margin-left: 6px;
  color: var(--primary-strong);
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  width: 54px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(209, 213, 219, 1);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: rgba(59, 110, 234, 0.6);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(26px);
}

.button-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(59, 110, 234, 0.18);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(59, 110, 234, 0.22);
}

.result-card {
  text-align: center;
  padding: 22px;
  border-radius: 18px;
  background: rgba(240, 248, 255, 0.85);
  border: 1px solid rgba(59, 110, 234, 0.15);
  box-shadow: 0 10px 20px rgba(31, 41, 51, 0.06);
}

.result-card h3 {
  font-size: 2.1rem;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.result-card p {
  margin: 10px 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.result-card p strong {
  color: var(--text);
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.note-secondary {
  color: var(--muted);
  font-size: 0.9rem;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  border: 1px solid rgba(29, 41, 55, 0.08);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 24px rgba(31, 41, 51, 0.05);
}

li .info {
  flex: 1;
  min-width: 220px;
}

li .info strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

li .actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

li button {
  padding: 8px 10px;
  font-size: 0.9rem;
  min-width: 100px;
  flex: none;
}

footer {
  text-align: center;
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .page {
    padding: 16px 14px 28px;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .button-group {
    grid-template-columns: 1fr;
  }

  li {
    flex-direction: column;
    align-items: flex-start;
  }

  li .actions {
    width: 100%;
    justify-content: space-between;
  }

  input,
  select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  button {
    font-size: 1rem;
    padding: 14px 16px;
  }
}
