/* 图形侦探社 的专用样式，叠在 styles.css 之后 */

#soundBtn {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
}

/* ================= 首页 ================= */

#home {
  gap: 14px;
}

.hero {
  padding: 20px 18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 216, 77, .38), transparent 36%),
    radial-gradient(circle at 8% 90%, rgba(91, 192, 235, .3), transparent 42%),
    linear-gradient(135deg, #f2fbff, #fffaf0);
  border: 1px solid #d9eef7;
}

.hero__kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #3d8aa8;
}

.hero__title {
  margin: 6px 0 8px;
  font-size: clamp(26px, 7.2vw, 40px);
  line-height: 1.18;
  letter-spacing: .02em;
}

.hero__text {
  margin: 0;
  color: #5b6b74;
  font-size: 15px;
  line-height: 1.6;
}

.cert-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 24px;
  border: 2px solid #ffe08a;
  background: linear-gradient(135deg, #fffaf0, #fffdf8);
}

.cert-card__icon {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff2c4;
  font-size: 28px;
}

.cert-card__body {
  flex: 1 1 160px;
  min-width: 0;
}

.cert-card__title {
  margin: 0;
  font-size: 18px;
}

.cert-card__text {
  margin: 3px 0 0;
  font-size: 13px;
  color: #7b6a3d;
}

.cert-card__btn {
  flex: 0 0 auto;
  margin-left: auto;
}

.case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.case-card {
  --case-color: #5bc0eb;
  min-width: 0;
  padding: 14px;
  border-radius: 26px;
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--case-color) 32%, #ffffff);
  box-shadow: 0 10px 24px rgba(40, 100, 120, .08);
}

.case-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.case-thumb {
  flex: 0 0 auto;
  width: 82px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  background: color-mix(in srgb, var(--case-color) 14%, #ffffff);
}

.case-thumb svg {
  width: 112%;
  height: 112%;
  display: block;
}

.case-meta {
  min-width: 0;
}

.case-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.case-obj {
  margin: 3px 0 0;
  font-size: 13px;
  color: #5b6b74;
}

.case-best {
  margin: 5px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--case-color);
}

.case-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.case-lv {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "tag right"
    "name name";
  align-items: center;
  gap: 2px 6px;
  min-height: 72px;
  min-width: 0;
  padding: 8px 10px;
  text-align: left;
  border-radius: 16px;
  border: 2px solid color-mix(in srgb, var(--case-color) 34%, #ffffff);
  background: #fbfeff;
  color: #22424f;
  font: inherit;
  cursor: pointer;
}

.case-lv:hover,
.case-lv:focus-visible {
  background: color-mix(in srgb, var(--case-color) 10%, #ffffff);
  border-color: var(--case-color);
}

.case-lv:active {
  transform: translateY(1px);
}

.case-lv__tag {
  grid-area: tag;
  font-size: 15px;
  font-weight: 900;
  color: var(--case-color);
}

.case-lv__name {
  grid-area: name;
  font-size: 13px;
  line-height: 1.25;
  color: #3d5762;
  overflow-wrap: anywhere;
}

.case-lv__right {
  grid-area: right;
  justify-self: end;
  font-size: 12px;
  font-weight: 800;
  color: #6b808a;
}

.case-lv__stars {
  display: inline-flex;
  gap: 1px;
  font-size: 12px;
  line-height: 1;
}

.case-lv__stars .wf-star {
  font-size: 13px;
}

.case-lv--cert {
  background: #fffaf0;
  border-style: dashed;
  border-color: #f2c94c;
}

.family-home {
  display: flex;
  align-items: center;
  gap: 12px;
}

.family-home > .grow {
  min-width: 0;
}

/* ================= 答题页 ================= */

#play {
  gap: 10px;
}

.play-head {
  padding: 2px 2px 0;
}

.play-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.3;
}

.play-sub {
  margin: 3px 0 0;
  color: #6b808a;
  font-size: 13px;
}

.play-hud {
  min-height: 0;
}

.cert-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff2c4;
  color: #7b5a00;
  font-size: 13px;
  font-weight: 700;
}

