:root {
  --fuel: #F5A623;
  --fuel-dark: #D4851A;
  --bg: #0E0E0E;
  --surface: #181818;
  --surface2: #222222;
  --border: #2E2E2E;
  --text: #F0F0F0;
  --muted: #777;
  --green: #4ADE80;
  --red: #F87171;
}

* { box-sizing: border-box; margin: 0; padding: 0; max-width: 100%; }
html { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 40px) clamp(8px, 2vw, 16px) clamp(32px, 6vw, 80px);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(245,166,35,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.header-img {
  max-width: clamp(100px, 25vw, 160px);
  width: 100%;
  margin-bottom: clamp(6px, 1.5vw, 12px);
}

.header .label {

  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fuel);
  margin-bottom: 8px;
}


.header h1 {
  font-size: clamp(16px, 4vw, 22px);
}

.header h4 {
  font-size: clamp(12px, 2.5vw, 16px);
}

.header h1 span,
.header h2 span { color: var(--red); }

.header p {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(10px, 2.5vw, 16px);
  padding: clamp(16px, 4vw, 28px);
  width: 100%;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.section-label {
  font-size: clamp(13px, 2.5vw, 15px);
  margin-bottom: clamp(6px, 1.5vw, 10px);
  font-weight: bold;
}

.input-group { margin-bottom: clamp(12px, 3vw, 20px); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 2vw, 12px); }

select, input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: clamp(6px, 1.5vw, 10px);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(13px, 2.5vw, 15px);
  font-weight: 500;
  padding: clamp(8px, 2vw, 12px) clamp(10px, 2vw, 14px);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

select.placeholder { color: var(--muted); font-weight: 400; }

select:hover, input:hover { border-color: var(--fuel); }

select:focus, input:focus {
  border-color: var(--fuel);
}

select option { background: var(--surface2); }

.select-wrap { position: relative; }

.select-wrap::after {
  content: '\25BE';
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 15px;
}

.price-input-row {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
}

.price-input-row.visible {
  max-height: 120px;
  opacity: 1;
  margin-bottom: 20px;
}

#priceDivider {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

#priceDivider.visible {
  max-height: 1px;
  opacity: 1;
  margin: 24px 0;
}

.price-field {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color 0.2s;
}

.price-field:hover { border-color: var(--fuel); }
.price-field:focus-within { border-color: var(--fuel); }

.price-prefix, .price-suffix {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
  flex-shrink: 0;
}

.price-field input {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 12px 6px;
  flex: 1;
  min-width: 0;
}

.price-field input:hover,
.price-field input:focus {
  border-color: transparent;
}

.price-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  padding-left: 2px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: clamp(14px, 3.5vw, 24px) 0;
}

.fill-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.fill-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: clamp(6px, 1.5vw, 10px);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(11px, 2vw, 13px);
  font-weight: 600;
  padding: clamp(8px, 2vw, 12px) clamp(4px, 1vw, 8px);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.fill-btn .fraction {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.fill-btn .sub {
  font-size: clamp(12px, 2.5vw, 15px);
  font-weight: 400;
  color: var(--muted);
}

.fill-btn:hover { border-color: var(--fuel); }
.fill-btn.active {
  background: rgba(245,166,35,0.12);
  border-color: var(--fuel);
  color: var(--fuel);
}
.fill-btn.active .fraction { color: var(--fuel); }

.calc-btn {
  width: 100%;
  background: var(--fuel);
  border: none;
  border-radius: clamp(8px, 2vw, 12px);
  color: #0E0E0E;
  font-size: clamp(16px, 3.5vw, 20px);
  padding: clamp(12px, 2.5vw, 16px);
  cursor: pointer;
  margin-top: clamp(14px, 3.5vw, 24px);
  transition: background 0.2s, transform 0.1s;
  position: relative;
  overflow: hidden;
}

.calc-btn:hover { background: var(--fuel-dark); }
.calc-btn:active { transform: scale(0.99); }
.calc-btn:disabled { background: #333; color: var(--muted); cursor: not-allowed; }

.result-card {
  width: 100%;
  max-width: 520px;
  position: relative;
  z-index: 1;
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, margin-top 0.4s ease;
  pointer-events: none;
}

.result-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  max-height: 800px;
  margin-top: 16px;
}

.result-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: clamp(10px, 2.5vw, 16px);
  padding: clamp(16px, 4vw, 28px);
  position: relative;
  overflow: hidden;
}

