/* 爆速燃費記録 — 色と書体は design/*.dc.html に合わせる */
:root {
  --paper: #F3F0E8;      /* 生成り地 */
  --ink: #16181A;        /* 墨 */
  --line: #DDD7CA;
  --line2: #EAE5DA;
  --sub: #5B5F63;        /* 補助文字 */
  --sub2: #3E4246;
  --sub-d: #C9C3B6;      /* 暗地の補助文字 */
  --panel-d: #2A2D31;    /* 暗地の面 */
  --amber: #FFB25B;      /* 暗地の数字 */
  --orange: #C2410C;     /* 主ボタン */
  --orange-shadow: #7C2D12;
  --link: #9A3412;
  --attn-bg: #FFE9A8; --attn-line: #E0B300; --attn-ink: #4A3300;
  --soft: #E6E0D2;
  --white: #FFFFFF;
  --danger: #B42318;
  --num: "Barlow Condensed", sans-serif;
  --jp: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* iPhoneのダブルタップ拡大を止める。数字を素早く連打すると画面が拡大され、決定が押せなくなることがあった（OJフィードバック） */
html, body, button { touch-action: manipulation; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--jp); }
body.dark { background: var(--ink); color: var(--paper); }
button { font-family: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input { font-family: inherit; }
.num { font-family: var(--num); letter-spacing: 0.01em; }
b, .bold { font-weight: 700; }

.screen { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.page { min-height: 100dvh; display: flex; flex-direction: column; gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
.pad-onb { padding-top: max(48px, env(safe-area-inset-top)); gap: 22px; }
.keypad-page { gap: 14px; padding-left: 16px; padding-right: 16px; }
.grow { flex-grow: 1; }
.row { display: flex; align-items: center; }
.row.base { align-items: baseline; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; }
.px6 { padding: 0 6px; } .pad20 { padding: 20px; } .w100 { width: 100%; } .w110 { width: 110px; flex: none; }
.center { text-align: center; align-self: center; }
.muted { color: var(--sub); } .muted-d { color: var(--sub-d); } .small { font-size: 13px; } .ink { color: var(--ink); }
.accent { color: var(--link); }

.bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.app-name { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; color: var(--sub); }
.icon-btn { width: 44px; height: 44px; border: none; background: transparent; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.icon-btn.small { width: 32px; height: 32px; flex: none; }
.link { border: none; background: none; color: var(--link); font-size: 14px; font-weight: 700; padding: 10px 0; }
.link.danger { color: var(--danger); }

/* ボタン */
.btn-primary { height: 64px; border: none; border-radius: 20px; background: var(--orange); color: var(--white); font-size: 20px; font-weight: 900; letter-spacing: 0.1em; }
.keypad-page .btn-primary, .sheet .btn-primary { height: 60px; border-radius: 16px; letter-spacing: 0.08em; }
.btn-record { height: 108px; border: none; border-radius: 26px; background: var(--orange); color: var(--white); display: flex; align-items: center; justify-content: center; gap: 14px; box-shadow: 0 6px 0 var(--orange-shadow); font-size: 28px; font-weight: 900; letter-spacing: 0.08em; }
.btn-record:active, .btn-share:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--orange-shadow); }
.btn-share { height: 68px; border: none; border-radius: 22px; background: var(--orange); color: var(--white); display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: 0 5px 0 var(--orange-shadow); font-size: 22px; font-weight: 900; letter-spacing: 0.08em; }
.btn-outline { height: 52px; border-radius: 16px; border: 2px solid #CFC8B8; background: transparent; color: var(--sub2); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.keypad-page .btn-outline { height: 60px; font-size: 16px; }
.btn-dark { height: 52px; border: none; border-radius: 16px; background: var(--ink); color: var(--white); font-size: 15px; font-weight: 700; }
.btn-danger { height: 52px; border: none; border-radius: 16px; background: var(--danger); color: var(--white); font-size: 15px; font-weight: 700; }
.btn-ghost { height: 48px; border: none; background: transparent; color: var(--sub); font-size: 15px; font-weight: 700; }
.btn-outline-d { height: 56px; border-radius: 16px; border: 2px solid var(--sub); background: transparent; color: var(--paper); font-size: 16px; font-weight: 700; }
.btn-light { height: 56px; border: none; border-radius: 16px; background: var(--paper); color: var(--ink); font-size: 16px; font-weight: 900; }

/* 初回起動 */
.dots { display: flex; gap: 6px; }
.dots span { width: 6px; height: 6px; border-radius: 3px; background: #CFC8B8; }
.dots span.on { width: 28px; background: var(--orange); }
.hero-full { height: 230px; border-radius: 28px; background: var(--ink); display: flex; align-items: center; justify-content: center; gap: 28px; }
.tank { width: 58px; height: 160px; border: 3px solid var(--paper); border-radius: 12px; padding: 5px; display: flex; }
.tank div { flex: 1; border-radius: 6px; background: var(--amber); }
.h1 { margin: 0; font-size: 28px; font-weight: 900; line-height: 1.3; }
.h2 { font-size: 22px; font-weight: 900; }
.lead { margin: 0; font-size: 16px; line-height: 1.8; color: var(--sub2); }
.lead.sub { font-size: 15px; color: var(--sub); margin-top: 8px; }
.note-card { display: flex; gap: 12px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; align-items: flex-start; }
.note-card p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--sub2); }
.mode-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; background: var(--white); border: 1px solid var(--line); text-align: left; margin: 2px; }
.mode-card.on { border: 3px solid var(--orange); margin: 0; }
.mode-label { font-size: 26px; font-weight: 700; letter-spacing: 0.04em; }
.radio { width: 26px; height: 26px; border-radius: 13px; border: 2px solid #A8A193; display: flex; align-items: center; justify-content: center; }
.mode-card.on .radio { border-color: var(--orange); }
.radio span { width: 12px; height: 12px; border-radius: 6px; }
.mode-card.on .radio span { background: var(--orange); }
.mini-meter { display: flex; align-items: center; gap: 12px; background: var(--ink); border-radius: 12px; padding: 10px 14px; }
.mini-meter .lbl { font-size: 13px; font-weight: 600; color: var(--sub-d); width: 40px; }
.mini-meter .val { font-size: 32px; font-weight: 600; color: var(--amber); letter-spacing: 0.08em; }
.mini-meter .unit { font-size: 16px; color: var(--sub-d); }
.mode-card .body { font-size: 14px; line-height: 1.7; color: var(--sub2); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--sub); }
.field input, .set-row input[type=text] { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); padding: 0 14px; font-size: 17px; color: var(--ink); }
.seg { display: flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 44px; border: none; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 700; color: var(--sub2); }
.seg button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.seg.small button { height: 36px; font-size: 13px; padding: 0 10px; white-space: nowrap; }