.cert-bar__num {
  font-size: 18px;
  line-height: 1;
}

.cert-bar__max {
  color: #a2842c;
  font-weight: 600;
}

.play-card {
  padding: 12px;
}

.stage {
  width: 100%;
  min-width: 0;
}

.q-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.q-wrap > .prompt {
  margin: 2px 0 0;
}

.q-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 88%, rgba(91, 192, 235, .18), transparent 55%),
    linear-gradient(180deg, #f7fdff, #eef8fc);
  overflow: hidden;
}

.q-visual svg {
  display: block;
  width: min(100%, 300px);
  height: auto;
}

.choices {
  min-width: 0;
}

.choices--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.choices--pic {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.choice {
  min-width: 0;
  overflow-wrap: anywhere;
}

.choice__pic {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 64px;
}

.choice__pic svg {
  display: block;
  width: 100%;
  max-height: 92px;
  height: auto;
}

.choice__label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.choices--pic .choice {
  padding: 6px;
}

.choices--pic .choice__label {
  font-size: 13px;
  margin-top: 2px;
}

/* ---- 描一描 ---- */

.trace-stage {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 320 / 260;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 80%, rgba(255, 255, 255, .5), transparent 60%),
    linear-gradient(180deg, #f5fcff, #e4f5fb);
  box-shadow: inset 0 0 0 2px #d6eef7;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.trace-art,
.trace-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trace-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.trace-layer {
  cursor: crosshair;
  touch-action: none;
}

.trace-guide {
  fill: none;
  stroke: #ffffff;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .66;
}

.trace-done {
  fill: none;
  stroke: var(--key);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .92;
}

.trace-sample {
  fill: none;
  stroke: none;
}

.trace-stage.is-complete .trace-guide {
  opacity: .16;
}

.trace-stage.is-fail {
  box-shadow: inset 0 0 0 3px #f4a184;
}

.trace-meter {
  width: 100%;
  max-width: 380px;
  height: 12px;
  margin: 0 auto;
  border-radius: 999px;
  background: #e4f1f6;
  overflow: hidden;
}

.trace-meter__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--key), #7ddb92);
  transition: width .12s linear;
}

.trace-meter__text,
.trace-tip,
.trace-attempts {
  text-align: center;
}

.trace-meter__text {
  margin-top: -4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--key);
}

.trace-tip {
  margin: 0;
  font-size: 14px;
  color: #3d5762;
}

.trace-attempts {
  margin: -4px 0 0;
  font-size: 12px;
  color: #8a9aa2;
}

.trace-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trace-actions .btn {
  min-height: 56px;
}

/* ---- 滚一滚 ---- */

.roll-hint {
  margin: -4px 0 0;
  text-align: center;
  font-size: 13px;
  color: #7a8d96;
}

.roll-scene {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 320 / 200;
  border-radius: 26px;
  overflow: hidden;
  background: #eef9fd;
  box-shadow: inset 0 0 0 2px #cfeaf5;
}

.roll-slope {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.roll-obj {
  position: absolute;
  left: 7%;
  top: 1%;
  width: 26%;
  transform-origin: 50% 78%;
  will-change: transform;
}

.roll-obj svg {
  display: block;
  width: 100%;
  height: auto;
}

.roll-obj.roll-one {
  animation: rollOne 1760ms cubic-bezier(.22, .7, .3, 1) forwards;
}

.roll-obj.roll-all {
  animation: rollAll 1760ms cubic-bezier(.22, .7, .3, 1) forwards;
}

.roll-obj.roll-none {
  animation: rollNone 900ms ease-in-out;
}

.roll-outcome {
  position: absolute;
  right: 10px;
  bottom: 8px;
  max-width: 70%;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #2b5566;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(40, 100, 120, .12);
}

.roll-outcome[hidden] {
  display: none !important;
}

.roll-choices {
  grid-template-columns: 1fr !important;
}

.roll-choices .choice {
  min-height: 56px;
}

.reason-host:empty {
  display: none;
}

.reason-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@keyframes rollOne {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(250%, 168%) rotate(310deg); }
}

