@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

:root {
  --bg0: #5f7fe6;
  --bg1: #6a8bea;
  --bg2: #7897ee;
  --text: #f7fbff;
  --ink: #10204a;
  --muted: #dce9ff;
  --accent: #1f66ff;
  --accent2: #0f4bd1;
  --danger: #d93f57;
  --ok: #1b8f4a;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  touch-action: auto;
  color: var(--text);
  font-family: "DotGothic16", sans-serif;
  letter-spacing: 0.05em;
}

html.result-scroll-unlock {
  overflow-y: auto;
  height: auto;
}

body.result-scroll-unlock {
  overflow-y: auto;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
}

body {
  background: #69bbff;
}

body[data-level="2"] {
  background: #69bbff;
}

body[data-level="3"] {
  background: #69bbff;
}

body.fever {
  animation: feverBg 0.7s linear infinite;
}

@keyframes feverBg {
  0% { filter: saturate(1) brightness(1); }
  50% { filter: saturate(1.25) brightness(1.08); }
  100% { filter: saturate(1) brightness(1); }
}

#app {
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 10px 0;
}

body.result-scroll-unlock #app {
  height: auto;
  min-height: 100dvh;
  align-items: flex-start;
  overflow: visible;
}

.screen {
  width: min(100%, 520px);
  height: 100%;
  max-height: 940px;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

#titleScreen {
  background: transparent;
  border: 0;
  box-shadow: none;
  max-height: none;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#titleScreen::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#quizScreen {
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  gap: clamp(4px, 1.3vw, 10px);
}

#quizScreen .quiz-top-card,
#quizScreen .prompt-flat,
#quizScreen .host-wrap,
#quizScreen .choices,
#quizScreen .time-meter-wrap {
  flex-shrink: 0;
}

#resultScreen {
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

body.result-scroll-unlock #resultScreen {
  height: auto;
  max-height: none;
  overflow: visible;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.screen.active {
  display: flex;
}

.screen::before {
  content: none;
}

.screen > * {
  position: relative;
  z-index: 1;
}

#titleScreen {
  gap: clamp(8px, 2.2vw, 14px);
  padding:
    calc(8px + env(safe-area-inset-top))
    clamp(10px, 3.2vw, 16px)
    calc(12px + env(safe-area-inset-bottom));
}

#titleScreen > .title-screen__character,
#titleScreen > .title-card,
#titleScreen > .title-screen__cta,
#titleScreen > .title-credit {
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1), opacity 1s ease;
  will-change: transform, opacity;
}

#titleScreen.title-start-hide > .title-screen__character,
#titleScreen.title-start-hide > .title-card,
#titleScreen.title-start-hide > .title-screen__cta,
#titleScreen.title-start-hide > .title-credit {
  transform: translateY(200px);
  opacity: 0;
  pointer-events: none;
}

.title-center-host {
  position: fixed;
  left: 50%;
  top: 50%;
  --title-host-offset-y: clamp(54px, 10vh, 86px);
  transform: translate(-50%, calc(-50% + var(--title-host-offset-y))) scale(0.82);
  width: min(78vw, 430px);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}

.title-center-host__img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  animation: titleKokeshiFloat 1.2s steps(2, end) infinite;
}

#titleScreen.title-focus-character .title-center-host {
  animation: titleCenterIn 1s cubic-bezier(0.32, 0, 0.67, 0) forwards;
}

.title-screen__header {
  text-align: center;
}

.title-screen__title {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: clamp(6px, 2vw, 12px);
  color: #eef6ff;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.42);
}

.title-screen__title-main {
  font-size: clamp(32px, 9.6vw, 58px);
}

.title-screen__ver {
  font-size: clamp(14px, 3.8vw, 20px);
  letter-spacing: 0.04em;
  opacity: 0.95;
}

.title-screen__subtitle {
  margin: clamp(4px, 1.2vw, 8px) 0 0;
  font-size: clamp(13px, 3.2vw, 18px);
  color: #e7f2ff;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(14, 36, 88, 0.35);
}

.title-screen__ver-inline {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0;
  border-radius: 0;
  font-size: 0.88em;
  line-height: 1;
  color: #ffef5a;
  background: transparent;
  text-shadow: 0 1px 0 rgba(89, 66, 8, 0.45);
}

.title-screen__character {
  display: grid;
  place-items: center;
  padding: clamp(2px, 0.8vw, 6px) 0;
  position: relative;
}

