/* 店舗向けの Web 画面。色・文字・余白は tokens.css（spec/design-tokens.json から生成）の変数を使う。 */

:root {
  color-scheme: light;
  --font-japanese: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --font-numeric: Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  /* タップできる部分の最小の高さ。 */
  --tap-target: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-surface-muted);
  color: var(--color-text-primary);
  font-family: var(--font-japanese);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-map-current-location);
  outline-offset: 2px;
}

.boot {
  padding: var(--spacing-xl) var(--spacing-screen-horizontal);
  color: var(--color-text-secondary);
}

/* ---------------------------------------------------------------- 枠組み */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-surface-muted);
}

.app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-m);
  padding: calc(var(--spacing-l) + env(safe-area-inset-top)) var(--spacing-screen-horizontal) var(--spacing-l);
  background: var(--color-brand-navy);
  color: var(--color-text-on-brand);
}

.app-header h1 {
  font-size: var(--font-size-header-title);
  font-weight: var(--font-weight-header-title);
  line-height: var(--line-height-header-title);
}

.app-header .date {
  font-size: var(--font-size-caption);
  white-space: nowrap;
}

.page {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-l);
  padding: var(--spacing-l) var(--spacing-screen-horizontal) calc(var(--spacing-xl) + env(safe-area-inset-bottom));
}

.page h2 {
  font-size: var(--font-size-screen-heading);
  font-weight: var(--font-weight-screen-heading);
  line-height: var(--line-height-screen-heading);
}

.page h2:focus {
  outline: none;
}

.lead {
  color: var(--color-text-primary);
}

.hint {
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
}

.badge {
  display: inline-block;
  margin-left: var(--spacing-xs);
  padding: 1px 6px;
  border-radius: var(--radius-badge);
  background: var(--color-surface-demo-badge);
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- お知らせ */

.message {
  display: flex;
  gap: var(--spacing-s);
  align-items: flex-start;
  padding: var(--spacing-m);
  border-radius: var(--radius-control);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
}

.message::before {
  flex: none;
  font-weight: 700;
}

.message.error {
  background: var(--color-status-warning-background);
  color: var(--color-status-warning-foreground);
}

.message.error::before {
  content: "!";
}

.message.notice {
  background: var(--color-status-success-background);
  color: var(--color-status-success-foreground);
}

.message.notice::before {
  content: "✓";
}

/* ---------------------------------------------------------------- 入力 */

form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-l);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.field label {
  font-size: var(--font-size-section-heading);
  font-weight: var(--font-weight-section-heading);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: var(--spacing-s) var(--spacing-m);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-control);
  background: var(--color-surface-base);
}

.field input[aria-invalid="true"] {
  border-color: var(--color-status-error);
  border-width: 2px;
}

.field .code {
  font-family: var(--font-numeric);
  font-size: var(--font-size-price-input);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
}

.price-field {
  display: grid;
  grid-template-columns: minmax(6em, 1fr) minmax(7em, 9em) auto;
  align-items: center;
  gap: var(--spacing-s);
}

.price-field label {
  font-size: var(--font-size-fuel-name);
  font-weight: var(--font-weight-fuel-name);
}

.price-field input {
  min-height: 52px;
  font-family: var(--font-numeric);
  font-size: var(--font-size-price-input);
  font-weight: 700;
  text-align: right;
}

.price-field .unit {
  color: var(--color-text-secondary);
  font-size: var(--font-size-price-unit);
  white-space: nowrap;
}

.field-error {
  color: var(--color-status-error);
  font-size: var(--font-size-caption);
  font-weight: 700;
}

/* ---------------------------------------------------------------- ボタン */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: var(--spacing-s) var(--spacing-l);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  /* 白い文字とオレンジの地のコントラスト（約 3.6:1）は、大きい太字の基準（3:1）で満たす。 */
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.button.primary {
  background: var(--color-brand-orange);
  color: var(--color-text-on-brand);
}

.button.secondary {
  background: rgb(9 40 66 / 8%);
  color: var(--color-brand-navy);
}

.button.destructive {
  background: var(--color-status-error);
  color: var(--color-text-on-brand);
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.link {
  min-height: var(--tap-target);
  padding: var(--spacing-s) 0;
  border: 0;
  background: none;
  color: var(--color-brand-navy);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link.destructive {
  color: var(--color-status-error);
}

.link:disabled {
  opacity: 0.45;
  cursor: default;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-m);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--spacing-xl);
}

/* ---------------------------------------------------------------- 店舗と価格 */

.confirmation {
  display: flex;
  gap: var(--spacing-s);
  align-items: flex-start;
  padding: var(--spacing-m);
  border-radius: var(--radius-control);
  font-size: var(--font-size-caption-strong);
  font-weight: var(--font-weight-caption-strong);
  line-height: var(--line-height-caption-strong);
}

.confirmation::before {
  flex: none;
}

.confirmation.needed {
  background: var(--color-status-warning-background);
  color: var(--color-status-warning-foreground);
}

.confirmation.needed::before {
  content: "▲";
}

.confirmation.complete {
  background: var(--color-status-success-background);
  color: var(--color-status-success-foreground);
}

.confirmation.complete::before {
  content: "✓";
}

.panel {
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-panel);
  background: var(--color-surface-base);
}

.prices li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-m);
  padding: var(--spacing-m) var(--spacing-l);
}

.prices li + li {
  border-top: 1px solid var(--color-border-default);
}

.prices h3 {
  font-size: var(--font-size-fuel-name);
  font-weight: var(--font-weight-fuel-name);
  line-height: var(--line-height-fuel-name);
}

.prices .condition {
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
}

.price {
  font-family: var(--font-numeric);
  font-size: var(--font-size-price-list);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.price .unit {
  margin-left: var(--spacing-xs);
  font-family: var(--font-japanese);
  font-size: var(--font-size-price-unit);
  font-weight: 400;
}

.station-list li + li {
  border-top: 1px solid var(--color-border-default);
}

.station-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-m);
  width: 100%;
  min-height: 56px;
  padding: var(--spacing-m) var(--spacing-l);
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.station-list .state {
  flex: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-small);
  font-weight: 400;
}

.account {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-l);
  padding-top: var(--spacing-l);
  border-top: 1px solid var(--color-border-default);
}

.account .email {
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- 確認のダイアログ */

dialog {
  width: min(92vw, 420px);
  padding: var(--spacing-xl);
  border: 0;
  border-radius: var(--radius-sheet);
  color: var(--color-text-primary);
}

dialog::backdrop {
  background: rgb(9 40 66 / 45%);
}

dialog h2 {
  margin-bottom: var(--spacing-m);
  font-size: var(--font-size-screen-heading);
}

dialog p {
  margin-bottom: var(--spacing-xl);
}

/* 公開の前に確かめる内容（油種と価格）。 */
dialog .review {
  margin: 0 0 var(--spacing-l);
  padding: 0;
  list-style: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

dialog .review li + li {
  margin-top: var(--spacing-xs);
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .link {
    transition: opacity 0.15s;
  }
}
