:root {
  --color-bg-main: #050810;
  --color-bg-elevated: #0b0f1a;
  --color-bg-muted: #101522;

  --color-text-primary: #f5f5f7;
  --color-text-secondary: #a3a8b8;
  --color-text-muted: #6d7385;
  --color-text-danger: #ff6b6b;
  --color-text-accent: #7cffb2;

  --color-accent-primary: #16f29a;
  --color-accent-soft: #1e9c74;

  --color-border-subtle: #1b2235;
  --color-border-strong: #2f3b5c;

  --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.55);
  --radius-card: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* prevent any sideways scroll / shift */
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #0b0f1a 0, #050810 55%);
  color: var(--color-text-primary);
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-title {
  margin: 0;
  font-size: 1.8rem;
}

.app-subtitle {
  margin: 0.4rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(22, 242, 154, 0.5);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-accent);
}

.app-meta {
  display: flex;
  align-items: center;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.25rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(
      135deg,
      rgba(22, 242, 154, 0.06),
      transparent 60%
    ),
    var(--color-bg-elevated);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.25rem 1.25rem;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.field-input {
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-muted);
  color: var(--color-text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.field-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 1px rgba(22, 242, 154, 0.45);
}

.field-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.btn-primary {
  margin-top: 0.5rem;
  align-self: flex-start;
  border-radius: 999px;
  border: none;
  background-image: linear-gradient(135deg, #16f29a, #4da3ff);
  color: #050810;
  padding: 0.55rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    filter 0.12s ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.7);
}

/* Checkboxes */

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem 0.75rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-accent-primary);
}

/* Results */

.results-body,
.flags-body {
  font-size: 0.95rem;
}

.results-placeholder {
  margin: 0;
  color: var(--color-text-muted);
}

.results-section h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
}

.results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.results-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

.results-label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.results-value {
  font-weight: 600;
}

.results-value--accent {
  color: var(--color-text-accent);
}

.results-value--danger {
  color: var(--color-text-danger);
}

/* Validation errors */

.results-errors h3 {
  margin-top: 0;
  font-size: 0.95rem;
  color: var(--color-text-danger);
}

.results-errors ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

/* Flags */

.flag-pill {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

.flag-pill--warning {
  background: rgba(255, 200, 87, 0.1);
  color: #ffc857;
  border-left: 3px solid #ffc857;
}

.flag-pill--danger {
  background: rgba(255, 107, 107, 0.08);
  color: #ff6b6b;
  border-left: 3px solid #ff6b6b;
}

/* Footer */

.app-footer {
  margin-top: 1.75rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.disclaimer {
  margin: 0;
}

.citation {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Remove spinner arrows from number inputs (Age box) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

/* ================================
   MOBILE LAYOUT (<= 600px)
   Center header + cards + footer
   ================================ */
@media (max-width: 600px) {
  /* remove extra side padding so centering is exact */
  .app-shell {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 0 2.5rem;
  }

  /* shared centered width for main content blocks */
  .app-header,
  .app-footer,
  .card {
    max-width: 480px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* header stack + center */
  .app-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .app-title {
    font-size: 1.6rem;
    line-height: 1.2;
  }

  .app-subtitle {
    max-width: 26rem;
    margin: 0 auto;
    font-size: 0.9rem;
  }

  /* main grid becomes single column, content centered */
  .app-main {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
    justify-items: center;
  }

  /* footer text centered inside its shared width */
  .app-footer {
    text-align: center;
  }

  .disclaimer,
  .citation {
    max-width: 26rem;
    margin: 0.5rem auto 0 auto;
    text-align: center;
  }

  .app-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .app-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
    background: radial-gradient(circle, rgba(22, 242, 154, 0.12), transparent 60%);
    border: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-card);
  }

  /* Center header content */
  .app-header {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .app-header h1,
  .app-header p {
    text-align: center;
  }

  /* Center the footer text */
  .app-footer {
    text-align: center;
    margin-top: 2rem;
    opacity: 0.75;
    font-size: 0.85rem;
  }

  /* === iOS Install Hint Banner === */

  .ios-install-hint {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(0, 255, 102, 0.5);
    box-shadow: 0 -0.4rem 1rem rgba(0, 255, 102, 0.25);
    color: #e0ffe6;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.8rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .ios-install-hint-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .ios-install-hint-text {
    flex: 1;
  }

  .ios-install-hint-text strong {
    color: #00ff66;
  }

  .ios-install-hint-close {
    border: 1px solid rgba(0, 255, 102, 0.6);
    background: transparent;
    color: #e0ffe6;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    cursor: pointer;
  }

  .ios-install-hint-hidden {
    display: none !important;
  }
}

