/* =====================================================================
   ホーンテッドみゆきーハウス 予約システム
   テーマ: 古い洋館 / 夜 / 霧 / ゴシック
   方針  : 雰囲気は背景と見出しで作り、操作に関わる部分は必ず読みやすく。
           スマートフォン優先（狭い画面を基準に書き、広い画面で拡張する）。
   ===================================================================== */

:root {
  --bg:          #080a10;
  --bg-2:        #0d1119;
  --fog:         #1b2230;
  --card:        #11151f;
  --card-2:      #161b27;
  --line:        #2a3242;
  --text:        #e9e5dd;
  --text-dim:    #9aa3b4;
  --text-faint:  #6c7688;

  --ember:       #e2612c;   /* 主要アクション（ランプの灯り） */
  --ember-soft:  #ff7b45;
  --blood:       #8e2b2b;
  --moon:        #b9c9ee;

  --ok:          #4fa87a;   /* 空きあり */
  --warn:        #d99a2b;   /* 残りわずか */
  --full:        #6b5560;   /* 満員 */

  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --tap: 48px;              /* タップ目標の最小高さ */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI",
               Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  /* 霧のグラデーション（画像を使わずCSSだけで作る） */
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(120, 150, 210, 0.16), transparent 60%),
    radial-gradient(90% 50% at 15% 105%, rgba(226, 97, 44, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 45%, #05070c 100%);
  background-attachment: fixed;
}

h1, h2, h3 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
  margin: 0 0 0.6em;
}

a { color: var(--ember-soft); }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* ---------------------------------------------------------------- ヒーロー */
.hero {
  position: relative;
  padding: 56px 16px 40px;
  text-align: center;
  overflow: hidden;
}

.hero::after {                       /* 下端をぼかして本文へ溶かす */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 90px;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}

.hero .org {
  color: var(--moon);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  margin: 0 0 12px;
}

