@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: var(--page-bg, #49B7FB);
  font-family: 'Noto Sans TC', sans-serif;
  color: #1a1a1a;
  height: 100%;
  overflow-x: hidden;
}

.phone-frame {
  max-width: 430px;
  margin: 0 auto;
  background: var(--page-bg, #49B7FB);
  min-height: 100vh;
  position: relative;
}

/* ========== 新版首頁：全版背景圖 ========== */
.hero-content {
  width: 100vw;
  max-width: none !important;
  margin-left: calc(-50vw + 50%) !important;
  position: relative;
  background: var(--page-bg, #49B7FB);
  overflow: hidden;
}

.hero-bg {
  width: 100%;
}

.hero-bg img {
  display: block;
  width: 100vw;
  height: auto;
  max-width: none !important;
  margin: 0 !important;
}

/* 電腦版（≥768px）：430px 置中 */
@media (min-width: 768px) {
  .hero-content {
    width: 100%;
    max-width: 430px !important;
    margin: 0 auto !important;
  }
  .hero-bg img {
    width: 100%;
    max-width: 430px !important;
    margin: 0 auto !important;
  }
  body {
    background: var(--page-bg, #49B7FB);
  }
}

.overlay-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* 位置對齊封面圖裡畫好的紅色按鈕（透明點擊區） */
.overlay-content .cta {
  position: absolute;
  top: 87%;
  bottom: 5.5%;
  left: 16%;
  right: 16%;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.overlay-content .cta:hover {
  transform: scale(1.03);
}

.overlay-content .cta:active {
  transform: scale(0.97);
}

/* ========== 舊版 Hero（保留相容性） ========== */
/* Hero */
.hero-image {
  width: calc(100% - 32px);
  margin: 20px 16px 0;
  border-radius: 16px;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.hero-placeholder {
  width: calc(100% - 32px);
  margin: 20px 16px 0;
  border-radius: 16px;
  background: #e0e0e0;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 14px;
  font-weight: 500;
}

/* Content */
.content {
  padding: 20px 16px 120px;
}

.field-label {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 10px;
}
.field-label .required {
  color: #e53935;
  margin-left: 4px;
  font-size: 13px;
}

.search-wrap {
  position: relative;
  margin-bottom: 24px;
}
.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}
.search-input {
  width: 100%;
  padding: 14px 14px 14px 42px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 12px;
  font-size: 14px;
  color: #1a1a1a;
  outline: none;
  font-family: 'Noto Sans TC', sans-serif;
}
.search-input::placeholder { color: #aaa; }
.search-input:focus { border-color: var(--primary); }

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 12px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.search-result-item {
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: #f5f5f5;
}
.search-result-item.no-result {
  color: #999;
  cursor: default;
}
.search-result-item.no-result:hover {
  background: transparent;
}

/* 高風險/Closed 職業標籤（灰色圖示，跟 App 一樣） */
.search-result-item.high-risk,
.search-result-item.closed {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.risk-badge {
  font-size: 14px;
  margin-left: 8px;
  opacity: 0.6;
}

/* Closed Alert 單按鈕置中 */
.high-risk-alert-buttons.single {
  justify-content: center;
}
.high-risk-alert-buttons.single .high-risk-alert-btn {
  flex: none;
  min-width: 120px;
}

/* 高風險 Alert Modal */
.high-risk-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.high-risk-alert-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.high-risk-alert-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}
.high-risk-alert-message {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 24px;
}
.high-risk-alert-buttons {
  display: flex;
  gap: 12px;
}
.high-risk-alert-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all 0.2s;
}
.high-risk-alert-btn.cancel {
  background: #f0f0f0;
  color: #666;
}
.high-risk-alert-btn.cancel:hover {
  background: #e0e0e0;
}
.high-risk-alert-btn.confirm {
  background: transparent;
  color: #006AA6;
}
.high-risk-alert-btn.confirm:hover {
  background: #e3f2fd;
}

.section-title {
  font-size: 13px;
  color: #888;
  font-weight: 600;
  margin-bottom: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid #ddd;
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 14px;
  color: #555;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover, .chip.selected {
  border-color: var(--primary);
  color: var(--primary);
}
.chip.selected {
  background: var(--primary);
  color: #fff;
}

/* CTA */
.cta-wrap {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  padding: 12px 16px 28px;
  background: var(--content-bg);
}
.cta-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.cta-btn.ready {
  opacity: 1;
}

/* 轉場頁 */
.transition-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 40px;
  background: var(--content-bg);
  min-height: 100vh;
}
.transition-screen.active {
  display: flex;
}
.trans-prefix {
  font-size: 13px;
  color: #666;
}
.trans-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--trans-value-color, var(--primary));
}
.trans-suffix {
  font-size: 13px;
  color: #666;
}
/* 轉場文字脈動動畫 */
.transition-screen.active .trans-value {
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}

/* 題目頁 */
.quiz-screen {
  display: none;
  flex-direction: column;
  padding: 24px 20px;
  background: var(--quiz-bg);
  min-height: 100vh;
}
.quiz-screen.active {
  display: flex;
}
.quiz-header {
  text-align: right;
  font-size: 13px;
  color: #888;
  font-weight: 600;
  margin-bottom: 24px;
}
.quiz-text {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.6;
  margin-bottom: 32px;
}
.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.quiz-opt:hover {
  border-color: var(--primary);
}
.quiz-opt:active {
  transform: scale(0.98);
}
.quiz-opt.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.quiz-opt-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #666;
  flex-shrink: 0;
}
.quiz-opt.selected .quiz-opt-label {
  background: var(--primary);
  color: #fff;
}
.quiz-opt-text {
  font-size: 15px;
  color: #333;
  line-height: 1.5;
  padding-top: 3px;
}

