.discovery-lab-page {
  background:
    radial-gradient(circle at 8% 15%, rgba(13, 148, 136, .10), transparent 28rem),
    radial-gradient(circle at 92% 38%, rgba(249, 115, 22, .08), transparent 24rem),
    #f7f8f5;
}

.discovery-lab-page .nav-links-inline a.active {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.disc-lab {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 54px;
}

.disc-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 10px 4px 0;
}

.disc-kicker,
.disc-eyebrow {
  display: block;
  color: var(--primary);
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 900;
  letter-spacing: .16em;
}

.disc-hero h1 {
  margin: 7px 0 8px;
  color: #143b35;
  font-size: clamp(2rem, calc(4vw * var(--elder-text-scale, 1)), 3.3rem);
  line-height: 1.08;
}

.disc-hero p {
  max-width: 640px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.disc-hero-mark {
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: calc(42px * var(--elder-text-scale, 1));
  transform: rotate(5deg);
}

.disc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr);
  gap: 18px;
  align-items: stretch;
}

.disc-draw-card,
.disc-hot-card,
.disc-search-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 38px rgba(15, 23, 42, .07);
}

.disc-draw-card {
  /* 固定高度会让长辈模式（根字号 125%）下按钮变大后内容被裁，改为最小高度 */
  min-height: 352px;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.disc-hot-card {
  /* 与抽卡卡等高对齐；用最小高度而不是固定高度，长辈模式放大后不会裁掉列表 */
  display: flex;
  flex-direction: column;
  min-height: 352px;
  overflow: hidden;
}

.disc-card-head,
.disc-search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.disc-card-head h2,
.disc-search-head h2 {
  margin: 5px 0 0;
  color: #173d37;
  font-size: 1.15rem;
}

.disc-mode-tabs {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: #f1f5f3;
  gap: 3px;
}

.disc-mode-tabs button {
  border: 0;
  border-radius: 8px;
  padding: 7px 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: calc(11px * var(--elder-text-scale, 1));
  font-weight: 800;
  cursor: pointer;
}

.disc-mode-tabs button.active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.disc-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  flex: 1;
  min-height: 0;
  margin-top: 16px;
  align-items: stretch;
}

.disc-source-panel {
  min-height: 0;
  overflow: hidden;
}

.disc-featured-panel,
.disc-limit-panel {
  display: flex;
  flex-direction: column;
  /* 同 .disc-draw-card：固定高度在长辈模式下会裁字，改为最小高度 */
  min-height: 160px;
  box-sizing: border-box;
  overflow-y: auto;
}

.disc-featured-panel[hidden],
.disc-limit-panel[hidden] {
  display: none;
}

.disc-featured-panel {
  padding: 14px;
  border-radius: 14px;
  background: #f8faf9;
  border: 1px dashed #cbd5e1;
}

.disc-source-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 7px;
}

.disc-source-title b {
  color: #33443f;
  font-size: calc(11px * var(--elder-text-scale, 1));
}

.disc-source-title span {
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
}

.disc-featured-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  overflow-y: auto;
  padding-bottom: 2px;
}

.disc-featured-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dce9e4;
  color: #315b52;
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-featured-note {
  margin: auto 0 0;
  padding-top: 12px;
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
  line-height: 1.5;
}

.disc-limit-panel {
  padding: 14px;
  border-radius: 14px;
  background: #f8faf9;
  border: 1px dashed #cbd5e1;
}

