/* ===== Rust — личный кабинет игрока ===== */
:root {
  --bg: #101014;
  --bg-2: #17171d;
  --panel: #1d1d25;
  --panel-2: #24242e;
  --line: #2e2e3a;
  --text: #e8e8ee;
  --muted: #9a9aad;
  --rust: #f97316;
  --rust-2: #ff9440;
  --green: #22c55e;
  --blue: #3b82f6;
  --red: #ef4444;
  --radius: 14px;
  font-size: 16px;
}

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

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page { display: none; min-height: 100vh; }
.page--active { display: block; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Кнопки ---------- */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  background: linear-gradient(180deg, var(--rust-2), var(--rust));
  color: #1a1205;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(249, 115, 22, .35); }
.btn:active { transform: translateY(0); }
.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.btn--ghost:hover { border-color: var(--rust); color: var(--rust); box-shadow: none; }
.btn--small { padding: 8px 14px; font-size: .82rem; border-radius: 8px; }

/* ---------- Страница входа ---------- */
#page-login {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
}
#page-login.page--active { display: flex; }

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(249, 115, 22, .22), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(239, 68, 68, .16), transparent 60%),
    repeating-linear-gradient(-45deg, transparent 0 26px, rgba(255, 255, 255, .014) 26px 52px),
    var(--bg);
  animation: bgDrift 18s ease-in-out infinite alternate;
}
@keyframes bgDrift { to { background-position: 40px 30px, -40px -30px, 0 0, 0 0; } }

.login-card {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px 34px 30px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55);
  overflow: hidden;
}
.login-card__glow {
  position: absolute;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(249, 115, 22, .4), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}
.login-card__head { position: relative; text-align: center; margin-bottom: 28px; }
.login-card__logo {
  width: 64px; height: 64px;
  padding: 12px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(249, 115, 22, .4);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.login-card__title { margin-top: 16px; font-size: 2.1rem; letter-spacing: .3em; font-weight: 900; }
.login-card__sub { margin-top: 6px; font-size: .74rem; letter-spacing: .28em; color: var(--rust); font-weight: 700; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.field__input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field__input::placeholder { color: #62627a; }
.field__input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(249, 115, 22, .18); }

.login-error {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .45);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .88rem;
  text-align: center;
  animation: shake .35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.login-form .btn { width: 100%; padding: 14px; font-size: 1rem; }

/* Ссылки-переключатели */
.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: .86rem;
  cursor: pointer;
  padding: 4px;
  transition: color .2s;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--rust); }

/* Заголовок блока регистрации */
.reg-head { text-align: center; margin-bottom: 4px; }
.reg-title { font-size: 1rem; letter-spacing: .18em; font-weight: 800; }
.reg-sub { font-size: .78rem; color: var(--muted); margin-top: 5px; }

/* Сообщение об успехе */
.reg-success {
  background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .45);
  color: #86efac;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .88rem;
  text-align: center;
  animation: fadeIn .3s ease;
}

.login-hint {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  font-size: .78rem; color: var(--muted);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
}
.login-hint code {
  background: rgba(249, 115, 22, .14);
  color: var(--rust-2);
  padding: 2px 7px;
  border-radius: 6px;
  font-family: "Consolas", "SF Mono", monospace;
}

/* ---------- Топбар ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  background: rgba(23, 23, 29, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__logo { width: 26px; height: 26px; padding: 4px; background: #fff; border-radius: 7px; }
.topbar__brand { font-weight: 900; letter-spacing: .22em; }
.topbar__sep { color: var(--line); }
.topbar__page { color: var(--rust); font-weight: 700; letter-spacing: .2em; font-size: .82rem; }
.topbar__user {
  font-weight: 700;
  background: rgba(249, 115, 22, .12);
  border: 1px solid rgba(249, 115, 22, .4);
  color: var(--rust-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .88rem;
}

/* ---------- Кабинет ---------- */
.cabinet { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .3);
}
.panel__title {
  font-size: .84rem;
  letter-spacing: .2em;
  color: var(--muted);
  margin-bottom: 18px;
  font-weight: 800;
}

/* Профиль */
.panel--profile { margin-bottom: 20px; }
.profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile__avatar {
  width: 78px; height: 78px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-size: 2.1rem; font-weight: 900;
  color: #1a1205;
  background: linear-gradient(135deg, var(--rust-2), var(--rust));
  box-shadow: 0 10px 26px rgba(249, 115, 22, .35);
  flex-shrink: 0;
}
.profile__info { flex: 1; min-width: 240px; }
.profile__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile__name { font-size: 1.45rem; }
.profile__rank {
  font-size: .72rem; font-weight: 800; letter-spacing: .12em;
  background: rgba(168, 85, 247, .16);
  border: 1px solid rgba(168, 85, 247, .5);
  color: #d8b4fe;
  padding: 4px 11px;
  border-radius: 999px;
  text-transform: uppercase;
}
.profile__row--meta { margin-top: 7px; gap: 18px; color: var(--muted); font-size: .88rem; }
.profile__row--meta span::before { content: "• "; color: var(--rust); }

.xpbar {
  position: relative;
  margin-top: 14px;
  height: 22px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.xpbar__fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--rust), var(--rust-2));
  transition: width 1s cubic-bezier(.2, .8, .2, 1);
}
.xpbar__label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* Сетка */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }

/* Статистика */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  transition: transform .18s, border-color .18s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--rust); }
.stat__value { display: block; font-size: 1.45rem; font-weight: 900; color: var(--rust-2); }
.stat__label { display: block; margin-top: 4px; font-size: .7rem; color: var(--muted); letter-spacing: .05em; }

.bars { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.bar__head { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.bar__track { height: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green), #4ade80);
  border-radius: 999px;
  transition: width 1s cubic-bezier(.2, .8, .2, 1);
}
.bar__fill--alt { background: linear-gradient(90deg, var(--blue), #60a5fa); }
.bar__fill--lvl { background: linear-gradient(90deg, var(--rust), var(--rust-2)); }

/* Заметки */
.notes__head { display: flex; align-items: center; justify-content: space-between; }
.notes__head .panel__title { margin-bottom: 0; }

.note-form {
  margin-top: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-2);
  border: 1px dashed var(--rust);
  border-radius: 12px;
  padding: 14px;
  animation: fadeIn .25s ease;
}
.note-form__input, .note-form__textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.note-form__input:focus, .note-form__textarea:focus { border-color: var(--rust); }
.note-form__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.note-form__colors { display: flex; gap: 8px; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch--active { border-color: #fff; transform: scale(1.15); }
.note-form__actions { display: flex; gap: 8px; }

.notes__list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.notes__list::-webkit-scrollbar { width: 8px; }
.notes__list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.note {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--note-c, var(--rust));
  border-radius: 12px;
  padding: 14px 44px 14px 16px;
  animation: fadeIn .3s ease;
  transition: transform .16s, box-shadow .16s;
}
.note:hover { transform: translateX(4px); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.note__title { font-size: 1rem; font-weight: 700; margin-bottom: 5px; }
.note__body { font-size: .88rem; color: var(--muted); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.note__meta { margin-top: 8px; font-size: .7rem; color: #62627a; letter-spacing: .05em; }
.note__del {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all .15s;
}
.note__del:hover { background: rgba(239, 68, 68, .18); border-color: var(--red); color: var(--red); }
.notes__empty { text-align: center; color: var(--muted); font-size: .88rem; padding: 24px 0; }

/* Тост */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--rust);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: .9rem;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  z-index: 100;
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
