:root {
  --bg: #111317;
  --fg: #f4f5f7;
  --accent: #f2a541;
  --muted: #b8bdc7;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* ページのスクロール・ズームを止め、指の操作はすべて main.js で受ける */
#camerafeed {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;      /* 高さが足りないときに上が切れないよう、中央寄せは .card の margin:auto で */
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(17, 19, 23, 0.96);
  touch-action: pan-y;          /* 案内画面だけは縦にスクロールできる（横向き・文字拡大でボタンが切れないように） */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.card {
  margin: auto;
  width: min(440px, 100%);
  text-align: center;
  line-height: 1.7;
}
.card h1 { font-size: 1.45rem; margin: 0 0 0.6em; }
.card p { margin: 0.5em 0; }
.notes { text-align: left; color: var(--muted); font-size: 0.92rem; padding-left: 1.2em; margin: 1em 0 1.4em; }
.small { color: var(--muted); font-size: 0.85rem; min-height: 1.4em; }
.steps { text-align: left; padding-left: 1.3em; }
.steps li { margin: 0.35em 0; }
.url { word-break: break-all; color: var(--muted); font-size: 0.85rem; -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}
.primary {
  display: inline-block;
  width: 100%;
  padding: 1em 1.2em;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1206;
  font-weight: 700;
  font-size: 1.1rem;
}
.secondary {
  display: inline-block;
  width: 100%;
  margin-top: 0.7em;
  padding: 0.85em 1.2em;
  border-radius: 999px;
  background: #2a2e37;
  color: var(--fg);
}
.actions { margin-top: 1.2em; }

.qr { margin: 1em auto; width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 10px; box-sizing: content-box; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }

.spinner {
  width: 44px; height: 44px; margin: 0 auto 1em;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; margin-top: 0.8em; }
#loading-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }

/* AR 中の表示 */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.guide {
  position: absolute;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  padding: 0.7em 1em;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.5;
}
.guide:empty { display: none; }
.pill {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 26px);
  transform: translateX(-50%);
  padding: 0.8em 1.8em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  touch-action: manipulation;
}
.credit {
  position: absolute;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(6px, env(safe-area-inset-bottom));
  font-size: 10px;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 0 3px rgba(0,0,0,0.8);
}
.legal { margin-top: 1.6em; font-size: 0.72rem; line-height: 1.5; }
.legal a { color: var(--muted); }