.title-screen__character > .title-screen__character-img,
.title-screen__character > .title-countdown {
  grid-area: 1 / 1;
}

.title-screen__character-img {
  width: 78%;
  max-width: 520px;
  height: auto;
  image-rendering: pixelated;
  animation: titleKokeshiFloat 1.2s steps(2, end) infinite;
}

.title-countdown {
  position: fixed;
  left: 50%;
  top: 50%;
  --title-countdown-offset-y: clamp(118px, 19vh, 164px);
  transform: translate(-50%, calc(-50% - var(--title-countdown-offset-y)));
  width: min(70vw, 390px);
  opacity: 0;
  pointer-events: none;
  transform-origin: center center;
  z-index: 40;
}

.title-countdown.show {
  animation: titleCountImage 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.title-countdown img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

@keyframes titleCountImage {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - var(--title-countdown-offset-y))) scale(0.88);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - var(--title-countdown-offset-y))) scale(0.94);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - var(--title-countdown-offset-y))) scale(1.18);
  }
}

@keyframes titleCenterIn {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--title-host-offset-y))) scale(0.82);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, calc(-50% + var(--title-host-offset-y))) scale(1);
  }
}

@keyframes titleKokeshiFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.title-card {
  background: rgba(12, 58, 174, 0.35);
  border-radius: 12px;
  padding: clamp(10px, 2.8vw, 16px);
  box-shadow: 0 3px 0 rgba(9, 28, 97, 0.5);
}

.title-card--rules {
  background: linear-gradient(180deg, rgba(6, 35, 126, 0.62) 0%, rgba(13, 56, 170, 0.5) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(176, 214, 255, 0.45),
    0 3px 0 rgba(9, 28, 97, 0.55);
}

.title-card--nickname {
  background: linear-gradient(180deg, rgba(12, 71, 188, 0.42) 0%, rgba(8, 50, 150, 0.35) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.26),
    0 3px 0 rgba(9, 28, 97, 0.45);
}

.title-card--rank {
  background: linear-gradient(180deg, rgba(20, 84, 120, 0.46) 0%, rgba(14, 66, 112, 0.38) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(192, 239, 255, 0.3),
    0 3px 0 rgba(8, 38, 74, 0.45);
}

.title-card__heading {
  margin: 0 0 clamp(6px, 1.4vw, 10px);
  font-size: clamp(16px, 4.2vw, 24px);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.52);
}

.title-card--rules .title-card__heading {
  text-align: center;
}

.title-card__desc {
  margin: 0 0 clamp(6px, 1.4vw, 10px);
  font-size: clamp(15px, 4.2vw, 22px);
  font-weight: 700;
  line-height: 1.28;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
}

.title-card__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.title-card__list li {
  font-size: clamp(15px, 4.2vw, 22px);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
  line-height: 1.28;
}

.title-card__list li::before {
  content: "■";
  margin-right: 0.2em;
  color: #ffe96d;
}

.rules-detail {
  margin-top: 6px;
}

.rules-detail__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  text-align: center;
  font-size: clamp(14px, 3.6vw, 18px);
  font-weight: 700;
  color: #fff57c;
  text-shadow: 0 1px 0 rgba(53, 43, 2, 0.48);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(7, 31, 105, 0.52);
}

.rules-detail__summary::-webkit-details-marker {
  display: none;
}

.rules-detail__body {
  margin-top: 8px;
}

.title-card__note {
  margin: clamp(6px, 1.6vw, 10px) 0 0;
  font-size: clamp(15px, 4.2vw, 22px);
  font-weight: 700;
  line-height: 1.28;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
  text-align: center;
}

.title-card__label {
  font-size: clamp(15px, 4.2vw, 22px);
  font-weight: 700;
  line-height: 1.28;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
  text-align: center;
}

.title-card__nickname {
  display: block;
  margin-top: clamp(4px, 1.2vw, 8px);
  font-size: clamp(15px, 4.2vw, 22px);
  font-weight: 700;
  color: #ffef5a;
  text-align: center;
  line-height: 1.28;
  letter-spacing: 0.05em;
  text-shadow:
    0 2px 0 rgba(14, 36, 88, 0.45);
}

.title-card__nickname-action {
  margin-top: clamp(8px, 2vw, 12px);
  display: grid;
  place-items: center;
}

.nickname-edit-btn {
  min-height: 56px;
  min-width: min(100%, 280px);
  padding: 10px 14px;
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffffff 0%, #e7f0ff 100%);
  color: #214a9b;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 3px 0 #9bb5e6;
}

