* { box-sizing: border-box; }

:root {
  --background-color: #f7f7f4;
  --card-bg: #fbfaf7;
  --text-color: #1a1a1a;
  --icon-color: #1a1a1a;
  --muted: #6f6f6b;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --input-bg: #f0efeb;
  --track-bg: #ececea;
  --accent: #5c8a66;
  --accent-contrast: #ffffff;
  --focus-ring: rgba(92, 138, 102, 0.18);
  --accent-muted: #55795d;
  --shadow-ambient: 0 1px 4px rgba(0, 0, 0, 0.02);
  --shadow-key: 0 6px 18px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --background-color: #101311;
  --card-bg: #181c19;
  --text-color: #f2f2f0;
  --icon-color: #f2f2f0;
  --muted: #9a9a96;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --input-bg: #242422;
  --track-bg: #2a2a28;
  --accent: #6fa07a;
  --accent-contrast: #0f0f0f;
  --focus-ring: rgba(111, 160, 122, 0.25);
  --accent-muted: #5f8969;
  --shadow-ambient: 0 0 0 rgba(0, 0, 0, 0);
  --shadow-key: 0 0 0 rgba(0, 0, 0, 0);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 680px;
  margin: 1rem auto;
  padding: 1rem 1.25rem 4rem;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.hero {
  position: relative;
  margin: 0 0 1.5rem;
  border-radius: 22px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.hero picture {
  display: block;
}

.hero-img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  object-position: left center;
  border-radius: 22px;
}

@media (min-width: 600px) {
  .hero-img { height: 320px; }
}

@media (min-width: 900px) {
  .hero-img { height: 420px; }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  border-radius: 22px;
}

@media (min-width: 600px) {
  .hero-overlay { padding: 30px; }
}

.hero-text {
  position: relative;
  text-align: right;
  max-width: 74%;
  transform: translateY(10px);
}

@media (min-width: 600px) {
  .hero-text { max-width: 92%; }
  .hero-subtitle { white-space: nowrap; }
}

.hero-text::before {
  content: '';
  position: absolute;
  inset: -0.5rem -0.75rem;
  background: radial-gradient(ellipse 120% 130% at 78% 68%, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 45%, rgba(0, 0, 0, 0) 78%);
  border-radius: 20px;
  z-index: -1;
  pointer-events: none;
}

.hero-overlay h1 {
  margin: 0 0 0.25rem;
}

.hero-reset-btn {
  display: inline-block;
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  color: #ffffff;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.hero-reset-btn:hover { opacity: 0.85; }
.hero-reset-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
  border-radius: 4px;
}

@media (min-width: 600px) {
  .hero-reset-btn { font-size: 2.5rem; }
}

.hero-subtitle {
  color: #ffffff;
  opacity: 0.96;
  font-size: 1.18rem;
  line-height: 1.45;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  margin: 0;
}

@media (min-width: 600px) {
  .hero-subtitle { font-size: 1.38rem; }
}

.settings-wrap {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

@media (min-width: 600px) {
  .settings-wrap { right: 20px; top: 20px; }
}

.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(20, 22, 20, 0.38);
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.settings-btn:hover,
.settings-btn[aria-expanded="true"] {
  background: rgba(20, 22, 20, 0.55);
  border-color: rgba(255, 255, 255, 0.5);
}
.settings-btn svg { width: 20px; height: 20px; }

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 30;
}
.settings-backdrop[hidden] { display: none; }
@media (min-width: 481px) {
  .settings-backdrop { display: none !important; }
}

.settings-popover {
  position: fixed;
  width: max-content;
  max-width: min(300px, calc(100vw - 2rem));
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  z-index: 31;
}
.settings-popover[hidden] { display: none; }

@media (max-width: 480px) {
  .settings-popover {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-width: none;
    width: 100%;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .popover-row { flex-direction: column; align-items: stretch; gap: 1rem; }
  .popover-divider { display: none; }
  .popover-group .segmented { width: 100%; }
  .popover-group .segmented-btn { flex: 1; }
}

.popover-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.popover-divider {
  align-self: stretch;
  width: 1px;
  background: var(--border);
}
.popover-group { display: flex; flex-direction: column; gap: 0.3rem; }
.popover-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 600;
  color: var(--muted);
}

h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}

@media (min-width: 600px) {
  h2 { font-size: 1.15rem; }
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.segmented-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-width: 44px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
  transition: background-color 150ms ease, color 150ms ease;
}
.segmented-btn:hover { color: var(--text-color); }
.segmented-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}
.segmented-btn.icon-btn { padding: 0; width: 44px; }

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-key), var(--shadow-ambient);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.panel:has(.collapsible) {
  padding: 1rem 1.25rem;
}
.panel:has(.collapsible[open]) {
  padding: 1.25rem 1.25rem 1.5rem;
}

label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.015em;
  font-weight: 600;
  color: var(--muted);
  margin: 1.25rem 0 0.45rem;
}
label:first-child { margin-top: 0; }

select,
input[type="number"],
input[type="text"] {
  width: 100%;
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 0.3s ease;
}
select:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.weight-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}
.weight-row > div { flex: 1; }
.weight-row select { width: auto; min-width: 80px; }
.weight-row input[type="number"] { flex: 1; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.weight-range-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
  min-height: 1.1em;
}

