/* ==========================================================================
   ARSENEY VETROV — реферальная программа и колесо фортуны
   Дополняет producer.css: те же переменные, панели и кнопки.
   ========================================================================== */

/* ---------- общий каркас страниц /ref ---------- */

.ref-hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--bar) + 56px) 0 48px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(760px 380px at 80% -18%, rgba(47, 107, 255, .18), transparent 70%),
    var(--bg);
}

.ref-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: 48px;
}

.ref-title {
  max-width: 760px;
  margin-top: 18px;
  font-size: clamp(34px, 5.2vw, 60px);
}

.ref-lead {
  max-width: 660px;
  margin-top: 20px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--dim);
}

.ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 7px 13px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-3);
}

.ref-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.ref-card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.ref-card-t {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-3);
}

.ref-card h2 {
  margin-top: 12px;
  font-size: 24px;
}

.ref-card p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--dim);
}

/* ---------- шаги ---------- */

.ref-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ref-step {
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
}

.ref-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-3);
}

.ref-step h3 {
  margin-top: 16px;
  font-size: 18px;
  letter-spacing: -.02em;
}

.ref-step p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--dim);
}

/* ---------- форма регистрации ---------- */

.ref-form {
  max-width: 520px;
  margin-top: 20px;
}

.ref-form .field label {
  font-size: 13px;
}

.ref-form-note {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.ref-form-note a {
  color: var(--accent-3);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- колесо ---------- */

.wheel-stage {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.wheel-stage svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wheel-rotor {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 5.6s cubic-bezier(.12, .72, .08, 1);
  will-change: transform;
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 26px solid var(--accent-2);
  filter: drop-shadow(0 6px 14px rgba(47, 107, 255, .5));
}

.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #1a2340, #0a0d16 70%);
  box-shadow: 0 0 0 8px rgba(6, 7, 11, .9), 0 18px 40px -18px rgba(0, 0, 0, .9);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-3);
  text-align: center;
  pointer-events: none;
}

.wheel-stage.is-spinning .wheel-hub {
  animation: hubPulse 1.1s ease-in-out infinite;
}

@keyframes hubPulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(6, 7, 11, .9), 0 0 0 0 rgba(47, 107, 255, .4); }
  50% { box-shadow: 0 0 0 8px rgba(6, 7, 11, .9), 0 0 0 16px rgba(47, 107, 255, 0); }
}

.wheel-sector {
  transition: opacity .25s ease;
}

.wheel-stage.is-spinning .wheel-sector {
  opacity: .92;
}

.wheel-sector text {
  fill: #dfe7f7;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
}

.wheel-sector.is-win text {
  fill: #fff;
}

.wheel-sector.is-win path {
  fill: #1b2c52;
  stroke: var(--accent-2);
  stroke-width: 1.5;
}

/* ---------- кабинет ---------- */

.cab-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: calc(var(--bar) + 44px) 0 34px;
  border-bottom: 1px solid var(--line);
}

.cab-title {
  margin-top: 14px;
  font-size: clamp(30px, 4.4vw, 46px);
}

.cab-sub {
  margin-top: 10px;
  font-size: 15px;
  color: var(--dim);
}

.cab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: start;
  gap: 26px;
  padding: 36px 0 88px;
}

.cab-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.ref-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ref-stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
}

.ref-stat b {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--text);
}

.ref-stat span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ref-progress {
  margin-top: 18px;
}

.ref-progress-bar {
  display: flex;
  gap: 6px;
}

.ref-progress-bar i {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  transition: background .3s ease, box-shadow .3s ease;
}

.ref-progress-bar i.on {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px -4px rgba(47, 107, 255, .8);
}

.ref-progress p {
  margin-top: 10px;
  font-size: 13px;
  color: var(--dim);
}

.ref-linkbox {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.ref-linkbox .inp {
  min-width: 0;
  font-size: 13px;
  color: var(--accent-3);
}

.ref-linkbox .btn {
  flex: 0 0 auto;
  min-height: 50px;
}

.ref-share {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.ref-share .btn {
  flex: 1 1 auto;
}

.ref-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .02);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.ref-note b {
  color: var(--dim);
}

.ref-spin-btn {
  margin-top: 20px;
}

.ref-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.ref-history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .02);
}

