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

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: linear-gradient(160deg, #141e46 0%, #3b1d5e 55%, #7a1f4d 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 640px;
  padding: 24px 16px 40px;
}

.screen { display: none; text-align: center; }
.screen.active { display: block; }

/* スタート画面 */
.logo {
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffd93b;
  text-shadow: 0 4px 0 #b3541e, 0 8px 24px rgba(0,0,0,.45);
  margin-bottom: 12px;
}
.tagline { font-size: 1.15rem; line-height: 1.7; margin-bottom: 24px; }
.rules {
  background: rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  line-height: 1.9;
  font-size: .95rem;
  margin-bottom: 28px;
}
.best { margin-top: 18px; color: #ffd93b; font-weight: 700; min-height: 1.4em; }

.btn-main {
  font-size: 1.3rem;
  font-weight: 800;
  color: #3b1d5e;
  background: #ffd93b;
  border: none;
  border-radius: 999px;
  padding: 14px 52px;
  cursor: pointer;
  box-shadow: 0 5px 0 #b3541e;
  transition: transform .05s;
}
.btn-main:active { transform: translateY(3px); box-shadow: 0 2px 0 #b3541e; }

/* ゲーム画面 */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.progress { font-size: 1.05rem; font-weight: 800; color: #ffd93b; }
.timer-text { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer-text.danger { color: #ff5a5a; }

.timer-bar-wrap {
  height: 14px;
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 28px;
}
#timer-bar {
  height: 100%;
  width: 100%;
  background: #37d67a;
  border-radius: 999px;
}
#timer-bar.danger { background: #ff5a5a; }

.rank-live { text-align: center; font-size: .95rem; font-weight: 800; color: #ffd93b; min-height: 1.4em; margin-bottom: 14px; }

.question {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.6;
  min-height: 3.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  padding: 0 4px;
}

.choices { display: flex; gap: 14px; }
.choice {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.4;
  color: #fff;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 16px;
  padding: 26px 10px;
  cursor: pointer;
  min-height: 110px;
  word-break: break-word;
}
#choice-left { background: #2563eb; }
#choice-right { background: #dc2626; }
.choice:active { filter: brightness(1.25); }
.choice.correct { background: #37d67a !important; color: #08351a; border-color: #fff; }
.choice.wrong { background: #444 !important; opacity: .65; }

.hint { margin-top: 18px; font-size: .8rem; opacity: .6; }

/* 結果画面 */
.result-title { font-size: 2.4rem; font-weight: 900; margin-bottom: 14px; }
.result-title.clear { color: #ffd93b; }
.result-title.over { color: #ff8a8a; }
.result-detail { font-size: 1.05rem; line-height: 1.8; margin-bottom: 10px; }
.result-next { font-size: 1.15rem; font-weight: 800; color: #ffd93b; margin-bottom: 10px; min-height: 1.4em; }
.result-answer { font-size: 1rem; color: #ffd93b; font-weight: 700; margin-bottom: 6px; min-height: 1.4em; }
.result-buttons {
  margin-top: 26px;
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.btn-share {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: #000;
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 999px;
  padding: 12px 30px;
  text-decoration: none;
}

.btn-sub {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 10px 28px;
  cursor: pointer;
  margin-top: 14px;
}
.btn-sub:active { background: rgba(255,255,255,.3); }
.btn-sub:disabled { opacity: .45; cursor: default; }

/* ランキング登録フォーム */
.rank-form { margin-top: 20px; }
.rank-form input {
  font-size: 1rem;
  padding: 11px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,.5);
  background: rgba(0,0,0,.3);
  color: #fff;
  width: min(260px, 80%);
  text-align: center;
}
.rank-form input::placeholder { color: rgba(255,255,255,.5); }
.rank-form .btn-sub { margin-top: 10px; display: inline-block; }
.register-msg { margin-top: 10px; color: #ffd93b; font-weight: 700; min-height: 1.4em; }

/* ランキング画面 */
.ranking-title { font-size: 2rem; font-weight: 900; color: #ffd93b; margin-bottom: 10px; }
.ranking-note { font-size: .9rem; opacity: .85; margin-bottom: 16px; min-height: 1.3em; }
.ranking-list { text-align: left; margin-bottom: 24px; }
.rank-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: rgba(255,255,255,.09);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 7px;
}
.rank-row .pos { font-weight: 900; color: #ffd93b; min-width: 2.4em; }
.rank-row .nm { flex: 1; font-weight: 700; word-break: break-all; }
.rank-row .sc { font-weight: 900; font-variant-numeric: tabular-nums; }
.rank-row .lv { font-size: .8rem; opacity: .75; min-width: 3.2em; text-align: right; }
.rank-row.top1 { background: rgba(255,217,59,.22); }

@media (max-width: 480px) {
  .logo { font-size: 2.6rem; }
  .question { font-size: 1.25rem; }
  .choice { font-size: 1.05rem; min-height: 96px; padding: 20px 6px; }
}
