/**
 * SR AR System Styles
 * Global styles for AR experience
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  background: #000;
  color: #fff;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

#mindar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  touch-action: none;
}

#mindar-container video {
  position: absolute;
  top: 0;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

#action-overlay {
  pointer-events: auto;
}

#action-overlay button {
  pointer-events: auto;
  cursor: pointer;
}

/* ===================================================================
   CTA Overlay — 全ポスター共通の白黒角丸1種
   画面下部固定、フェードイン+スライドアップで登場
   =================================================================== */

.cta-overlay {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;

  /* 登場前: 下オフセット + 透明。translate は transform とは独立プロパティで指定 */
  opacity: 0;
  translate: 0 16px;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    translate 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.cta-overlay.is-visible {
  opacity: 1;
  translate: 0 0;
}

.cta-button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.cta-button:active {
  transform: scale(0.96);
  background: #f2f2f2;
}

@media (max-width: 480px) {
  .cta-overlay {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  }

  .cta-button {
    padding: 15px 30px;
  }
}

/* Error Modal */
/* ===================================================================
   共通デザイントークン — 全UI白黒シンプル
   =================================================================== */
:root {
  --ui-scrim: rgba(0, 0, 0, 0.72);
  --ui-card-bg: #ffffff;
  --ui-card-border: rgba(0, 0, 0, 0.08);
  --ui-card-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --ui-title: #111111;
  --ui-body: #333333;
  --ui-muted: #666666;
  --ui-btn-primary-bg: #111111;
  --ui-btn-primary-fg: #ffffff;
  --ui-btn-primary-bg-hover: #000000;
  --ui-btn-secondary-bg: #ffffff;
  --ui-btn-secondary-fg: #111111;
  --ui-btn-secondary-border: rgba(0, 0, 0, 0.18);
  --ui-radius-card: 16px;
  --ui-radius-btn: 999px;
  --ui-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans JP', sans-serif;
}

/* ===================================================================
   Feedback Overlay (検出ヒント / エラー / 警告 / 情報 / 成功)
   =================================================================== */
.feedback-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--ui-scrim);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
  font-family: var(--ui-font);
}

.feedback-overlay.is-visible {
  display: flex;
}

.feedback-card {
  background: var(--ui-card-bg);
  border: 1px solid var(--ui-card-border);
  border-radius: var(--ui-radius-card);
  padding: 28px 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--ui-card-shadow);
  text-align: center;
  pointer-events: auto;
}

.feedback-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ui-title);
  margin-bottom: 12px;
  line-height: 1.4;
}

.feedback-body {
  font-size: 14px;
  color: var(--ui-body);
  line-height: 1.6;
}

.feedback-hints {
  text-align: left;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ui-card-border);
  font-size: 13px;
  color: var(--ui-muted);
}

.feedback-hints-label {
  font-weight: 700;
  color: var(--ui-body);
  margin-bottom: 8px;
}

.feedback-hints ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.feedback-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--ui-title);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}

.feedback-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}

.feedback-progress-fill {
  height: 100%;
  background: var(--ui-title);
  transition: width 0.3s ease;
}

.feedback-progress-label {
  font-size: 13px;
  color: var(--ui-muted);
  margin-top: 8px;
  font-weight: 600;
}

.feedback-close {
  margin-top: 20px;
  padding: 12px 24px;
  background: var(--ui-btn-primary-bg);
  color: var(--ui-btn-primary-fg);
  border: none;
  border-radius: var(--ui-radius-btn);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--ui-font);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
  pointer-events: auto;
}

.feedback-close:hover {
  background: var(--ui-btn-primary-bg-hover);
}

.feedback-close:active {
  transform: scale(0.97);
}

/* ===================================================================
   Error Modal (エラーモーダル / 動画エラーモーダル 共通)
   =================================================================== */
.error-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--ui-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: auto;
}

.error-content {
  background: var(--ui-card-bg);
  border: 1px solid var(--ui-card-border);
  border-radius: var(--ui-radius-card);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--ui-card-shadow);
  font-family: var(--ui-font);
  animation: errorFadeIn 0.3s ease-out;
}

@keyframes errorFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.error-message {
  text-align: center;
  margin-bottom: 24px;
}

.error-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ui-title);
  line-height: 1.4;
}

.error-description {
  font-size: 15px;
  color: var(--ui-body);
  margin-bottom: 12px;
  line-height: 1.6;
}

.error-suggestion {
  font-size: 13px;
  color: var(--ui-muted);
  line-height: 1.5;
}

.error-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.error-button {
  flex: 1;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-btn);
  font-family: var(--ui-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.error-button-retry {
  background: var(--ui-btn-primary-bg);
  color: var(--ui-btn-primary-fg);
}

.error-button-retry:hover {
  background: var(--ui-btn-primary-bg-hover);
}

.error-button-retry:active {
  transform: scale(0.97);
}

.error-button-close {
  background: var(--ui-btn-secondary-bg);
  color: var(--ui-btn-secondary-fg);
  border-color: var(--ui-btn-secondary-border);
}

.error-button-close:hover {
  background: #f5f5f5;
}

.error-button-close:active {
  transform: scale(0.97);
}

/* ===================================================================
   Loading Overlay
   =================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 900;
  pointer-events: auto;
  font-family: var(--ui-font);
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-message {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  max-width: 80%;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 14px 24px;
  border-radius: 999px;
}

.loading-progress {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 12px;
  text-align: center;
}

/* ===================================================================
   Pause / Detection Feedback
   =================================================================== */
.pause-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.72);
  padding: 20px 28px;
  border-radius: 16px;
  z-index: 800;
  pointer-events: none;
  font-family: var(--ui-font);
  animation: pulseFade 2s ease-in-out infinite;
}