@keyframes rollAll {
  0% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(135%, 58%) rotate(120deg); }
  58% { transform: translate(55%, 190%) rotate(230deg); }
  82% { transform: translate(215%, 130%) rotate(330deg); }
  100% { transform: translate(255%, 210%) rotate(430deg); }
}

@keyframes rollNone {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(-3%, 0) rotate(-2deg); }
  65% { transform: translate(3%, 0) rotate(2deg); }
}

/* ---- 特征关键帧 ---- */

.keyframe {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  padding: 6px 8px 8px;
  border-radius: 16px;
  background: #fff8f4;
  border: 2px solid #ffd2c0;
}

.keyframe svg {
  display: block;
  width: 150px;
  max-width: 100%;
  height: auto;
}

.keyframe--flat .sf-flat,
.keyframe--curve .sf-curve {
  stroke: #e4572e !important;
  stroke-width: 3 !important;
  animation: keyframePulse 900ms ease-in-out infinite alternate;
}

.keyframe__cap {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #b4441f;
}

@keyframes keyframePulse {
  from { opacity: .45; }
  to { opacity: 1; }
}

/* ================= 结算 ================= */

.done-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.badge-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
  border: 2px solid #ffd84d;
  background:
    radial-gradient(circle at 92% 6%, rgba(255, 216, 77, .34), transparent 34%),
    linear-gradient(135deg, #fffdf5, #fff8e3);
  box-shadow: 0 12px 26px rgba(160, 120, 20, .1);
}

.badge-card__medal {
  flex: 0 0 auto;
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #fff2c4;
  font-size: 40px;
  line-height: 1;
}

.badge-card__body {
  min-width: 0;
}

.badge-card__title {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
}

.badge-card__text {
  margin: 4px 0 0;
  font-size: 13px;
  color: #7b6a3d;
}

.report-host .wf-report {
  max-width: 100%;
}

.report-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #8b7400;
  font-size: 13px;
  font-weight: 700;
}

.report-stars__host {
  display: inline-flex;
  gap: 2px;
}

.report-stars .wf-star {
  font-size: 26px;
}

.family-card .family-list {
  margin-top: 8px;
}

.family-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.family-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 6px 8px;
  border-radius: 16px;
  background: #fbfeff;
  border: 1px solid #e2f0f6;
  cursor: pointer;
}

.family-item:hover {
  border-color: #bfe5f2;
}

.family-item input {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  accent-color: var(--key);
}

.family-item__pic {
  flex: 0 0 auto;
  width: 56px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.family-item__pic svg {
  width: 100%;
  height: 100%;
  display: block;
}

.family-item__txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.family-item__name {
  font-size: 15px;
}

.family-item__sub {
  font-size: 12px;
  color: #6b808a;
}

.family-count {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12px;
  color: #6b808a;
}

.family-modal .family-list {
  margin: 8px 0 2px;
}

/* ================= 窄屏 ================= */

@media (max-width: 380px) {
  .choices--pic {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .case-name {
    font-size: 18px;
  }

  .case-thumb {
    width: 68px;
    height: 58px;
  }

  .case-lv {
    min-height: 68px;
    padding: 7px 8px;
  }

  .case-lv__name {
    font-size: 12px;
  }

  .cert-card__btn {
    width: 100%;
    margin-left: 0;
  }

  .family-home {
    flex-wrap: wrap;
  }

  .family-home .btn {
    width: 100%;
  }

  .badge-card {
    align-items: flex-start;
  }

  .badge-card__title {
    font-size: 20px;
  }
}

@media (max-width: 340px) {
  .brand__sub {
    display: none;
  }

  .case-levels {
    grid-template-columns: 1fr;
  }

  .case-lv {
    min-height: 64px;
  }

  .roll-obj {
    width: 28%;
  }
}

@media (min-width: 760px) {
  .case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .roll-obj.roll-one,
  .roll-obj.roll-all,
  .roll-obj.roll-none,
  .keyframe--flat .sf-flat,
  .keyframe--curve .sf-curve {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
