:root{
  --bg:#0b0f1a;
  --panel:rgba(10,14,25,.78);
  --stroke:rgba(255,255,255,.18);
  --text:#f4f6ff;
  --muted:rgba(244,246,255,.78);
  --btn:rgba(255,255,255,.10);
  --btn2:rgba(255,255,255,.16);
  --shadow:0 20px 60px rgba(0,0,0,.45);
}

*{box-sizing:border-box}

html,body{height:100%; max-width:100%; overflow-x:hidden}
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
  overflow-x:hidden;
}

#app{height:100%}

.screen{
  display:none;
  height:100%;
  width:100%;
}
.screen.active{display:block}

#screen-start{
  background: url("assets/start.png") center/cover no-repeat;
  position:relative;
}
.start-overlay{
  position:absolute; inset:0;
  background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.18) 45%, rgba(0,0,0,0) 70%);
  display:flex;
  align-items:center;
  padding: clamp(18px, 4vw, 56px);
}
.menu{
  width:min(360px, 86vw);
  background: rgba(10, 14, 25, .35);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.menu .btn{width:100%; margin: 10px 0}
.small-note{margin-top:8px; color:rgba(255,255,255,.55); font-size:12px}

.btn{
  border:1px solid rgba(255,255,255,.16);
  background: var(--btn);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 18px;
  cursor:pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{background: var(--btn2)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  background: rgba(255, 210, 120, .20);
  border-color: rgba(255, 210, 120, .35);
}

.panel{
  width:min(720px, 92vw);
  margin: 48px auto;
  background: var(--panel);
  border:1px solid var(--stroke);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel h1{margin: 4px 0 16px; font-size: 28px}
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,.14);
}
.row:last-of-type{border-bottom:none}
.row label{color: var(--muted)}
.row input,.row select{
  width: 180px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.row.buttons{border-bottom:none; justify-content:flex-end}
.row.buttons .btn{width:auto}
.hint{margin-top:12px; color:rgba(255,255,255,.72); font-size: 13px; line-height:1.6}

.quiz-wrap{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
  background: radial-gradient(1200px 700px at 30% 20%, rgba(120,140,255,.14), transparent 55%),
              radial-gradient(900px 500px at 70% 80%, rgba(255,210,120,.10), transparent 60%),
              var(--bg);
}
.quiz-top{
  width:min(820px, 94vw);
  max-width:100%;
  display:flex;
  justify-content:space-between;
  color:rgba(255,255,255,.80);
  margin-bottom: 12px;
  font-size: 14px;
}
.card{
  width:min(820px, 94vw);
  max-width:100%;
  background: var(--panel);
  border:1px solid var(--stroke);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.question-label{color:rgba(255,255,255,.70); font-size:12px; letter-spacing:.12em; text-transform:uppercase}
.question{
  width:100%;
  max-width:100%;
  min-width:0;
  font-size: 42px;
  margin: 10px 0 16px;
  font-weight: 700;
  line-height:1.35;
  white-space:normal;
  word-break:break-word;
  overflow-wrap:anywhere;
}
.choices{display:grid; grid-template-columns: 1fr 1fr; gap: 12px}
.choice{
  width:100%;
  max-width:100%;
  min-width:0;
  text-align:left;
  padding: 14px 14px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: var(--text);
  cursor:pointer;
  font-size: 18px;
  line-height:1.5;
  white-space:normal;
  word-break:break-word;
  overflow-wrap:anywhere;
}
.choice:hover{background: rgba(255,255,255,.12)}
.choice.correct{border-color: rgba(110,255,170,.42); background: rgba(110,255,170,.16)}
.choice.wrong{border-color: rgba(255,120,120,.46); background: rgba(255,120,120,.16)}
.quiz-bottom{display:flex; justify-content:flex-end; margin-top: 16px}

.panel.result{margin-top: 70px; text-align:center}
.result-text{font-size:18px; margin: 10px 0 18px; color: rgba(255,255,255,.86)}

.popup{
  position:fixed; inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 50;
}
.popup.hidden{display:none}
.popup-backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(2px);
}
.popup-card{
  position:relative;
  width: min(1080px, 92vw);  /* 1.5x feel */
  max-height: min(80vh, 720px);
  background: rgba(10,14,25,.92);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.popup-card video{
  width:100%;
  height:auto;
  max-height: calc(80vh - 52px);
  border-radius: 12px;
  background:black;
}

.popup-card img{
  display:block;
  max-width: 100%;
  max-height: calc(80vh - 52px);
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 12px;
  background: transparent;
}

.popup-close{
  position:absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 26px;
  cursor:pointer;
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.92);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 80;
}
.toast.hidden{display:none}

@media (max-width: 640px){
  .choices{grid-template-columns: 1fr}
  .question{font-size: 26px; line-height:1.45}
  .choice{font-size:16px; padding:12px}
  .quiz-wrap{padding:12px}
  .card{padding:16px}
  .quiz-top{font-size:12px; gap:8px; flex-wrap:wrap}
}


/* ===== Two-column quiz layout with side image ===== */
.quiz-layout{
  width:min(1200px, 96vw);
  display:flex;
  gap:24px;
  align-items:stretch;
}
.quiz-image{
  flex: 0 0 40%;
  background: url("assets/quiz_side.png") center/cover no-repeat;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow);
  min-height: 520px;
}
.quiz-area{ flex: 1; min-width:0; width:100%; }
@media (max-width: 900px){
  .quiz-layout{ flex-direction:column; gap:14px; }
  .quiz-image{ height:220px; min-height:220px; }
}
@media (max-width: 480px){
  .quiz-image{ height:160px; min-height:160px; }
}


/* ===== Punish Caption ===== */
.punish-caption{
  position:absolute;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  font-size:64px;
  font-weight:900;
  color:#ffdddd;
  text-shadow:0 0 20px rgba(255,0,0,0.6),
              0 0 40px rgba(255,0,0,0.4);
  pointer-events:none;
  letter-spacing:4px;
}
.punish-caption.hidden{
  display:none;
}


.btn.danger{border-color:#b33;color:#b33}
.btn.danger:hover{background:rgba(179,51,51,.08)}


/* Gallery */
.gallery-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin: 14px 0 4px;
}
.gallery-list .btn{
  width:100%;
  text-align:left;
}

#storyHint{font-size:16px; color:rgba(255,255,255,.72); margin-top:8px}

.gauge-wrap{margin-top:10px; margin-bottom:14px}
.gauge-label{font-size:14px; color:rgba(255,255,255,.78); margin-bottom:6px}
.gauge-bar{width:100%; height:16px; background:rgba(255,255,255,.16); border-radius:999px; overflow:hidden; border:1px solid rgba(255,255,255,.18)}
.gauge-fill{height:100%; width:0%; background:linear-gradient(90deg,#7fd3ff 0%,#86ffa7 100%); transition:width .25s ease}

.gauge-bar{
  height:22px;
  background:#222;
  border:2px solid #fff;
}
.gauge-fill{
  background:linear-gradient(90deg,#00e5ff,#00ff88);
}
#gaugeText{
  font-size:18px;
  font-weight:bold;
  color:#fff;
}


/* ===== Confession screen ===== */
.confession-panel{
  margin-top: 70px;
  text-align:center;
  max-width: 760px;
}
.confession-text{
  white-space: pre-line;
  font-size: 24px;
  line-height: 1.9;
  color: rgba(255,255,255,.92);
  margin: 18px 0 26px;
}
.confession-buttons{
  justify-content: center;
}
@media (max-width: 640px){
  .confession-text{font-size: 20px; line-height: 1.8;}
}


.review-panel{
  width:min(860px, 94vw);
}
.review-list{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-top:14px;
  max-height:58vh;
  overflow:auto;
  padding-right:4px;
}
.review-item{
  position:relative;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  padding:16px 16px 14px 52px;
}
.review-no{
  position:absolute;
  left:14px;
  top:14px;
  width:26px;
  height:26px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,210,120,.18);
  border:1px solid rgba(255,210,120,.28);
  font-weight:700;
}
.review-question{
  font-size:18px;
  font-weight:700;
  line-height:1.6;
  margin-bottom:10px;
}
.review-row{
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin:6px 0;
  color:rgba(255,255,255,.88);
}
.review-row span{
  min-width:90px;
  color:rgba(255,255,255,.68);
}
.review-correct{color:#b8ffd0}
.review-wrong{color:#ffb7b7}
.review-expl{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.92);
  line-height:1.7;
}


@media (max-width: 640px){
  .start-overlay{
    align-items:flex-end;
    justify-content:center;
    padding: 16px;
    background: linear-gradient(180deg, rgba(0,0,0,.16) 0%, rgba(0,0,0,.28) 40%, rgba(0,0,0,.72) 100%);
  }
  .menu{
    width:min(100%, 420px);
    margin-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .popup-card{
    width:min(96vw, 960px);
    max-height:min(88vh, 900px);
    padding:10px;
  }
  .popup-card video,
  .popup-card img{
    max-height: calc(88vh - 84px);
  }
}
