/* =========================================================
   Академия EMS — лёгкая тема (без тяжёлых blur-слоёв)
   Полиш: глубина панелей, иерархия, акценты, адаптив.
   ========================================================= */

:root {
  --bg: #0b1622;
  --bg-2: #070e17;
  --surface: #0f1e2e;
  --surface-2: #14283c;
  --surface-3: #0a1826;
  --line: rgba(150, 195, 235, .13);
  --line-2: rgba(150, 210, 255, .32);
  --text: #eaf3fc;
  --muted: #9fb4c9;
  --muted-2: #64798f;
  --c1: #22d3ee;
  --c2: #3b82f6;
  --c3: #2dd4bf;
  --ok: #34d399;
  --danger: #fb7185;
  --grad: linear-gradient(120deg, #22d3ee 0%, #2dd4bf 48%, #3b82f6 100%);
  --grad-soft: linear-gradient(160deg, rgba(34, 211, 238, .16), rgba(59, 130, 246, .05));
  --glow: 0 12px 34px rgba(34, 211, 238, .30);
  --shadow: 0 18px 46px rgba(2, 8, 16, .5);
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", var(--font-ui);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(760px 460px at 10% -8%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(840px 540px at 94% 2%, rgba(59, 130, 246, .12), transparent 62%),
    radial-gradient(1000px 720px at 50% 118%, rgba(45, 212, 191, .07), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
}

button, input { font: inherit; }
a { color: inherit; }
::selection { background: var(--c2); color: #fff; }

.hidden { display: none !important; }

/* =========================================================
   КАРКАС
   ========================================================= */

.page { position: relative; max-width: 720px; margin: 0 auto; padding: 60px 20px 100px; }

/* ---------- шапка ---------- */
.hero { text-align: center; margin-bottom: 34px; }
.hero-kicker {
  position: relative; display: inline-block; margin-bottom: 18px; padding: 7px 16px 7px 30px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--c1); background: rgba(34, 211, 238, .06); border: 1px solid var(--line-2);
}
.hero-kicker::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px rgba(34, 211, 238, .9);
}
.hero h1 {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(30px, 6.4vw, 48px); line-height: 1.06; letter-spacing: -.025em;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin: 15px auto 0; max-width: 480px; font-size: 14.5px; line-height: 1.65; color: var(--muted); }

/* ---------- вход ---------- */
.rise { opacity: 0; animation: riseIn .5s cubic-bezier(.16, 1, .3, 1) forwards; }
.d1 { animation-delay: .02s; }
.d2 { animation-delay: .08s; }
.d3 { animation-delay: .14s; }
.d4 { animation-delay: .2s; }
.d5 { animation-delay: .26s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* =========================================================
   ШАГИ
   ========================================================= */

.stepper {
  display: flex; align-items: center; gap: 8px; margin: 0 0 28px; padding: 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow);
}
.stp { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 9px 14px; border-radius: 999px; transition: .2s; }
.stp-n {
  width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 50%; background: rgba(255, 255, 255, .02); transition: .2s;
}
.stp-body { display: flex; flex-direction: column; min-width: 0; }
.stp-t { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.stp-s { font-size: 11px; color: var(--muted-2); }
.stp-line { flex: 0 0 22px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.stp-line i { display: block; width: 0; height: 100%; background: var(--grad); transition: width .3s; }
.stp-line.fill i { width: 100%; }
.stp.active { background: rgba(34, 211, 238, .09); }
.stp.active .stp-t { color: var(--text); }
.stp.active .stp-n, .stp.done .stp-n { color: #06131f; border-color: transparent; background: var(--grad); box-shadow: 0 4px 14px rgba(34, 211, 238, .35); }
.stp.done .stp-n { background: var(--c3); }

/* =========================================================
   ПАНЕЛИ
   ========================================================= */

.panel {
  position: relative; padding: 28px; margin-bottom: 18px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 140px);
  box-shadow: var(--shadow);
}
.panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
}
.panel.reveal { animation: riseIn .4s cubic-bezier(.16, 1, .3, 1) both; }
.panel.draft { background-color: var(--surface-2); }

.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.panel-no {
  font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--c1);
  padding: 7px 11px; border-radius: 11px; background: var(--grad-soft); border: 1px solid var(--line-2);
}
.panel-titles { flex: 1; min-width: 0; }
.panel-titles h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 17.5px; letter-spacing: -.01em; }
.panel-titles p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.rank-chip {
  font-family: var(--font-display); font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 8px 13px; border-radius: 999px; color: #06131f; background: var(--grad);
  box-shadow: 0 6px 18px rgba(34, 211, 238, .3);
}