.ref-history-item b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.ref-history-item span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.ref-history-item em {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ref-history-item em.new {
  background: var(--accent-soft);
  color: var(--accent-3);
}

.ref-history-item em.done {
  background: rgba(70, 200, 130, .12);
  color: #7fe0a8;
}

.ref-history-item em.cancelled {
  background: rgba(255, 92, 92, .1);
  color: #ff9c9c;
}

.ref-empty {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- приглашение /ref/<code> ---------- */

.invite-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  align-items: center;
  gap: 46px;
  padding: calc(var(--bar) + 64px) 0 80px;
}

.invite-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border: 1px solid var(--accent-line);
  border-radius: 16px;
  background: var(--accent-soft);
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-3);
}

.invite-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(420px 260px at 70% 10%, rgba(47, 107, 255, .18), transparent 70%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.invite-visual .wheel-stage {
  max-width: 360px;
}

.invite-ok {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
}

.invite-ok b { font-size: 14px; color: var(--text); }
.invite-ok span { font-size: 13px; color: var(--dim); }

/* ---------- модальное окно приза ---------- */

.ref-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 4, 8, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ref-modal[hidden] { display: none !important; }

.ref-modal-card {
  width: 100%;
  max-width: 460px;
  padding: 34px 30px 30px;
  border: 1px solid var(--accent-line);
  border-radius: 22px;
  background:
    radial-gradient(420px 220px at 50% 0%, rgba(47, 107, 255, .2), transparent 70%),
    var(--panel);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .95);
  text-align: center;
  animation: refPop .35s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes refPop {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ref-modal-card .eyebrow { justify-content: center; }

.ref-prize {
  margin-top: 16px;
  font-size: clamp(24px, 4.6vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--text);
}

.ref-modal-card p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--dim);
}

.ref-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.ref-modal-actions .btn { width: 100%; }

.ref-modal-x {
  position: absolute;
  top: 14px;
  right: 14px;
}

/* ---------- уведомление ---------- */

.ref-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 400;
  max-width: min(92vw, 460px);
  padding: 13px 20px;
  transform: translate(-50%, 16px);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: rgba(12, 15, 22, .96);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.ref-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ref-toast.err {
  border-color: rgba(255, 92, 92, .5);
  color: #ffb3b3;
}

/* ---------- адаптив ---------- */

@media (max-width: 980px) {
  .ref-hero-grid,
  .cab-grid,
  .invite-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .ref-hero { padding-top: calc(var(--bar) + 36px); }

  .ref-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .ref-hero { padding: calc(var(--bar) + 26px) 0 34px; }

  .ref-title { font-size: clamp(32px, 10vw, 44px); }

  .ref-lead,
  .ref-step p,
  .ref-card p {
    font-size: 16px;
    line-height: 1.62;
  }

  .ref-card { padding: 22px 20px; }

  .ref-steps { gap: 12px; }

  .ref-step { padding: 22px 20px; }

  .ref-step h3 { font-size: 19px; }

  .cab-head { padding-top: calc(var(--bar) + 24px); }

  .cab-title { font-size: 32px; }

  .cab-sub { font-size: 16px; }

  .cab-grid { padding: 26px 0 64px; gap: 18px; }

  .ref-stat b { font-size: 26px; }

  .ref-stat span { font-size: 10px; }

  .ref-linkbox { flex-direction: column; }

  .ref-linkbox .btn { width: 100%; }

  .ref-linkbox .inp { font-size: 15px; }

  .ref-share .btn { flex: 1 1 100%; }

  .ref-form .field label { font-size: 14px; }

  .ref-form-note { font-size: 13px; }

  .ref-history-item b { font-size: 14px; }

  .wheel-hub { width: 74px; height: 74px; font-size: 9px; }

  .wheel-pointer {
    border-left-width: 12px;
    border-right-width: 12px;
    border-top-width: 22px;
  }

  .invite-wrap { padding: calc(var(--bar) + 32px) 0 56px; }

  .invite-visual { min-height: 0; padding: 22px; }

  .ref-modal-card { padding: 30px 22px 24px; }
}

/* ---------- добавление прокрута по паролю ---------- */

.ref-bonus {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ref-bonus-toggle {
  align-self: flex-start;
}

.ref-bonus-form {
  display: flex;
  gap: 8px;
}

.ref-bonus-form .inp {
  min-width: 0;
  font-size: 14px;
}

.ref-bonus-form .btn {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .ref-bonus-form {
    flex-direction: column;
  }

  .ref-bonus-form .btn {
    width: 100%;
  }
}
