/* ==========================================================
   Topic Past-Paper Page
   ========================================================== */

.topic-paper-room {
  --tp-panel: rgba(255, 252, 246, .78);
  --tp-panel-strong: rgba(255, 252, 246, .94);
  --tp-line: rgba(44, 44, 42, .14);
  --tp-line-strong: rgba(44, 44, 42, .2);
  --tp-shadow: 0 28px 80px rgba(42, 30, 18, .2);
  --tp-soft-shadow: 0 12px 28px rgba(42, 30, 18, .08);
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 6.8rem 0 2.6rem;
  background: var(--paper);
}

.topic-paper-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(250, 247, 240, .26), rgba(250, 247, 240, .66)),
    url("/assets/img/library-background.png") center bottom / cover no-repeat;
  filter: saturate(.94);
}

.topic-paper-floating-nav {
  position: absolute;
  z-index: 3;
  top: 1.35rem;
  left: min(4vw, 4.4rem);
  right: min(4vw, 4.4rem);
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.1rem;
  border: 1px solid rgba(235, 224, 209, .78);
  border-radius: 12px;
  background: rgba(255, 252, 246, .9);
  box-shadow: 0 18px 40px rgba(40, 25, 12, .14);
  backdrop-filter: blur(10px);
  padding: .5rem 1rem .5rem 1.35rem;
}

.topic-paper-floating-nav__logo {
  color: var(--ink);
  font-size: 1.32rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.topic-paper-floating-nav__logo span {
  color: var(--green);
}

.topic-paper-floating-nav__logo em {
  color: var(--coral);
  font-family: var(--font-hand);
  font-size: 1rem;
  font-style: normal;
  margin-left: .18rem;
}

.topic-paper-floating-nav__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.45rem;
  min-width: 0;
}

.topic-paper-floating-nav__links a,
.topic-paper-floating-nav__links span,
.topic-paper-floating-nav__tools a,
.topic-paper-floating-nav__tools span {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.topic-paper-floating-nav__links a {
  position: relative;
}

.topic-paper-floating-nav__links a:hover,
.topic-paper-floating-nav__tools a:hover {
  color: var(--green-deep);
}

.topic-paper-floating-nav__links .is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.55rem;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

.topic-paper-floating-nav__tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: .65rem;
}

.topic-paper-floating-nav__tools svg {
  width: 20px;
  height: 20px;
}

.topic-paper-floating-nav__tools > a:not(.topic-paper-floating-nav__space),
.topic-paper-floating-nav__tools > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-left: 1px solid rgba(216, 204, 186, .7);
}

.topic-paper-floating-nav__space {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(216, 204, 186, .84);
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  padding: .45rem .9rem;
}

.topic-paper-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  overflow: hidden;
  border: 1.5px solid rgba(44, 44, 42, .16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 255, 255, .72), transparent 34%),
    linear-gradient(180deg, rgba(255, 253, 248, .96), rgba(250, 241, 224, .96));
  box-shadow: var(--tp-shadow), inset 0 1px 0 rgba(255, 255, 255, .75);
}

.topic-paper-top-ad {
  position: relative;
  z-index: 1;
  width: min(970px, calc(100% - 48px));
  margin: 0 auto 1rem;
}

.topic-paper-top-ad .ad-slot {
  min-height: 90px;
  margin: 0;
  border-radius: 10px;
  background: rgba(255, 252, 246, .76);
  border-color: rgba(216, 204, 186, .72);
  box-shadow: 0 12px 28px rgba(42, 30, 18, .08);
  backdrop-filter: blur(8px);
}

.topic-paper-shell::before,
.topic-paper-shell::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 18px;
  border-radius: 999px;
  opacity: .32;
  pointer-events: none;
}

.topic-paper-shell::before {
  left: 0;
  background: linear-gradient(90deg, rgba(82, 56, 31, .18), transparent);
}