/* =========================================================
   ПОЛЯ
   ========================================================= */

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.req { color: var(--c1); }

.ctrl { display: flex; gap: 8px; }
.in-wrap {
  position: relative; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 0 15px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(0, 0, 0, .24); transition: border-color .18s, box-shadow .18s, background .18s;
}
.in-wrap:focus-within {
  border-color: var(--line-2); background: rgba(34, 211, 238, .06);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .13);
}
.in-pre { flex-shrink: 0; font-size: 15px; color: var(--muted-2); transition: color .18s; }
.in-wrap:focus-within .in-pre { color: var(--c1); }
.in-wrap input {
  flex: 1; min-width: 0; padding: 15px 0; border: 0; outline: none;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 500;
}
input::placeholder { color: var(--muted-2); font-weight: 400; }

.ok-ico { width: 18px; height: 18px; flex-shrink: 0; color: var(--ok); opacity: 0; transform: scale(.7); transition: .2s; }
.in-wrap.valid { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .05); }
.in-wrap.valid .ok-ico { opacity: 1; transform: none; }
.err-field { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(251, 113, 133, .15) !important; }
.in-wrap.drag { border-color: var(--c1); background: rgba(34, 211, 238, .1); box-shadow: 0 0 0 3px rgba(34, 211, 238, .16); }

.date-wrap, .date-wrap input { cursor: pointer; }
.cal-caret { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted-2); }
.field-hint { margin-top: 10px; font-size: 12px; line-height: 1.55; color: var(--muted-2); }
.field-hint b { color: var(--c1); font-weight: 700; }

/* =========================================================
   РАНГИ
   ========================================================= */

.ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rank-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px 12px; border: 1px solid var(--line); border-radius: 18px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(0, 0, 0, .18));
  background-color: rgba(0, 0, 0, .18);
  color: var(--text); cursor: pointer; transition: .18s;
}
.rank-btn:hover { border-color: var(--line-2); transform: translateY(-2px); }
.rank-btn.active {
  border-color: transparent; box-shadow: 0 0 0 1.5px var(--c1), var(--glow);
  background-image: linear-gradient(160deg, rgba(34, 211, 238, .16), rgba(59, 130, 246, .14));
  transform: translateY(-2px);
}
.rb-check {
  position: absolute; top: 11px; right: 11px; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; color: #06131f; background: var(--grad);
  box-shadow: 0 4px 12px rgba(34, 211, 238, .4);
  opacity: 0; transform: scale(.6); transition: .2s;
}
.rb-check svg { width: 12px; height: 12px; }
.rank-btn.active .rb-check { opacity: 1; transform: none; }
.rb-row { display: flex; align-items: center; gap: 8px; }
.rb-n { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1; }
.rb-arrow { width: 20px; color: var(--c1); }
.rb-arrow svg { width: 20px; height: 20px; }
.rb-cap { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.35; }
.ranks.err .rank-btn { border-color: rgba(251, 113, 133, .45); }

/* =========================================================
   ОШИБКА / ЧЕРНОВИК
   ========================================================= */

