/* ========================================================
   見え方シミュレーター モバイル専用スタイル (mobile.css)
   ======================================================== */

:root {
  --bg-dark: #0a0f1d;
  --bg-surface: #151e32;
  --bg-sheet: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --shutter: #ffffff;
  --border: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
}

/* スマホ用アプリコンテナ */
.mobile-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* 1. 上部トップバー */
.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 8px;
  background: rgba(10, 15, 29, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title .icon {
  font-size: 1.3rem;
}

.topbar-title .title-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.2);
}

.icon-btn.active {
  background: var(--accent);
  color: #0a0f1d;
  border-color: var(--accent);
}

.btn-icon {
  font-size: 1rem;
}

/* 2. メインカメラビューワー */
.mobile-viewer {
  flex: 1;
  position: relative;
  background-color: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#videoElement {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s ease;
}

/* インカメラ時のミラー表示 */
.mirror-mode {
  transform: scaleX(-1);
}

/* 白内障オーバーレイ */
.cataract-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  display: none;
  transition: opacity 0.2s ease;
  background: radial-gradient(circle at center, rgba(255, 248, 220, 0.35) 0%, rgba(250, 235, 185, 0.6) 80%);
  mix-blend-mode: screen;
  z-index: 5;
}

.cataract-overlay.active {
  opacity: 1;
  display: block;
}

/* 緑内障オーバーレイ */
.glaucoma-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  display: none;
  transition: opacity 0.2s ease;
  background: radial-gradient(circle at center, transparent 20%, rgba(0, 0, 0, 0.65) 50%, rgba(0, 0, 0, 0.98) 80%);
  z-index: 5;
}

.glaucoma-overlay.active {
  opacity: 1;
  display: block;
}

/* スプリット比較レイヤー */
.split-curtain {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
  border-right: 2.5px solid var(--accent);
  display: none;
  z-index: 8;
}

.split-curtain video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  object-fit: cover;
  filter: none !important;
}

.split-label {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
  pointer-events: none;
}

.split-divider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 6px;
  height: 100%;
  background: var(--accent);
  transform: translateX(-50%);
  cursor: ew-resize;
  display: none;
  z-index: 9;
}

.divider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: #0a0f1d;
  padding: 3px 6px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* フローティングバッジ */
.floating-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 12;
  pointer-events: none;
}

/* カメラ起動前プレースホルダー */
.camera-placeholder {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 25;
}

.placeholder-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
}

.placeholder-icon {
  font-size: 3.2rem;
}

.placeholder-box h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.placeholder-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.start-camera-btn {
  margin-top: 8px;
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  padding: 13px 28px;
  border-radius: 28px;
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.start-camera-btn:active {
  transform: scale(0.96);
}

/* 3. 下部操作パネル */
.mobile-controls {
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 横スクロール・フィルターチップ */
.filter-chips-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 10px 14px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-chips-wrapper::-webkit-scrollbar {
  display: none;
}

.filter-chips {
  display: flex;
  gap: 8px;
  width: max-content;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 22px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip-btn:active {
  transform: scale(0.94);
}

.chip-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* アクションバー (シャッター・調整・解説) */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 20px 8px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: 56px;
  transition: transform 0.15s ease;
}

.action-btn:active {
  transform: scale(0.9);
}

.action-icon {
  font-size: 1.35rem;
}

.action-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* シャッターボタン */
.shutter-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 3.5px solid var(--shutter);
  background: transparent;
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
}

.shutter-btn:active {
  transform: scale(0.92);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--shutter);
  transition: background-color 0.12s ease;
  pointer-events: none;
}

.shutter-btn:active .shutter-inner {
  background: #cbd5e1;
}

/* 4. スライドアップ・ボトムシート */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-sheet);
  border-radius: 20px 20px 0 0;
  padding: 12px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  z-index: 50;
  transform: translateY(105%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  visibility: hidden;
}

.bottom-sheet.open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.sheet-handle-bar {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 0 auto 12px;
  cursor: pointer;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
}

/* 3段階強度セレクター */
.intensity-selector-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.intensity-selector-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.intensity-button-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(0, 0, 0, 0.28);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.intensity-btn {
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--text-muted);
  padding: 12px 6px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.16s ease;
}

.intensity-btn:active {
  transform: scale(0.95);
}

.intensity-btn-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.intensity-btn-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.intensity-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.intensity-btn.active .intensity-btn-title {
  color: #ffffff;
}

.intensity-btn.active .intensity-btn-sub {
  color: var(--accent);
}

.intensity-description {
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 48px;
  display: flex;
  align-items: center;
}

.sheet-desc {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.sheet-alert {
  margin-top: 14px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.74rem;
  color: #fbbf24;
  line-height: 1.4;
}

/* シート用背景オーバーレイ */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* シャッターフラッシュ演出 */
.shutter-flash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.08s ease-out;
}

.shutter-flash.flash {
  opacity: 0.75;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--accent);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