/* ホーム */
.a2hs { display: flex; gap: 8px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 14px; background: var(--attn-bg); border: 1px solid var(--attn-line); color: var(--attn-ink); font-size: 13px; line-height: 1.6; }
.vehicle-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; text-align: left; }
.vehicle-card .thumb { width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: flex; align-items: center; justify-content: center; color: var(--sub); overflow: hidden; flex: none; }
.vehicle-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-name { font-size: 17px; font-weight: 700; }
.avg-card { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.avg-card .cap { font-size: 13px; font-weight: 500; color: var(--sub-d); letter-spacing: 0.06em; }
.avg-card .avg { font-size: 88px; font-weight: 700; line-height: 0.85; color: var(--amber); }
.avg-card .unit { font-size: 24px; font-weight: 600; margin-left: 8px; }
.avg-card .stats { display: flex; gap: 20px; font-size: 13px; color: var(--sub-d); flex-wrap: wrap; }
.avg-card .stats b { font-size: 18px; font-weight: 500; color: var(--paper); }
.hint-dark { font-size: 13px; color: var(--sub-d); }
.list { display: flex; flex-direction: column; }
.list-head { padding: 4px 2px; }
.hist-row { display: flex; align-items: center; gap: 8px; padding: 12px 4px; border: none; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.hist-row .d { width: 56px; font-size: 14px; color: var(--sub); flex: none; }
.hist-row .m { flex: 1; font-size: 14px; color: var(--sub); }
.big-num { font-size: 24px; font-weight: 700; }
.warn-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--attn-line); }
.empty { padding: 20px 4px; color: var(--sub); font-size: 14px; }

