*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #16325c;
  --muted: #6b84a5;
  --blue: #2f7dff;
  --blue-deep: #1d5fd6;
  --up: #16a34a;
  --down: #ef4444;
  --card: #ffffff;
  --shadow: 0 12px 32px rgba(40, 90, 160, 0.12);
  --radius: 18px;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #d7ebff 0%, #eef6ff 42%, #f7fbff 100%);
}

.advisor-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 88% 8%, rgba(80, 140, 255, 0.18), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(120, 180, 255, 0.12), transparent 36%);
}

.advisor-page {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.advisor-hero {
  text-align: center;
  margin-bottom: 22px;
  position: relative;
}

.back-link {
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: var(--blue);
}

.advisor-hero h1 {
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 800;
  color: #1a3d75;
}

.advisor-hero p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.advisor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.panel-input {
  padding: 22px 20px 20px;
}

.step {
  margin-bottom: 22px;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4f8dff, #2f7dff);
  color: #fff;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.coin-meta {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 12px;
}

.coin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.coin-search-wrap {
  position: relative;
  margin-top: 14px;
}

.coin-search-wrap input {
  width: 100%;
  border: 1.5px solid #d7e4f5;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  background: #fbfdff;
}

.coin-search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 125, 255, 0.12);
}

.coin-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d7e4f5;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(40, 90, 160, 0.14);
}

.suggest-item {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.suggest-item:hover {
  background: #f3f7ff;
}

.suggest-item img,
.suggest-item .coin-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.suggest-item span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.suggest-item strong {
  font-size: 14px;
}

.suggest-item small {
  color: var(--muted);
  font-size: 12px;
}

.suggest-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.selected-coin {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.coin-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid #d7e4f5;
  background: #f7faff;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.coin-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.coin-chip .check {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  align-items: center;
  justify-content: center;
}

.coin-chip.is-active {
  border-color: var(--blue);
  background: #edf4ff;
  box-shadow: 0 6px 16px rgba(47, 125, 255, 0.18);
}

.coin-chip.is-active .check {
  display: inline-flex;
}

.coin-chip:hover {
  transform: translateY(-2px);
}

.coin-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f0fb;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.coin-empty {
  width: 100%;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.coin-other .plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f0fb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--blue);
}

.coin-extra {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #c9daf0;
  border-radius: 16px;
  background: #f8fbff;
}

.coin-extra-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.coin-extra-row {
  margin-bottom: 4px;
}

.coin-extra .coin-search-wrap {
  margin-top: 12px;
}

.other-wrap {
  margin-top: 12px;
}

.other-wrap input,
.amount-box input {
  width: 100%;
  border: 1.5px solid #d7e4f5;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
  background: #fbfdff;
}

.other-wrap input:focus,
.amount-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 125, 255, 0.12);
}

.amount-box {
  position: relative;
}

.amount-box .unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.amount-box input {
  padding-right: 68px;
}

.btn-generate {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #4f8dff 0%, #2f7dff 55%, #1d5fd6 100%);
  box-shadow: 0 12px 24px rgba(47, 125, 255, 0.28);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-generate:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-generate:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.panel-result {
  min-height: 420px;
  padding: 22px 22px 24px;
}

.panel-result.has-result {
  min-height: 0;
}

.result-empty {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 10px;
}

.result-empty[hidden],
.result-body[hidden] {
  display: none !important;
}

.empty-icon {
  font-size: 42px;
  opacity: 0.45;
}

.result-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.result-top h2 {
  font-size: 20px;
  font-weight: 800;
}

.gen-time {
  font-size: 13px;
  color: var(--muted);
}

.direction-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, #e8f9ef, #f3fcf6);
  color: var(--up);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
}

.direction-bar.is-short {
  background: linear-gradient(90deg, #ffecec, #fff5f5);
  color: var(--down);
}

.dir-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: #f7faff;
  border: 1px solid #e5eef9;
  border-radius: 14px;
  padding: 14px 12px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 18px;
  font-weight: 800;
  word-break: break-all;
}

.metric-value.up {
  color: var(--up);
}

.metric-value.down {
  color: var(--down);
}

.reason-block,
.news-block {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e5eef9;
}

.reason-block h3,
.news-block h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.reason-block p,
.news-block p {
  font-size: 14px;
  line-height: 1.75;
  color: #355174;
  white-space: pre-wrap;
}

.advisor-footer {
  text-align: center;
  margin-top: 22px;
  color: #8aa0bc;
  font-size: 13px;
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 243, 255, 0.55);
  backdrop-filter: blur(3px);
}

.loading-mask[hidden] {
  display: none !important;
}

.loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 22px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(47, 125, 255, 0.2);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(22, 50, 92, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  max-width: min(90vw, 420px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.toast[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .advisor-layout {
    grid-template-columns: 1fr;
  }

  .back-link {
    position: static;
    display: inline-block;
    margin-bottom: 10px;
  }

  .advisor-hero {
    text-align: left;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .advisor-page {
    padding: 16px 14px 28px;
  }

  .coin-chip {
    padding: 8px 10px;
    font-size: 13px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-value {
    font-size: 16px;
  }
}
