/* v66: one coordinated Tsinghua-purple instruction system. */
.instruction-overlay {
  background: rgba(49, 24, 62, .62);
}
.instruction-card {
  color: #30233a;
  background: #fffafd;
  border-top-color: #7b2cad;
  box-shadow: 0 28px 80px rgba(54, 23, 69, .32);
}
.instruction-card .eyebrow {
  color: #7b2cad;
}
.instruction-types .type-choice {
  background: #f4eafa;
  border-color: #d9bce9;
}
.instruction-types .type-sentence {
  background: #fff1e8;
  border-color: #f1c7aa;
}
.instruction-types .type-choice .instruction-icon {
  background: #7b2cad;
}
.instruction-types .type-sentence .instruction-icon {
  background: #ef7a2f;
}
.instruction-card ul {
  color: #695d70;
}
.instruction-card .primary-button {
  background: linear-gradient(135deg, #8e3ac1, #6f269d);
  box-shadow: 0 10px 22px rgba(111, 38, 157, .24);
}
.instruction-card .primary-button:hover {
  background: linear-gradient(135deg, #7e2eaf, #602087);
}

/* v68: compact illustrated subbank cards. */
.theme-bank-heading {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-top: 25px;
  padding-bottom: 9px;
}
.theme-bank-heading::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 43px;
  width: 72px;
  height: 4px;
  background: linear-gradient(90deg, #ff8b32, #ffc35e);
  border-radius: 999px;
  transform: rotate(-2deg);
}
.theme-bank-heading > img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.theme-bank-heading span {
  display: inline-block;
  padding: 3px 9px;
  color: #7d36ae;
  background: #f4e7ff;
  border-radius: 999px;
  font-size: 12px;
}
.theme-bank-heading strong { font-size: 22px; }
.theme-bank-list { gap: 15px; }
.theme-bank-card.ip-subbank-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 118px;
  grid-template-areas:
    "number copy art"
    ". action art";
  gap: 4px 13px;
  min-height: 132px;
  padding: 14px 15px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 22%, rgba(255,255,255,.96), rgba(255,255,255,0) 29%),
    linear-gradient(145deg, #fff, #fff5fe 70%, #f4e7ff);
  border-color: #ead9f3;
  border-radius: 22px;
  box-shadow: 0 7px 0 #ead5f4, 0 16px 28px rgba(101,67,124,.12);
}
.theme-bank-card.ip-subbank-card > span {
  grid-area: number;
  align-self: start;
  width: 48px;
  height: 54px;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%);
  border-radius: 9px 9px 6px 6px;
  box-shadow: none;
}
.theme-bank-card.ip-subbank-card > div { grid-area: copy; align-self: center; }
.theme-bank-card.ip-subbank-card strong { font-size: 19px; }
.theme-bank-card.ip-subbank-card small { font-size: 12px; }
.theme-bank-card.ip-subbank-card em { margin-top: 5px; }
.theme-bank-card.ip-subbank-card > b {
  grid-area: action;
  justify-self: start;
  align-self: end;
  margin-top: 5px;
  padding: 8px 17px;
  color: #fff;
  background: linear-gradient(135deg, #ff9a3f, #f27425);
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 5px 10px rgba(218,102,34,.2);
}
.theme-bank-art {
  grid-area: art;
  align-self: center;
  justify-self: center;
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(94,49,115,.14));
}
.theme-test-note {
  position: relative;
  padding-left: 58px;
  background: linear-gradient(135deg, #fffdf8, #fff5ea);
  border-color: #f2d9bb;
}
.theme-test-note::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 32px;
  height: 32px;
  background: url("./assets/ui/mode-read-word-3d-fast.webp") center / contain no-repeat;
  transform: translateY(-50%);
}

@media (max-width: 700px) {
  .theme-bank-heading { grid-template-columns: 30px 1fr auto; align-items: center; }
  .theme-bank-heading > img { width: 30px; height: 30px; }
  .theme-bank-heading strong { font-size: 19px; }
  .theme-bank-heading small { font-size: 10px; }
  .theme-bank-card.ip-subbank-card {
    grid-template-columns: 42px minmax(0, 1fr) 92px;
    grid-template-areas:
      "number copy art"
      ". action art";
    gap: 3px 10px;
    min-height: 118px;
    padding: 12px;
  }
  .theme-bank-card.ip-subbank-card > span { width: 42px; height: 48px; }
  .theme-bank-card.ip-subbank-card strong { font-size: 17px; }
  .theme-bank-card.ip-subbank-card small { font-size: 11px; }
  .theme-bank-card.ip-subbank-card > b { grid-column: auto; margin-top: 3px; padding: 7px 14px; }
  .theme-bank-art { width: 90px; height: 90px; }
}