.disc-limit-panel label {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-size: calc(11px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-city-add {
  display: flex;
  gap: 7px;
}

.disc-city-add .input {
  min-width: 0;
  flex: 1;
  height: 34px;
  padding: 0 10px;
}

.disc-city-add .btn {
  height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.disc-city-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  min-height: 25px;
  margin-top: 5px;
  overflow-y: auto;
  padding-bottom: 2px;
}

.disc-city-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px 6px 10px;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  font-size: calc(11px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-city-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #d1fae5;
  color: #065f46;
  cursor: pointer;
  line-height: 1;
}

.disc-field-note,
.disc-draw-meta,
.disc-hot-meta {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: calc(10px * var(--elder-text-scale, 1));
  line-height: 1.55;
}

.disc-limit-panel .disc-field-note {
  margin-top: 6px;
  font-size: calc(9px * var(--elder-text-scale, 1));
  line-height: 1.35;
}

.disc-draw-stage {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.disc-machine {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 0 0 8px;
}

.disc-screen {
  position: relative;
  width: min(280px, 100%);
  /* 长辈模式文字变大后固定高度会裁掉说明，改为最小高度 */
  height: auto;
  min-height: 160px;
  padding: 12px;
  border-radius: 20px;
  border: 1px dashed #0d9488;
  background:
    linear-gradient(145deg, rgba(255,255,255,.84), rgba(236,253,245,.9)),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(13,148,136,.035) 11px 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 #fff, 0 14px 30px rgba(13, 148, 136, .10);
  overflow: hidden;
}

.disc-screen::before,
.disc-screen::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(13, 148, 136, .07);
}

.disc-screen::before { width: 150px; height: 150px; left: -70px; top: -80px; }
.disc-screen::after { width: 110px; height: 110px; right: -48px; bottom: -64px; }

.disc-emoji {
  position: relative;
  z-index: 1;
  font-size: 2.5rem;
  line-height: 1;
}

.disc-emoji.rolling {
  animation: discPulse .16s ease-in-out infinite alternate;
}

.disc-screen strong {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  color: #115e59;
  font-size: 1.3rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disc-screen small {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: calc(12px * var(--elder-text-scale, 1));
  text-align: center;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.disc-draw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  height: 46px;
  margin: 0 auto;
  padding: 0 26px;
  font-size: calc(15px * var(--elder-text-scale, 1));
  font-weight: 900;
}

.disc-draw-stage .disc-draw-meta {
  min-height: 16px;
  text-align: center;
}

.disc-hot-card {
  padding: 22px 18px;
  background: linear-gradient(180deg, #fff, #fbfcfa);
}

.disc-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #b45309;
  font-size: calc(9px * var(--elder-text-scale, 1));
  font-weight: 900;
}

.disc-live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .12);
}

.disc-hot-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 12px;
  overflow-y: auto;
  padding-right: 2px;
}

.disc-hot-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 3px;
  border-bottom: 1px dashed #e8eeeb;
  cursor: pointer;
}

.disc-hot-row:hover { background: #f8faf9; }
.disc-hot-row:last-child { border-bottom: 0; }

.disc-hot-rank {
  color: #94a3b8;
  font-size: calc(12px * var(--elder-text-scale, 1));
  font-style: italic;
  font-weight: 900;
  text-align: center;
}

.disc-hot-row:nth-child(1) .disc-hot-rank { color: #f59e0b; }
.disc-hot-row:nth-child(2) .disc-hot-rank { color: #64748b; }
.disc-hot-row:nth-child(3) .disc-hot-rank { color: #b45309; }

.disc-hot-main b {
  display: block;
  font-size: calc(12px * var(--elder-text-scale, 1));
}

.disc-hot-main small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disc-heat {
  color: #c2410c;
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 900;
}

.disc-search-card {
  margin-top: 18px;
  padding: 24px;
}

.disc-search-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: calc(12px * var(--elder-text-scale, 1));
}

.disc-search-form {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  background: #f8faf9;
  border: 1px solid var(--line);
}

.disc-search-label {
  display: block;
  margin-bottom: 7px;
  color: #33443f;
  font-size: calc(11px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.disc-search-controls .input,
.disc-search-controls .btn {
  min-height: 42px;
}

.disc-search-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.disc-search-tags > span {
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-search-tags button {
  border: 1px solid #dbe5e1;
  border-radius: 999px;
  padding: 5px 9px;
  background: #ecfdf5;
  color: #047857;
  font-size: calc(9px * var(--elder-text-scale, 1));
  font-weight: 800;
  cursor: pointer;
}

.disc-search-tags button:hover {
  border-color: #6ee7b7;
  background: #d1fae5;
}

.disc-search-status {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
}

.disc-knowledge-source {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 900;
  text-decoration: none;
}

.disc-knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.disc-knowledge-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #fff, #f8faf9);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.disc-knowledge-item:hover {
  transform: translateY(-3px);
  border-color: #a7f3d0;
  box-shadow: 0 12px 26px rgba(15, 23, 42, .09);
}

.disc-knowledge-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-knowledge-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
}

.disc-knowledge-item h3 {
  margin: 10px 0 7px;
  color: #173d37;
  font-size: calc(14px * var(--elder-text-scale, 1));
  line-height: 1.55;
}

.disc-knowledge-item p {
  margin: 0;
  color: #52645e;
  font-size: calc(11px * var(--elder-text-scale, 1));
  line-height: 1.7;
}

.disc-knowledge-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
}

.disc-knowledge-footer small {
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
}

.disc-knowledge-footer a {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 900;
  text-decoration: none;
}

.disc-knowledge-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border-radius: 16px;
  background: #f8faf9;
  color: var(--ink-soft);
  font-size: calc(12px * var(--elder-text-scale, 1));
  text-align: center;
}

.disc-knowledge-note {
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-size: calc(9px * var(--elder-text-scale, 1));
  line-height: 1.6;
}

.disc-lab-disclaimer {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: calc(10px * var(--elder-text-scale, 1));
  text-align: center;
}

.disc-result-modal {
  display: flex;
  flex-direction: column;
  width: min(680px, calc(100vw - 40px));
  max-width: 680px;
  max-height: calc(100vh - 40px);
  margin: auto;
  overflow: hidden;
}

.disc-result-modal #discResultBody {
  min-height: 0;
  overflow-y: auto;
}

.disc-result-hero {
  position: relative;
  min-height: 230px;
  padding: 24px;
  border-radius: 16px 16px 0 0;
  background-size: cover;
  background-position: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.disc-result-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,23,42,.04), rgba(15,23,42,.78));
}