/* 結果頁 */
.result-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: var(--result-bg);
  min-height: 100vh;
  overflow-y: auto;
}
.result-screen.active {
  display: flex;
}
/* 四張圖連續顯示容器 */
.result-images-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.result-img-item {
  width: 100%;
  max-width: 100%;
}
.result-img-item.with-btns {
  position: relative;
}
.result-img-item img,
.result-img-item canvas {
  width: 100%;
  height: auto;
  display: block;
}
/* 按鈕疊在第一張圖底部，位置對齊圖片裡畫好的按鈕（透明點擊區） */
.result-img-item.with-btns .result-btns {
  position: absolute;
  inset: 0;
  padding: 0;
}

/* 第二張圖（resultpage2）裡畫好的「搶先認識同校同學」按鈕，位置對齊（透明點擊區） */
.result-img2-btn {
  position: absolute;
  top: 84.2%;
  bottom: 5.3%;
  left: 4.3%;
  right: 3.8%;
  display: block;
}

/* 分享頁 */
.share-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  background: var(--share-bg);
  min-height: 100vh;
  gap: 20px;
}
.share-screen.active {
  display: flex;
}
.result-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}
.result-canvas-wrap {
  width: 100%;
  max-width: 300px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.result-canvas-wrap.shrink {
  max-width: 240px;
}
.result-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}
/* 結果頁按鈕 */
.result-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  box-sizing: border-box;
}
.result-btns-row {
  display: flex;
  gap: 12px;
  width: 100%;
}
.result-btn {
  position: absolute;
  left: 4.3%;
  right: 4.8%;
  border: none;
  background: transparent;
  color: transparent;
  cursor: pointer;
  transition: opacity 0.2s;
}
.result-btn:active {
  opacity: 0.6;
}
.result-btn.primary {
  top: 85.0%;
  bottom: 9.4%;
}
.result-btn.secondary {
  top: 92.1%;
  bottom: 2.6%;
}
.result-btn.full-width {
  flex: none;
  width: 100%;
}
/* IG 分享步驟區塊 */
.ig-share-section {
  width: 100%;
  max-width: 400px;
  display: none;
}
.ig-share-section.show {
  display: block;
}
.ig-share-toast {
  background: #444;
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  margin-bottom: 20px;
}
.ig-share-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #666;
  font-size: 14px;
  margin-bottom: 16px;
}
.ig-share-title::before,
.ig-share-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ccc;
}
.ig-share-title svg {
  width: 20px;
  height: 20px;
}
.ig-share-steps {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.ig-step {
  flex: 1;
  text-align: center;
}
.ig-step-label {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.ig-step-btn {
  display: inline-block;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: transparent;
  border: 1.5px solid #333;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}
.ig-step-btn:active {
  background: #333;
  color: #fff;
}
.ig-step-text {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}
.result-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.result-toast.show {
  opacity: 1;
}