/* v69: keep the four landing choices fully readable on narrow phones. */
@media (max-width: 430px) {
  .play-mode-tabs {
    gap: 9px 7px;
  }

  .play-mode-button,
  .play-mode-button:nth-child(2),
  .play-mode-button:nth-child(3),
  .play-mode-button:nth-child(4) {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 3px;
    min-width: 0;
    min-height: 74px;
    padding: 8px 7px;
    border-radius: 18px;
  }

  .play-mode-button .mode-icon {
    width: 44px;
    height: 44px;
  }

  .play-mode-button b {
    min-width: 0;
    font-size: 21px;
    line-height: 1.1;
    letter-spacing: 0;
    white-space: nowrap;
  }
}

/* v70: keep the mobile title clear of the Tsinghua gate artwork. */
@media (max-width: 390px) {
  .game-brand-copy {
    transform: translate(-46px, 12px);
  }
}

/* v72: balanced two-line title and narrow-phone mode buttons. */
.game-brand-copy .title-art {
  display: grid;
  grid-template-rows: 1fr 1.08fr;
  gap: 10px;
  aspect-ratio: 756 / 258;
}

.title-art-line {
  display: block;
  min-height: 0;
  background-image: url("./assets/ui/title-kaiti-v52-fast.webp?v=52");
  background-repeat: no-repeat;
  background-size: 100% auto;
}

.title-art-top {
  background-position: center top;
}

.title-art-bottom {
  background-position: center bottom;
}

@media (max-width: 700px) {
  .tsinghua-gate-bg {
    right: -24px;
    width: 205px;
    opacity: .84;
  }

  .game-brand-copy {
    transform: translate(-58px, 12px);
  }

  .game-brand-copy .title-art {
    width: min(100%, 350px);
    gap: 12px;
    aspect-ratio: 756 / 266;
  }
}

@media (max-width: 430px) {
  .play-mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
    width: 100%;
  }

  .play-mode-button,
  .play-mode-button:nth-child(2),
  .play-mode-button:nth-child(3),
  .play-mode-button:nth-child(4) {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 5px;
    width: 100%;
    min-width: 0;
    min-height: 72px;
    padding: 8px 7px;
    overflow: hidden;
    border-width: 3px;
    border-radius: 17px;
  }

  .play-mode-button .mode-icon {
    width: 40px;
    height: 40px;
  }

  .play-mode-button b {
    min-width: 0;
    width: auto;
    font-size: clamp(17px, 4.7vw, 20px);
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .tsinghua-gate-bg {
    top: 24px;
    right: -28px;
    width: 168px;
    height: 139px;
    opacity: .8;
  }

  .game-brand-copy {
    transform: translate(-54px, 10px);
  }

  .game-brand-copy .title-art {
    width: min(100%, 282px);
    gap: 11px;
  }
}

@media (max-width: 360px) {
  .play-mode-button,
  .play-mode-button:nth-child(2),
  .play-mode-button:nth-child(3),
  .play-mode-button:nth-child(4) {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 64px;
    padding: 5px;
  }

  .play-mode-button .mode-icon {
    width: 34px;
    height: 34px;
  }

  .play-mode-button b {
    font-size: 16px;
  }
}

/* Keep the original title artwork intact and fit each choice on mobile. */
.game-brand-copy .title-art {
  display: block;
  aspect-ratio: 756 / 258;
}
.title-art-top {
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: contain;
}
.title-art-bottom { display: none; }
@media (max-width: 700px) {
  .play-mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-mode-button,
  .play-mode-button:nth-child(n) {
    grid-template-columns: 40px minmax(0, 1fr);
    column-gap: 2px;
    min-width: 0;
    min-height: 64px;
    padding: 5px;
  }
  .play-mode-button .mode-icon { width: 40px; height: 40px; }
  .play-mode-button b {
    width: 100%;
    min-width: 0;
    font-size: 22px;
    text-align: center;
    white-space: nowrap;
    transform: none;
  }
}
@media (max-width: 360px) {
  .play-mode-button,
  .play-mode-button:nth-child(n) { grid-template-columns: 35px minmax(0, 1fr); }
  .play-mode-button .mode-icon { width: 35px; height: 35px; }
  .play-mode-button b { font-size: 18px; }
}