.topic-paper-shell::after {
  right: 0;
  background: linear-gradient(270deg, rgba(82, 56, 31, .18), transparent);
}

.topic-paper-hero {
  position: relative;
  border-bottom: 1px solid rgba(44, 44, 42, .1);
  padding: 2.2rem 2.6rem 1.25rem;
}

.topic-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1.25rem;
  color: var(--ink-faint);
  font-size: .78rem;
}

.topic-breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}

.topic-breadcrumb a:hover {
  color: var(--green);
  text-decoration: underline;
}

.topic-paper-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 455px);
  gap: 1.75rem;
  align-items: end;
}

.topic-paper-hero__copy {
  min-width: 0;
}

.topic-paper-kicker {
  margin-bottom: .5rem;
  color: var(--green);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.topic-paper-hero h1 {
  max-width: none;
  margin-bottom: .3rem;
  font-family: var(--font-display);
  font-size: 2.7rem;
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: 0;
  white-space: nowrap;
}

.topic-paper-hero h2 {
  margin-bottom: .72rem;
  color: var(--green-deep);
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0;
}

.topic-paper-intro {
  max-width: 650px;
  color: var(--ink-soft);
  font-size: .92rem;
  line-height: 1.7;
}

.topic-paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}

.topic-paper-tags span {
  border: 1px solid rgba(44, 44, 42, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 700;
  padding: .38rem .72rem;
}

.topic-paper-tags span:first-child {
  background: var(--coral-soft);
  color: var(--coral);
}

.topic-paper-hero__side {
  display: grid;
  justify-items: end;
  gap: 1rem;
}

.topic-paper-illustration {
  position: relative;
  width: min(230px, 100%);
  height: 124px;
  margin: -1.35rem 1.4rem -.15rem 0;
  opacity: .34;
  pointer-events: none;
  transform: translateY(-1.6rem);
}

.topic-paper-illustration img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: saturate(.8);
}

.topic-paper-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .65rem;
}

.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 40px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 750;
  line-height: 1;
  padding: .7rem .9rem;
  text-decoration: none;
  white-space: nowrap;
}

.tp-btn svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.tp-btn--line {
  border: 1.5px solid rgba(44, 44, 42, .18);
  background: rgba(255, 255, 255, .42);
  color: var(--ink);
}

.tp-btn--line:hover {
  border-color: rgba(15, 110, 86, .35);
  color: var(--green);
}

.tp-btn--green {
  border: 1.5px solid var(--green);
  background: var(--green);
  color: #fff;
  box-shadow: 0 12px 26px rgba(15, 110, 86, .16);
}

.tp-btn--green:hover {
  background: var(--green-deep);
}

.topic-paper-board {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 1.35rem;
  padding: 1.55rem 1.8rem 1.8rem;
}

.topic-guide {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-width: 0;
}

.topic-guide-card {
  border: 1.5px solid rgba(44, 44, 42, .13);
  border-radius: 8px;
  background: rgba(255, 255, 255, .42);
  padding: 1rem;
}

.topic-guide-card--soft {
  background:
    linear-gradient(180deg, rgba(228, 243, 235, .56), rgba(255, 255, 255, .3));
}

.topic-guide-card__head {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .65rem;
}

.topic-guide-card__head svg {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: var(--green);
}

.topic-guide-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.2;
}

.topic-guide-card p {
  margin-bottom: .6rem;
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.65;
}

.topic-guide-card p:last-of-type {
  margin-bottom: .7rem;
}

.topic-check-list,
.topic-step-list {
  list-style: none;
  display: grid;
  gap: .5rem;
}

.topic-check-list li {
  position: relative;
  color: var(--ink);
  font-size: .78rem;
  line-height: 1.45;
  padding-left: 1.35rem;
}

.topic-check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: .05rem;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15, 110, 86, .28);
  border-radius: 50%;
  color: var(--green);
  font-size: .58rem;
  font-weight: 900;
}