.form-error {
  display: none; margin-bottom: 18px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .1);
  color: var(--danger); font-size: 13.5px; font-weight: 500; line-height: 1.55;
}
.form-error.show { display: block; animation: shake .35s ease; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.draft-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 15px;
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.draft-head::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: var(--grad); }
.live-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.live-empty { font-size: 13px; color: var(--muted-2); }
.live-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 13px; border-radius: 11px; background: rgba(0, 0, 0, .22); font-size: 13px; }
.live-row span { color: var(--muted); }
.live-row b { max-width: 62%; font-size: 12.5px; font-weight: 700; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-row b.ok { color: var(--c1); }
.live-row b.no { color: var(--muted-2); }

/* =========================================================
   КНОПКИ
   ========================================================= */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 22px; border: 0; border-radius: 14px; cursor: pointer; overflow: hidden;
  background: var(--surface-2); color: var(--text); font-size: 15px; font-weight: 700; transition: .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #04121d; background: var(--grad); box-shadow: var(--glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 50%);
}
.btn.primary:hover { box-shadow: 0 12px 38px rgba(34, 211, 238, .44); }
.btn.primary:active { transform: translateY(0); box-shadow: 0 6px 20px rgba(34, 211, 238, .34); }
.btn.block { width: 100%; }
.btn.big { padding: 18px 24px; border-radius: 16px; font-size: 16px; }
.btn .ico { width: 19px; height: 19px; }
.btn:disabled { opacity: .65; cursor: default; transform: none; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   ПРИКРЕПЛЕНИЕ И ХОСТИНГИ
   ========================================================= */

.attach-btn {
  flex-shrink: 0; width: 50px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, .24); color: var(--muted); transition: .18s;
}
.attach-btn svg { width: 21px; height: 21px; }
.attach-btn:hover { color: #fff; border-color: transparent; background: var(--grad); box-shadow: var(--glow); }

.attach-preview { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(0, 0, 0, .24); }
.attach-preview.hidden { display: none; }
.ap-thumb { width: 48px; height: 48px; flex-shrink: 0; object-fit: cover; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); }
.ap-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ap-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-size { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.ap-remove { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--line-2); border-radius: 11px; background: transparent; color: var(--muted); transition: .18s; }
.ap-remove svg { width: 15px; height: 15px; }
.ap-remove:hover { color: var(--danger); border-color: var(--danger); background: rgba(251, 113, 133, .12); }

.hostlinks { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 11px; }
.hostlinks-l { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted-2); }
.hostlinks-l svg { width: 13px; height: 13px; }
.hostlink {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--c1);
  border: 1px solid var(--line); background: rgba(34, 211, 238, .05); transition: .18s;
}
.hostlink:hover { color: #fff; border-color: transparent; background: var(--grad); box-shadow: var(--glow); transform: translateY(-1px); }

/* =========================================================
   УСПЕХ
   ========================================================= */

.overlay { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(4, 10, 18, .82); }
.overlay.show { display: flex; }
.success-card {
  position: relative; width: 100%; max-width: 440px; overflow: hidden;
  padding: 36px 26px 30px; text-align: center;
  border: 1px solid var(--line-2); border-radius: 24px; background: var(--surface);
  background-image: linear-gradient(180deg, rgba(34, 211, 238, .08), rgba(255, 255, 255, 0) 180px);
  box-shadow: var(--shadow);
}
.overlay.show .success-card { animation: popIn .34s cubic-bezier(.16, 1, .3, 1); }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -14px; width: 8px; height: 14px; border-radius: 2px; opacity: .9; animation: confFall ease-in infinite; }
@keyframes confFall { from { transform: translateY(-20px) rotate(0deg); } to { transform: translateY(380px) rotate(360deg); } }
.ok-ring { width: 68px; height: 68px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: #04121d; background: var(--grad); box-shadow: var(--glow); }
.ok-ring svg { width: 33px; height: 33px; }
.success-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.02em; }
.success-sub { margin: 10px auto 20px; max-width: 330px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.success-summary { display: flex; flex-direction: column; gap: 8px; max-height: 220px; margin-bottom: 22px; overflow: auto; text-align: left; }
.ss-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 13px; border-radius: 11px; background: rgba(0, 0, 0, .24); font-size: 12.5px; }
.ss-row span { color: var(--muted); }
.ss-row b { max-width: 60%; font-size: 12.5px; font-weight: 700; text-align: right; word-break: break-word; }

