:root {
  --bg: #0c0e12;
  --panel: #151922;
  --panel-2: #1b202b;
  --input: #0e1117;
  --gold: #d8a85a;
  --gold-soft: #f0cf9a;
  --gold-dim: rgba(216, 168, 90, 0.18);
  --red: #b2463d;
  --text: #ece8e1;
  --muted: #98a0ad;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --radius: 16px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 380px at 18% -8%, rgba(216, 168, 90, 0.12), transparent 70%),
    radial-gradient(620px 360px at 92% 8%, rgba(178, 70, 61, 0.10), transparent 70%),
    linear-gradient(180deg, #0c0e12 0%, #0c0e12 60%, #0a0c10 100%);
}

.app {
  position: relative;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 64px;
}

.hero { margin-bottom: 26px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold);
  opacity: 0.9;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.08;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.hero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.search-card {
  background: linear-gradient(180deg, rgba(27, 32, 43, 0.96), rgba(21, 25, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.search-form {
  display: flex;
  gap: 10px;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#queryInput {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--input);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#queryInput::placeholder { color: #6f7784; }

#queryInput:focus {
  border-color: rgba(216, 168, 90, 0.7);
  box-shadow: 0 0 0 4px var(--gold-dim);
}

.primary-btn {
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #e3b76c, #c99745);
  color: #1a1409;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.primary-btn:hover:not(:disabled) { filter: brightness(1.06); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.55; cursor: default; }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.suggest-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-right: 2px;
}

.suggestions button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
  color: #c9cdd4;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.suggestions button:hover {
  border-color: rgba(216, 168, 90, 0.55);
  color: var(--gold-soft);
  background: rgba(216, 168, 90, 0.06);
}

.cache-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.cache-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  color: #b8bec8;
}

.cache-toggle input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 34px;
  height: 19px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #2a303c;
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.cache-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #8a919d;
  transition: transform 0.18s ease, background 0.18s ease;
}

.cache-toggle input:checked {
  background: rgba(216, 168, 90, 0.24);
  border-color: rgba(216, 168, 90, 0.62);
}

.cache-toggle input:checked::after {
  transform: translateX(15px);
  background: var(--gold-soft);
}

.cache-toggle input:focus-visible {
  outline: 2px solid rgba(216, 168, 90, 0.55);
  outline-offset: 2px;
}

.cache-text { color: #d5d0c8; }

.cache-hint {
  color: #6f7784;
  font-size: 11.5px;
  line-height: 1.5;
}

.output-card {
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(24, 29, 39, 0.96), rgba(19, 23, 31, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.output-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.output-title {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #c9cdd4;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a5160;
  box-shadow: 0 0 0 3px rgba(74, 81, 96, 0.15);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.dot.is-ok {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(216, 168, 90, 0.16);
}

.dot.is-loading {
  background: var(--gold);
  animation: pulse 1s ease-in-out infinite;
}

.dot.is-error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(178, 70, 61, 0.18);
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: #c9cdd4;
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.ghost-btn:hover:not(:disabled) {
  border-color: rgba(216, 168, 90, 0.55);
  color: var(--gold-soft);
}

.ghost-btn:disabled { opacity: 0.38; cursor: default; }

.output {
  min-height: 260px;
  padding: 22px 22px 28px;
  font-size: 15px;
  line-height: 1.78;
}

.placeholder {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.placeholder-kicker {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(216, 168, 90, 0.7);
}

.answer-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 6px;
  letter-spacing: 0.02em;
}

.answer-heading:first-child { margin-top: 0; }

.heading-label {
  flex: none;
  color: var(--gold-soft);
  font-weight: 700;
}

.heading-text {
  color: #d8d3ca;
  font-weight: 400;
}

.answer-line { color: #ddd8cf; }

.answer-bullet {
  color: #d2cdc4;
  padding-left: 1.1em;
  position: relative;
}

.answer-bullet::before {
  content: "·";
  position: absolute;
  left: 0.25em;
  color: var(--gold);
}

.answer-gap { height: 8px; }

.stream-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--gold);
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.loading {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(216, 168, 90, 0.18);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid rgba(178, 70, 61, 0.35);
  background: rgba(178, 70, 61, 0.08);
  border-radius: 10px;
  color: #e6b3ad;
  font-size: 13px;
}

.error-box {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #e6b3ad;
  text-align: center;
  font-size: 14px;
}

.error-title {
  color: #f0c9c5;
  font-weight: 700;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  color: #6f7784;
  font-size: 12px;
}

.foot-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.health { color: #7d8593; }

.db-btn {
  padding: 4px 10px;
  font-size: 11.5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== 预留：后续表格 / 渠道图标 / 折叠 / 公告跳转 ===== */
/*
.answer-table { ... }      结构化价格表
.channel-icon { ... }      玉玺/同心结/如意结/元宝图标
.timeline-more { ... }     时间线“展开详情”
.article-link { ... }      跳转官网公告
*/

/* ===== 结构化结果：目标选择 / 祈愿台龙珠 / 价格分组 ===== */
.target-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.target-kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.target-name {
  font-size: 20px;
  font-weight: 700;
  color: #f3ead9;
  letter-spacing: 0.02em;
}

.target-meta {
  font-size: 12px;
  color: var(--muted);
}

.target-pick {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8d95a2;
}

.target-correction {
  font-size: 11.5px;
  color: #d8a85a;
  background: rgba(216, 168, 90, 0.1);
  border: 1px solid rgba(216, 168, 90, 0.35);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.target-pick select {
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12.5px;
  max-width: 240px;
  outline: none;
}

.target-pick select:focus { border-color: rgba(216, 168, 90, 0.7); }

.result-section {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--gold-soft);
  font-weight: 700;
}

.section-sub {
  font-size: 11.5px;
  color: #6f7784;
}

.prayer-row {
  display: grid;
  grid-template-columns: 110px minmax(150px, 1fr) 140px 92px;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
}

.acq-row {
  display: grid;
  grid-template-columns: 140px 180px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
}

.acq-row:last-child { border-bottom: 0; }

.acq-date { color: #8d95a2; font-variant-numeric: tabular-nums; }
.acq-channel { color: var(--gold-soft); font-weight: 600; }
.acq-note { color: #b8bec8; line-height: 1.55; }

/* 日期就是公告入口：隐藏单独的“公告”链接 */
.date-range { white-space: nowrap; }
.date-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(212, 175, 55, 0.45);
}
.date-link:hover { color: var(--gold-soft); border-bottom-color: currentColor; }
.price-legacy {
  display: inline-block;
  margin-left: 8px;
  white-space: nowrap;
  color: #8d95a2;
  font-size: 11px;
  border: 1px solid rgba(141, 149, 162, 0.35);
  border-radius: 999px;
  padding: 0 6px;
  vertical-align: 1px;
}

.price-crystal {
  display: inline-block;
  margin-left: 8px;
  white-space: nowrap;
  color: var(--gold-soft);
  font-size: 11px;
  border: 1px solid rgba(216, 168, 90, 0.4);
  border-radius: 999px;
  padding: 0 6px;
  vertical-align: 1px;
}

.prayer-row:last-child { border-bottom: 0; }

.prayer-name { color: var(--gold-soft); font-weight: 600; }
.prayer-date { color: #8d95a2; }
.prayer-main { color: #d5d0c8; }
.prayer-row .prayer-name,
.prayer-row .prayer-date,
.prayer-row .prayer-main { white-space: nowrap; }
.prayer-row .prayer-main { grid-column: 3; }
.prayer-row .price-toggle { grid-column: 4; justify-self: start; }

.price-group {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.price-group:first-child { margin-top: 0; }

.price-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.currency-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: none;
}

.price-currency {
  font-size: 13px;
  font-weight: 700;
  color: #e7e1d7;
}

.price-min {
  font-size: 11.5px;
  color: var(--gold);
  margin-left: 2px;
}

.price-total {
  font-size: 11px;
  color: #6f7784;
}

.price-discount {
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(178, 70, 61, 0.16);
  color: #e8a59e;
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}

.price-row {
  display: grid;
  grid-template-columns: 56px minmax(120px, 1.3fr) 84px 88px 104px;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
}

.price-row:last-child { border-bottom: 0; }

.price-amount {
  color: #f3ead9;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.price-date { color: #8d95a2; font-variant-numeric: tabular-nums; }
.price-channel { color: #b8bec8; }

.price-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}

.price-link:hover { text-decoration: underline; }

.price-note {
  grid-column: 1 / -1;
  color: #6f7784;
  font-size: 11px;
  padding-left: 2px;
}

.price-repeat {
  font-size: 11px;
  color: var(--gold-soft);
  white-space: nowrap;
}

/* 每一行都是独立网格：把次数/展开按钮钉在固定列，避免“收起”变长把列顶开 */
.price-row .price-repeat { grid-column: 4; }
.price-row .price-toggle { grid-column: 5; }

.price-toggle {
  justify-self: start;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: #b8bec8;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.price-toggle:hover {
  border-color: rgba(216, 168, 90, 0.6);
  color: var(--gold-soft);
}

.price-extra {
  padding: 2px 0 4px 14px;
  margin: 2px 0 4px;
  border-left: 2px solid rgba(216, 168, 90, 0.18);
}

.price-extra[hidden] { display: none; }

.price-extra-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 3px 0;
  font-size: 11.5px;
  color: #8d95a2;
}

.price-extra-date { font-variant-numeric: tabular-nums; }
.price-extra-count { color: #b8bec8; }

.price-more {
  margin-top: 7px;
  color: #6f7784;
  font-size: 11px;
}

.alt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alt-chip {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  color: #d5d0c8;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.alt-chip:hover {
  border-color: rgba(216, 168, 90, 0.6);
  color: var(--gold-soft);
  background: rgba(216, 168, 90, 0.07);
}

/* ===== 预留：后续折叠时间线 ===== */
/*
.timeline-more { ... }
.article-link { ... }
*/

@media (max-width: 640px) {
  .app { padding-top: 34px; }
  .search-form { flex-direction: column; }
  .primary-btn { width: 100%; }
  .output { padding: 18px 16px 22px; }
  .meta { max-width: 40vw; }
  .foot { flex-direction: column; gap: 6px; }
  .foot-right { flex-wrap: wrap; }
  .cache-toggle { flex-wrap: wrap; }
  .cache-hint { flex-basis: 100%; padding-left: 43px; }
  .target-pick { margin-left: 0; flex-basis: 100%; }
  .target-pick select { flex: 1; max-width: none; }
  .prayer-row { grid-template-columns: 92px 1fr; }
  .prayer-row .prayer-main { grid-column: 2; }
  .prayer-row .price-toggle { grid-column: 2; }
  .acq-row { grid-template-columns: 1fr; gap: 2px; }
  .acq-note { grid-column: 1; }
  .price-row { grid-template-columns: 52px 1fr 72px auto; }
  .price-row .price-repeat { grid-column: 4; }
  .price-row .price-toggle { grid-column: 4; justify-self: start; }
  .price-note { grid-column: 1 / -1; }
}
