/* ============================================================
   駐車料金チェッカー / スタイル
   - モバイルファースト。カード + 角丸 + 余白でグルーピング
   - 色の意味: ブルー＝安心・現在地、レッド＝注意・取り消し、アンバー＝警告
   - ライト / ダークはOSの設定に自動追従（ダークはコントラストを緩めに）
   ============================================================ */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --border: #e4e8f0;
  --text: #1a1d24;
  --text-sub: #6b7280;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eaf0ff;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn-bg: #fff8e1;
  --warn-border: #f0b429;
  --warn-text: #6b4b00;
  --ok: #16a34a;
  --appbar-bg: #111418;
  --appbar-text: #ffffff;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 6px 20px rgba(17, 24, 39, .06);
  --shadow-hero: 0 8px 24px rgba(37, 99, 235, .28);
}

/* このアプリは白ベースの配色で固定する（OSのダークモードには追従しない）。
   屋外・車内で見ることが多く、明るい画面のほうが視認性が高いため。 */
:root { color-scheme: light; }

* { box-sizing: border-box; }

/* hidden 属性を常に最優先する。
   display を指定したクラス（.privacy-alert / .row など）が
   hidden を打ち消してしまうのを防ぐ。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 0 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

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

/* ===== アプリバー ===== */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--appbar-bg);
  color: var(--appbar-text);
}
.appbar__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  gap: .65rem;
}
.appbar__logo {
  width: 2rem;
  height: 2rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}
.appbar__title h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.appbar__title p {
  margin: 0;
  font-size: .7rem;
  opacity: .65;
}

.main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
/* 横に長い中身（表・タイムライン）がカードの幅を押し広げないようにする */
.main > * { min-width: 0; }

/* ===== 個人情報アラート（ルール2） ===== */
.privacy-alert {
  max-width: 640px;
  margin: 1rem auto -.25rem;
  padding: .9rem 2.5rem .9rem .9rem;
  position: relative;
  display: flex;
  gap: .6rem;
  background: var(--warn-bg);
  border: 2px solid var(--warn-border);
  border-radius: var(--radius);
  color: var(--warn-text);
  font-size: .85rem;
  font-weight: 600;
  animation: pop .25s ease;
}
.privacy-alert__icon { flex: none; font-size: 1.1rem; line-height: 1.3; }
.privacy-alert__close {
  position: absolute;
  top: .3rem; right: .45rem;
  width: 2rem; height: 2rem;
  background: none; border: 0;
  color: inherit;
  font-size: 1.3rem; line-height: 1;
  cursor: pointer;
}
@keyframes pop {
  from { transform: translateY(-4px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ===== 共通カード ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .7rem;
}
.card__title {
  margin: 0 0 .7rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.card__head .card__title { margin: 0; }
/* カード見出しの線画アイコン */
.card__icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link {
  background: none;
  border: 0;
  padding: .2rem .1rem;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }

/* ===== ヒーロー（現在の料金） ===== */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hero);
  padding: 1rem 1rem .35rem;
  text-align: center;
}
.hero__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .3rem;
}
.hero__label {
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  opacity: .9;
  text-align: center;
}