.result-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--fuel), var(--fuel-dark));
}

.price-display {
  text-align: center;
  padding: 16px 0;
}

.price-display .total {
  font-size: clamp(64px, 18vw, 96px);
  line-height: 1;
  color: var(--fuel);
  letter-spacing: 0.02em;
}

.price-display .sub-info {
  font-size: clamp(12px, 2.5vw, 15px);
  color: var(--muted);
  margin-top: clamp(4px, 1vw, 8px);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.stat {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.stat .val {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.stat .lbl {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

.gauge-bar {
  margin-top: 20px;
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fuel-dark), var(--fuel));
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;

  color: var(--muted);
  margin-top: 6px;
}

.price-history {
  margin-top: 18px;
}

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

.history-item {
  background: var(--surface2);
  border-radius: clamp(6px, 1.5vw, 10px);
  padding: clamp(8px, 2vw, 12px) clamp(4px, 1vw, 8px);
  text-align: center;
}

.history-label {
  font-size: clamp(9px, 1.8vw, 11px);
  color: var(--muted);
  margin-bottom: 6px;
}

.history-cost {
  font-size: clamp(12px, 2.5vw, 15px);
  font-weight: 500;
  color: var(--text);
}

.history-diff {
  font-size: clamp(9px, 1.8vw, 11px);
  color: var(--muted);
  margin-top: 4px;
}

.history-diff.up { color: var(--red); }
.history-diff.down { color: var(--green); }

.fuel-type-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: clamp(6px, 1.5vw, 10px);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(11px, 2vw, 13px);
  font-weight: 500;
  padding: clamp(6px, 1.5vw, 10px) clamp(4px, 1vw, 8px);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.fuel-type-btn:hover { border-color: var(--fuel); }
.fuel-type-btn.active {
  background: rgba(245,166,35,0.12);
  border-color: var(--fuel);
  color: var(--fuel);
}

.status-msg {
  font-size: 15px;

  margin-top: 10px;
  text-align: center;
  min-height: 16px;
}

a {
  color: #969696;
}

.status-msg.loading { color: var(--fuel); animation: pulse 1s ease infinite; }
.status-msg.error { color: var(--red); }
.status-msg.ok { color: var(--green); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(245,166,35,0.2);
  border-top-color: var(--fuel);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.note {
  font-size: clamp(9px, 1.8vw, 11px);
  color: var(--muted);
  text-align: left;
  margin-top: clamp(14px, 3.5vw, 24px);
  line-height: 1.6;
  position: relative;
  z-index: 1;
  max-width: 420px;
}

@media (max-width: 400px) {
  body { padding: 16px 8px 32px; }
  .card, .result-inner { padding: 16px; }
  .fill-options { grid-template-columns: repeat(2, 1fr); }
  .history-grid { grid-template-columns: 1fr 1fr; }
  .header-img { max-width: 100px; }
  .header h1 { font-size: 16px; }
  .divider { margin: 12px 0; }
  .input-group { margin-bottom: 12px; }
  .calc-btn { font-size: 16px; padding: 12px; margin-top: 14px; }
  .price-display .total { font-size: clamp(40px, 14vw, 64px); }
}

@media (max-width: 300px) {
  body { padding: 10px 6px 24px; }
  .card, .result-inner { padding: 12px; }
  .row { grid-template-columns: 1fr; }
  .header h1 { font-size: 14px; }
  select, input { font-size: 13px; padding: 8px 10px; }
  .section-label { font-size: 12px; }
  .fuel-type-btn { font-size: 11px; padding: 6px 4px; }
  .fill-btn { padding: 8px 4px; }
  .fill-btn .fraction { font-size: 14px; }
  .fill-btn .sub { font-size: 11px; }
  .calc-btn { font-size: 14px; padding: 10px; }
  .price-display .total { font-size: clamp(32px, 12vw, 48px); }
  .note { font-size: 9px; }
}
