/* 利用者 Web のスタイル
 *
 * デザイントークンは店舗アプリ（app/lib/shared/theme）と揃える。
 * 変更するときは両方を確認すること。
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-subtle: #f0f2f5;
  --fg: #111827;
  --muted: #667085;
  --border: #d9dee7;
  --primary: #123b5d;
  --primary-hover: #0d304d;
  --on-primary: #ffffff;
  --caution-bg: #eef3f7;
  --caution-fg: #123b5d;
  --error: #b42318;
  --skeleton: #e5e8ed;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --surface: #181c20;
    --surface-subtle: #20262c;
    --fg: #e2e2e5;
    --muted: #9aa0a8;
    --border: #2c3238;
    --primary: #9dcbfb;
    --primary-hover: #b9d9fa;
    --on-primary: #00325a;
    --caution-bg: #20303d;
    --caution-fg: #c8e2f7;
    --error: #ffb4ab;
    --skeleton: #23282d;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
               "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.7;
  /* ブラウザの文字サイズ設定に追従させる。200% でも壊れないこと。 */
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 24px max(72px, env(safe-area-inset-bottom));
}

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mt { margin-top: 28px; }
.mt-sm { margin-top: 12px; }

h1 {
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -.025em;
  line-height: 1.35;
  margin: 0 0 6px;
}
h2 { font-size: 1.1rem; margin: 36px 0 8px; }
p { margin: 8px 0; }

/* 受付番号・待ち組数・待ち時間。桁が変わっても揺れないように等幅数字にする。 */
.big {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.1;
}
.big-xl { font-size: clamp(3.25rem, 15vw, 4.5rem); }
.big-l  { font-size: clamp(2rem, 9vw, 2.75rem); }
.big-email { font-size: 1.05rem; letter-spacing: -.01em; overflow-wrap: anywhere; }
.number-suffix { font-size: 1.1rem; letter-spacing: 0; margin-left: 2px; }

.card {
  background: var(--surface-subtle);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-top: 20px;
}
.card.caution {
  background: var(--caution-bg);
  color: var(--caution-fg);
  border-color: transparent;
}

.label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0;
}
.card.caution .label { color: inherit; opacity: .85; }

button, .btn {
  display: block;
  width: 100%;
  /* 最小タップ領域 44px */
  min-height: 52px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button:disabled { opacity: .5; cursor: default; }
@media (hover: hover) {
  button:not(:disabled) { transition: background-color .15s ease, border-color .15s ease; }
  button:not(.secondary):not(.danger):not(.destructive):hover { background: var(--primary-hover); }
}
button.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
button.danger {
  background: transparent;
  color: var(--error);
  border: 0;
  font-weight: 500;
}

label, .form-label {
  display: block;
  margin: 24px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}
input[type="email"] {
  width: 100%;
  min-height: 52px;
  margin-top: 6px;
  padding: 12px 14px;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
input:hover { border-color: var(--muted); }
input:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px;
  background: var(--surface-subtle);
  border-radius: var(--radius);
}
.stepper button {
  width: 52px;
  min-height: 48px;
  padding: 0;
  font-size: 1.35rem;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
@media (hover: hover) {
  .stepper button:hover { background: var(--surface-subtle); }
}
.stepper .value {
  flex: 1;
  text-align: center;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.hint { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.error { color: var(--error); font-size: 0.9rem; margin-top: 8px; }

.notice {
  background: var(--surface-subtle);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 16px;
}

.test-mode-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 24px;
  padding: 14px 16px;
  color: var(--caution-fg);
  background: var(--caution-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  font-size: .9rem;
}
.test-mode-banner b { font-size: 1rem; }


.skeleton-title, .skeleton-box {
  background: var(--skeleton);
  border-radius: 8px;
  margin: 16px auto;
  animation: pulse 1.4s ease-in-out infinite;
}
.skeleton-title { width: 160px; height: 24px; }
.skeleton-box { width: 220px; height: 64px; border-radius: var(--radius); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .5 } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-title, .skeleton-box { animation: none; }
}

/* 呼び出し中は画面全体で伝える */
.called {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  margin-top: 16px;
}

/* ---------------------------------------------------------------------------
 * ページ内ダイアログ
 *
 * ブラウザ標準の confirm() は使わない。
 *   ・iOS Safari では「127.0.0.1 の内容」のように URL が出て怪しく見える
 *   ・「OK / キャンセル」の二択は、この画面では「キャンセル」がどちらの意味か
 *     分からず、押し間違いを誘う
 *   ・文字が小さく、スタイルを当てられない
 * --------------------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.dialog {
  background: var(--surface);
  color: var(--fg);
  border-radius: 12px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.dialog h2 { margin: 0 0 8px; font-size: 1.15rem; }
.dialog p { margin: 0; color: var(--muted); font-size: .95rem; }
.dialog .actions { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.dialog .actions button { margin: 0; }
.dialog .actions .destructive {
  background: var(--error);
  color: #fff;
  border: none;
}

@media (prefers-reduced-motion: no-preference) {
  .overlay { animation: fade .12s ease-out; }
  @keyframes fade { from { opacity: 0 } to { opacity: 1 } }
}

@media (max-width: 360px) {
  main { padding-left: 18px; padding-right: 18px; }
}