@keyframes pulseFade {

  0%,
  100% {
    opacity: 0.85;
  }

  50% {
    opacity: 1;
  }
}

.pause-message {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
}

.detection-box {
  position: absolute;
  border: 2px solid #ffffff;
  border-radius: 4px;
  pointer-events: none;
  animation: detectionPulse 1.5s ease-in-out infinite;
}

@keyframes detectionPulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
}

.detection-searching {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  font-family: var(--ui-font);
  pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .error-content {
    padding: 24px;
  }

  .error-title {
    font-size: 20px;
  }

  .error-description {
    font-size: 14px;
  }

  .error-button {
    padding: 10px 20px;
    font-size: 14px;
  }

  .loading-spinner {
    width: 48px;
    height: 48px;
  }

  .loading-message {
    font-size: 16px;
  }
}

/* Tracking Indicator - Simplified */
.tracking-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
}

/* Audio Toggle Button - Larger */
.audio-toggle-button {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.audio-toggle-button:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.audio-toggle-button:active {
  transform: scale(0.98);
}

/* ===================================================================
   Browser Compatibility Error
   =================================================================== */
.compatibility-error {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--ui-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.compatibility-content {
  background: var(--ui-card-bg);
  border: 1px solid var(--ui-card-border);
  border-radius: var(--ui-radius-card);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--ui-card-shadow);
  font-family: var(--ui-font);
}

.compatibility-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--ui-title);
  text-align: center;
  line-height: 1.4;
}

.compatibility-description {
  font-size: 15px;
  color: var(--ui-body);
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}

.compatibility-errors,
.compatibility-warnings,
.compatibility-recommendation {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--ui-card-border);
}

.compatibility-errors strong,
.compatibility-warnings strong,
.compatibility-recommendation strong {
  color: var(--ui-title);
  font-weight: 700;
}

.compatibility-errors ul,
.compatibility-warnings ul,
.compatibility-recommendation ul {
  margin-top: 8px;
  padding-left: 20px;
  color: var(--ui-body);
  line-height: 1.6;
  font-size: 14px;
}

/* ===================================================================
   Splash Screen (カメラ許可前オンボーディング)
   =================================================================== */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  display: none;
  /* Hidden by default */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
  font-family: var(--ui-font);
  animation: splash-fade-in 0.5s ease-out;
}

.splash-screen.splash-fade-out {
  animation: splash-fade-out 0.5s ease-out forwards;
}

.splash-content {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.splash-instruction-main {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.5;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.splash-instruction-sub {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.5px;
  margin-bottom: 48px;
}

.splash-start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 16px 32px;
  background: #ffffff;
  color: #111111;
  border: none;
  border-radius: 999px;
  font-family: var(--ui-font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.18);
  transition: background 0.18s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.splash-start-button:hover {
  background: #f2f2f2;
}

.splash-start-button:active {
  transform: scale(0.97);
  background: #e5e5e5;
}

@media (max-width: 480px) {
  .splash-instruction-main {
    font-size: 20px;
  }

  .splash-instruction-sub {
    font-size: 13px;
    margin-bottom: 40px;
  }

  .splash-start-button {
    width: 100%;
    padding: 17px 24px;
  }
}

@keyframes splash-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes splash-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.splash-subtitle {
  font-size: 20px;
  color: #ffffff;
  margin-bottom: 60px;
  font-weight: 500;
  letter-spacing: 2px;
  font-family: var(--ui-font);
}

.splash-loader {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: splash-spin 0.9s linear infinite;
}

@keyframes splash-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================================================================
   Audio Consent Dialog
   =================================================================== */
.audio-consent-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--ui-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  pointer-events: auto;
  animation: fadeIn 0.3s ease-out;
}

.audio-consent-content {
  background: var(--ui-card-bg);
  border: 1px solid var(--ui-card-border);
  border-radius: var(--ui-radius-card);
  padding: 40px 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--ui-card-shadow);
  font-family: var(--ui-font);
  animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.audio-consent-message {
  font-size: 20px;
  font-weight: 700;
  color: var(--ui-title);
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: 0.5px;
}

.audio-consent-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.audio-consent-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  background: var(--ui-btn-secondary-bg);
  border: 1px solid var(--ui-btn-secondary-border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
  color: var(--ui-title);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--ui-font);
}

.audio-consent-button svg {
  color: var(--ui-title);
}

.audio-consent-button:hover {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.32);
}

.audio-consent-button:active {
  transform: scale(0.97);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .audio-consent-content {
    padding: 32px 24px;
  }

  .audio-consent-message {
    font-size: 20px;
    margin-bottom: 32px;
  }

  .audio-consent-buttons {
    flex-direction: column;
    gap: 16px;
  }

  .audio-consent-button {
    padding: 24px 20px;
  }

  .audio-consent-button svg {
    width: 40px;
    height: 40px;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  body {
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* Prevent zoom on double tap */
  * {
    touch-action: manipulation;
  }
}