.nickname-edit-btn:disabled {
  opacity: 0.6;
  filter: grayscale(0.2);
}

.title-screen__cta {
  margin-top: clamp(2px, 1.2vw, 8px);
  display: grid;
  gap: clamp(8px, 2vw, 12px);
}

#startBtn {
  min-height: 64px;
  font-size: clamp(32px, 8.6vw, 52px);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.35),
    0 2px 0 rgba(124, 14, 44, 0.9);
  background: linear-gradient(180deg, #ff3f6b 0%, #e11d56 100%);
  box-shadow:
    inset 0 -6px 0 rgba(0, 0, 0, 0.2),
    0 6px 0 #8e1034,
    0 0 0 3px rgba(255, 255, 255, 0.72);
}

#startBtn:active {
  transform: translateY(3px);
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.2),
    0 1px 0 rgba(124, 14, 44, 0.78);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.22),
    0 3px 0 #8e1034,
    0 0 0 2px rgba(255, 255, 255, 0.65);
}

.rank-optin-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: clamp(8px, 2vw, 12px);
}

.rank-optin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #5b7fbf 0%, #4369a5 100%);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 4px 0 #2a4875;
  color: #ffffff;
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
  cursor: pointer;
  touch-action: manipulation;
}

.rank-optin-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.24),
    0 2px 0 #243f66;
}

.rank-optin-btn.is-active {
  background: linear-gradient(180deg, #2ed07c 0%, #1ea85f 100%);
  transform: translateY(2px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 2px 0 #177b46;
}

.title-card__rank-note {
  margin: 8px 0 0;
  padding: 0;
  font-size: clamp(12px, 3.2vw, 15px);
  color: #ffffff;
  text-align: center;
  text-shadow: 0 1px 0 rgba(14, 36, 88, 0.4);
}

.sound-btn {
  min-height: 48px;
  padding: 10px 12px;
  font-size: clamp(14px, 3.6vw, 18px);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #1f3f88;
  background: #ffffff;
  border-radius: 10px;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.12),
    0 2px 0 rgba(20, 56, 130, 0.28);
}

#soundBtn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 1px 0 rgba(20, 56, 130, 0.24);
}

.sound-btn.off {
  color: #ffffff;
  background: #8aa0cc;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.16),
    0 2px 0 rgba(16, 36, 80, 0.28);
}

.title-rank-btn {
  min-height: 52px;
  padding: 10px 12px;
  font-size: clamp(16px, 4.2vw, 22px);
  letter-spacing: 0.06em;
}

.title-rank-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.title-rank-modal[hidden] {
  display: none;
}

.title-rank-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 24, 66, 0.66);
}

.title-rank-modal__panel {
  position: relative;
  width: min(100%, 720px);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 10px;
  border: 2px solid rgba(215, 233, 255, 0.75);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(84, 140, 226, 0.95) 0%, rgba(63, 118, 212, 0.95) 100%);
  box-shadow: 0 10px 28px rgba(2, 13, 35, 0.45);
}

.title-rank-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.title-rank-modal__title {
  margin: 0;
  font-size: clamp(20px, 6vw, 30px);
  color: #ffffff;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.45);
}

.title-rank-modal__close {
  min-height: 44px;
  min-width: 88px;
  padding: 8px 12px;
  font-size: clamp(13px, 3.4vw, 16px);
  border-radius: 10px;
}

.title-credit {
  margin-top: auto;
  text-align: center;
  color: #ffffff;
  font-size: clamp(10px, 2.7vw, 12px);
  line-height: 1.35;
  opacity: 0.92;
  padding-bottom: env(safe-area-inset-bottom);
}