.disc-result-hero > * { position: relative; z-index: 1; }
.disc-result-hero h3 { margin: 0; font-size: 2.2rem; }
.disc-result-hero p { margin: 6px 0 0; font-size: calc(12px * var(--elder-text-scale, 1)); opacity: .9; }

.disc-result-content {
  padding: 18px 22px 22px;
}

.disc-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.disc-result-tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: calc(10px * var(--elder-text-scale, 1));
  font-weight: 800;
}

.disc-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.disc-result-actions .btn {
  width: 100%;
  justify-content: center;
}

.disc-fav-btn.active {
  border-color: #fbbf24;
  background: #fffbeb;
  color: #b45309;
}

.disc-poster-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 15px;
  background: #f8faf9;
  border: 1px solid var(--line);
}

.disc-poster-box[hidden] { display: none; }
.disc-poster-box img { display: block; width: min(100%, 380px); margin: 0 auto; border-radius: 8px; box-shadow: var(--shadow-lg); }
.disc-poster-actions { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.disc-poster-note { margin: 8px 0 0; color: var(--ink-soft); font-size: calc(10px * var(--elder-text-scale, 1)); text-align: center; }

@keyframes discPulse {
  from { transform: scale(.88); filter: blur(1px); }
  to { transform: scale(1.08); filter: blur(2.5px); }
}

@media (max-width: 900px) {
  .disc-lab {
    width: calc(100% - 24px);
    max-width: 720px;
    padding-top: 24px;
  }

  .disc-hero {
    align-items: flex-start;
  }

  .disc-hero-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    font-size: calc(28px * var(--elder-text-scale, 1));
  }

  .disc-grid,
  .disc-search-controls {
    grid-template-columns: 1fr;
  }

  .disc-workbench {
    grid-template-columns: 1fr;
  }

  .disc-draw-card,
  .disc-hot-card {
    height: auto;
    overflow: visible;
  }

  .disc-source-panel { min-height: 0; }

  .disc-hot-list {
    flex: none;
    overflow: visible;
  }

  .disc-draw-stage {
    min-height: auto;
    padding-top: 4px;
  }

  .disc-search-card {
    padding: 18px;
  }

  .disc-knowledge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .disc-search-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .discovery-lab-page {
    overflow-x: hidden;
  }

  .disc-lab {
    width: 100%;
    padding: 18px 12px 34px;
  }

  .disc-hero-mark {
    display: none;
  }

  .disc-draw-card,
  .disc-hot-card,
  .disc-search-card {
    min-width: 0;
    padding: 16px;
  }

  .disc-card-head {
    flex-direction: column;
  }

  .disc-card-head > div,
  .disc-search-head > div {
    min-width: 0;
  }

  .disc-mode-tabs {
    width: 100%;
    min-width: 0;
  }

  .disc-mode-tabs button {
    flex: 1;
    min-width: 0;
    padding: 7px 4px;
    white-space: nowrap;
  }

  .disc-knowledge-grid {
    grid-template-columns: 1fr;
  }

  .disc-search-controls .btn {
    width: 100%;
  }

  .disc-draw-btn {
    width: 100%;
  }

  .disc-source-panel { min-height: 0; }
}

@media (max-width: 640px) {
  .disc-result-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) and (max-width: 1320px) {
  html.lang-en .discovery-lab-page .nav-actions {
    gap: 6px;
  }

  html.lang-en .discovery-lab-page #settingsBtn {
    padding-left: 10px;
    padding-right: 10px;
  }
}