.canister-illustration {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 100px;
  margin: 0.375rem 0 1.25rem;
}
.canister-illustration[hidden] { display: none; }
.canister-illustration svg,
.canister-illustration img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.13));
}
[data-theme="dark"] .canister-illustration svg,
[data-theme="dark"] .canister-illustration img {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.error-msg {
  display: none;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  margin-top: 1.25rem;
}
.error-msg.visible { display: block; }

.result { display: none; margin-top: 2rem; }
.result.visible { display: block; }

.result-top {
  margin-bottom: 2rem;
}

.status-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}
.status-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.status-icon.tier-full,
.status-icon.tier-high { color: var(--accent); }
.status-icon.tier-mid,
.status-icon.tier-low { color: #b8923f; }
.status-icon.tier-empty { color: #b85c5c; }
[data-theme="dark"] .status-icon.tier-mid,
[data-theme="dark"] .status-icon.tier-low { color: #d4ad5f; }
[data-theme="dark"] .status-icon.tier-empty { color: #d47a7a; }

.result-pct-block { margin-bottom: 0.5rem; }

.fuel-pct {
  font-size: 3.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0;
  line-height: 1;
}

.fuel-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.status-recommendation {
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-color);
  line-height: 1.65;
  max-width: 46ch;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .result-top {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 1.5rem;
    align-items: start;
  }
  .result-pct-block { grid-column: 1; grid-row: 1 / 3; margin-bottom: 0; }
  .status-headline { grid-column: 2; grid-row: 1; justify-content: flex-start; text-align: left; }
  .status-recommendation { grid-column: 2; grid-row: 2; text-align: left; margin: 0; }
}

.bar-bg {
  background: var(--track-bg);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 1.75rem;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.details-grid {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.details-grid td { padding: 0.4rem 0; border-bottom: 1px solid rgba(127, 127, 127, 0.14); }
.details-grid td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}
.details-grid tr:last-child td { border-bottom: none; }

.boil-box {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.boil-count { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.boil-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.35rem 0 1rem;
  min-height: 1.1em;
}

.boil-size-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.boil-size-lbl {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.boil-btn {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-color);
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.boil-btn:hover { border-color: var(--border-strong); }
.boil-btn:active { transform: scale(0.97); }
.boil-btn:focus-visible { outline-offset: 2px; }
.boil-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

.text-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  text-align: center;
  background: var(--accent-muted);
  color: var(--accent-contrast);
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.text-btn:hover { opacity: 0.9; box-shadow: 0 6px 16px rgba(92, 138, 102, 0.28); }
.text-btn:active { transform: scale(0.98); opacity: 0.85; }
.text-btn:focus-visible {
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.trip-result {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.9rem;
  min-height: 1.4em;
}

.trip-planner-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 450ms cubic-bezier(0.4, 0, 0.2, 1), opacity 350ms ease;
}
.trip-planner-body.unlocked {
  grid-template-rows: 1fr;
  opacity: 1;
}
.trip-planner-body > div {
  overflow: hidden;
}

.comparison-wrap {
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.comparison-table th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.comparison-table td {
  padding: 1rem 0.85rem;
  text-align: left;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.comparison-table td:first-child {
  font-weight: 600;
  color: var(--text-color);
}
.comparison-table th:nth-child(2), .comparison-table th:nth-child(3), .comparison-table th:nth-child(4),
.comparison-table td:nth-child(2), .comparison-table td:nth-child(3), .comparison-table td:nth-child(4) {
  text-align: right;
}
.comparison-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }
[data-theme="dark"] .comparison-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.comparison-table tbody tr:hover { background: rgba(0, 0, 0, 0.03); }
[data-theme="dark"] .comparison-table tbody tr:hover { background: rgba(255, 255, 255, 0.035); }

.sort-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 150ms ease;
}
.sort-btn:hover { color: var(--text-color); }
.sort-arrow {
  font-size: 0.7rem;
  opacity: 0.45;
  transition: opacity 150ms ease;
}
.sort-btn:hover .sort-arrow { opacity: 1; }

.delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.15rem 0.45rem;
  transition: background-color 150ms ease;
}
.delete-btn:hover { background: rgba(0, 0, 0, 0.05); }
[data-theme="dark"] .delete-btn:hover { background: rgba(255, 255, 255, 0.08); }

.custom-canister-form {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}
.custom-canister-form label { margin-top: 1rem; }
.custom-canister-form label:first-child { margin-top: 0; }
.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.85rem;
}

.section-intro {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  text-align: left;
  margin: 0 0 1.5rem;
}

.collapsible summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible-heading {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.collapsible-heading h2 { margin: 0; }
.collapsible-teaser {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
  line-height: 1.5;
}
.chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 250ms ease;
}
.collapsible[open] .chevron { transform: rotate(180deg); }
.collapsible-body {
  padding-top: 1.25rem;
}

.disclaimer {
  max-width: 600px;
  margin: 2rem 0 0;
}
.disclaimer h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 0.5rem;
}
.disclaimer p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer p a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  transition: color 150ms ease, border-color 150ms ease;
}
.disclaimer p a:hover,
.disclaimer p a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.legal-page { max-width: 620px; }
.legal-page h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 1.5rem; }
.legal-page h2 { font-size: 1rem; margin-top: 1.75rem; }
.legal-page p { font-size: 0.92rem; line-height: 1.65; color: var(--text-color); }
.legal-page address { font-style: normal; line-height: 1.65; font-size: 0.92rem; }
.legal-page a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  transition: color 150ms ease, border-color 150ms ease;
}
.legal-page a:hover,
.legal-page a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.legal-back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
}
.legal-back:hover, .legal-back:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }

.faq-page h2 { margin-top: 2.25rem; }
.faq-page p { margin-bottom: 1.1rem; line-height: 1.75; }

footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 620px;
}

.footer-tagline {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0.85rem 0 0;
}

.footer-links {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}
.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.footer-sep {
  color: var(--border-strong);
  margin: 0 0.35em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 479px) {
  .panel { padding: 1.5rem 1.25rem; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .trip-planner-body { transition: none; }
}
