* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: #241f18;
  background:
    linear-gradient(115deg, rgba(255, 211, 58, .72), transparent 43%),
    linear-gradient(247deg, rgba(68, 154, 198, .40), transparent 48%),
    linear-gradient(180deg, #fffdf6 0%, #f4ead2 100%);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  text-align: center;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(35, 31, 22, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 31, 22, .07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

button,
a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.game {
  position: fixed;
  inset: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto auto 32dvh minmax(0, 1fr) auto;
  gap: clamp(6px, 1.35dvh, 13px);
  max-width: 1020px;
  max-height: 760px;
  margin: auto;
  padding: clamp(8px, 1.7dvh, 18px);
  overflow: hidden;
  border: 2px solid rgba(35, 31, 22, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 18px 50px rgba(35, 31, 22, .16);
  backdrop-filter: blur(14px);
}

.topbar,
.scorebar,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

 .round {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 50px;
  min-height: 36px;
  border: 2px solid #241f18;
  border-radius: 8px;
  background: #fff;
  box-shadow: 3px 3px 0 #241f18;
  color: #241f18;
  font-size: clamp(.72rem, 2dvh, .9rem);
  font-weight: 950;
  line-height: 1;
}

button:focus-visible {
  outline: 3px solid #236cba;
  outline-offset: 3px;
}

.titleblock { min-width: 0; }
.titleblock p,
.qtag {
  margin: 0;
  color: #735a17;
  font-size: clamp(.56rem, 1.6dvh, .7rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
}

h1,
h2,
p { margin: 0; }

h1 {
  overflow: hidden;
  font-size: clamp(1.03rem, 3.75dvh, 1.85rem);
  font-weight: 950;
  line-height: 1.04;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: clamp(1rem, 3.1dvh, 1.62rem);
  font-weight: 950;
  line-height: 1.16;
}

.scorebar {
  min-height: 22px;
  font-size: clamp(.64rem, 1.9dvh, .82rem);
  font-weight: 950;
  white-space: nowrap;
}

.track {
  display: flex;
  flex: 1;
  height: clamp(12px, 2.2dvh, 18px);
  overflow: hidden;
  border: 2px solid #241f18;
  border-radius: 999px;
  background: #fff;
}

.track i,
.track b {
  display: block;
  width: 50%;
  height: 100%;
  transition: width .22s ease;
}
.track i { background: #4d9ccc; }
.track b { background: #f4bd36; }

.mascotRow {
  display: grid;
  grid-template-columns: minmax(96px, 40%) minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  gap: clamp(8px, 2vw, 18px);
}

.mascotFrame {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 2px solid rgba(35, 31, 22, .16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 242, 176, .96), transparent 39%),
    linear-gradient(160deg, #1f1b17 0%, #3f3528 55%, #f1bd31 100%);
}

.mascotFrame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: clamp(3px, 1dvh, 8px);
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .2));
  animation: bob 2.8s ease-in-out infinite;
}

.bubble {
  display: grid;
  align-items: center;
  min-height: clamp(52px, 10dvh, 88px);
  padding: clamp(9px, 1.8dvh, 15px);
  border: 2px solid #241f18;
  border-radius: 8px;
  background: #fff;
  box-shadow: 5px 5px 0 #241f18;
  font-size: clamp(.78rem, 2.25dvh, 1.02rem);
  font-weight: 850;
  line-height: 1.34;
}

.panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 1.55dvh, 13px);
  min-height: 0;
  padding: clamp(9px, 1.8dvh, 16px);
  overflow: hidden;
  border: 2px solid #241f18;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 6px 6px 0 #241f18;
}

.intro,
.resultText {
  max-width: 58ch;
  color: #594f3f;
  font-size: clamp(.74rem, 2.05dvh, .94rem);
  font-weight: 750;
  line-height: 1.4;
}

.answers {
  display: grid;
  width: 100%;
  gap: clamp(7px, 1.18dvh, 10px);
}

.answer,
.primary {
  min-height: clamp(42px, 7dvh, 54px);
  border: 2px solid #241f18;
  border-radius: 8px;
  color: #241f18;
  cursor: pointer;
  font-weight: 950;
  line-height: 1.12;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.answer {
  width: 100%;
  padding: 0 12px;
  background: #fff9df;
  box-shadow: 4px 4px 0 #241f18;
  font-size: clamp(.82rem, 2.35dvh, 1rem);
}
.answer:nth-child(2n) { background: #e7f5fb; }
.answer:nth-child(3n) { background: #ffe4d0; }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(240px, 100%);
  padding: 0 18px;
  background: #f6c63f;
  box-shadow: 5px 5px 0 #241f18;
  font-size: clamp(.9rem, 2.5dvh, 1.06rem);
}

.answer:active,`r`n.primary:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #241f18;
}

.resultMeter {
  display: flex;
  width: min(420px, 100%);
  height: clamp(34px, 5.6dvh, 44px);
  overflow: hidden;
  border: 2px solid #241f18;
  border-radius: 8px;
  background: #fff;
  font-size: clamp(.64rem, 1.8dvh, .82rem);
  font-weight: 950;
}
.resultMeter span {
  display: grid;
  min-width: 42px;
  place-items: center;
  overflow: hidden;
  white-space: nowrap;
}
.resultMeter span:first-child { background: #91d2ec; }
.resultMeter span:last-child { background: #f6c63f; }

footer {
  min-height: 18px;
  color: #5f5749;
  font-size: clamp(.5rem, 1.45dvh, .66rem);
  font-weight: 850;
  line-height: 1.2;
}
footer span:last-child {
  max-width: 58%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-5px) rotate(1deg); }
}

@media (orientation: landscape) and (min-width: 720px) {
  .game {
    grid-template-columns: .92fr 1.08fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .topbar,
  .scorebar,
  footer { grid-column: 1 / -1; }
  .mascotRow,
  .panel { grid-row: 3; }
  .mascotRow { grid-template-columns: minmax(120px, .86fr) minmax(0, 1.14fr); }
}

@media (max-height: 640px) {
  .game { gap: 6px; padding: 8px; }
  .mascotRow { grid-template-columns: minmax(86px, 35%) minmax(0, 1fr); }
  .panel { padding: 8px; }
  .intro { display: none; }
}

@media (max-width: 360px) {
  .round { min-width: 44px; }
  footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}


