:root {
  --bg: #eef1f6;
  --ink: #14171f;
  --soft: #667085;
  --lime: #c6ff3d;
  --lime-deep: #9fd600;
  --panel: #ffffff;
  --line: rgba(20, 23, 31, 0.08);
  --font-display: "Anton", Impact, sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 0 0 calc(32px + var(--safe-bottom));
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

.blob-a {
  width: 260px;
  height: 260px;
  top: -80px;
  right: -60px;
  background: rgba(198, 255, 61, 0.55);
  animation: floaty 9s ease-in-out infinite alternate;
}

.blob-b {
  width: 220px;
  height: 220px;
  left: -90px;
  top: 28vh;
  background: rgba(120, 170, 255, 0.28);
  animation: floaty 11s ease-in-out infinite alternate-reverse;
}

@keyframes floaty {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(18px, 24px) scale(1.08); }
}

.bar, .splash, main, .drawer, .snack {
  position: relative;
  z-index: 1;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 0;
}

.pill-cart,
.pill-manager {
  border: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.pill-manager {
  background: var(--ink);
  color: var(--lime);
}

.pill-cart b {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--lime);
  font-size: 12px;
}

.pill-cart b[hidden] {
  display: none !important;
}

.splash {
  padding: 28px 18px 8px;
  animation: up 0.55s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(84px, 26vw, 120px);
  line-height: 0.86;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #14171f 0%, #14171f 58%, #c6ff3d 58%, #c6ff3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tag {
  margin: 14px 0 0;
  max-width: 22ch;
  color: var(--soft);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

main { padding: 18px 0 0; }

.rail-wrap { padding: 0 0 8px; }

.rail-label {
  padding: 0 18px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
}

.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 18px 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.fuel-tile {
  flex: 0 0 132px;
  scroll-snap-align: start;
  border: 0;
  text-align: left;
  padding: 16px 14px 14px;
  border-radius: 28px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(20, 23, 31, 0.06);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
  animation: up 0.45s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.fuel-tile:nth-child(2) { animation-delay: 0.05s; }
.fuel-tile:nth-child(3) { animation-delay: 0.1s; }
.fuel-tile:nth-child(4) { animation-delay: 0.15s; }

.fuel-tile.active {
  background: var(--ink);
  color: #fff;
  transform: translateY(-4px) scale(1.02);
}

.fuel-octane {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  margin-bottom: 18px;
}

.fuel-tile.active .fuel-octane { color: var(--lime); }

.fuel-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.fuel-sub {
  margin: 2px 0 10px;
  font-size: 12px;
  opacity: 0.65;
}

.fuel-cost {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.dial-panel {
  margin: 0 18px;
  padding: 18px 16px 16px;
  border-radius: 32px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(20, 23, 31, 0.08);
  animation: up 0.35s ease both;
}

.dial-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.dial-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

.dial-top h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
}

.dial-sum {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.dial {
  position: relative;
  width: min(260px, 74vw);
  aspect-ratio: 1;
  margin: 8px auto 12px;
}

.dial-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dial-track {
  fill: none;
  stroke: #edf0f5;
  stroke-width: 14;
}

.dial-progress {
  fill: none;
  stroke: var(--lime-deep);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 515.2;
  stroke-dashoffset: 400;
  transition: stroke-dashoffset 0.28s ease;
}

.dial-core {
  position: absolute;
  inset: 18%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px 10px;
  border: 0;
  border-radius: 50%;
  background: rgba(198, 255, 61, 0.12);
  cursor: text;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.dial-core:focus-within,
.dial-core.is-editing {
  background: rgba(198, 255, 61, 0.28);
  box-shadow: inset 0 0 0 2px var(--lime-deep);
}

.dial-edit-hint {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  line-height: 1.2;
}

.dial-core.is-editing .dial-edit-hint {
  color: var(--ink);
}

.dial-core input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 2px dashed rgba(20, 23, 31, 0.28);
  background: transparent;
  text-align: center;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  color: var(--ink);
  outline: none;
  padding: 0 0 4px;
  margin: 0;
  caret-color: var(--lime-deep);
}

.dial-core input.digits-4 {
  font-size: 34px;
  letter-spacing: -0.02em;
}

.dial-core input.digits-3 {
  font-size: 40px;
}

.dial-core input:focus {
  border-bottom-style: solid;
  border-bottom-color: var(--ink);
}

.dial-unit {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
}

#litersRange {
  width: 100%;
  accent-color: var(--lime-deep);
  margin: 0 0 12px;
}

.chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.preset {
  border: 0;
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 0;
  font-weight: 800;
  cursor: pointer;
}

.preset.active {
  background: var(--lime);
  color: var(--ink);
}

.cta {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.cta:active { transform: scale(0.98); }
.cta:disabled { opacity: 0.45; cursor: not-allowed; }

.veil {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 31, 0.35);
  z-index: 20;
  animation: fade 0.2s ease both;
  touch-action: none;
}

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 760px);
  height: min(88vh, 760px);
  overflow: hidden;
  z-index: 30;
  background: #f7f8fb;
  border-radius: 28px 28px 0 0;
  padding: 8px 16px calc(18px + var(--safe-bottom));
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.2, 0.85, 0.2, 1);
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.drawer.open { transform: translateY(0); }

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: 8px;
}

body.sheet-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.sheet-open .stage,
body.sheet-open main {
  pointer-events: none;
  touch-action: none;
}

body.sheet-open .rail {
  overflow: hidden;
}

.drawer-grab {
  width: 42px;
  height: 4px;
  margin: 6px auto 10px;
  border-radius: 999px;
  background: rgba(20, 23, 31, 0.15);
  flex-shrink: 0;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--soft);
  font-weight: 700;
  cursor: pointer;
}

.bag { display: grid; gap: 8px; margin-bottom: 12px; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
}

.cart-item strong { display: block; }
.cart-item span { color: var(--soft); font-size: 13px; }

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #c0392b;
  font-weight: 700;
  cursor: pointer;
}

.bag-empty {
  padding: 22px 8px;
  text-align: center;
  color: var(--soft);
  font-weight: 600;
}

.form {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.track-card {
  background: #fff;
  border-radius: 22px;
  padding: 18px 16px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(159, 214, 0, 0.55);
}

.track-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}

.track-card > strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
  margin-bottom: 14px;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.track-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.track-list span {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.track-list b {
  text-align: right;
  font-size: 13px;
  font-weight: 800;
}

.track-hint {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--soft);
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
}

.time-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 14px;
  padding-right: 14px;
}

.time-input input {
  flex: 1;
  min-width: 0;
}

.time-input span {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.field-hint {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--soft);
}

.form input,
.form textarea {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  font-size: 16px; /* iOS: less than 16px zooms on focus */
  line-height: 1.25;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tab {
  border: 0;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.tab.on {
  background: var(--ink);
  color: #fff;
}

.drawer-foot {
  flex-shrink: 0;
  display: grid;
  gap: 10px;
  padding-top: 8px;
  background: #f7f8fb;
}

.payline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.payline span {
  color: var(--soft);
  font-weight: 700;
}

.payline strong {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
}

.snack {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: var(--lime);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
}

.snack.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 480px) {
  body { max-width: 440px; margin: 0 auto; }
  .drawer { left: 50%; right: auto; width: 440px; margin-left: -220px; }
}