/* 記録フロー */
.steps { display: flex; gap: 6px; justify-content: center; }
.steps span { padding: 6px 12px; border-radius: 999px; background: var(--soft); color: var(--sub2); font-size: 13px; font-weight: 700; }
.steps span.on { background: var(--orange); color: var(--white); font-weight: 900; }
.steps.dark span { background: var(--panel-d); color: var(--sub-d); }
.steps.dark span.on { background: var(--amber); color: var(--ink); }
.dark-page { background: var(--ink); color: var(--paper); }
.scan-box { flex-grow: 1; min-height: 300px; border-radius: 24px; background: var(--panel-d); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.scan-img { max-width: 100%; max-height: 52dvh; object-fit: contain; }
.scan-line { position: absolute; left: 0; right: 0; height: 3px; background: var(--amber); box-shadow: 0 0 18px 4px rgba(255,178,91,0.6); animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { top: 12%; } to { top: 88%; } }
.scan-title { font-size: 20px; font-weight: 900; }
.progress { height: 8px; border-radius: 4px; background: var(--panel-d); overflow: hidden; }
.progress div { width: 40%; height: 100%; background: var(--amber); border-radius: 4px; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.meter-box { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.meter-box .lbl { font-size: 16px; font-weight: 600; letter-spacing: 0.1em; }
.meter-val { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; min-height: 84px; }
.meter-val .val { font-size: 80px; font-weight: 600; line-height: 1; letter-spacing: 0.06em; color: var(--amber); }
.meter-val .val.ghost { color: #4A4E53; }
.meter-val .unit { font-size: 24px; color: var(--sub-d); }
.dist { font-size: 14px; color: var(--sub-d); text-align: right; min-height: 20px; }
.warn-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--attn-bg); border: 1px solid var(--attn-line); color: var(--attn-ink); font-size: 14px; font-weight: 700; }
/* キーパッドと決定は画面の下に固定し、画面が短い機種でも決定が常に見えて押せるようにする */
.keypad-dock { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 8px; background: var(--paper);
  padding-top: 8px; z-index: 2; }
.btn-shoot { height: 56px; border-radius: 16px; border: 2px solid var(--ink); background: var(--white); color: var(--ink); font-size: 17px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-shoot:active { background: var(--soft); }
@media (max-height: 760px) {
  .pad-onb { gap: 16px; padding-top: max(24px, env(safe-area-inset-top)); }
  .hero-full { height: 150px; gap: 20px; }
  .hero-full svg { width: 64px; height: 64px; }
  .tank { height: 110px; width: 44px; }
  .h1 { font-size: 24px; }
  .lead { font-size: 15px; line-height: 1.7; }
  .mode-card { padding: 12px; gap: 8px; }
  .mini-meter .val { font-size: 26px; }
  .keypad-page { gap: 10px; padding-top: max(12px, env(safe-area-inset-top)); }
  .keypad-page .h2 { font-size: 19px; }
  .meter-box { padding: 12px 16px; gap: 4px; }
  .meter-val { min-height: 64px; }
  .meter-val .val { font-size: 62px; }
  .key { height: 54px; font-size: 30px; }
  .keypad-page .btn-primary, .keypad-page .btn-outline { height: 54px; }
  .btn-shoot { height: 48px; }
}
@media (max-height: 700px) {
  .keypad-page { gap: 8px; }
  .keypad-page .muted { font-size: 13px; }
  .key { height: 48px; font-size: 28px; }
  .keypad { gap: 6px; }
  .keypad-page .btn-primary, .keypad-page .btn-outline { height: 50px; }
  .meter-val { min-height: 56px; }
  .meter-val .val { font-size: 54px; }
}
.guide { display: flex; flex-direction: column; gap: 12px; text-align: center; padding-top: 4px; }
.guide-step { align-self: center; padding: 4px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 700; color: var(--sub2); }
.guide-illust { color: var(--ink); display: flex; justify-content: center; }
.guide .muted { font-size: 15px; line-height: 1.7; text-align: left; }
.guide-go { display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 5px 0 var(--orange-shadow); margin-top: 4px; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key { height: 64px; border-radius: 16px; border: none; background: var(--white); color: var(--ink); font-family: var(--num); font-size: 34px; font-weight: 600; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--line); touch-action: manipulation; }
.key:active { background: var(--soft); }
.key:disabled { opacity: 0.3; }
.key-back { background: var(--soft); }
.confirm { display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.confirm-num { font-size: 88px; font-weight: 700; line-height: 1; }

/* 結果 */
.res-card { background: var(--ink); color: var(--paper); border-radius: 26px; padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.res-title { font-size: 20px; font-weight: 900; color: var(--amber); }
.res-big { font-size: 128px; font-weight: 700; line-height: 0.85; color: var(--white); }
.res-unit { font-size: 30px; font-weight: 600; color: var(--sub-d); }
.res-reason { font-size: 22px; font-weight: 900; line-height: 1.5; padding: 12px 0; }
.pill { padding: 6px 12px; border-radius: 999px; background: var(--panel-d); font-size: 13px; }
.pill b { font-size: 17px; color: var(--amber); }
.res-list { background: var(--white); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; }
.res-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: none; border-bottom: 1px solid var(--line2); background: transparent; text-align: left; color: #8A8377; }
.res-item:last-child { border-bottom: none; }
.res-item .grow { color: var(--ink); }
.res-item.attn { background: var(--attn-bg); color: var(--attn-ink); }
.res-label { width: 80px; font-size: 14px; color: var(--sub); flex: none; }
.res-item.attn .res-label { color: var(--attn-ink); }
.res-item .v { font-size: 26px; font-weight: 700; }
.res-item .v2 { font-size: 22px; font-weight: 600; }
.attn-msg { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--attn-ink); }
.break-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--sub2); padding: 0 4px; }

/* シート・トースト */
.sheet-wrap { position: fixed; inset: 0; background: rgba(22,24,26,0); display: flex; align-items: flex-end; justify-content: center; z-index: 20; transition: background .2s; }
.sheet-wrap.open { background: rgba(22,24,26,0.45); }
.sheet { width: 100%; max-width: 480px; background: var(--paper); color: var(--ink); border-radius: 24px 24px 0 0; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; transform: translateY(100%); transition: transform .2s; max-height: 92dvh; overflow: auto; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-title { margin: 0; font-size: 18px; font-weight: 900; }
.sheet p { margin: 0; }
.sheet-item { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); text-align: left; font-size: 16px; }
.sheet-item.on { border: 2px solid var(--orange); }
.edit-val { text-align: right; font-size: 18px; padding: 4px 8px; }
.edit-val .num { font-size: 56px; font-weight: 700; }
.date-input { height: 56px; border-radius: 14px; border: 1px solid var(--line); padding: 0 14px; font-size: 20px; background: var(--white); color: var(--ink); }
.spinner { width: 36px; height: 36px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid var(--soft); border-top-color: var(--orange); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 30; max-width: 90vw; }
body.dark #toast { background: var(--paper); color: var(--ink); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 設定 */
.sec { margin: 8px 0 0; font-size: 14px; color: var(--sub); font-weight: 700; }
.set-list { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 14px; border: none; border-bottom: 1px solid var(--line2); background: transparent; width: 100%; text-align: left; font-size: 15px; }
.set-row:last-child { border-bottom: none; }
.set-row input[type=text] { width: 60%; height: 40px; }
.set-row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--orange); }
.fatal { padding: 24px; color: var(--danger); }
.err-text { margin: 0; padding: 10px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); font-size: 12px; white-space: pre-wrap; word-break: break-all; user-select: text; }
/* 給油量の確認：撮ったレシートを見比べられるように小さく出す */
.fuel-thumb { align-self: center; max-width: 100%; max-height: 30vh; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; background: var(--white); }
@media (max-height: 700px) { .fuel-thumb { max-height: 22vh; } }
/* 車両アイコン */
.thumb { width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; color: var(--sub); overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.sm { width: 36px; height: 36px; border-radius: 10px; }
.set-row .thumb { width: 44px; height: 44px; }
.icon-preview { align-self: center; width: min(70vw, 280px); aspect-ratio: 1; border-radius: 20px; object-fit: cover; border: 1px solid var(--line); }
/* 記録し忘れの回の推定値 */
.est { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--soft); color: var(--sub2); margin-right: 6px; align-self: center; }
.est-d { background: var(--panel-d); color: var(--sub-d); font-size: 13px; }
/* シェアのプレビュー */
.share-box { display: flex; justify-content: center; }
.share-preview { width: min(78vw, 340px); aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); object-fit: contain; background: var(--soft); }
.share-box.story .share-preview { width: auto; height: min(52vh, 460px); aspect-ratio: 9 / 16; }
/* 爆速モード：画面全体が撮影ボタン */
.quick-page { cursor: pointer; }
.quick-steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.quick-steps span { padding: 5px 10px; border-radius: 999px; background: var(--panel-d); color: var(--sub-d); font-size: 12px; font-weight: 700; }
.quick-steps span.on { background: var(--orange); color: var(--white); }
.quick-center { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.quick-icon { width: 160px; height: 160px; border-radius: 50%; background: var(--orange); color: var(--white); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 0 var(--orange-shadow); }
.quick-page:active .quick-icon { transform: translateY(4px); box-shadow: 0 4px 0 var(--orange-shadow); }
.quick-title { font-size: 30px; font-weight: 900; line-height: 1.35; }
.link-d { border: none; background: transparent; color: var(--sub-d); font-size: 15px; font-weight: 700; padding: 12px; text-decoration: underline; }
