/* ===== スマホッチ 基本スタイル ===== */
:root {
  --orange: #FF8A3D;
  --orange-dark: #F06A12;
  --teal: #2BB8A8;
  --purple: #8E6CEF;
  --yellow: #FFD34D;
  --bg: #FFF7EE;
  --card: #FFFFFF;
  --ink: #3A2E28;
  --ink-soft: #8A7A70;
  --danger: #E85D5D;
  --radius: 20px;
  --shadow: 0 4px 14px rgba(240, 106, 18, 0.12);
}

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

html, body { height: 100%; }

body {
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== ヘッダー ===== */
#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  background: var(--orange);
  color: #fff;
  flex-shrink: 0;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.coin-chip {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 15px;
}

/* ===== メイン ===== */
#app-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen { display: none; padding: 16px 16px 24px; }
.screen.active { display: block; }

/* ===== ナビ ===== */
#app-nav {
  display: flex;
  background: #fff;
  border-top: 1px solid #F0E4D8;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
}
#app-nav button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
#app-nav button span { font-size: 22px; }
#app-nav button.active { color: var(--orange-dark); }

/* ===== カード類 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; color: var(--ink-soft); margin-bottom: 10px; }

/* ===== キャラクター ===== */
.char-stage { text-align: center; padding: 10px 0 4px; }
.char-stage svg { width: 150px; height: 150px; }
.char-name { font-size: 18px; font-weight: 800; margin-top: 4px; }
.char-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.char-bubble {
  display: inline-block;
  background: #FFF1DE;
  border-radius: 14px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
}

/* ===== ステータス ===== */
.stat-row { display: flex; gap: 10px; }
.stat-box {
  flex: 1;
  background: #FFF6EA;
  border-radius: 14px;
  padding: 10px;
  text-align: center;
}
.stat-box .num { font-size: 22px; font-weight: 800; color: var(--orange-dark); }
.stat-box .lbl { font-size: 11px; color: var(--ink-soft); font-weight: 700; }

/* ===== ボタン ===== */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-dark); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 4px 0 #1E8C80; }
.btn-ghost { background: #fff; color: var(--ink-soft); border: 2px solid #EADFD3; font-size: 14px; padding: 12px; }
.btn + .btn { margin-top: 10px; }

/* ===== 年齢セレクタ ===== */
.age-select { display: flex; gap: 8px; }
.age-select button {
  flex: 1;
  border: 2px solid #EADFD3;
  background: #fff;
  border-radius: 12px;
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  color: var(--ink-soft);
}
.age-select button.on { border-color: var(--orange); background: #FFF1DE; color: var(--orange-dark); }

/* ===== カメラ画面 ===== */
#screen-physical { padding: 12px; display: none; flex-direction: column; height: 100%; }
#screen-physical.active { display: flex; }
.privacy-badge {
  background: #2E4B46;
  color: #C9F5EE;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.cam-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1E1A17;
  flex: 1;
  min-height: 220px;
}
#cam, #cam-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* 鏡像 */
}
#phys-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  pointer-events: none;
}
.phys-count {
  font-size: 64px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  line-height: 1;
}
.phys-count small { font-size: 20px; }
.phys-cheer {
  background: rgba(255,255,255,0.9);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 800;
  color: var(--orange-dark);
}
.phys-status {
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}
#phys-panel { padding-top: 12px; flex-shrink: 0; }
.phys-progress {
  height: 14px;
  background: #F0E4D8;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.phys-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
  border-radius: 999px;
  transition: width 0.3s;
}

/* ===== クイズ画面 ===== */
.quiz-q {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.6;
  margin-bottom: 16px;
}
.quiz-progress { font-size: 12px; font-weight: 800; color: var(--ink-soft); margin-bottom: 8px; }
.quiz-choice {
  display: block;
  width: 100%;
  text-align: left;
  border: 2px solid #EADFD3;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.5;
  margin-bottom: 10px;
  cursor: pointer;
}
.quiz-choice:active { background: #FFF6EA; }
.quiz-choice.picked-good { border-color: var(--teal); background: #E6FAF7; }
.quiz-choice.picked-mid { border-color: var(--yellow); background: #FFF9E3; }
.quiz-choice.picked-low { border-color: var(--danger); background: #FDEDED; }
.quiz-fb {
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  margin-bottom: 12px;
}
.quiz-fb.lv2 { background: #E6FAF7; color: #14655B; }
.quiz-fb.lv1 { background: #FFF9E3; color: #8A6D00; }
.quiz-fb.lv0 { background: #FDEDED; color: #A33; }
.quiz-exp { font-size: 13px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 14px; }
.quiz-gain { font-size: 15px; font-weight: 800; color: var(--orange-dark); text-align: center; margin-bottom: 10px; }

/* ===== 結果 ===== */
.result-hero { text-align: center; padding: 18px 0 8px; }
.result-hero .big { font-size: 26px; font-weight: 800; }
.result-hero .pts { font-size: 40px; font-weight: 800; color: var(--orange-dark); margin: 8px 0; }

/* ===== チケット ===== */
.ticket {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px dashed #EAB98A;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.ticket .emoji { font-size: 30px; }
.ticket .info { flex: 1; }
.ticket .name { font-size: 14px; font-weight: 800; }
.ticket .desc { font-size: 11.5px; color: var(--ink-soft); }
.ticket .cost { font-size: 13px; font-weight: 800; color: var(--orange-dark); white-space: nowrap; }
.ticket button {
  border: none;
  background: var(--orange);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
}
.ticket button:disabled { background: #DBCFC3; }
.ticket.owned { border-style: solid; border-color: var(--teal); background: #F2FCFA; }
.ticket .owned-mark { font-size: 12px; font-weight: 800; color: var(--teal); }
.section-title { font-size: 14px; font-weight: 800; color: var(--ink-soft); margin: 16px 0 8px; }

.reset-link {
  display: block;
  text-align: center;
  font-size: 11px;
  color: #C8B8AC;
  margin-top: 24px;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
}