.topic-step-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: .5rem;
  align-items: start;
  color: var(--ink);
  font-size: .78rem;
  line-height: 1.45;
}

.topic-step-list span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 110, 86, .18);
  color: var(--green);
  font-size: .68rem;
  font-weight: 850;
}

.topic-guide-art {
  position: relative;
  min-height: 162px;
  overflow: hidden;
  border-radius: 8px;
}

.topic-guide-art img {
  position: absolute;
  left: -20px;
  right: auto;
  bottom: -30px;
  width: 250px;
  max-width: none;
  height: auto;
  opacity: .88;
  filter: saturate(.9);
}

.question-panel {
  min-width: 0;
  border: 1.5px solid rgba(44, 44, 42, .13);
  border-radius: 8px;
  background: rgba(255, 255, 255, .36);
  padding: 1.15rem;
}

.question-panel__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.mini-label {
  display: inline-flex;
  margin-bottom: .38rem;
  color: var(--green);
  font-size: .72rem;
  font-weight: 800;
}

.question-panel__head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0;
}

.question-panel__head h3::after {
  content: "";
  display: block;
  width: 58px;
  height: 4px;
  margin-top: .42rem;
  border-radius: 999px;
  background: var(--green);
  transform: rotate(-1deg);
}

.question-filters {
  display: flex;
  gap: .62rem;
}

.question-filters select {
  min-height: 40px;
  border: 1.5px solid rgba(44, 44, 42, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .8rem;
  padding: .6rem 2rem .6rem .78rem;
}

.question-scroll {
  height: min(62vh, 620px);
  min-height: 430px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: .9rem;
  padding-right: .45rem;
  scroll-behavior: smooth;
}

.question-scroll::-webkit-scrollbar {
  width: 9px;
}

.question-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(44, 44, 42, .06);
}

.question-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 110, 86, .34);
}

.question-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 110, 86, .5);
}

.past-question-card {
  border: 1.5px solid rgba(44, 44, 42, .13);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 253, 248, .94), rgba(250, 244, 234, .96));
  box-shadow: 0 8px 20px rgba(44, 44, 42, .045), inset 0 1px 0 rgba(255, 255, 255, .7);
  padding: 1rem 1.05rem;
}

.past-question-card[hidden] {
  display: none;
}

.past-question-card:target {
  outline: 2px solid rgba(15, 110, 86, .38);
  outline-offset: 2px;
}

.question-inline-ad {
  border: 1px dashed rgba(216, 204, 186, .82);
  border-radius: 8px;
  background: rgba(255, 252, 246, .7);
  padding: .65rem;
}

.question-inline-ad[hidden] {
  display: none;
}

.question-inline-ad .ad-slot {
  min-height: 120px;
  margin: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  border-color: rgba(216, 204, 186, .82);
}

.past-question-card__top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .7rem;
  align-items: center;
  margin-bottom: .8rem;
}

.past-question-card__label {
  justify-self: start;
  border: 1px solid rgba(99, 56, 6, .08);
  border-radius: 999px;
  background: var(--amber-soft);
  color: #7A4E14;
  font-size: .68rem;
  font-weight: 800;
  padding: .28rem .62rem;
}

.past-question-card__top strong {
  justify-self: start;
  border-radius: 999px;
  background: rgba(228, 243, 235, .62);
  color: var(--green);
  font-size: .86rem;
  font-weight: 800;
  padding: .3rem .64rem;
}

.past-question-card__top em {
  justify-self: end;
  color: var(--green-deep);
  font-size: .82rem;
  font-style: normal;
  font-weight: 850;
}

.past-question-card__body {
  display: grid;
  gap: .55rem;
}

.past-question-card p {
  margin: 0;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.62;
}

.past-question-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .58rem;
  margin-top: .95rem;
  border-top: 1px solid rgba(44, 44, 42, .1);
  padding-top: .75rem;
}