.hero h1 {
  /* 「ホーンテッドマンション」(全角11文字)が375px幅で1行に収まるサイズ */
  font-size: clamp(1.35rem, 7.2vw, 3rem);
  margin: 0 0 14px;
  text-shadow: 0 0 26px rgba(185, 201, 238, 0.28);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.hero .catch {
  color: var(--ember-soft);
  font-size: clamp(1rem, 4.4vw, 1.3rem);
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}

.hero .desc {
  color: var(--text-dim);
  max-width: 34em;
  margin: 18px auto 0;
  text-align: left;
  font-size: 0.95rem;
}

/* -------------------------------------------------------------- カード類 */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin: 0 0 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.15rem;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2::before {
  content: "";
  width: 4px; height: 18px;
  background: var(--ember);
  border-radius: 2px;
  flex: none;
}

/* 定義リスト（開催情報） */
.info {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 10px 12px;
  margin: 0;
  font-size: 0.95rem;
}
.info dt { color: var(--text-faint); }
.info dd { margin: 0; }

/* ---------------------------------------------------------------- ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 22px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--ember-soft), var(--ember));
  color: #1a0d06;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(226, 97, 44, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s;
  font-family: inherit;
}
.btn:hover  { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(226,97,44,.45); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-block { display: flex; width: 100%; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 500;
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); box-shadow: none; }

.btn-danger {
  background: transparent;
  color: #e88;
  border: 1px solid #6b3038;
  box-shadow: none;
  font-weight: 500;
}
.btn-danger:hover { background: rgba(142, 43, 43, 0.18); box-shadow: none; }

.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.9rem; }
.btn { white-space: nowrap; }

.cta-area { text-align: center; margin: 26px 0 8px; }
.cta-note { color: var(--text-faint); font-size: 0.85rem; margin-top: 10px; }

/* ------------------------------------------------------- 予約状況の可視化 */
.status-bar {
  height: 10px;
  background: #05070c;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.status-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ember), var(--ember-soft));
  transition: width 0.4s ease;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.overview div {
  background: #0b0e15;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}
.overview .n {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.overview .l { font-size: 0.72rem; color: var(--text-faint); }

/* ------------------------------------------------------------ 日付タブ */
.date-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.date-tabs button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 8px 12px;
  background: #0b0e15;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
.date-tabs button[aria-pressed="true"] {
  border-color: var(--ember);
  color: var(--text);
  background: rgba(226, 97, 44, 0.12);
  font-weight: 700;
}

/* -------------------------------------------------------------- 時間帯 */
.slots { display: grid; gap: 10px; }

.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 12px 14px;
  background: #0b0e15;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, background 0.15s;
}
.slot:hover:not(:disabled) { border-color: var(--ember); background: #10141d; }
.slot[aria-pressed="true"] {
  border-color: var(--ember);
  background: rgba(226, 97, 44, 0.14);
  box-shadow: inset 0 0 0 1px var(--ember);
}
.slot:disabled { opacity: 0.5; cursor: not-allowed; }
/* 終了した回。満員などより一段さらに沈めて、目が滑るようにする */
.slot.is-past { opacity: 0.32; }
.slot.is-past .time { text-decoration: line-through; }
#date-tabs button.is-past { opacity: 0.55; }

.slot .time {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  flex: none;
}
.slot .meta { margin-left: auto; text-align: right; flex: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge.available { background: rgba(79, 168, 122, 0.18); color: #7fd6a6; }
.badge.few       { background: rgba(217, 154, 43, 0.18); color: #f0c063; }
.badge.full      { background: rgba(107, 85, 96, 0.25); color: #b9a3ae; }
.badge.closed    { background: rgba(120, 128, 145, 0.18); color: #98a1b2; }
.badge.popular   { background: rgba(142, 43, 43, 0.25); color: #ffa9a9; }

.slot .sub { display: block; font-size: 0.75rem; color: var(--text-faint); }

/* ---------------------------------------------------------------- 人数 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 6px 0 4px;
}
.stepper button {
  width: 56px; height: 56px;
  font-size: 1.6rem;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #0b0e15;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper .value {
  min-width: 3.2em;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- 通知欄 */
.notice {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0 0 14px;
  font-size: 0.92rem;
}
.notice.error   { border-color: #7a3340; background: rgba(142,43,43,.16); color: #ffc2c2; }
.notice.success { border-color: #2f6b4f; background: rgba(79,168,122,.14); color: #a8e6c4; }
.notice.info    { border-color: #35507a; background: rgba(90,130,200,.12); color: #c3d6f5; }
.notice[hidden] { display: none; }

/* ---------------------------------------------------------- 予約完了画面 */
.code-box {
  text-align: center;
  padding: 22px 16px;
  border: 1px dashed var(--ember);
  border-radius: 12px;
  background: rgba(226, 97, 44, 0.07);
  margin-bottom: 16px;
}
.code-box .label { font-size: 0.8rem; color: var(--text-dim); letter-spacing: .16em; }
.code-box .code {
  font-size: clamp(2rem, 11vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 4px;
  color: #ffd9c4;
}

.qr-area { text-align: center; margin: 8px 0 4px; }
.qr-area img, .qr-area svg {
  width: 200px; height: 200px;
  background: #fff;
  padding: 10px;
  border-radius: 10px;
}

.notes { padding-left: 1.2em; margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.notes li { margin-bottom: 6px; }

/* ------------------------------------------------------------- 管理画面 */
.admin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #0b0e15;
  position: sticky; top: 0; z-index: 10;
}
.admin-bar h1 {
  font-size: 0.95rem;
  margin: 0;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.admin-bar .spacer { margin-left: auto; }

.bignum {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.bignum div {
  background: #0b0e15;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}
.bignum .n {
  display: block;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.bignum .l { font-size: 0.78rem; color: var(--text-faint); }
.bignum .hi .n { color: var(--ember-soft); }
.bignum .ok .n { color: #7fd6a6; }

.now-slot {
  border: 1px solid var(--ember);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(226, 97, 44, 0.08);
}
.now-slot .t { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--text-faint); font-weight: 500; font-size: 0.78rem; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; }
tr.cancelled td { opacity: 0.45; text-decoration: line-through; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 狭い画面では列を潰さず、横スクロールで見せる */
  scrollbar-width: thin;
}
.table-scroll table { min-width: 540px; }
/* 表の中の入力欄・ボタンは内容に合わせた幅にする */
.table-scroll input[type="number"] { width: 72px; min-height: 38px; padding: 6px 8px; }
.table-scroll td { white-space: nowrap; }

input, select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  background: #05070c;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, button:focus-visible, .slot:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

label { display: block; font-size: 0.85rem; color: var(--text-dim); margin: 12px 0 4px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 120px; }

.muted { color: var(--text-faint); font-size: 0.85rem; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.hide { display: none !important; }

footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  padding: 26px 16px 40px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}

.error-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.error-page .card { max-width: 420px; text-align: center; }
.error-page h1 { font-size: 3rem; color: var(--blood); }

/* ローディング */
.loading { color: var(--text-faint); text-align: center; padding: 22px; }

/* --------------------------------------------------------- 待機室 */
.wait-card { text-align: center; }

.wait-lead {
  color: var(--text-dim);
  line-height: 1.9;
  margin: 0 0 4px;
}

/* 揺れるランタン。待っている間の手持ち無沙汰を少しだけ埋める */
.queue-figure { height: 64px; position: relative; margin: 10px 0 2px; }
.queue-figure .lantern {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 16px;
  height: 22px;
  margin-left: -8px;
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(180deg, var(--ember-soft), var(--ember));
  box-shadow: 0 0 26px 10px rgba(226, 97, 44, 0.32);
  transform-origin: 50% -28px;
  animation: sway 3.6s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(7deg); }
}

.queue-num {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 2px;
}
.queue-num .l { font-size: 0.8rem; color: var(--text-faint); }
.queue-num .n {
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ember-soft);
  font-variant-numeric: tabular-nums;
}
.queue-num .u { font-size: 0.95rem; color: var(--text-dim); }

.queue-eta {
  font-size: 1.05rem;
  color: var(--text);
  margin: 2px 0 14px;
}

.queue-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-faint);
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.queue-meta b { color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- QRスキャナ */
.scanner { display: grid; gap: 12px; }

.scanner-view {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  background: #05070c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.scanner-view::after {
  content: "カメラは停止中です";
  color: var(--text-faint);
  font-size: 0.85rem;
}
.scanner-view.live::after { content: none; }

.scanner-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 読み取り位置の目安。映像の上に重ねるだけで、処理には関与しない */
.scan-frame {
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(226, 97, 44, 0.85);
  border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  pointer-events: none;
  display: none;
}
.scanner-view.live .scan-frame { display: block; }

.scan-result {
  min-height: 62px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-2);
}
.scan-result .scan-title { font-size: 1.15rem; font-weight: 700; }
.scan-result .scan-detail { font-size: 0.9rem; color: var(--text-dim); }

.scan-result.ok {
  border-color: #2f6b4f;
  background: rgba(79, 168, 122, 0.14);
}
.scan-result.ok .scan-title { color: #a8e6c4; }

.scan-result.warn {
  border-color: #7a6333;
  background: rgba(217, 154, 43, 0.14);
}
.scan-result.warn .scan-title { color: #f0c063; }

.scan-result.err {
  border-color: #7a3340;
  background: rgba(142, 43, 43, 0.16);
}
.scan-result.err .scan-title { color: #ffc2c2; }

/* 管理画面の中に置くときは区切り線を消して左寄せにする */
.queue-meta-plain {
  border-top: 0;
  padding-top: 0;
  justify-content: flex-start;
}

/* --------------------------------------------------------- 広い画面向け */
@media (min-width: 600px) {
  .bignum { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 76px 16px 52px; }
}

/* 動きを減らす設定を尊重する */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- 予約開始前の案内 ------------------------------------------------ */
.countdown {
  border-color: var(--ember);
  background: linear-gradient(180deg, rgba(226, 97, 44, 0.10), transparent 70%);
  text-align: center;
}
.countdown-when {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.2rem 0 0.6rem;
}
.countdown-left {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ember);
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.6rem;
}

/* --- 受付完了の知らせ ---------------------------------------------- */
.done-card {
  border-color: var(--ok);
  background: linear-gradient(180deg, rgba(79, 168, 122, 0.14), transparent 70%);
  text-align: center;
}
.done-card h2 { justify-content: center; border-bottom: 0; margin-bottom: 6px; }
.done-card h2::before { display: none; }
.done-lead { font-size: 1.05rem; font-weight: 600; margin: 0 0 12px; }
.done-card .cta-area { margin: 14px 0 0; }

/* --- 受付停止中の案内 ------------------------------------------------ */
.suspended-card {
  border-color: var(--blood);
  background: linear-gradient(180deg, rgba(142, 43, 43, 0.22), transparent 75%);
  text-align: center;
}
.suspended-card h2 {
  justify-content: center;
  border-bottom: 0;
  margin-bottom: 10px;
  color: #ffb4b4;
}
.suspended-card h2::before { display: none; }
.suspended-message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.9;
  text-align: left;
  max-width: 34em;
  margin-inline: auto;
  /* 設定の文中の改行をそのまま見せる。
     文字はすべて textContent で入れているので、HTMLは混入しない */
  white-space: pre-line;
}
