* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  font-family: "Noto Sans JP", sans-serif;
  background: #ffffff;
  color: #364153;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
}

:root {
  --primary: #4ea1f0;
  --text-dark: #0a0a0a;
  --text-muted: #4a5565;
  --pattern-bg: #f0ffff;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.quiz-app {
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
  background: #fff;
  --quiz-bg: url("/assets/img/quiz/background.webp");
  --next-btn-bg: #4ea1f0;
  --next-btn-border: #2f86da;
  --next-btn-text: #ffffff;
  --next-btn-arrow: #ffffff;
  --timer-gradient: linear-gradient(90deg, #5FDCF0, #50A0F0);
  --timer-icon-size: 32px;
  --timer-icon-gap: 0px;
}

.quiz-app.category-holoca {
  --quiz-bg: url("/assets/img/quiz/background.webp");
  --next-btn-bg: #f0814e;
  --next-btn-border: #e06f3c;
  --timer-gradient: linear-gradient(90deg, #6C64AE, #4DC2FF);
}

.quiz-app.category-hololive {
  --quiz-bg: url("/assets/img/quiz/background2.webp");
  --next-btn-bg: #4ea1f0;
  --next-btn-border: #2f86da;
  --timer-gradient: linear-gradient(90deg, #5FDCF0, #50A0F0);
}

.quiz-app.category-mix {
  --quiz-bg: url("/assets/img/quiz/background3.webp");
  --next-btn-bg: #fe77c6;
  --next-btn-border: #e05da9;
  --timer-gradient: linear-gradient(90deg, #FFF983, #9D842C);
}

/* 編ごとの残り時間プログレスバー（固定配置で画面最上部へ） */
.quiz-timer-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  max-width: 375px;
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--timer-icon-gap);
  overflow: visible;
  z-index: 9999;
}
.quiz-timer-progress::before {
  content: "";
  flex: 0 0 auto;
  width: var(--timer-icon-size);
  height: var(--timer-icon-size);
  background: var(--timer-gradient);
  -webkit-mask-image: url("/assets/img/quiz/hourglass.png");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-image: url("/assets/img/quiz/hourglass.png");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}
.quiz-timer-progress-track {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.quiz-timer-progress-bar {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  border-radius: 999px 0 0 999px;
  background: var(--timer-gradient);
  transition: width 0.12s linear;
}
/* trueのとき（カード内）のスタイル上書き */
.quiz-timer-progress.is-in-card {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 1;
  margin: 0 0 16px 0;
  width: 100%;
  height: 16px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.blend-light {
  mix-blend-mode: screen;
}

.quiz-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.quiz-btn {
  width: 100%;
  min-height: 54px;
  height: auto;
  border-radius: 14px;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 16px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.quiz-btn:hover {
  filter: brightness(1.04);
}

.quiz-btn:active {
  transform: translateY(2px);
}

.quiz-btn:focus-visible {
  outline: 3px solid #5fdbef;
  outline-offset: 2px;
}

.quiz-btn.orange { background: #f0814e; }
.quiz-btn.green { background: #73dd45; }
.quiz-btn.pink { background: #fe77c6; }
.quiz-btn.blue { background: #4ea1f0; }
.quiz-btn.gray { background: #cccccc; }

.quiz-btn.disabled {
  cursor: not-allowed;
  filter: none;
}

.quiz-footer {
  background: #4ea1f0;
  color: #fff;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 0;
  position: relative;
  z-index: 2;
}

.quiz-footer p {
  width: 100%;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
}

.quiz-footer .footer-period {
  font-size: 13px;
  line-height: 19.5px;
}

.quiz-footer ul {
  width: 100%;
  max-width: 335px;
  list-style: disc;
  padding-left: 18px;
  font-size: 12px;
  line-height: 18px;
}

/* ======================
   TOP
====================== */
.quiz-top {
  background: #fff;
}

.quiz-kv {
  background: var(--pattern-bg);
  overflow: hidden;
}

.quiz-kv-visual {
  position: relative;
  width: 100%;
  height: 483px;
  background: var(--pattern-bg);
  overflow: hidden;
}

.quiz-kv-visual .kv-layer {
  position: absolute;
  inset: 0;
}

.quiz-kv-visual img {
  position: absolute;
  max-width: none;
}

.kv-hero-bg {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kv-stamp {
  left: 12px;
  bottom: 18px;
  width: 120px;
  pointer-events: none;
}

.kv-rabbit {
  right: -8px;
  bottom: 46px;
  width: 140px;
  pointer-events: none;
}

.kv-sheep {
  left: 126px;
  bottom: 8px;
  width: 110px;
  pointer-events: none;
}

.kv-title-text {
  position: absolute;
  left: 50%;
  top: 158px;
  transform: translateX(-50%);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  color: #5c8cf3;
  letter-spacing: 3px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.05);
  white-space: nowrap;
}

.kv-sub-tag {
  position: absolute;
  left: 50%;
  top: 102px;
  transform: translateX(-50%);
  background: #ff6363;
  color: #fff;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  letter-spacing: 4px;
}

.kv-series {
  position: absolute;
  left: 50%;
  top: 134px;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(101deg, #4dc2ff 8%, #4f4982 99%);
  -webkit-background-clip: text;
  color: transparent;
  white-space: nowrap;
}


.quiz-kv-copy {
  background: var(--pattern-bg);
  padding: 16px 20px;
  text-align: center;
}

.quiz-kv-copy .kv-logo {
  width: 216px;
  height: 60px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.kv-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.kv-lead {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(125deg, #4dc2ff 8%, #6c64ae 99%);
  -webkit-background-clip: text;
  color: transparent;
}

.quiz-kv-bullets {
  background: var(--pattern-bg);
  padding: 0 20px 16px;
  font-size: 14px;
  line-height: 2;
  color: #364153;
  font-weight: 400;
}

.quiz-bullet-list {
  list-style: disc;
  padding-left: 21px;
  margin: 0;
}

.quiz-bullet-list li {
  margin: 0;
}

.quiz-bullet-nested {
  list-style: disc;
  padding-left: 21px;
  margin: 0;
}

.quiz-bullet-nested li {
  margin: 0;
}

.quiz-bullet-emphasis {
  font-weight: 500;
}

.quiz-bullet-card {
  flex-shrink: 0;
  width: 95px;
  height: 84px;
  object-fit: contain;
}

.quiz-levels {
  background: var(--pattern-bg);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.quiz-campaign-link {
  display: block;
  width: 335px;
  margin-top: 32px;
}

.quiz-campaign-image {
  width: 100%;
  height: auto;
  display: block;
}

.level-card {
  width: 335px;
  border-radius: 40px;
  background: transparent;
  box-shadow: 0 12px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  border: none;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.level-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 16px rgba(0,0,0,0.12);
}

.level-card:active {
  transform: translateY(0);
  box-shadow: 0 12px 12px rgba(0,0,0,0.1);
}

.level-card-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 40px;
}

.level-card:first-child .level-card-image {
  height: 82px;
  object-fit: cover;
}

.level-card:nth-child(2) .level-card-image {
  height: 82px;
  object-fit: cover;
}

.level-card:nth-child(3) .level-card-image {
  height: 74px;
  object-fit: cover;
}

.quiz-about {
  background: var(--pattern-bg);
  padding: 0;
}

.about-visual {
  position: relative;
  width: 100%;
  min-height: 492px;
  overflow: visible;
  padding-bottom: 100px;
}

.about-visual .about-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100%;
  background-image: url("/assets/img/quiz/top_background.webp");
  background-size: 100% auto;
  background-position: top center;
  background-repeat: no-repeat;
}

.about-visual .about-holocard {
  display: block;
  width: auto;
  max-width: 44px;
  height: auto;
  margin: 12px auto 0;
  object-fit: contain;
}

.about-title-wrapper {
  position: absolute;
  top: 64px;
  left: 59px;
  display: flex;
  align-items: center;
  gap: 0;
}

.about-logo {
  width: 216px;
  height: 60px;
  object-fit: contain;
  display: block;
}

.about-title-text {
  position: absolute;
  left: 230px;
  top: 41px;
  font-size: 18px;
  font-weight: 700;
  color: #4f4982;
  white-space: nowrap;
  line-height: 1;
}

.about-visual .about-copy {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translateX(-50%);
  width: 343px;
}

.about-visual .about-copy .heading {
  font-size: 18px;
  font-weight: 700;
  color: #4f4982;
  line-height: 1.5;
  text-align: center;
}

.about-visual .about-copy .heading .accent {
  color: #d651ff;
}

.about-visual .about-copy .desc {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #364153;
  text-align: left;
}

.about-visual .about-copy .desc-note {
  margin-top: 8px;
  margin-bottom: 0;
}

/* ======================
   Nickname / Question / Answer
====================== */
.quiz-form {
  min-height: 667px;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.quiz-form .form-bg {
  position: absolute;
  inset: 0;
  background-image: var(--quiz-bg);
  background-size: cover;
  background-position: center;
}

.quiz-form .form-body {
  position: relative;
  padding: 16px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.quiz-logo-group {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-logo-small {
  width: 140px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-logo-small img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quiz-logo-duo {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo-duo-image {
  width: 140px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.quiz-logo-group .logo-holoca,
.quiz-logo-group .logo-hololive,
.quiz-logo-group .logo-mix {
  display: none;
}

.quiz-app.category-holoca .quiz-logo-group .logo-holoca {
  display: flex;
}

.quiz-app.category-hololive .quiz-logo-group .logo-hololive {
  display: flex;
}

.quiz-app.category-mix .quiz-logo-group .logo-mix {
  display: flex;
}

.quiz-form-card {
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-form-card .title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.quiz-form-card .desc {
  font-size: 14px;
  line-height: 22.75px;
  color: #364153;
}

.quiz-form-card .question-topic {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: #4b5563;
}

.nickname-input {
  width: 100%;
  height: 42px;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.nickname-input::placeholder {
  color: #aaa;
  font-weight: 700;
}


.answer-indicator {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
}

.screen-answer-correct .answer-indicator {
  color: #ff6363;
}

.next-btn {
  width: 201px;
  height: 48px;
  border-radius: 40px;
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.next-btn .next-btn-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  box-shadow: none;
}

.next-btn:focus,
.next-btn:active,
.next-btn:focus-visible {
  outline: none;
  box-shadow: none;
}


.answer-buttons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  align-self: stretch;
}

.screen-answer-correct .next-btn,
.screen-answer-wrong .next-btn {
  position: static;
  margin: 0;
  z-index: 3;
  width: calc((100% - 12px) / 2);
  flex-shrink: 0;
  min-width: 0;
}

.screen-answer-correct .reset-btn,
.screen-answer-wrong .reset-btn {
  width: calc((100% - 12px) / 2);
  height: 48px;
  flex-shrink: 0;
  min-width: 0;
  border-radius: 40px;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.reset-btn .reset-btn-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen-answer-correct .form-body,
.screen-answer-wrong .form-body {
  position: relative;
  gap: 25.54px;
}

/* 問題画面のリセットボタン（常時表示・左配置・正解/不正解画面と同様） */
.question-reset-row {
  width: 100%;
  align-self: stretch;
  display: flex;
  justify-content: flex-start;
  margin-top: 25.54px;
}

.screen-question .reset-btn {
  width: 161px;
  height: 48px;
  margin-left: 0;
  border-radius: 40px;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.screen-question .reset-btn .reset-btn-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ======================
   Result (Pass)
====================== */
.screen-result .quiz-form {
  min-height: 812px;
}

.screen-result .form-body {
  padding: 16px 20px 16px;
  gap: 12px;
}

.result-card {
  align-items: center;
  text-align: center;
}

.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: #0a0a0a;
}

.result-score-value {
  color: #ff6363;
}

.result-score-unit {
  font-size: 0.6em;
  transform: translateY(calc(-0.15em + 2px));
  margin-left: -3px;
}

.result-message {
  width: 100%;
  font-size: 14px;
  line-height: 22.75px;
  color: #364153;
  text-align: center;
}

.result-message .message-line {
  display: block;
}

.result-cert {
  width: 160px;
  height: 160px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-cert img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.result-download {
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.result-download-button {
  width: 292px;
  height: 54px;
  background: #4ea1f0;
  border: 3px solid #5fdbef;
  border-radius: 14px;
  box-shadow: 0 8px 0 #5283dd;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.result-download-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #5283dd;
}

.result-share {
  width: calc(100% + 40px);
  margin: 4px -20px 0;
  background: #ffffff;
  box-shadow: var(--card-shadow);
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.result-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.result-share-button-image {
  width: 179px;
  height: 48px;
  display: block;
  object-fit: contain;
}

.result-bottom {
  position: relative;
  padding: 12px 20px 20px;
  min-height: 140px;
  display: flex;
  align-items: flex-start;
}

.result-top-button {
  width: 201px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.result-top-button img {
  width: 100%;
  height: auto;
  display: block;
}

.result-top-button:focus,
.result-top-button:active,
.result-top-button:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Result Fail: 認定証・ダウンロード・シェアなし */
.screen-result-fail .result-fail-card {
  padding: 24px 20px 32px; /* 下部32px: ボタン接近で減った12pxを補填し背景余白を維持 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* 文言とボタンをまとめ、その間の gap を調整 */
.screen-result-fail .result-fail-message-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.screen-result-fail .result-fail-message {
  text-align: center;
  margin: 0;
}

/* 不合格時の点数色（合格時は #ff6363 のまま） */
.screen-result-fail .result-score .result-score-value {
  color: #A8D182;
}

.screen-result-fail .result-fail-tryagain {
  width: 296px;
  height: 56px;
  margin: 0;
  background: #4ea1f0;
  border: 3px solid #5fdbef;
  border-radius: 14px;
  box-shadow: 0 8px 0 #5283dd;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.5;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.screen-result-fail .result-fail-tryagain:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #5283dd;
}

/* Timeout */
.screen-timeout .quiz-form {
  min-height: 812px;
}

.screen-timeout .form-body {
  padding: 16px 20px 16px;
  gap: 12px;
}

.screen-timeout .timeout-card {
  min-height: 126px;
  padding: 20px;
  gap: 16px;
}

.screen-timeout .timeout-title {
  width: 100%;
  text-align: center;
  font-size: 28px;
  line-height: 27px;
  font-weight: 700;
  color: #ff6363;
}

.screen-timeout .timeout-message {
  font-size: 14px;
  line-height: 1.5;
  color: #364153;
  text-align: center;
  margin-top: 0;
  width: 292px;
}

.screen-timeout .timeout-message p {
  margin: 0;
}

.screen-timeout .result-bottom {
  padding: 20px 20px 0;
  min-height: 0;
}

/* ======================
   Download Certificate (PNG)
====================== */
.screen-download-cert .quiz-form {
  min-height: 812px;
}

.download-cert-body {
  position: relative;
  z-index: 2;
  padding-top: 48px;
}

.download-cert-preview {
  width: 100%;
  margin: 0;
  background: #f0f0f0;
  overflow: hidden;
}

.download-cert-preview img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.download-cert-loading {
  margin: 16px 20px 0;
  padding: 12px 16px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f7f9fc;
}

.download-cert-loading-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #364153;
  text-align: center;
}

.download-cert-note {
  margin: 12px 20px 0;
  font-size: 14px;
  line-height: 22.75px;
  color: #364153;
}

.screen-download-cert .result-bottom {
  padding: 24px 20px 0;
  min-height: 0;
}


