* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0b11;
  --card: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8ebf5;
  --muted: #8b93a8;
  --accent: #4ade80;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(74, 222, 128, 0.12), transparent 60%),
    radial-gradient(800px 500px at 95% 0%, rgba(56, 189, 248, 0.1), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Фон с ником ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* по краям растворяется, чтобы не спорить с контентом */
  -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 25%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 25%, transparent 78%);
}

/* Одна большая надпись по центру: дышит, переливается, по ней ходит блик */
.bg-title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Unbounded, Inter, sans-serif;
  font-weight: 900;
  font-size: clamp(64px, 15vw, 260px);
  letter-spacing: -0.03em;
  white-space: nowrap;
  animation: breathe 11s ease-in-out infinite;
}

/* Слой 1 — заливка градиентом, который медленно течёт */
.bg-title .fill {
  grid-area: 1 / 1;
  background: linear-gradient(100deg, #4ade80, #38bdf8 40%, #a78bfa 70%, #4ade80);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.16;
  filter: drop-shadow(0 0 60px rgba(74, 222, 128, 0.25));
  animation: flow 14s linear infinite, glow 7s ease-in-out infinite;
}

/* Слой 2 — контур поверх заливки, чтобы буквы читались */
.bg-title .line {
  grid-area: 1 / 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.13);
  opacity: 0.5;
}

/* Слой 3 — узкий блик, проходящий по буквам */
.bg-title .shine {
  grid-area: 1 / 1;
  color: #fff;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  mask-image: linear-gradient(105deg, transparent 42%, #000 50%, transparent 58%);
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
  animation: shine 6.5s ease-in-out infinite;
}

@keyframes flow {
  from { background-position: 0% 0; }
  to   { background-position: 260% 0; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 40px rgba(74, 222, 128, 0.18)); }
  50%      { filter: drop-shadow(0 0 90px rgba(56, 189, 248, 0.35)); }
}
@keyframes shine {
  0%       { -webkit-mask-position: 130% 0; mask-position: 130% 0; }
  55%, 100% { -webkit-mask-position: -30% 0; mask-position: -30% 0; }
}

/* Мягкие цветные пятна поверх текста */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 420px; height: 420px; top: -120px; left: -80px;  background: rgba(74, 222, 128, 0.28); }
.orb-2 { width: 380px; height: 380px; top: 30%; right: -120px;  background: rgba(56, 189, 248, 0.22); animation-delay: -6s; }
.orb-3 { width: 340px; height: 340px; bottom: -140px; left: 35%; background: rgba(167, 139, 250, 0.2); animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.08); }
  66%      { transform: translate(-30px, 25px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-title, .bg-title *, .orb { animation: none; }
}

header, main, .login-card { position: relative; z-index: 1; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 17, 0.7);
  z-index: 5;
}

.brand {
  font-family: Unbounded, Inter, sans-serif;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 0.02em;
}
.brand em { font-style: normal; color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }
.badge.on { color: var(--accent); border-color: rgba(74, 222, 128, 0.35); }
.badge.on .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 24px;
}

h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Unbounded, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.hint { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 6px 0; }
.hint code {
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12.5px;
}

.copy-row { display: flex; gap: 10px; margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

input[readonly] {
  flex: 1;
  min-width: 0;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.btn {
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-accent { border-color: rgba(74, 222, 128, 0.4); color: var(--accent); }
.btn-accent:hover { background: rgba(74, 222, 128, 0.14); }

.icon-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  opacity: 0.6;
}
.icon-btn:hover { opacity: 1; }

.totals { font-family: Inter, sans-serif; font-size: 13px; font-weight: 600; color: var(--accent); }

#history { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

#history li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-size: 14px;
  animation: slide-in 0.35s ease both;
}
#history li.fresh { border-color: rgba(74, 222, 128, 0.4); }
#history li .n { font-weight: 700; }
#history li .a { color: var(--accent); font-weight: 700; margin-left: auto; white-space: nowrap; }
#history li .m { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#history li .t { color: var(--muted); font-size: 12px; }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.muted { color: var(--muted); font-size: 14px; }

/* ---------- Уровни ---------- */

.btn-small { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.tier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin-top: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

input.num, input.txt {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input.num { width: 90px; }
input.txt { flex: 1; min-width: 130px; }

input.clr {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.num-wrap { position: relative; display: inline-flex; align-items: center; }
.num-wrap .num { padding-right: 30px; }
.num-wrap .cur-mark {
  position: absolute;
  right: 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}

.file-slot { display: flex; align-items: center; gap: 8px; }
.file-slot label { cursor: pointer; margin: 0; }

.slot-preview { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.slot-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.icon-btn:disabled { opacity: 0.2; cursor: default; }

/* ---------- Вход ---------- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.brand-big {
  justify-content: center;
  font-size: 30px;
  letter-spacing: 0.01em;
  background: linear-gradient(92deg, #4ade80, #38bdf8 55%, #a78bfa);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hue 6s linear infinite;
}
.brand-big em { color: inherit; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(12, 14, 22, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 34px 30px;
}

.login-card input[type="password"] {
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: rgba(74, 222, 128, 0.5);
}

.login-error {
  min-height: 18px;
  margin: 0;
  text-align: center;
  font-size: 13.5px;
  color: #f87171;
}