.past-question-card__actions a,
.past-question-card__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 36px;
  border: 1.5px solid rgba(44, 44, 42, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .55);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 800;
  font-family: var(--font-body);
  padding: .52rem .82rem;
  text-decoration: none;
  cursor: pointer;
}

.past-question-card__actions a + a,
.past-question-card__actions a + button,
.past-question-card__actions button + a,
.past-question-card__actions button + button {
  border-color: rgba(15, 110, 86, .22);
  color: var(--green);
}

.past-question-card__actions a:hover,
.past-question-card__actions button:hover {
  border-color: rgba(15, 110, 86, .34);
  background: var(--green-soft);
  color: var(--green-deep);
}

.past-question-card__actions svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.rewarded-answer-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(30, 22, 14, .42);
  backdrop-filter: blur(5px);
}

.rewarded-answer-modal[hidden] {
  display: none;
}

.rewarded-answer-modal__panel {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid rgba(216, 204, 186, .9);
  border-radius: 12px;
  background: rgba(255, 252, 246, .96);
  box-shadow: 0 24px 70px rgba(30, 22, 14, .25);
  padding: 1.4rem;
}

.rewarded-answer-modal__close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(44, 44, 42, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .78);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.rewarded-answer-modal h2 {
  max-width: 360px;
  margin-bottom: .65rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.12;
  font-weight: 650;
}

.rewarded-answer-modal p {
  color: var(--ink-soft);
  font-size: .92rem;
  line-height: 1.6;
}

.rewarded-answer-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1rem;
}

@media (max-width: 1080px) {
  .topic-paper-floating-nav {
    grid-template-columns: auto 1fr;
  }

  .topic-paper-floating-nav__links {
    justify-content: flex-end;
    overflow-x: auto;
    padding-bottom: .2rem;
  }

  .topic-paper-floating-nav__tools {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .topic-paper-hero__grid {
    grid-template-columns: 1fr;
  }

  .topic-paper-hero h1 {
    white-space: normal;
  }

  .topic-paper-hero__side {
    justify-items: start;
  }

  .topic-paper-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 920px) {
  .topic-paper-board {
    grid-template-columns: 1fr;
  }

  .topic-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topic-guide-art {
    display: none;
  }
}

@media (max-width: 720px) {
  .topic-paper-room {
    overflow: visible;
    padding-top: 8.4rem;
  }

  .topic-paper-floating-nav {
    left: 14px;
    right: 14px;
    top: 14px;
    grid-template-columns: 1fr;
    gap: .7rem;
    padding: .85rem;
  }

  .topic-paper-floating-nav__links {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .topic-paper-floating-nav__tools {
    display: none;
  }

  .topic-paper-shell {
    width: min(100% - 24px, 1120px);
    border-radius: 18px;
  }

  .topic-paper-top-ad {
    width: min(100% - 24px, 970px);
  }

  .topic-paper-hero {
    padding: 1.45rem 1.15rem 1.2rem;
  }

  .topic-paper-hero h1 {
    font-size: 2.4rem;
    white-space: normal;
  }

  .topic-paper-hero h2 {
    font-size: 1.28rem;
  }

  .topic-paper-board {
    padding: 1rem;
  }

  .topic-guide,
  .question-panel__head {
    display: block;
  }

  .topic-guide-card + .topic-guide-card {
    margin-top: .9rem;
  }

  .question-filters,
  .topic-paper-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .question-filters {
    margin-top: .9rem;
  }

  .question-filters select,
  .tp-btn {
    width: 100%;
  }

  .question-scroll {
    min-height: 360px;
    height: 68vh;
  }

  .past-question-card__top {
    grid-template-columns: 1fr;
  }

  .past-question-card__top em {
    justify-self: start;
  }

  .past-question-card__actions {
    justify-content: stretch;
  }

  .past-question-card__actions a,
  .past-question-card__actions button {
    flex: 1 1 100%;
  }
}