/* =========================================================
   ТОСТЫ
   ========================================================= */

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; width: 310px; padding: 14px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--surface-2); box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  animation: toastIn .3s cubic-bezier(.16, 1, .3, 1); transition: opacity .35s, transform .35s;
}
.toast.error { border-color: rgba(251, 113, 133, .45); }
.toast.out { opacity: 0; transform: translateX(20px); }
.t-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; color: var(--c1); }
.toast.error .t-icon { color: var(--danger); }
.t-body { min-width: 0; }
.t-title { font-size: 13.5px; font-weight: 700; }
.t-msg { margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* =========================================================
   КАЛЕНДАРЬ
   ========================================================= */

.cal {
  position: fixed; z-index: 99999; width: 312px; padding: 14px;
  border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface-2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6); animation: riseIn .18s ease;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; text-transform: capitalize; }
.cal-nav { width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); transition: .18s; }
.cal-nav svg { width: 16px; height: 16px; }
.cal-nav:hover { color: #fff; border-color: transparent; background: var(--grad); }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-wd span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; transition: .15s; }
.cal-day:hover { background: rgba(34, 211, 238, .12); }
.cal-day.empty { pointer-events: none; }
.cal-day.today { border-color: var(--line-2); }
.cal-day.sel { color: #04121d; font-weight: 700; background: var(--grad); box-shadow: 0 4px 12px rgba(34, 211, 238, .35); }
.cal-foot { display: flex; gap: 8px; margin-top: 10px; }
.cal-today, .cal-clear { flex: 1; padding: 9px; cursor: pointer; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--text); font-size: 12.5px; font-weight: 600; transition: .18s; }
.cal-today { color: var(--c1); border-color: var(--line-2); }
.cal-today:hover, .cal-clear:hover { background: rgba(34, 211, 238, .12); }

/* =========================================================
   ПОДВАЛ
   ========================================================= */

.foot { margin-top: 36px; text-align: center; font-size: 12.5px; color: var(--muted-2); }
.foot::before { content: ""; display: block; width: 44px; height: 2px; margin: 0 auto 16px; border-radius: 2px; background: var(--grad); opacity: .7; }

/* =========================================================
   ФОКУС
   ========================================================= */

.btn:focus-visible, .rank-btn:focus-visible, .cal-day:focus-visible, .cal-nav:focus-visible,
.attach-btn:focus-visible, .ap-remove:focus-visible, .cal-today:focus-visible, .cal-clear:focus-visible,
.hostlink:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

/* =========================================================
   АДАПТИВ
   ========================================================= */

@media (max-width: 640px) {
  body { background-attachment: scroll; }
  .page { padding: 36px 15px 84px; }
  .hero { margin-bottom: 26px; }
  .panel { padding: 22px 16px; border-radius: 18px; }
  .stepper { gap: 4px; padding: 8px; }
  .stp { gap: 8px; padding: 6px 8px; }
  .stp-s { display: none; }
  .ranks { grid-template-columns: 1fr; }
  .rank-btn { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 15px; }
  .rb-cap { margin-left: auto; text-align: right; }
  .cal { width: 290px; }
  .attach-btn { width: 47px; }
  .toast-stack { right: 14px; left: 14px; bottom: 14px; }
  .toast { width: auto; }
}

@media (max-width: 380px) {
  .stp-t { display: none; }
  .stp.active .stp-t { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .rise { opacity: 1; }
}

html.no-anim *, html.no-anim *::before, html.no-anim *::after { animation-play-state: paused !important; }
