/* ============================================
   Design tokens
   参考画像(木目カウンター・石壁・間接照明)の
   質感をベースにした配色
   ============================================ */
:root {
  --stone-900: #17140f;      /* 背景: 夜の石壁を思わせる濃い焦げ茶 */
  --stone-800: #211c15;
  --stone-700: #2c261c;      /* カードの背景 */
  --wood-500: #a9713c;       /* 受付カウンターの木目 */
  --wood-400: #c68a52;
  --wood-300: #e0ab74;
  --ivory-100: #f3ede1;      /* 明るいテキスト */
  --ivory-60: rgba(243, 237, 225, 0.6);
  --signal-green: #4caf6d;   /* 画像内のドア表示灯を思わせるアクセント */
  --error-red: #e2665a;

  --font-display: "Noto Serif JP", "Yu Mincho", serif;
  --font-body: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;

  --radius: 4px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--stone-900);
  color: var(--ivory-100);
  font-family: var(--font-body);
}

/* ============================================
   背景: 石壁のテクスチャを疑似的に表現
   (実際の3D空間実装までの仮の背景)
   ============================================ */
.scene-placeholder {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(198, 138, 82, 0.10), transparent 55%),
    linear-gradient(180deg, var(--stone-800) 0%, var(--stone-900) 60%);
}

.scene-placeholder canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* モバイルでドラッグ操作した際、ブラウザ標準のスクロール/ズームと競合しないようにする */
}

/* WebGL初期化に失敗した端末向けの案内(通常時は非表示) */
.webgl-error {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: var(--stone-900);
  color: var(--ivory-100);
  font-size: 14px;
  line-height: 1.7;
}

.controls-hint {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ivory-60);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(243, 237, 225, 0.14);
  border-radius: 999px;
  pointer-events: none;
}

/* カウンターに近づいた時だけ表示される、フォームを開くための案内 */
.interact-hint {
  position: fixed;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%) translateY(6px);
  z-index: 2;
  margin: 0;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a140c;
  background: var(--wood-400);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.interact-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* モバイル用バーチャルジョイスティック(移動操作) */
.joystick-base {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 3;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(243, 237, 225, 0.2);
  touch-action: none;
  display: none; /* タッチ操作可能な端末のみ表示する(下のmedia queryで切り替え) */
}

.joystick-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(243, 237, 225, 0.55);
  transition: transform 0.05s linear;
}

/* マウスのみの端末(PC)ではジョイスティックを出さず、キーボード操作の案内文だけ見せる。
   タッチ操作可能な端末では逆に、そのヒント文をジョイスティックに置き換える。 */
@media (hover: none) and (pointer: coarse) {
  .joystick-base {
    display: block;
  }
  #controls-hint {
    display: none;
  }
}

/* 天井のスポットライトを思わせる、控えめな光の帯 */
.scene-placeholder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(720px, 90%);
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(230, 200, 160, 0.14), transparent 70%);
  filter: blur(4px);
}

/* ============================================
   ヘッダー
   ============================================ */
.site-header {
  position: relative;
  z-index: 1;
  padding: 28px clamp(20px, 5vw, 56px) 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--wood-400);
  border-radius: 3px;
  position: relative;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px solid var(--wood-300);
  opacity: 0.6;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ivory-60);
}

/* ============================================
   受付カード
   ============================================ */
.reception-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
  pointer-events: none; /* カード以外の透明部分はマウス操作を素通りさせ、3D空間の視点操作を可能にする */
}

.reception-card {
  pointer-events: auto; /* カード自体は通常通り操作できるようにする */
  width: 100%;
  max-width: 440px;
  background: var(--stone-700);
  border: 1px solid rgba(230, 200, 160, 0.10);
  border-top: 2px solid var(--wood-500);
  border-radius: var(--radius);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* カウンターに近づいてEキーを押すまでは非表示にしておく */
.reception-card.is-hidden {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
}

.card-head h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}

.card-head p {
  margin: 0 0 30px;
  font-size: 13px;
  color: var(--ivory-60);
  line-height: 1.7;
}

/* フォーム右上の「終わる」ボタン(タップ/クリックで受付を閉じる) */
.card-head {
  position: relative;
}

.card-close-btn {
  position: absolute;
  top: -4px;
  right: 0;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ivory-100);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(243, 237, 225, 0.2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.card-close-btn:hover,
.card-close-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

/* ============================================
   フォーム
   ============================================ */
.field {
  margin-bottom: 20px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--ivory-100);
}

.required,
.optional {
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 2px;
}

.required {
  color: #2c261c;
  background: var(--wood-400);
}

.optional {
  color: var(--ivory-60);
  border: 1px solid rgba(243, 237, 225, 0.25);
}

.field input,
.field textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(243, 237, 225, 0.14);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ivory-100);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 92px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(243, 237, 225, 0.32);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--wood-400);
  background: rgba(0, 0, 0, 0.3);
}

.field input:focus-visible,
.field textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--signal-green);
  outline-offset: 2px;
}

.field.has-error input,
.field.has-error textarea {
  border-color: var(--error-red);
}

.field-error {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--error-red);
  min-height: 1em;
}

/* ============================================
   送信ボタン
   ============================================ */
#submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: var(--wood-500);
  color: #1a140c;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#submit-btn:hover {
  background: var(--wood-400);
}

#submit-btn:active {
  transform: translateY(1px);
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  font-size: 13px;
  text-align: center;
}

.form-status[data-state="success"] {
  color: var(--signal-green);
}

.form-status[data-state="error"] {
  color: var(--error-red);
}

/* ============================================
   受付完了後に表示する受付番号
   ============================================ */
.ticket-result {
  margin-top: 22px;
  padding: 18px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(230, 200, 160, 0.18);
  border-radius: var(--radius);
}

.ticket-result.is-hidden {
  display: none;
}

.ticket-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ivory-60);
}

.ticket-number {
  margin: 6px 0;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--wood-300);
}

.ticket-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ivory-60);
}

.ticket-note a {
  color: var(--wood-300);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