.title-policy-link-wrap {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.title-policy-link {
  color: #eef6ff;
  font-size: clamp(10px, 2.6vw, 12px);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  opacity: 0.95;
}

.title-policy-link:hover,
.title-policy-link:focus-visible {
  color: #ffffff;
  opacity: 1;
}

button,
.choice {
  border: 0;
  padding: 14px 10px;
  color: #ffffff;
  background: linear-gradient(180deg, #2f78ff 0%, #1f5fe1 100%);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 4px 0 #1a459f;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 14px;
}

button:active,
.choice:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 2px 0 #1a3b88;
}

.secondary {
  background: linear-gradient(180deg, #23c078 0%, #159d60 100%);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 4px 0 #0f7648;
}

.quiz-title {
  text-align: center;
  font-weight: 800;
  font-size: clamp(30px, 9vw, 54px);
  line-height: 1;
  color: #eef6ff;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.42);
  margin: 0;
}

.quiz-top-card {
  width: 100%;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  gap: clamp(4px, 1.2vw, 8px);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 1.2vw, 8px);
  align-items: stretch;
  margin: 0;
}

.status-strip > .combo,
.status-strip > .master-badge,
.status-strip > .live-score {
  min-height: clamp(38px, 8.2vw, 52px);
}

.hud-label {
  font-size: clamp(11px, 2.9vw, 14px);
  opacity: 0.95;
}

.hud-value {
  font-size: clamp(23px, 5.8vw, 34px);
  line-height: 1;
}

.hud-unit {
  font-size: clamp(13px, 3.4vw, 18px);
  margin-left: 2px;
}

.host-wrap {
  --host-w: 146px;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 4px 0 0;
  position: relative;
  min-height: 150px;
  z-index: 1;
}

.host-col {
  --speech-w: 68px;
  position: relative;
  width: min(100%, var(--host-w));
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  justify-items: center;
  overflow: visible;
}

.master-badge {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 2px 6px;
  border: 0;
  background: #0f41d2;
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(13px, 3.8vw, 22px);
  border-radius: 0;
  box-shadow: 1px 1px 0 #ffffff;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  text-align: center;
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.master-on {
  opacity: 1;
}

.combo {
  display: grid;
  place-items: center;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  min-height: 0;
  font-size: clamp(13px, 3.8vw, 22px);
  color: #ffffff;
  background: #ff2f3d;
  padding: 2px 4px;
  border-radius: 0;
  box-shadow: 1px 1px 0 #ffffff;
  letter-spacing: 0.03em;
  line-height: 1.05;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 0;
}

.live-score {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  background: #101010;
  color: #ffffff;
  min-height: 0;
  font-size: clamp(13px, 3.8vw, 22px);
  font-weight: 700;
  padding: 0 4px;
  box-shadow: 1px 1px 0 #ffffff;
  border: 0;
  line-height: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
}

.live-score b {
  font-weight: 800;
  line-height: 1;
}

.score-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  white-space: nowrap;
  line-height: 1;
  word-break: keep-all;
  letter-spacing: 0.03em;
}

.score-inline b {
  display: inline-block;
}

.mini-time {
  display: none;
}

.mini-time b {
  color: #fff;
  font-size: 1em;
}

.event-banner {
  position: absolute;
  --event-host-gap: 1px;
  left: 0;
  right: calc(50% + (var(--host-w) / 2) + var(--event-host-gap));
  top: 50%;
  min-height: 56px;
  padding: 2px 6px;
  border: 1px solid rgba(214, 233, 255, 0.75);
  background: linear-gradient(180deg, rgba(84, 140, 226, 0.48) 0%, rgba(61, 116, 211, 0.36) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  border-radius: 2px;
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  color: #eef6ff;
  letter-spacing: 0.04em;
  opacity: 0;
  overflow: visible;
  white-space: pre-line;
  line-height: 1.12;
  transform: translateY(-50%) translateX(4px);
  transition: opacity 0.15s steps(2, end), transform 0.15s steps(2, end);
  z-index: 3;
  pointer-events: none;
}

.event-banner.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.event-banner.pop {
  animation: eventPop 0.26s steps(2, end);
}

.event-line {
  display: block;
}

.event-line--total {
  margin-top: 2px;
  font-size: 1.04em;
  color: #fffef6;
  text-shadow: 0 1px 0 rgba(38, 29, 2, 0.55), 0 0 7px rgba(255, 250, 184, 0.55);
}

.event-banner.total-focus {
  text-align: center;
}

.event-banner.total-focus .event-line {
  font-size: 1.62em;
  line-height: 1.08;
  letter-spacing: 0.06em;
}

.event-value {
  display: inline-block;
  animation: eventValuePop 0.34s steps(2, end);
}

.event-banner.bad {
  color: #ffd8de;
}

.event-banner.good {
  color: #d6ffe6;
}

.event-banner.speed {
  color: #ffe933;
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(38, 29, 2, 0.45), 0 0 5px rgba(255, 233, 51, 0.38);
}

.event-banner.show.speed {
  min-height: 64px;
}

.event-banner.levelup {
  color: #fff9b8;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.1em;
  border: 2px solid rgba(255, 242, 156, 0.95);
  background: linear-gradient(180deg, rgba(76, 142, 255, 0.75) 0%, rgba(28, 90, 195, 0.72) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65), 0 0 12px rgba(255, 244, 150, 0.5);
  text-shadow: 0 1px 0 rgba(60, 45, 9, 0.78), 0 0 8px rgba(255, 246, 145, 0.7);
}

.event-banner.levelup .event-line:first-child {
  font-size: 1.72em;
}

.event-banner.levelup .event-value {
  animation: levelValuePop 0.45s steps(2, end);
}

.event-banner.show.levelup {
  min-height: 78px;
}

.event-banner.sticky {
  animation: stickyFlash 0.45s steps(2, end) infinite;
}

@keyframes stickyFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@keyframes eventPop {
  0% { transform: translateY(-50%) translateX(0) scale(1); }
  45% { transform: translateY(calc(-50% - 5px)) translateX(0) scale(1.04); }
  100% { transform: translateY(-50%) translateX(0) scale(1); }
}

@keyframes eventValuePop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-4px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes levelValuePop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-5px) scale(1.18); }
  100% { transform: translateY(0) scale(1); }
}

