/* r205: compact, era-aware museum-night flashcard blind box. */
body.student-page .memory-feed-mode-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.student-page .memory-feed-mode-switch button {
  min-width: 0;
  white-space: nowrap;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"],
body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-shell,
body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-list {
  background-color: #0d0d0c !important;
  background-image: url("/assets/blindbox/night-museum-bg.webp?v=v1-0-r202") !important;
  background-position: center top !important;
  background-repeat: repeat-y !important;
  background-size: min(100vw, 920px) auto !important;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-paleolithic"],
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-paleolithic"] .memory-feed-shell,
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-paleolithic"] .memory-feed-list {
  background-image: url("/assets/blindbox/era-china-paleolithic.webp?v=v1-0-r205") !important;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-neolithic"],
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-neolithic"] .memory-feed-shell,
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-neolithic"] .memory-feed-list {
  background-image: url("/assets/blindbox/era-china-neolithic.webp?v=v1-0-r205") !important;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-bronze"],
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-bronze"] .memory-feed-shell,
body.student-page #podcastPanel[data-memory-mode="flashcard"][data-era-theme="china-bronze"] .memory-feed-list {
  background-image: url("/assets/blindbox/era-china-bronze.webp?v=v1-0-r205") !important;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-shell {
  height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-list {
  display: block !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  scroll-snap-type: none !important;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-toolbar {
  background: rgba(13, 13, 12, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-mode-switch button.active {
  color: #e6bd68;
}

body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-mode-switch button.active::after {
  background: #e6bd68;
}

body.student-page .flashcard-blindbox {
  width: min(100%, 860px);
  min-height: calc(100dvh + 1px);
  margin: 0 auto;
  padding: calc(82px + env(safe-area-inset-top, 0px)) clamp(18px, 4vw, 34px) calc(126px + env(safe-area-inset-bottom, 0px));
  color: #f1dfbb;
}

body.student-page .flashcard-blindbox[data-era-theme="china-paleolithic"] {
  --flashcard-era-accent: #c89a58;
  --flashcard-era-face: url("/assets/blindbox/era-china-paleolithic.webp?v=v1-0-r205");
  --flashcard-era-radius: 18px;
}

body.student-page .flashcard-blindbox[data-era-theme="china-neolithic"] {
  --flashcard-era-accent: #c87c43;
  --flashcard-era-face: url("/assets/blindbox/era-china-neolithic.webp?v=v1-0-r205");
  --flashcard-era-radius: 27px;
}

body.student-page .flashcard-blindbox[data-era-theme="china-bronze"] {
  --flashcard-era-accent: #8f9f82;
  --flashcard-era-face: url("/assets/blindbox/era-china-bronze.webp?v=v1-0-r205");
  --flashcard-era-radius: 12px;
}

body.student-page .flashcard-blindbox-hero {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.student-page .flashcard-blindbox-hero span {
  color: #d9aa50;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

body.student-page .flashcard-blindbox-hero strong {
  max-width: 690px;
  color: #f4e8d1;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}

body.student-page .flashcard-blindbox-hero p {
  margin: 0;
  color: rgba(228, 207, 172, 0.68);
  font-size: 14px;
}

body.student-page .flashcard-blindbox-range {
  margin-bottom: 16px;
  border: 1px solid rgba(217, 170, 80, 0.42);
  border-radius: 22px;
  background: rgba(15, 15, 13, 0.76);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.student-page .flashcard-blindbox-range summary {
  padding: 15px 18px;
  color: #d8b76e;
  cursor: pointer;
  list-style-position: inside;
}

body.student-page .flashcard-blindbox-range summary span {
  margin-right: 12px;
  font-size: 13px;
  font-weight: 800;
}

body.student-page .flashcard-blindbox-range summary strong {
  display: inline;
  color: rgba(244, 232, 209, 0.86);
  font-size: 12px;
  font-weight: 650;
}

body.student-page .flashcard-blindbox-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 2px 14px 16px;
}

body.student-page .flashcard-blindbox-filter {
  display: grid;
  gap: 5px;
}

body.student-page .flashcard-blindbox-filter span {
  color: rgba(226, 196, 139, 0.66);
  font-size: 11px;
  font-weight: 750;
}

body.student-page .flashcard-blindbox-filter select {
  width: 100%;
  min-height: 43px;
  padding: 8px 28px 8px 10px;
  border: 1px solid rgba(217, 170, 80, 0.28);
  border-radius: 13px;
  background: #181713;
  color: #f0dfbe;
  font: inherit;
  font-size: 12px;
}

body.student-page .flashcard-blindbox-deck-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: rgba(227, 204, 165, 0.74);
  font-size: 13px;
}

body.student-page .flashcard-blindbox-deck-meta button,
body.student-page .flashcard-blindbox-card .student-flashcard-summary > button {
  min-height: 40px;
  margin-left: auto;
  padding: 8px 15px;
  border: 1px solid rgba(217, 170, 80, 0.45);
  border-radius: 999px;
  background: rgba(19, 18, 14, 0.84);
  color: #e4bd6d;
  font-weight: 800;
}

body.student-page .flashcard-blindbox-deck-meta button.active {
  border-color: #e4bd6d;
  background: #dfb45e;
  color: #18130a;
}

body.student-page .flashcard-blindbox-ready,
body.student-page .flashcard-blindbox-empty {
  display: grid;
  place-items: center;
  gap: 14px;
  min-height: 420px;
  padding: 20px;
  border: 0;
  background: transparent;
  text-align: center;
}

body.student-page .flashcard-blindbox-ready-card {
  position: relative;
  width: min(62vw, 290px);
  aspect-ratio: 5 / 7;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(221, 183, 106, 0.56);
  border-radius: 22px;
  background: #11100e;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.54);
  color: #f4dfb6;
  transform: rotate(-2deg);
}

body.student-page .flashcard-blindbox-ready-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.student-page .flashcard-blindbox-ready-card span {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  min-height: 48px;
  border: 1px solid rgba(232, 196, 121, 0.66);
  border-radius: 999px;
  padding: 12px;
  background: rgba(12, 11, 9, 0.82);
  color: #f2d99f;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

body.student-page .flashcard-blindbox-ready > strong,
body.student-page .flashcard-blindbox-empty strong {
  color: #f2ddba;
  font-size: 22px;
}

body.student-page .flashcard-blindbox-ready > span,
body.student-page .flashcard-blindbox-empty span {
  max-width: 520px;
  color: rgba(226, 205, 169, 0.68);
  line-height: 1.65;
}

body.student-page .flashcard-blindbox-card.student-flashcard-shell {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: flashcard-blindbox-arrive 520ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

body.student-page .flashcard-blindbox-card .student-flashcard-summary {
  min-height: 50px;
  margin: 0 0 16px;
  color: #eddbb9;
}

body.student-page .flashcard-blindbox-card .student-flashcard-summary strong {
  color: #f3dfb8;
  font-size: 16px;
}

body.student-page .flashcard-blindbox-card .student-flashcard-summary > div > span {
  display: block;
  max-width: min(68vw, 390px);
  overflow: hidden;
  color: rgba(224, 199, 153, 0.64);
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.student-page .flashcard-answer-label,
body.student-page .flashcard-blindbox-card.is-flipped .flashcard-question-label {
  display: none !important;
}

body.student-page .flashcard-blindbox-card.is-flipped .flashcard-answer-label {
  display: inline !important;
}

body.student-page .flashcard-blindbox-stage-wrap {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 5 / 7;
  margin: 0 auto 14px;
}

body.student-page .flashcard-blindbox-stack,
body.student-page .flashcard-blindbox-card .student-flashcard-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 24px;
}

body.student-page .flashcard-blindbox-stack {
  display: block;
  border: 1px solid rgba(216, 172, 88, 0.35);
  object-fit: cover;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

body.student-page .flashcard-blindbox-stack.stack-two {
  transform: translateY(12px) rotate(3.5deg) scale(0.975);
  opacity: 0.72;
}

body.student-page .flashcard-blindbox-stack.stack-one {
  transform: translateY(6px) rotate(-2deg) scale(0.988);
  opacity: 0.9;
}

body.student-page .flashcard-blindbox-card .student-flashcard-stage {
  z-index: 2;
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1500px;
  touch-action: manipulation;
}

body.student-page .flashcard-blindbox-card .student-flashcard-card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 720ms cubic-bezier(0.2, 0.76, 0.18, 1);
}

body.student-page .flashcard-blindbox-card.is-flipped .student-flashcard-card {
  transform: rotateY(180deg);
}

body.student-page .flashcard-blindbox-card .student-flashcard-face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: clamp(46px, 8vw, 68px) clamp(24px, 6vw, 42px) clamp(118px, 29%, 168px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(176, 126, 40, 0.5);
  border-radius: 24px;
  background-color: #f4e7c9;
  background-image: url("/assets/blindbox/card-face.webp?v=v1-0-r202");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 28px 58px rgba(0, 0, 0, 0.46);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}

body.student-page .flashcard-blindbox[data-era-theme^="china-"] .student-flashcard-face {
  border-color: color-mix(in srgb, var(--flashcard-era-accent) 58%, transparent);
  border-radius: var(--flashcard-era-radius);
  background-color: #f0e4ca;
  background-image:
    linear-gradient(rgba(246, 236, 214, 0.91), rgba(236, 218, 184, 0.93)),
    var(--flashcard-era-face);
  background-size: cover;
}

body.student-page .flashcard-blindbox[data-era-theme^="china-"] .student-flashcard-face small,
body.student-page .flashcard-blindbox[data-era-theme^="china-"] .student-flashcard-face em {
  color: color-mix(in srgb, var(--flashcard-era-accent) 68%, #4b3420);
}

body.student-page .flashcard-blindbox[data-era-theme^="china-"] .student-flashcard-face strong {
  color: #241b12;
}

body.student-page .flashcard-blindbox-card .student-flashcard-back {
  transform: rotateY(180deg);
}

body.student-page .flashcard-blindbox-card .student-flashcard-face small {
  color: #8e682d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

body.student-page .flashcard-blindbox-card .student-flashcard-face strong {
  align-self: center;
  color: #2c2116;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(22px, 4.6vw, 31px);
  font-weight: 800;
  line-height: 1.52;
  white-space: pre-line;
}

body.student-page .flashcard-blindbox-card .student-flashcard-back strong {
  font-size: clamp(18px, 3.8vw, 25px);
  line-height: 1.62;
}

body.student-page .flashcard-blindbox-card .student-flashcard-face em {
  align-self: end;
  color: #967342;
  font-size: 12px;
  font-style: normal;
}

body.student-page .flashcard-blindbox-card .student-flashcard-instruction {
  min-height: 48px;
  margin: 0;
  padding: 12px 8px;
  color: rgba(228, 205, 165, 0.72);
  text-align: center;
}

body.student-page .flashcard-blindbox-card .student-flashcard-ratings {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  min-height: 64px;
  padding: 4px 0 0;
}

body.student-page .flashcard-blindbox-card.is-flipped .student-flashcard-ratings {
  display: grid;
}

body.student-page .flashcard-blindbox-card.is-flipped .student-flashcard-instruction {
  display: none;
}

body.student-page .flashcard-blindbox-card .student-flashcard-ratings button {
  display: grid;
  place-content: center;
  gap: 3px;
  min-height: 62px;
  padding: 8px 5px;
  border: 1px solid rgba(215, 172, 88, 0.42);
  border-radius: 15px;
  background: rgba(15, 14, 12, 0.86);
  color: #e7c77f;
}

body.student-page .flashcard-blindbox-card .student-flashcard-ratings button.good {
  border-color: #d8aa50;
  background: #d8aa50;
  color: #171108;
}

body.student-page .flashcard-blindbox-card .student-flashcard-ratings span {
  font-size: 13px;
  font-weight: 850;
}

body.student-page .flashcard-blindbox-card .student-flashcard-ratings small {
  color: inherit;
  font-size: 10px;
  opacity: 0.72;
}

@keyframes flashcard-blindbox-arrive {
  from { opacity: 0; transform: translateY(28px) scale(0.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  body.student-page #podcastPanel[data-memory-mode="flashcard"] .memory-feed-toolbar {
    position: fixed;
    z-index: 100;
  }

  body.student-page .flashcard-blindbox {
    padding-top: calc(76px + env(safe-area-inset-top, 0px));
  }

  body.student-page .flashcard-blindbox.has-card {
    padding-top: calc(68px + env(safe-area-inset-top, 0px));
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-hero {
    display: block;
    margin-bottom: 7px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-hero strong,
  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-hero p {
    display: none;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-range {
    margin-bottom: 7px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-range summary {
    padding: 10px 13px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-deck-meta {
    margin-bottom: 7px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-card .student-flashcard-summary {
    min-height: 42px;
    margin-bottom: 7px;
  }

  body.student-page .flashcard-blindbox-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  body.student-page .memory-feed-mode-switch button {
    padding-inline: 4px;
    font-size: 11px;
  }

  body.student-page .flashcard-blindbox {
    padding-right: 14px;
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    padding-left: 14px;
  }

  body.student-page .flashcard-blindbox-hero {
    margin-bottom: 16px;
  }

  body.student-page .flashcard-blindbox-hero strong {
    font-size: 27px;
  }

  body.student-page .flashcard-blindbox-hero p {
    font-size: 12px;
  }

  body.student-page .flashcard-blindbox-range {
    border-radius: 18px;
  }

  body.student-page .flashcard-blindbox-range summary {
    padding: 13px 14px;
  }

  body.student-page .flashcard-blindbox-range summary strong {
    display: block;
    max-width: 100%;
    margin: 5px 0 0 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.student-page .flashcard-blindbox-filters {
    gap: 8px;
    padding: 0 10px 12px;
  }

  body.student-page .flashcard-blindbox-deck-meta {
    flex-wrap: wrap;
    gap: 7px 10px;
    margin-bottom: 18px;
  }

  body.student-page .flashcard-blindbox-deck-meta button {
    margin-left: auto;
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-summary > div > span {
    max-width: 58vw;
  }

  body.student-page .flashcard-blindbox-stage-wrap {
    width: min(82vw, 360px);
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-face {
    border-radius: 21px;
    padding: 44px 25px 124px;
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-face strong {
    font-size: clamp(20px, 6vw, 26px);
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-back strong {
    font-size: clamp(17px, 4.8vw, 21px);
  }
}

@media (max-height: 760px) and (min-width: 521px) {
  body.student-page .flashcard-blindbox.has-card {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    padding-bottom: 28px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-hero {
    display: none;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-range,
  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-deck-meta,
  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-card .student-flashcard-summary {
    width: min(100%, 680px);
    margin-right: auto;
    margin-left: auto;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-range {
    margin-bottom: 5px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-range summary {
    padding: 8px 13px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-deck-meta {
    margin-bottom: 4px;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-card .student-flashcard-summary {
    position: relative;
    z-index: 4;
    min-height: 0;
    height: 0;
    margin-bottom: 0;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-card .student-flashcard-summary > div {
    display: none;
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-card .student-flashcard-summary > button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    min-height: 36px;
    background: rgba(20, 16, 10, 0.76);
  }

  body.student-page .flashcard-blindbox.has-card .flashcard-blindbox-stage-wrap {
    width: min(80vw, 680px);
    height: min(48dvh, 360px);
    aspect-ratio: auto;
  }

  body.student-page .flashcard-blindbox.has-card .student-flashcard-face {
    padding: 24px 58px 30px;
  }

  body.student-page .flashcard-blindbox.has-card .student-flashcard-face strong,
  body.student-page .flashcard-blindbox.has-card .student-flashcard-back strong {
    font-size: clamp(18px, 3.2vw, 25px);
    line-height: 1.42;
  }

  body.student-page .flashcard-blindbox-card.is-flipped .student-flashcard-ratings {
    position: fixed;
    right: 10vw;
    bottom: 4px;
    left: 10vw;
    z-index: 96;
    width: auto;
    max-width: 680px;
    min-height: 46px;
    margin: 0 auto;
    padding: 0;
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-ratings button {
    min-height: 44px;
    border-radius: 999px;
    background: rgba(14, 13, 11, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-ratings small {
    display: none;
  }

  body.student-page .flashcard-blindbox.has-card .student-flashcard-instruction {
    min-height: 32px;
    padding: 7px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.student-page .flashcard-blindbox-card.student-flashcard-shell {
    animation: none;
  }

  body.student-page .flashcard-blindbox-card .student-flashcard-card {
    transition-duration: 1ms;
  }
}
