@font-face {
  font-family: "DSEG7";
  src: url("assets/fonts/dseg7classic-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #282828;
  --card: #3c3836;
  --text: #ebdbb2;
  --muted: #a89984;
  --border: #504945;
  --accent: #fabd2f;
}

html {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app__header-text {
  flex: 1;
  min-width: 0;
}

.app__header h1 {
  font-size: 1.2rem;
  margin: 0;
}

.app__subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.segmented--compact {
  flex: 0 0 auto;
  border-radius: 8px;
}

.segmented--compact .segmented__option {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.card h2 {
  font-size: 0.85rem;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.control-row--stacked {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.scroll-grab {
  width: 32px;
  height: 100%;
  min-height: 60px;
  flex: none;
}

.wheel {
  --item-h: 44px;
  --wheel-h: 132px;
  position: relative;
  flex: 1; 
  min-width: 0;
  height: var(--wheel-h);
  outline: none;
}

.wheel--short {
  --item-h: 35px;
  --wheel-h: 105px;
}

.wheel--short .wheel__item {
  font-size: 1rem;
}

.wheel--short .wheel__scroller {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
}

.wheel--short .wheel__item--active .wheel__item-label {
  transform: scale(1.2);
}

.wheel--fuel {
  --item-h: 20px;
  --wheel-h: 100px;
}

.wheel--fuel .wheel__item {
  font-size: 0.75rem;
}

.wheel--fuel .wheel__item--active .wheel__item-label {
  transform: scale(1.2);
}

.wheel--fuel .wheel__item {
  font-size: 0.75rem;
}

.wheel__band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--item-h);
  margin-top: calc(var(--item-h) / -2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(250, 189, 47, 0.08);
  pointer-events: none;
}

.wheel__scroller {
  position: relative;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 28%, #000 72%, transparent 100%);
}

.wheel__scroller::-webkit-scrollbar {
  display: none;
}

.wheel__list {
  padding: calc((var(--wheel-h) - var(--item-h)) / 2) 0;
}

.wheel__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--item-h);
  scroll-snap-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.12s ease;
}

.wheel__item--active {
  color: var(--accent);
  font-weight: 800;
}

.wheel__item-label {
  display: block;
  transition: transform 0.12s ease;
}

.wheel__item--active .wheel__item-label {
  transform: scale(1.28);
}

.wheel__item--mark::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.55;
}

.wheel:focus-visible .wheel__band {
  box-shadow: 0 0 0 3px rgba(250, 189, 47, 0.3);
}

.control-row output {
  text-align: left;
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.control-row--label {
  text-align: center;
  width: 110px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
}

/* Fuel gauge art is 900x900 with the drawing at x 303-867, y 52-866.
   Crop to that box so the gauge fills its slot. */
.fuel-gauge {
  position: relative;
  flex: none;
  width: 80px;
  height: 80px;
  overflow: hidden;
}

.fuel-gauge__img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}

.fuel-gauge__value {
  position: absolute;
  top: 4%;
  left: 4%;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ebdbb2;
  pointer-events: none;
  z-index: 2;
  line-height: 1;
}

.e85-badge {
  --badge-size: 80px;
  position: relative;
  width: var(--badge-size);
  flex: none;
}

.e85-badge__image {
  display: block;
  width: 100%;
  height: auto;
}

.e85-badge__value {
  position: absolute;
  left: 62.6%;
  top: 50.8%;
  transform: translate(-50%, -50%);
  font-family: "Arial Black", "Arial Bold", Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-size: calc(var(--badge-size) * 0.3929);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #000;
  -webkit-text-stroke: 1px #000;
  pointer-events: none;
}

.gauge {
  position: relative;
  width: 80px;
  flex: none;
  margin: 0;
}

.gauge__image {
  display: block;
  width: 100%;
  height: auto;
}

.gauge__value {
  position: absolute;
  left: 53.5%;
  top: 49.3%;
  transform: translate(-50%, -50%);
  font-family: "DSEG7", "SFMono-Regular", Menlo, monospace;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  color: #fabd2f;
  text-shadow: 0 0 6px rgba(250, 189, 47, 0.35);
  pointer-events: none;
}

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.segmented__option {
  flex: 1;
  padding: 10px 0;
  background: var(--card);
  color: var(--muted);
  border: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.segmented__option + .segmented__option {
  border-left: 1px solid var(--border);
}

.segmented__option[aria-pressed="true"] {
  background: var(--accent);
  color: #282828;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
}

.result-item--e85 {
  background: rgba(250, 189, 47, 0.12);
  border: 1px solid rgba(250, 189, 47, 0.25);
}

.result-item--pump {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.result-value {
  font-size: 1.1rem;
  font-weight: 700;
}