.main-host {
  grid-column: 1;
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  image-rendering: pixelated;
  margin-top: 0;
  z-index: 1;
  justify-self: center;
  animation: hostIdleFloat 1.2s steps(2, end) infinite;
}

.main-host.bounce {
  animation: hostBounce 0.34s ease-out;
}

.main-host.shake {
  animation: hostShake 0.28s steps(2, end);
}

@keyframes hostBounce {
  0% { transform: translateY(0); }
  30% { transform: translateY(-14px); }
  58% { transform: translateY(0); }
  78% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

@keyframes hostShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

@keyframes hostIdleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.prompt-flat {
  position: relative;
  width: 100%;
  padding: 0;
  text-align: center;
  background: #f4f4f4;
  border: 0;
  box-shadow: 1px 1px 0 #ffffff;
  border: 2px solid #0b1d8d;
  border-radius: 0;
  overflow: visible;
  z-index: 2;
}

.question-head {
  background: #07198d;
  color: #fff;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 800;
  line-height: 1.15;
  padding: 2px;
}

.question-body {
  background: #f4f4f4;
  min-height: clamp(70px, 14vw, 92px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  position: relative;
  overflow: hidden;
}

.prompt-text {
  width: 100%;
  color: #101010;
  font-weight: 800;
  line-height: 1.2;
  text-shadow: none;
}

.prompt-qno {
  display: none;
}

.prompt-body {
  font-size: 40px;
  font-size: clamp(30px, 8.6vw, 48px);
  font-weight: 800;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.15;
  letter-spacing: 0.01em;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.prompt-flat.pop {
  animation: popPixel 0.2s steps(2, end);
}

.prompt-flat.rise {
  animation: riseBubble 0.32s ease-out;
}

.prompt-flat.shake {
  animation: shakePixel 0.24s steps(2, end);
}

@keyframes popPixel {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shakePixel {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

@keyframes riseBubble {
  0% {
    transform: translateY(12px) scale(0.97);
    opacity: 0.4;
  }
  65% {
    transform: translateY(-4px) scale(1.015);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.host-speech {
  position: absolute;
  left: calc(100% + 2px);
  top: 50%;
  transform: translateY(-50%);
  width: var(--speech-w);
  height: auto;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 2;
}

.host-speech.show {
  visibility: visible;
  opacity: 1;
}

.host-speech::after {
  content: none;
}

.host-speech-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.translation {
  display: none;
}

.timer-cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0;
  width: 100%;
  height: 42px;
  margin-top: 0;
}

.time-meter-wrap {
  display: grid;
  gap: 3px;
  margin-top: 2px;
}

.time-meter-label {
  text-align: center;
  font-size: clamp(12px, 3.2vw, 16px);
  color: #edf5ff;
  text-shadow: 0 1px 0 rgba(14, 36, 88, 0.45);
  letter-spacing: 0.04em;
}

.timer-cell {
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 194, 0, 0.18);
}

.timer-cell.on {
  background: linear-gradient(180deg, #ffd466 0%, #ffb800 100%);
}

.timer-cell.warn {
  background: linear-gradient(180deg, #ffd057 0%, #e29d2f 100%);
}

.timer-cell.danger {
  background: linear-gradient(180deg, #ff8e8e 0%, #ef4e4e 100%);
}

.timer-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.75);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(31, 35, 65, 0.15);
}

.timer-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff7b7b 0%, #d59f45 20%, #b8b04d 40%, #7ac238 70%, #33ff14 100%);
  transition: width 0.1s linear;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(6px, 1.4vw, 10px);
  margin-top: 3px;
}

.choice {
  position: relative;
  min-height: clamp(82px, 22vw, 112px);
  font-size: clamp(22px, 6vw, 34px);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #101010;
  background: #d7d7d7;
  border: 2px solid #f3f3f3;
  box-shadow:
    0 5px 0 #0a2d8f,
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  line-height: 1.15;
  padding: 6px;
  transition: transform 0.08s ease, filter 0.08s ease, box-shadow 0.08s ease;
}

.choice:hover {
  filter: brightness(1.02);
}

.choice:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 #0a2d8f,
    inset 0 1px 0 rgba(0, 0, 0, 0.12);
}

.choice.debug-answer {
  background: #ffea7f;
  color: #2a1b00;
}

.choice.correct {
  background: #2aca7c;
  color: #fff;
  animation: correctFlash 0.38s steps(2, end) 1;
}

.choice.wrong {
  background: #ff5d69;
  color: #fff;
  animation: wrongFlash 0.34s steps(2, end) 1;
}

.choice.disabled {
  opacity: 1;
}

.choice-mark {
  position: absolute;
  right: 10px;
  top: 6px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(82, 14, 27, 0.45);
  pointer-events: none;
}

.combo.bump,
.live-score.bump {
  animation: hudBump 0.26s steps(2, end);
}

@keyframes hudBump {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  50% { transform: translateY(-2px) scale(1.05); filter: brightness(1.12); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes correctFlash {
  0% { filter: brightness(1); }
  45% { filter: brightness(1.35); }
  100% { filter: brightness(1); }
}

@keyframes wrongFlash {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.3) saturate(1.15); }
  100% { filter: brightness(1); }
}

.result-title {
  text-align: center;
  font-weight: 800;
  font-size: 34px;
  color: #ffffff;
  text-shadow: none;
  margin-top: 4px;
}

.result-title--compact {
  font-size: clamp(24px, 7.4vw, 40px);
  color: #eef6ff;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 rgba(14, 36, 88, 0.42);
}

.result-compact-card {
  background: rgba(9, 27, 84, 0.44);
  border: 1px solid rgba(214, 230, 255, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.result-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.result-summary-item {
  background: rgba(4, 13, 41, 0.42);
  border: 1px solid rgba(196, 214, 244, 0.35);
  padding: 6px;
  display: grid;
  gap: 2px;
}

.result-summary-item span {
  font-size: 12px;
  color: #d9e8ff;
}

.result-summary-item b {
  font-size: clamp(18px, 4.8vw, 28px);
  color: #ffffff;
}

.result-summary-item--soft b {
  font-size: clamp(15px, 4vw, 22px);
}

.result-list {
  background: transparent;
  border: 0;
  padding: 0;
}

.result-list {
  display: grid;
  gap: 6px;
}

.rank-meta {
  display: grid;
  gap: 4px;
}

.result-disclosure {
  background: rgba(8, 26, 80, 0.25);
  border: 1px solid rgba(196, 214, 244, 0.35);
  border-radius: 8px;
  padding: 4px 6px;
}

.result-disclosure > summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  color: #e7f1ff;
  text-align: center;
}

.result-disclosure > summary::-webkit-details-marker {
  display: none;
}

.result-disclosure[open] > summary {
  margin-bottom: 6px;
}

.result-disclosure[open] {
  background: rgba(10, 36, 102, 0.62);
  border-color: rgba(214, 230, 255, 0.55);
}

.leaderboard-box {
  margin-top: 6px;
  background: rgba(12, 28, 88, 0.35);
  padding: 6px;
  box-shadow: 1px 1px 0 #ffffff;
}

.leaderboard-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffe96d;
  text-shadow: 0 1px 0 rgba(53, 43, 2, 0.48);
  margin-bottom: 4px;
}

.leaderboard-list {
  display: grid;
  gap: 2px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  font-size: 13px;
  line-height: 1.2;
  padding: 3px 0;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
}

.leaderboard-row:last-child {
  border-bottom: 0;
}

.leaderboard-row--self {
  background: transparent;
  box-shadow: none;
}

.leaderboard-self-inline {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  line-height: 1.2;
  font-size: 11px;
  color: #000000;
  background: #ffe96d;
  vertical-align: middle;
}

.leaderboard-row--compact {
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
}

.leaderboard-row--ranked-date {
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
}

.leaderboard-date {
  color: #d6e6ff;
  font-size: 11px;
  min-width: 38px;
}

.leaderboard-rank {
  color: #ffe96d;
  font-size: 12px;
  min-width: 22px;
}

.leaderboard-time {
  color: #d6e6ff;
  font-size: 11px;
  min-width: 36px;
}

.perfect-badge {
  display: none;
  text-align: center;
  color: #ffe933;
  background: rgba(13, 26, 94, 0.5);
  padding: 6px 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 1px 1px 0 #ffffff;
}

.perfect-badge.show {
  display: block;
  animation: perfectBlink 0.8s steps(2, end) infinite;
}

.result-ad-wrap {
  margin-top: 8px;
  min-height: 54px;
}

.result-ad-wrap .adsbygoogle {
  border-radius: 6px;
  overflow: hidden;
}

.result-ad-fallback {
  display: none;
  margin-top: 6px;
  text-align: center;
  font-size: clamp(14px, 3.8vw, 20px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 0 rgba(14, 36, 88, 0.45);
}

.result-ad-fallback.show {
  display: block;
}

.big-score {
  text-align: center;
  margin-top: 2px;
}

.big-score-label {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.big-score-value {
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 800;
  line-height: 1;
  color: #ffe933;
  text-shadow: 1px 1px 0 #10204a;
}

.result-rank-title {
  margin-top: 6px;
  font-size: clamp(16px, 4.8vw, 24px);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 1px 1px 0 #10204a;
  transition: filter 0.2s ease;
  animation: rankBlink 1.1s steps(2, end) infinite;
}

.result-rank-title--tier-0 {
  color: #dce7ff;
  text-shadow: 1px 1px 0 #0f2048;
}

.result-rank-title--tier-1 {
  color: #e7f4ff;
  text-shadow: 1px 1px 0 #11336a;
}

.result-rank-title--tier-2 {
  color: #d7f3ff;
  text-shadow: 1px 1px 0 #0f4172;
}

.result-rank-title--tier-3 {
  color: #ceffe8;
  text-shadow: 1px 1px 0 #0f5a45, 0 0 4px rgba(164, 255, 218, 0.35);
}

.result-rank-title--tier-4 {
  color: #bdf8ff;
  text-shadow: 1px 1px 0 #0c4c74, 0 0 6px rgba(166, 248, 255, 0.45);
}

.result-rank-title--tier-5 {
  color: #fff3b8;
  text-shadow: 1px 1px 0 #5b4612, 0 0 7px rgba(255, 236, 141, 0.52);
}

.result-rank-title--tier-6 {
  color: #ffe787;
  text-shadow: 1px 1px 0 #5f420f, 0 0 9px rgba(255, 230, 119, 0.62);
}

.result-rank-title--tier-7 {
  color: #ffd461;
  text-shadow: 1px 1px 0 #6c3a0c, 0 0 11px rgba(255, 200, 95, 0.68);
  animation: rankShine 1.15s steps(2, end) infinite;
}

.result-rank-title--tier-8 {
  color: #ffe991;
  text-shadow: 1px 1px 0 #6e3e0a, 0 0 14px rgba(255, 238, 145, 0.85);
  animation: rankShine 0.9s steps(2, end) infinite;
}

.result-rank-title--tier-9 {
  color: #fff6c8;
  text-shadow: 1px 1px 0 #7a3e08, 0 0 16px rgba(255, 243, 160, 0.95);
  animation: rankLegendPulse 0.72s steps(2, end) infinite;
}

@keyframes perfectBlink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.6; }
}

@keyframes rankShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes rankLegendPulse {
  0%, 100% { filter: brightness(1) saturate(1); transform: scale(1); }
  50% { filter: brightness(1.3) saturate(1.2); transform: scale(1.03); }
}

@keyframes rankBlink {
  0%, 62% { opacity: 1; }
  63%, 100% { opacity: 0.72; }
}

.result-line {
  display: flex;
  justify-content: space-between;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed rgba(235, 244, 255, 0.5);
  padding: 7px 2px;
  font-size: 15px;
}

.result-line span:last-child {
  color: #ffffff;
  font-weight: 700;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  position: static;
  padding-top: 0;
  background: transparent;
}

#retryBtn {
  order: 1;
}

#shareBtn {
  order: 2;
}

#shareImageBtn {
  order: 3;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(17, 41, 97, 0.92);
  border: 0;
  color: #ffffff;
  padding: 8px 10px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s steps(2, end);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 430px) {
  .screen {
    padding: 10px;
    gap: 8px;
  }

  #titleScreen {
    padding:
      calc(8px + env(safe-area-inset-top))
      10px
      calc(10px + env(safe-area-inset-bottom));
  }

  .title-screen__title-main { font-size: clamp(28px, 9vw, 42px); }
  .title-screen__subtitle { font-size: clamp(12px, 3.4vw, 14px); }
  .title-screen__character-img { width: 78%; }
  .title-card { padding: 10px; border-radius: 10px; }
  .title-card__nickname { font-size: clamp(15px, 4.2vw, 22px); }
  .title-credit { font-size: clamp(9px, 2.6vw, 11px); }

  .big-score-label { font-size: 20px; }
  .big-score-value { font-size: 42px; }
  .result-rank-title { font-size: 18px; }

  #startBtn { min-height: 62px; font-size: clamp(30px, 9.2vw, 44px); }
  .nickname-edit-btn { min-height: 44px; }
  .rank-optin-switch { gap: 6px; }
  .rank-optin-btn { min-height: 52px; font-size: 12px; }

  button,
  .choice {
    font-size: 18px;
    padding: 14px 10px;
  }

  .quiz-title { font-size: clamp(28px, 9vw, 42px); }

  .quiz-top-card { border-radius: 0; padding: 0; }

  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(4px, 1.2vw, 6px);
  }

  .status-strip > .combo,
  .status-strip > .master-badge,
  .status-strip > .live-score {
    height: auto;
  }

  .host-wrap {
    --host-w: 122px;
  }

  .host-col {
    --speech-w: 48px;
    width: min(100%, var(--host-w));
  }

  .main-host { width: 100%; max-height: 142px; }

  .prompt-flat { min-height: 0; }

  .question-head { font-size: clamp(14px, 4.4vw, 18px); padding: 2px; }

  .question-body { min-height: 58px; padding: 2px; }

  .prompt-body { font-size: clamp(24px, 7.2vw, 34px); }

  .master-badge,
  .combo,
  .live-score { font-size: clamp(13px, 4vw, 19px); }

  .mini-time { font-size: clamp(14px, 4vw, 18px); }

  .host-speech { width: var(--speech-w); }

  .choices { gap: 6px; margin-top: 2px; }

  .timer-cells { height: 32px; gap: 0; }

  .choice { min-height: 80px; font-size: clamp(21px, 5.8vw, 28px); border-radius: 2px; padding: 4px; }

  .choice-mark { font-size: 16px; top: 2px; right: 4px; }
}