/* 左上：いま停めている駐車場（タップで切替） */
.heroplan {
  position: relative;
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  padding: .25rem .4rem .25rem .25rem;
  border-radius: 99px;
}
.heroplan:focus-within { outline: 2px solid #fff; outline-offset: 1px; }
.heroplan__icon {
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: .95rem;
}
.heroplan__name {
  font-size: .92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 実体の select を重ねる（見た目はチップ、操作は標準UI） */
.heroplan__select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex: none;
  padding: .28rem .7rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, .22);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge__dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: currentColor;
}
/* 駐車中は白地に緑（止まっていることが一目で分かる） */
.badge.is-parking { background: #fff; color: var(--ok); }

.hero__fee {
  margin: .1rem 0 .55rem;
  font-size: clamp(2.9rem, 16vw, 4.2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.hero__yen {
  font-size: .32em;
  font-weight: 700;
  margin-left: .12em;
  opacity: .85;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, .25);
}
.hero__meta > div {
  padding: .55rem .3rem;
  border-left: 1px solid rgba(255, 255, 255, .22);
}
.hero__meta > div:first-child { border-left: 0; }
.hero__meta dt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  font-size: .68rem;
  opacity: .85;
}
.hero__meta dd {
  margin: .1rem 0 0;
  font-size: .88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
/* 線画アイコン（色は文字色に追従） */
.mini {
  width: .95em;
  height: .95em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 下向き矢印。文字の中央に揃うよう flex 配置の中で使う */
.chev {
  width: 1.05em;
  height: 1.05em;
  stroke-width: 2.2;
  opacity: .85;
}

/* 駐車場名から編集モーダルを開くボタン */
.hero__edit {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.hero__edit:hover { text-decoration: underline; }
.hero__edit span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 次の加算まで ===== */
.next__amount {
  padding: .2rem .6rem;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.next__count {
  margin: 0 0 .55rem;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.next__detail {
  margin: .55rem 0 0;
  font-size: .82rem;
  color: var(--text-sub);
}

.progress {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .5s linear, background .3s;
}

/* 通知タイミングに入ったときの強調 */
.next.is-soon {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}
.next.is-soon .card__title,
.next.is-soon .next__count { color: var(--warn-text); }
.next.is-soon .next__detail { color: var(--warn-text); opacity: .85; }
.next.is-soon .next__amount {
  background: var(--warn-border);
  color: #3d2c00;
}
.next.is-soon .progress { background: rgba(0, 0, 0, .12); }
.next.is-soon .progress__fill { background: var(--warn-border); }

/* ===== フォーム部品 ===== */
.row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .55rem;
}
.row:last-child { margin-bottom: 0; }
.row--sub { margin-top: .4rem; }

.input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: .65rem .75rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
}
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.input--num {
  flex: 0 0 5.2rem;
  width: 5.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
textarea.input { resize: vertical; }
select.input { appearance: none; background-image: none; }

.btn {
  padding: .65rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .92rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.btn--primary:hover { background: var(--accent-strong); }

/* 出庫ボタン。押す機会が多く重要な操作なので大きく目立たせる */
.btn--exit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  margin-top: .6rem;
  padding: .85rem 1rem;
  font-size: 1rem;
  background: var(--danger-soft);
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn--exit:hover { background: var(--danger); color: #fff; }
.btn--exit .mini { width: 1.15em; height: 1.15em; }

/* 横並びの小さめボタン群 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .6rem;
}
.chip {
  padding: .45rem .8rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: translateY(1px); }
.chip--accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip--danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
  margin-left: auto;
}

/* 入庫時刻の微調整ボタン。狭い画面でも必ず横一列に収める */
.quick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .3rem;
  margin-top: .6rem;
}
.quick .chip {
  padding: .45rem .1rem;
  font-size: .78rem;
  text-align: center;
}

.field { display: block; margin-bottom: .85rem; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: .3rem;
}
.field__hint {
  display: block;
  margin-top: .35rem;
  font-size: .73rem;
  line-height: 1.6;
  color: var(--text-sub);
}
.unit-text {
  font-size: .85rem;
  color: var(--text-sub);
  white-space: nowrap;
}

.check {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  cursor: pointer;
}
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

/* ===== 料金体系の選択カード ===== */
.planpick {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .75rem .85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.planpick:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.planpick__icon {
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.planpick__body { flex: 1; min-width: 0; }
.planpick__name {
  display: block;
  font-weight: 700;
  font-size: .95rem;
  overflow-wrap: anywhere;
}
.planpick__desc {
  display: block;
  margin-top: .1rem;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--text-sub);
  white-space: pre-line;
}
.planpick__chev { flex: none; color: var(--text-sub); font-size: 1.1rem; }
/* 実体の select を全面に重ねる（見た目はカード、操作は標準UI） */
.planpick__select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
}
.planpick__memo {
  margin: .5rem 0 0;
  padding: .5rem .7rem;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--text);
  white-space: pre-line;
}

/* ===== 確認ダイアログ ===== */
.modal--confirm {
  width: min(21rem, calc(100% - 2.5rem));
  border-radius: 18px;
}
.confirm {
  padding: 1.6rem 1.3rem 1.3rem;
  text-align: center;
}
.confirm__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
}
/* 駐車時間・料金など、判断材料になる数値を目立たせる */
.confirm__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin: 1rem 0 0;
}
.confirm__stats > div {
  padding: .6rem .3rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.confirm__stats dt {
  font-size: .7rem;
  color: var(--text-sub);
}
.confirm__stats dd {
  margin: .15rem 0 0;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.confirm__body {
  margin: .9rem 0 0;
  font-size: .85rem;
  line-height: 1.7;
  color: var(--text-sub);
  white-space: pre-line;
}
.confirm__actions {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: 1.4rem;
}
.cbtn {
  width: 100%;
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.cbtn:active { transform: translateY(1px); }
.cbtn--primary { background: var(--accent); color: #fff; }
.cbtn--primary:hover { background: var(--accent-strong); }
.cbtn--danger { background: var(--danger); color: #fff; }
.cbtn--ghost {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.cbtn--ghost:hover { background: var(--accent-soft); }

/* ===== 入庫時刻の表示ボタン ===== */
.entrypick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: left;
}
.entrypick:hover { border-color: var(--accent); }
.entrypick span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== ホイールピッカー（iOS風） ===== */
.wheels {
  --item-h: 44px;
  --wheel-h: 220px;
  position: relative;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: .25rem;
  margin-bottom: .3rem;
}
/* 中央の選択バー（ホイールの背面に敷く） */
.wheels__bar {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: var(--item-h);
  border-radius: 10px;
  background: var(--surface-2);
  pointer-events: none;
}
.wheel {
  position: relative;
  z-index: 1;
  height: var(--wheel-h);
  padding: calc((var(--wheel-h) - var(--item-h)) / 2) 0;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  /* 上下を薄くフェードさせて回転しているように見せる */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.wheel__item {
  height: var(--item-h);
  line-height: var(--item-h);
  scroll-snap-align: center;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-sub);
  opacity: .55;
  transition: opacity .12s, color .12s, font-size .12s;
  cursor: pointer;
  white-space: nowrap;
}
.wheel__item.is-selected {
  color: var(--text);
  opacity: 1;
  font-weight: 800;
  font-size: 1.2rem;
}
.wheel__item.is-near { opacity: .8; }

.modal--picker .modal__body { padding-top: .6rem; }

/* ===== 料金体系エディタ（モーダル） ===== */
.modal {
  width: min(34rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .3);
  overflow: hidden;
}
.modal::backdrop {
  background: rgba(15, 23, 42, .55);
}
.modal[open] { animation: modal-in .18s ease; }
@keyframes modal-in {
  from { transform: translateY(12px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal__form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal__title { margin: 0; font-size: 1rem; font-weight: 700; }
.modal__close {
  width: 2rem;
  height: 2rem;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-sub);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.modal__close:hover { background: var(--border); }
.modal__body {
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .8rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
/* モーダル表示中は背面をスクロールさせない */
body.is-modal-open { overflow: hidden; }

.editor__error {
  margin: 0 0 .6rem;
  padding: .55rem .75rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  color: var(--warn-text);
  font-size: .82rem;
  white-space: pre-line;
}

/* ===== 通知設定 ===== */
.switch {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  width: 2.9rem;
  height: 1.65rem;
  border-radius: 99px;
  background: var(--border);
  transition: background .2s;
  position: relative;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 1.15rem; height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(1.25rem); }
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subcard {
  padding: .85rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  transition: opacity .2s;
}
.subcard.is-off { opacity: .5; }
.subcard__title {
  margin: 0 0 .55rem;
  font-size: .85rem;
  font-weight: 700;
}
.perm {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.perm__status { font-size: .75rem; color: var(--text-sub); }
.perm__status.is-ok { color: var(--ok); font-weight: 700; }

/* ===== 料金の見通し（タイムライン） ===== */
.timeline {
  display: flex;
  min-width: 0;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .35rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.timeline:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tl {
  flex: 0 0 5.2rem;
  scroll-snap-align: start;
  padding: .55rem .3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tl--now {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.tl__label {
  display: block;
  font-size: .68rem;
  color: var(--text-sub);
}
.tl--now .tl__label { color: var(--accent); font-weight: 700; }
.tl__time {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  margin-top: .1rem;
}
.tl__fee {
  display: block;
  margin-top: .15rem;
  font-size: .95rem;
  font-weight: 800;
  color: var(--accent);
}
.tl--now .tl__fee { color: var(--accent-strong); }
.timeline__empty {
  padding: .8rem;
  font-size: .82rem;
  color: var(--text-sub);
}

.sim {
  width: 100%;
  margin-top: .7rem;
  border-collapse: collapse;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}
.sim th, .sim td {
  padding: .45rem .3rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.sim th { font-size: .72rem; color: var(--text-sub); font-weight: 700; }
.sim .num, .sim td:last-child { text-align: right; font-weight: 700; }
.sim__empty { color: var(--text-sub); font-weight: 400; }

/* ===== 駐車履歴 ===== */
.history__summary {
  display: flex;
  gap: .5rem;
  margin: 0 0 .6rem;
}
.history__stat {
  flex: 1;
  padding: .5rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  text-align: center;
}
.history__stat dt {
  font-size: .68rem;
  color: var(--text-sub);
}
.history__stat dd {
  margin: .1rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.history__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 20rem;
  overflow-y: auto;
}
.hist {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .65rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.hist__body { flex: 1; min-width: 0; }
.hist__top {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
}
.hist__date {
  font-size: .82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hist__plan {
  font-size: .72rem;
  color: var(--text-sub);
  overflow-wrap: anywhere;
}
.hist__detail {
  font-size: .72rem;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}
.hist__fee {
  flex: none;
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hist__del {
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-sub);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.hist__del:hover { background: var(--danger-soft); color: var(--danger); }
.history__empty {
  margin: 0;
  padding: .8rem;
  font-size: .82rem;
  color: var(--text-sub);
  text-align: center;
}

/* ===== アカウント ===== */
.account__desc {
  margin: 0 0 .7rem;
  font-size: .82rem;
  color: var(--text-sub);
}
.btn--google {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.gicon { width: 1.15rem; height: 1.15rem; flex: none; }
.account__row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.account__badge {
  width: 2.1rem; height: 2.1rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.account__email {
  flex: 1;
  min-width: 8rem;
  font-size: .87rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.sync-status {
  margin: .6rem 0 0;
  font-size: .78rem;
  color: var(--text-sub);
  min-height: 1.2em;
}

.note {
  margin: .3rem 0 0;
  font-size: .72rem;
  line-height: 1.8;
  color: var(--text-sub);
  text-align: center;
}

/* ===== 説明ページ・記事エリア ===== */
.appbar__home {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: inherit;
  text-decoration: none;
}
.appbar__name { display: block; font-size: 1.05rem; font-weight: 700; }
.appbar__sub { display: block; font-size: .7rem; opacity: .65; }

.page { line-height: 1.9; }
.page__title {
  margin: 0 0 .8rem;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.5;
}
.page__lead { margin-top: 0; font-size: .95rem; }
.page h2 {
  margin: 2rem 0 .7rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--accent-soft);
  font-size: 1.1rem;
}
.page h3 {
  margin: 1.8rem 0 .6rem;
  font-size: 1rem;
  color: var(--accent-strong);
}
.page p { margin: .7rem 0; font-size: .9rem; }
.page ul, .page ol { margin: .7rem 0; padding-left: 1.4rem; font-size: .9rem; }
.page li { margin-bottom: .5rem; }
.page a { color: var(--accent); }

/* 見出しの下に短いアクセントバーを引く */
.page__title--bar { border-bottom: 0 !important; padding-bottom: 0 !important; }
.page__title--bar::after {
  content: '';
  display: block;
  width: 2.4rem;
  height: 3px;
  margin-top: .5rem;
  border-radius: 2px;
  background: var(--accent);
}

/* 冒頭：説明文 + イラスト */
.about__intro {
  display: grid;
  gap: .5rem;
  align-items: center;
  margin-bottom: 2rem;
}
.about__text > .page__title { margin-top: 0; }
.about__art { width: 100%; max-width: 15rem; height: auto; justify-self: center; }

@media (min-width: 560px) {
  .about__intro { grid-template-columns: 1.35fr 1fr; gap: 1.2rem; }
  .about__art { max-width: 100%; }
}

.about__center { text-align: center; }
.about__center::after { margin-left: auto; margin-right: auto; }

/* 使い方3ステップ */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: .6rem;
  margin: 1rem 0 2rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 560px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}
.step {
  margin: 0;
  padding: 1rem .8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.step__icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  margin-bottom: .6rem;
  border-radius: 50%;
  background: var(--accent-soft);
}
.step__icon svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.step__num {
  position: absolute;
  top: -.2rem;
  right: -.2rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
}
.step__title {
  margin: 0 0 .4rem;
  font-size: .92rem;
  font-weight: 700;
}
.step__text {
  margin: 0;
  font-size: .8rem;
  line-height: 1.8;
  color: var(--text-sub);
  text-align: left;
}

.page__scroll { overflow-x: auto; margin: .8rem 0; }
.page__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.page__table th, .page__table td {
  padding: .55rem .6rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.page__table thead th { background: var(--surface-2); white-space: nowrap; }
.page__table tbody th {
  background: var(--surface-2);
  white-space: nowrap;
  width: 8.5rem;
}
.page__note { font-size: .8rem; color: var(--text-sub); }
.page__date { margin-top: 2rem; font-size: .8rem; color: var(--text-sub); }
.page__back { margin-top: 1.5rem; font-size: .9rem; font-weight: 700; }

/* よくある質問（開閉式・広い画面では2列） */
.faqs {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
  align-items: start;
  margin: 1rem 0 2rem;
}
@media (min-width: 560px) {
  .faqs { grid-template-columns: repeat(2, 1fr); }
}
.faq {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.faq > summary {
  padding: .8rem .9rem;
  font-size: .87rem;
  font-weight: 700;
  line-height: 1.6;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.faq > summary::-webkit-details-marker { display: none; }
/* 右端の開閉インジケーター（開くと反転する） */
.faq > summary::after {
  content: '';
  flex: none;
  width: .5rem;
  height: .5rem;
  margin-left: auto;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s;
}
.faq[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.faq[open] > summary { border-bottom: 1px solid var(--border); }
.faq > p {
  margin: 0;
  padding: .8rem .9rem;
  font-size: .83rem;
  line-height: 1.9;
  color: var(--text-sub);
}

/* ===== 運営情報 ===== */
.owner {
  display: grid;
  grid-template-columns: 1fr;
  gap: .6rem;
  margin: 1rem 0 0;
}
@media (min-width: 560px) {
  .owner { grid-template-columns: repeat(3, 1fr); }
}
.owner__item {
  padding: .85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.owner__item dt {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .4rem;
  font-size: .8rem;
  font-weight: 700;
  /* 見出しラベルは黒。青はリンクだけに使い、押せる場所を分かりやすくする */
  color: var(--text);
}
.owner__item dd {
  margin: 0;
  font-size: .88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.owner__item dd a {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  text-decoration: none;
}
.owner__item dd a:hover { text-decoration: underline; }
/* 外部リンクを示す小さな矢印 */
.ext {
  width: .85em;
  height: .85em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== フッター ===== */
.footer {
  max-width: 640px;
  margin: 2rem auto 0;
  padding: 1.4rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
}
.footer__nav {
  display: flex;
  justify-content: center;
  gap: .6rem;
}
/* 丸いアイコンボタン */
.footer__icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background .2s, color .2s;
}
.footer__icon svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.footer__icon:hover {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.footer__copy {
  margin: 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
}

/* 画面が広いときは操作系を2列に並べて縦を短くする */
@media (min-width: 700px) {
  .main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* align-items は既定の stretch のまま。
       start にすると背の低いカードの下に隙間が空いてしまうため、
       左右のカードを同じ高さに伸ばして隙間をなくす */
    align-content: start;
  }
  /* 全幅で見せるカード。説明文や履歴は横に広い方が読みやすい。
     .page（説明セクション・プライバシーポリシー）は必ず全幅にする */
  .hero, .next, .note, .page, #accountCard, #historyCard { grid-column: 1 / -1; }
}

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