/* =========================================================
   CyTutor 小辅星球 · components
   Buttons, badges, status, chart, modal
   ========================================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease),
    background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 107, 74, 0.24);
}

.btn-primary:hover {
  background: var(--coral-deep);
  box-shadow: 0 16px 30px rgba(255, 107, 74, 0.30);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: #fff;
}

.btn-light {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16);
}

.btn-light:hover {
  background: var(--yellow);
}

.btn-small {
  padding: 9px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 15px 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-teal {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.badge-coral {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.badge-soft {
  background: var(--paper-2);
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.3;
}

/* ---------- Compare status ---------- */
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.status .icon {
  width: 16px;
  height: 16px;
}

.status-yes {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.status-no {
  background: rgba(31, 42, 55, 0.06);
  color: #A5ADB9;
}

.status-partial {
  background: var(--yellow-soft);
  color: #946700;
  font-weight: 700;
}

.status-beta {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

/* ---------- Chart controls ---------- */
.chip-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--paper-2);
}

.chip-tab {
  padding: 9px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.chip-tab:hover {
  color: var(--ink);
}

.chip-tab.is-active {
  background: var(--ink);
  color: #fff;
}

/* ---------- Chart internals ---------- */
.chart-grid-line {
  stroke: rgba(31, 42, 55, 0.09);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}

.chart-axis-text {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 11px;
}

.chart-axis-text.y {
  text-anchor: end;
}

.chart-axis-text.x {
  text-anchor: middle;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-dashoffset 1.7s var(--ease);
}

.chart-line.us {
  stroke: var(--coral);
  stroke-width: 4;
}

.chart-line.base {
  stroke: #B9C0CA;
  stroke-width: 2.5;
  stroke-dasharray: 6 7;
}

.chart-area {
  opacity: 0.55;
  transition: opacity 0.6s var(--ease);
}

.chart-point {
  opacity: 0;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  transform-origin: center;
}

.chart-point.is-visible {
  opacity: 1;
}

.chart-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 112px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 30px rgba(31, 42, 55, 0.22);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px)) scale(0.96);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 12px)) scale(1);
}

.chart-tooltip strong {
  display: block;
  margin-top: 2px;
  color: var(--yellow);
  font-size: 14px;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 55, 0.58);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.modal-card {
  position: relative;
  width: min(100%, 430px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s var(--ease);
}

.modal.is-open .modal-card {
  transform: none;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.modal-close:hover {
  background: #fff;
  transform: rotate(90deg);
}

.modal-mascot {
  width: 86px;
  height: 86px;
  margin: 0 auto 14px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-card h2 {
  margin: 10px 0 8px;
  font-size: 26px;
}

.modal-card > p {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.qr-box {
  width: 220px;
  margin: 20px auto 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-box svg {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.qr-box span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.modal-note {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
}

.modal-note strong {
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .modal-card {
    padding: 26px 20px 22px;
    border-radius: 26px;
  }

  .modal-mascot {
    width: 76px;
    height: 76px;
  }

  .qr-box {
    width: 190px;
  }
}