@media (max-width: 390px), (max-height: 740px) {
  .screen {
    padding: 8px;
    gap: 6px;
  }

  .quiz-title { font-size: clamp(24px, 8vw, 36px); }

  .big-score-label { font-size: 18px; }
  .big-score-value { font-size: 36px; }

  .prompt-flat { min-height: 0; }

  .question-head {
    font-size: clamp(14px, 4.6vw, 18px);
    padding: 2px;
  }

  .question-body {
    min-height: 50px;
    padding: 2px;
  }

  .prompt-body {
    font-size: clamp(21px, 7vw, 30px);
    line-height: 1.1;
    letter-spacing: 0.01em;
  }

  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .status-strip > .combo,
  .status-strip > .master-badge,
  .status-strip > .live-score {
    height: auto;
  }

  .master-badge,
  .live-score { font-size: clamp(12px, 3.6vw, 17px); }

  .combo { font-size: clamp(11px, 3.2vw, 15px); }

  .mini-time {
    font-size: clamp(13px, 4vw, 16px);
  }

  .timer-cells {
    height: 32px;
    gap: 0;
  }

  .host-wrap {
    --host-w: 120px;
  }

  .host-col {
    --speech-w: 44px;
    width: min(100%, var(--host-w));
  }

  .main-host {
    width: 100%;
    max-height: 130px;
  }

  .host-speech {
    width: var(--speech-w);
  }

  .choices { gap: 5px; margin-top: 2px; }

  .event-banner { padding: 2px 5px; }
  .event-banner.speed { font-size: 14px; }
  .event-banner.show.speed { min-height: 62px; }

  .choice {
    min-height: 72px;
    font-size: clamp(18px, 5.2vw, 22px);
    border-radius: 2px;
    padding: 3px;
  }

  .choice-mark {
    font-size: 22px;
  }
}

@media (min-width: 430px) {
  .master-badge,
  .combo,
  .live-score { font-size: clamp(18px, 4.2vw, 34px); }
}
