/* ──────────────────────────────────────────────────────────────
   photobooth.joelin.cc — 共用樣式
   老喬報 Design Tokens · tools_lively pattern
   ────────────────────────────────────────────────────────────── */

:root {
  --brand-blue: #3a4a9d;
  --brand-blue-light: #81a1d4;
  --brand-orange: #ee7500;
  --accent-yellow: #f9c158;
  --gray-dark: #595757;
  --gray-light: #bfc0c0;
  --canvas-cream: #fffdf7;
  --paper: #fff8ec;
}

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

html, body {
  height: 100%;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--gray-dark);
  background: var(--canvas-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 48px 24px;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(249, 193, 88, 0.18) 0%, transparent 38%),
    radial-gradient(circle at 92% 88%, rgba(129, 161, 212, 0.15) 0%, transparent 42%);
}

/* ── Header ──────────────────────────────────────────────────── */

header {
  text-align: center;
  margin-top: 24px;
  margin-bottom: 32px;
  max-width: 640px;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--brand-orange);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 1px;
  margin-bottom: 24px;
  transform: rotate(-2deg);
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

h1 .emoji {
  display: inline-block;
  margin-right: 8px;
  transform: rotate(-6deg);
}

.subtitle {
  font-size: clamp(14px, 2.5vw, 16px);
  color: var(--gray-dark);
  opacity: 0.75;
  font-weight: 400;
}

.lead {
  font-size: clamp(15px, 2.6vw, 17px);
  color: var(--gray-dark);
  margin-top: 16px;
  line-height: 1.75;
}

.lead strong {
  color: var(--brand-blue);
  font-weight: 700;
}

/* ── Photostrip 視覺 ─────────────────────────────────────────── */

.photostrip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: min(360px, 86vw);
  aspect-ratio: 1 / 1;
  margin: 8px 0 40px;
  padding: 16px 16px 48px;
  background: #fff;
  border-radius: 4px;
  box-shadow:
    0 2px 4px rgba(89, 87, 87, 0.06),
    0 12px 28px rgba(89, 87, 87, 0.12);
  transform: rotate(-1.5deg);
  position: relative;
}

.photostrip::after {
  content: "photobooth.joelin.cc";
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--gray-light);
  letter-spacing: 0.5px;
}

.frame {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--paper) 0%, var(--canvas-cream) 100%);
  border: 1px dashed var(--gray-light);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(28px, 6vw, 40px);
  transition: transform 0.4s ease;
}

.frame:hover {
  transform: scale(1.04) rotate(2deg);
  border-color: var(--brand-orange);
}

/* ── 工具區（placeholder until BL-010 + BL-011 ready）─────────── */

.tool-zone {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 1.5px solid var(--brand-blue);
  border-radius: 14px;
  padding: 36px 28px;
  margin-bottom: 32px;
  text-align: center;
  position: relative;
}

.tool-zone::before {
  content: "工具區";
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--brand-blue);
  color: #fff;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 1px;
}

.tool-zone h2 {
  font-size: 18px;
  color: var(--brand-blue);
  margin-bottom: 12px;
}

.tool-zone .status {
  font-size: 14px;
  color: var(--gray-dark);
  opacity: 0.75;
  margin-bottom: 24px;
  line-height: 1.7;
}

.btn-start {
  display: inline-block;
  padding: 14px 32px;
  background: var(--brand-orange);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.btn-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(238, 117, 0, 0.3);
}

.btn-start:disabled {
  background: var(--gray-light);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-hint {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-dark);
  opacity: 0.6;
}

/* ── Features list ───────────────────────────────────────────── */

.features {
  max-width: 520px;
  width: 100%;
  margin-bottom: 32px;
}

.features h3 {
  font-size: 14px;
  color: var(--brand-blue);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.8;
}

.features ul {
  list-style: none;
  padding: 0;
}

.features li {
  padding: 12px 0 12px 28px;
  border-bottom: 1px solid rgba(89, 87, 87, 0.08);
  font-size: 14px;
  position: relative;
  line-height: 1.65;
}

.features li::before {
  content: "✓";
  position: absolute;
  left: 4px;
  top: 12px;
  color: var(--brand-orange);
  font-weight: 700;
}

.features li:last-child { border-bottom: none; }

.features li strong {
  color: var(--brand-blue);
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-yellow);
  color: var(--gray-dark);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  margin: 0 2px;
}

/* ── Footer ──────────────────────────────────────────────────── */

footer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-dark);
  opacity: 0.65;
  line-height: 1.9;
  margin-top: auto;
  padding-top: 32px;
}

footer a {
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  color: var(--brand-orange);
  text-decoration: underline;
}

footer .star {
  color: var(--brand-orange);
  margin: 0 4px;
}

footer .nav {
  margin-bottom: 8px;
}

footer .nav a {
  margin: 0 6px;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 480px) {
  body { padding: 32px 16px; }
  header { margin-top: 8px; }
  .photostrip { margin: 4px 0 28px; }
  .tool-zone { padding: 28px 20px; }
}

/* ── Modal（拍照 + 結果頁）─────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 28, 45, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
}

.modal[hidden] { display: none; }

.modal-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--canvas-cream);
  border-radius: 18px;
  padding: 48px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
}

.modal-content.result {
  padding: 36px 24px 28px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--gray-dark);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: rgba(89, 87, 87, 0.1);
}

/* ── Camera View ───────────────────────────────────────────── */

.camera-view {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #1f1c2d;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* PRD R2.5: 預覽鏡像（自拍直覺） */
}

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(80px, 20vw, 160px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.countdown:empty { display: none; }

.flash-overlay {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.05s ease;
}

.flash-overlay.on {
  opacity: 0.95;
}

/* ── Capture Progress ──────────────────────────────────────── */

.capture-progress {
  width: 100%;
  margin-bottom: 20px;
}

.progress-text {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--gray-dark);
  margin-bottom: 8px;
}

.progress-text strong {
  color: var(--brand-blue);
  font-size: 18px;
  margin: 0 2px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(89, 87, 87, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand-orange);
  border-radius: 999px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ── Modal controls (buttons) ──────────────────────────────── */

.modal-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
  margin-bottom: 8px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand-orange);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(238, 117, 0, 0.3);
}

.btn-primary:disabled {
  background: var(--gray-light);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  background: transparent;
  color: var(--brand-blue);
  border: 1.5px solid var(--brand-blue);
}

.btn-secondary:hover {
  background: var(--brand-blue);
  color: #fff;
}

/* ── Result Modal ──────────────────────────────────────────── */

.result-title {
  font-size: 18px;
  color: var(--brand-blue);
  margin-bottom: 16px;
  text-align: center;
}

#result-preview {
  width: 100%;
  max-width: 360px;
  max-height: 60vh;
  height: auto;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 6px;
  box-shadow:
    0 4px 12px rgba(89, 87, 87, 0.15),
    0 16px 36px rgba(89, 87, 87, 0.18);
}

.result-hint {
  text-align: center;
  font-size: 12px;
  color: var(--gray-dark);
  opacity: 0.65;
  margin-top: 14px;
  line-height: 1.6;
}

/* Modal responsive */
@media (max-width: 480px) {
  .modal { padding: 0; }
  .modal-content {
    border-radius: 0;
    min-height: 100vh;
    padding: 56px 18px 24px;
  }
  .modal-content.result { padding: 40px 18px 24px; }
  .modal-content.inapp   { padding: 56px 22px 32px; }
}

/* ── In-app browser escape modal（Phase 2A）────────────────── */

.modal-content.inapp {
  text-align: center;
  padding: 48px 32px 36px;
}

.inapp-title {
  font-size: clamp(20px, 4vw, 24px);
  color: var(--brand-blue);
  margin-bottom: 12px;
  line-height: 1.4;
}

.inapp-title strong {
  color: var(--brand-orange);
}

.inapp-subtitle {
  font-size: 15px;
  color: var(--gray-dark);
  opacity: 0.85;
  margin-bottom: 18px;
  line-height: 1.65;
}

.inapp-hint {
  font-size: 13px;
  color: var(--gray-dark);
  opacity: 0.7;
  background: rgba(58, 74, 157, 0.06);
  border-left: 3px solid var(--brand-blue);
  padding: 12px 14px;
  margin-bottom: 24px;
  text-align: left;
  border-radius: 4px;
  line-height: 1.65;
}

.inapp-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.inapp-actions .btn-primary,
.inapp-actions .btn-secondary {
  width: 100%;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.inapp-continue {
  display: inline-block;
  font-size: 12px;
  color: var(--gray-dark);
  opacity: 0.55;
  text-decoration: underline;
  margin-top: 4px;
}

.inapp-continue:hover {
  opacity: 0.85;
  color: var(--brand-blue);
}

/* ── Prose（privacy / about 等內文頁）─────────────────────── */

.prose {
  max-width: 640px;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  margin-bottom: 32px;
  border: 1px solid rgba(89, 87, 87, 0.08);
}

.prose h2 {
  font-size: 17px;
  color: var(--brand-blue);
  margin: 24px 0 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.prose h2:first-child { margin-top: 0; }

.prose p {
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 12px;
  color: var(--gray-dark);
}

.prose ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.prose ul li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--gray-dark);
}

.prose ul li::before {
  content: "·";
  position: absolute;
  left: 8px;
  top: 6px;
  color: var(--brand-orange);
  font-weight: 700;
  font-size: 18px;
}

.prose ul li strong { color: var(--brand-blue); font-weight: 700; }

.prose a {
  color: var(--brand-blue);
  text-decoration: underline;
  text-decoration-color: rgba(58, 74, 157, 0.35);
  text-underline-offset: 2px;
}

.prose a:hover { color: var(--brand-orange); }

.prose code {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
  background: rgba(58, 74, 157, 0.08);
  color: var(--brand-blue);
  padding: 1px 6px;
  border-radius: 3px;
}

.prose .meta {
  margin-top: 24px;
  font-size: 12px;
  color: var(--gray-dark);
  opacity: 0.5;
  text-align: right;
}

@media (max-width: 480px) {
  .prose { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
