/* =========================================================
   AURA — Dark Premium / Glassmorphism / Cyberpunk
   Все цвета и шрифты меняются в блоке :root.
   ========================================================= */

:root {
  --bg: #04050a;
  --bg-soft: #080a12;
  --ink: #eaf0ff;
  --muted: #8a93ab;
  --muted-2: #5b6478;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.18);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.08);
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --pink: #f472b6;
  --amber: #fbbf24;
  --radius: 24px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --display: 'Unbounded', 'Segoe UI', system-ui, Arial, sans-serif;
  --digits: 'Orbitron', 'Segoe UI', system-ui, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

body.is-reason {
  overflow: hidden;
}

::selection {
  background: rgba(34, 211, 238, 0.35);
  color: #fff;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* =========================================================
   ФОН
   ========================================================= */

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 720px at 12% -12%, rgba(34, 211, 238, 0.16), transparent 62%),
    radial-gradient(1000px 700px at 88% -5%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(1000px 680px at 50% 112%, rgba(244, 114, 182, 0.12), transparent 62%),
    linear-gradient(180deg, #04050a, #06070e 42%, #04050a);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: drift 22s ease-in-out infinite alternate;
}

.orb-1 {
  width: 520px;
  height: 520px;
  left: -160px;
  top: -160px;
  background: radial-gradient(circle, #22d3ee, transparent 66%);
}

.orb-2 {
  width: 560px;
  height: 560px;
  right: -180px;
  top: -120px;
  background: radial-gradient(circle, #8b5cf6, transparent 66%);
  animation-delay: -7s;
}

.orb-3 {
  width: 640px;
  height: 640px;
  left: 30%;
  bottom: -360px;
  background: radial-gradient(circle, #f472b6, transparent 66%);
  animation-delay: -14s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(46px, 64px, 0) scale(1.13); }
}

.grid-lines {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -6%;
  height: 76%;
  background-image:
    linear-gradient(rgba(130, 180, 255, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 180, 255, 0.11) 1px, transparent 1px);
  background-size: 68px 68px;
  transform: perspective(520px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 8%, rgba(0, 0, 0, 0.55) 42%, transparent 92%);
  mask-image: linear-gradient(to top, #000 8%, rgba(0, 0, 0, 0.55) 42%, transparent 92%);
  animation: grid-move 14s linear infinite;
  opacity: 0.85;
}

@keyframes grid-move {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 68px, 0 0; }
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* =========================================================
   ШАПКА
   ========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(4, 5, 10, 0.92), rgba(4, 5, 10, 0.62));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(145deg, #22d3ee, #8b5cf6 65%, #f472b6);
  color: #04050a;
  font: 900 20px/1 var(--digits);
  box-shadow: 0 0 26px -4px rgba(34, 211, 238, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.logo-text {
  font: 900 clamp(13px, 4.2vw, 16px)/1 var(--digits);
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--glass);
  color: var(--muted);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-2);
  background: var(--glass-2);
}

.icon-btn .slash {
  opacity: 0;
  transition: opacity 0.18s;
}

.icon-btn.is-muted .slash {
  opacity: 1;
}

.icon-btn.is-muted .wave {
  opacity: 0.15;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(34, 211, 238, 0.32);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.16), rgba(139, 92, 246, 0.14));
  color: #d9f7ff;
  font: 600 10.5px/1 var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 22px -8px rgba(34, 211, 238, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.btn-admin svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-admin:hover {
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 30px -6px rgba(34, 211, 238, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

body.is-admin .btn-admin {
  border-color: rgba(74, 222, 128, 0.6);
  color: #dcfce7;
  background: linear-gradient(160deg, rgba(74, 222, 128, 0.2), rgba(34, 211, 238, 0.12));
  box-shadow: 0 0 28px -8px rgba(74, 222, 128, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* =========================================================
   ОБЩАЯ СЕТКА
   ========================================================= */

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 30px 0 4px;
}

.stat {
  position: relative;
  min-width: 148px;
  padding: 14px 22px 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 40px -30px #000;
  text-align: left;
  overflow: hidden;
}

.stat::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.7), transparent);
  opacity: 0.6;
}

.stat-value {
  display: block;
  font: 700 24px/1 var(--digits);
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.35);
}

.stat-value--name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.stat-label {
  display: block;
  margin-top: 7px;
  color: var(--muted-2);
  font: 500 9.5px/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* =========================================================
   ТАБЛО
   ========================================================= */

.board {
  margin-top: 22px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.slot {
  position: relative;
  min-width: 0;
  display: flex;
}

/* пульсирующее свечение вокруг плашки: красное → зелёное */
.slot::after {
  content: '';
  position: absolute;
  inset: 8% 5% 12%;
  z-index: 0;
  border-radius: 32px;
  box-shadow: 0 0 52px 6px var(--heat-soft, transparent);
  opacity: calc(0.3 + var(--heat-level, 0) * 0.5);
  animation: heat-breathe 4.2s ease-in-out infinite;
  transition: opacity 0.6s;
  pointer-events: none;
  will-change: transform, filter;
}

@keyframes heat-breathe {
  0%, 100% { transform: scale(0.97); filter: brightness(0.85); }
  50% { transform: scale(1.03); filter: brightness(1.25); }
}

/* =========================================================
   КАРТОЧКА
   ========================================================= */

.card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 292px;
  padding: 46px 20px 20px;
  border: 1px solid var(--heat-border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius);
  background:
    radial-gradient(120% 80% at 50% -12%, var(--heat-soft, transparent), transparent 58%),
    radial-gradient(90% 60% at 50% 112%, var(--soft), transparent 66%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018) 52%, rgba(255, 255, 255, 0.045));
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  box-shadow:
    0 30px 70px -34px rgba(0, 0, 0, 0.95),
    0 0 46px -18px var(--heat, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transform: perspective(950px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px));
  transform-style: preserve-3d;
  transition: transform 0.26s ease-out, border-color 0.26s, box-shadow 0.26s;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}

/* блик от курсора */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.1), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card:hover::after {
  opacity: 1;
}

.card:hover {
  border-color: var(--heat, rgba(255, 255, 255, 0.2));
  box-shadow:
    0 40px 90px -38px var(--heat-soft),
    0 0 60px -14px var(--heat),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.card:active {
  filter: brightness(1.12);
}

/* рамка лидера */
.card.is-leader::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(135deg, var(--heat), transparent 38%, transparent 62%, var(--heat));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.9;
  pointer-events: none;
}

/* HUD-уголки */
.hud {
  position: absolute;
  inset: 13px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
  background:
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) left top / 13px 1px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) left top / 1px 13px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) right top / 13px 1px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) right top / 1px 13px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) left bottom / 13px 1px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) left bottom / 1px 13px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) right bottom / 13px 1px no-repeat,
    linear-gradient(var(--heat, var(--accent)), var(--heat, var(--accent))) right bottom / 1px 13px no-repeat;
}

.card-head {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 17px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.rank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font: 700 10px/1 var(--digits);
  letter-spacing: 0.08em;
}

.rank b {
  font-weight: 900;
  color: #dfe7ff;
}

.rank .crown {
  width: 11px;
  height: 11px;
  fill: var(--heat, var(--accent));
  opacity: 0;
  transform: scale(0.6) rotate(-12deg);
  transition: opacity 0.3s, transform 0.3s;
  filter: drop-shadow(0 0 5px var(--soft));
}

.card.is-leader .rank .crown {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.card.is-leader .rank {
  border-color: var(--heat-border, var(--soft));
  color: var(--heat, var(--accent));
  background: var(--heat-soft, var(--soft));
}

/* аватар */
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin: 8px 0 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.45), transparent 42%),
    radial-gradient(circle at 70% 80%, var(--accent2), transparent 70%),
    linear-gradient(150deg, var(--accent), var(--accent2));
  box-shadow:
    0 14px 34px -12px var(--soft),
    inset 0 -8px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 1;
}

.avatar::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 62%, var(--accent) 82%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  animation: spin 6.5s linear infinite;
  opacity: 0.85;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.avatar span {
  font: 800 31px/1 var(--digits);
  color: #fff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}

.card-name {
  position: relative;
  z-index: 1;
  margin: 0;
  font: 600 17px/1.2 var(--display);
  letter-spacing: 0.01em;
  text-align: center;
  word-break: break-word;
}

.aura-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-top: 13px;
}

.aura-value {
  font: 900 clamp(34px, 4.6vw, 44px) / 0.95 var(--digits);
  letter-spacing: 0.005em;
  background: linear-gradient(180deg, #ffffff 30%, var(--heat, var(--accent)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 18px var(--heat-soft, var(--soft)));
  font-variant-numeric: tabular-nums;
}

.bar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 5px;
  margin-top: 16px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.bar i {
  position: relative;
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: var(--heat, var(--accent));
  box-shadow: 0 0 16px var(--heat-soft, var(--soft));
  transition: width 0.75s cubic-bezier(0.22, 0.9, 0.24, 1);
  overflow: hidden;
}

.bar i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: translateX(-110%);
  animation: shimmer 3.2s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 55% { transform: translateX(-110%); }
  100% { transform: translateX(110%); }
}

/* быстрые кнопки (только для админа) */
.quick {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 14px;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: max-height 0.28s ease, opacity 0.24s, transform 0.24s, visibility 0.24s;
}

body.is-admin .quick {
  max-height: 44px;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.quick button {
  height: 32px;
  padding: 0;
  border: 1px solid var(--soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  font: 700 10px/1 var(--digits);
  letter-spacing: 0.04em;
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.16s;
}

.quick button:hover {
  background: var(--soft);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.quick button:active {
  transform: translateY(0) scale(0.97);
}

/* подпрыгивание при добавлении */
.card.is-bumped {
  animation: card-bump 0.5s cubic-bezier(0.2, 0.9, 0.25, 1);
}

@keyframes card-bump {
  0% { transform: perspective(950px) translateY(0) scale(1); }
  32% { transform: perspective(950px) translateY(-7px) scale(1.022); }
  62% { transform: perspective(950px) translateY(2px) scale(0.998); }
  100% { transform: perspective(950px) translateY(0) scale(1); }
}

/* =========================================================
   ИСТОРИЯ АУРЫ
   ========================================================= */

.history {
  margin-top: 30px;
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.014));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 26px 60px -40px #000, inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 700 12px/1 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.history-title::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--muted-2);
}

.history-clear {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  font: 600 9px/1 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.16s, border-color 0.16s;
}

.history-clear:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
}

body:not(.is-admin) .history-clear {
  display: none;
}

.history-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.history-item {
  display: grid;
  grid-template-columns: 84px 132px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.history-item:first-child {
  border-top: 0;
}

.h-delta {
  color: #4ade80;
  font: 700 11px/1.2 var(--digits);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.h-delta.is-minus {
  color: #fb7185;
}

.h-name {
  color: #dfe7ff;
  font: 600 11.5px/1.3 var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-reason {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.h-time {
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.h-crit {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  border: 1px solid rgba(253, 224, 71, 0.4);
  border-radius: 5px;
  background: rgba(253, 224, 71, 0.12);
  color: #fde047;
  font: 800 8.5px/1.3 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.history-empty {
  margin: 9px 0 2px;
  color: var(--muted-2);
  font-size: 11.5px;
}

/* =========================================================
   ЗАЛ СЛАВЫ
   ========================================================= */

.periods {
  margin-top: 18px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.014));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 26px 60px -40px #000, inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.periods-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.periods-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 700 12px/1 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.periods-title::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--muted-2);
}

.periods-note {
  color: var(--muted-2);
  font: 500 9px/1 var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.periods-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.period-col {
  min-width: 0;
}

.period-label {
  margin: 0 0 6px;
  color: var(--muted-2);
  font: 600 9px/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.period-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.period-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'when aura'
    'name aura';
  align-items: center;
  gap: 3px 10px;
  padding: 9px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.period-item:first-child {
  border-top: 0;
}

.period-item.is-current {
  border-top-color: transparent;
  background: linear-gradient(100deg, var(--soft, rgba(255, 255, 255, 0.08)), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.period-when {
  grid-area: when;
  color: var(--muted-2);
  font: 600 8.5px/1.3 var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.period-item.is-current .period-when {
  color: var(--accent, #fff);
}

.period-name {
  grid-area: name;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #dfe7ff;
  font: 600 11.5px/1.3 var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-name::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, var(--muted-2));
  box-shadow: 0 0 8px var(--accent, transparent);
}

.period-aura {
  grid-area: aura;
  color: var(--muted);
  font: 700 11px/1 var(--digits);
  white-space: nowrap;
}

.period-empty {
  padding: 10px 2px;
  color: var(--muted-2);
  font-size: 11.5px;
}

/* =========================================================
   САЛЮТ И ВСПЛЫВАЮЩИЕ ЧИСЛА
   ========================================================= */

.fx {
  position: fixed;
  inset: 0;
  z-index: 45;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.float-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  overflow: hidden;
}

.aura-float {
  position: fixed;
  transform: translate(-50%, -50%);
  font: 800 19px/1 var(--digits);
  letter-spacing: 0.04em;
  white-space: nowrap;
  animation: float-up 1.45s cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}

@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1.06); }
  36% { transform: translate(-50%, -78%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -175%) scale(0.94); }
}

/* =========================================================
   МОДАЛКА
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 3, 7, 0.68);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: modal-in 0.22s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  width: min(580px, 100%);
  max-height: min(88vh, 760px);
  padding: 30px 26px 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    linear-gradient(165deg, rgba(20, 24, 38, 0.96), rgba(8, 10, 18, 0.98));
  box-shadow:
    0 50px 120px -30px #000,
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: card-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.modal-card::-webkit-scrollbar {
  width: 8px;
}

.modal-card::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  background-clip: padding-box;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.modal-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.modal-close:hover {
  color: #fff;
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.09);
}

.admin-view {
  animation: view-in 0.26s ease-out;
}

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

.lock-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 4px auto 18px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.18), rgba(139, 92, 246, 0.16));
  color: #bff3ff;
  box-shadow: 0 0 34px -10px rgba(34, 211, 238, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.lock-badge svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-title {
  margin: 0;
  font: 700 20px/1.2 var(--display);
  letter-spacing: -0.01em;
  text-align: center;
}

.modal-sub {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted-2);
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.06em;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field input::placeholder {
  color: var(--muted-2);
}

.field input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}

.field input.is-shake {
  animation: shake 0.32s ease;
  border-color: rgba(248, 113, 113, 0.7);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.login-error {
  margin: 0;
  color: #fca5a5;
  font-size: 12px;
}

.btn-primary {
  height: 48px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(120deg, #22d3ee, #8b5cf6);
  color: #05060a;
  font: 700 12px/1 var(--font);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 16px 34px -16px rgba(34, 211, 238, 0.9);
  transition: filter 0.18s, transform 0.18s, box-shadow 0.18s;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 20px 40px -16px rgba(34, 211, 238, 1);
}

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

.hint {
  margin: 16px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
  text-align: center;
}

.hint b {
  color: var(--muted);
  font-family: var(--digits);
  letter-spacing: 0.08em;
}

/* ---- панель ---- */

.panel-head .modal-title,
.panel-head .modal-sub {
  text-align: left;
}

.panel-head .modal-title {
  padding-right: 40px;
}

.adm-list {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.adm-row {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.014));
  transition: border-color 0.18s, background 0.18s;
}

.adm-row:hover {
  border-color: var(--soft);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}

.adm-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.adm-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px 1px var(--soft);
}

.adm-name {
  font: 600 13px/1.2 var(--display);
  letter-spacing: 0.01em;
}

.adm-aura {
  margin-left: auto;
  font: 700 12.5px/1 var(--digits);
  color: var(--heat, var(--accent));
  white-space: nowrap;
}

.adm-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.adm-btn {
  height: 29px;
  min-width: 0;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font: 700 9.5px/1 var(--digits);
  letter-spacing: 0;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}

.adm-btn:hover {
  color: #fff;
  border-color: var(--soft);
  background: rgba(255, 255, 255, 0.08);
}

.adm-btn:active {
  transform: scale(0.96);
}

.adm-btn--plus {
  color: var(--accent);
  border-color: var(--soft);
  background: var(--soft);
}

.adm-btn--plus:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #05060a;
}

.adm-btn--minus {
  color: #93a3bd;
}

.adm-custom {
  grid-column: 1 / -1;
  display: flex;
  gap: 5px;
  min-width: 0;
  margin-top: 1px;
}

.adm-custom input {
  width: 100%;
  min-width: 0;
  flex: 1;
  height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 11.5px;
}

.adm-custom .adm-btn {
  flex: 0 0 44px;
  font-size: 13px;
}

.adm-custom input::placeholder {
  color: var(--muted-2);
  font-size: 10.5px;
}

.adm-custom input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
}

.adm-custom input::-webkit-outer-spin-button,
.adm-custom input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.adm-custom input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.panel-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* история внутри модалки */
#historyView .history-head {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
  padding-right: 46px;
}

#historyView .history-title,
#historyView .modal-title {
  margin: 0;
}

.history-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 6px;
}

.history-tab {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.history-tab:hover {
  color: #fff;
  border-color: var(--line-2);
}

.history-tab.is-active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.btn-ghost {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 600 10px/1 var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.btn-ghost:hover {
  color: #fff;
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.05);
}

#adminReset:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}

/* =========================================================
   ОКНО ПРИЧИНЫ
   ========================================================= */

.reason {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 3, 7, 0.72);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: modal-in 0.18s ease-out;
}

.reason-card {
  width: min(420px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(34, 211, 238, 0.1), transparent 55%),
    linear-gradient(165deg, rgba(20, 24, 38, 0.98), rgba(8, 10, 18, 0.99));
  box-shadow: 0 40px 100px -30px #000, inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.reason-kicker {
  margin: 0 0 7px;
  font: 700 10.5px/1 var(--digits);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.reason-title {
  margin: 0 0 16px;
  font: 700 19px/1.2 var(--display);
  letter-spacing: -0.01em;
}

.reason-form .field input {
  height: 46px;
}

.reason-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.reason-actions .btn-primary,
.reason-actions .btn-ghost {
  height: 40px;
}

.reason-actions .btn-primary {
  padding: 0 20px;
}

/* ---- выбор цели рейджбайта ---- */

.reason-victims {
  margin-top: 14px;
}

.reason-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-2);
  font: 600 9px/1 var(--font);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.reason-label em {
  font-style: normal;
  letter-spacing: 0.04em;
  opacity: 0.65;
}

.victim-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.victim {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: 600 10.5px/1 var(--display);
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}

.victim:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
}

.victim.is-active {
  color: #fff;
  border-color: rgba(253, 224, 71, 0.6);
  background: rgba(253, 224, 71, 0.12);
  box-shadow: 0 0 20px -8px rgba(253, 224, 71, 0.9);
}

.victim-aura {
  color: var(--muted-2);
  font: 700 9.5px/1 var(--digits);
}

.victim.has-crit .victim-mult {
  color: #fde047;
}

.victim-mult {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(253, 224, 71, 0.14);
  color: #fde047;
  font: 800 9px/1 var(--digits);
  letter-spacing: 0.04em;
}

.reason-hint {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.45;
}

.reason-hint.is-crit {
  color: #fde047;
  font-weight: 600;
}

/* ---- верёвочка: сколько забрать ---- */

.rope-amount {
  margin-bottom: 14px;
}

.rope-amount-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.rope-amount-row input {
  grid-column: 1 / -1;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: 700 14px/1 var(--digits);
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.rope-amount-row input::-webkit-outer-spin-button,
.rope-amount-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rope-amount-row input:focus {
  border-color: rgba(253, 224, 71, 0.5);
  box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.12);
}

.rope-chip {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: 700 10px/1 var(--digits);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.rope-chip:hover {
  color: #fff;
  border-color: rgba(253, 224, 71, 0.45);
  background: rgba(253, 224, 71, 0.1);
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(90vw, 420px);
  padding: 11px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  background: rgba(10, 13, 21, 0.92);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px -20px #000, inset 0 1px 0 rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.24s, transform 0.24s;
}

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

.toast--good {
  border-color: rgba(74, 222, 128, 0.35);
  box-shadow: 0 0 34px -14px rgba(74, 222, 128, 0.9), 0 24px 50px -20px #000;
}

.toast--bad {
  border-color: rgba(147, 197, 253, 0.35);
}

.toast--crit {
  border-color: rgba(253, 224, 71, 0.55);
  box-shadow: 0 0 40px -10px rgba(253, 224, 71, 0.85), 0 24px 50px -20px #000;
  color: #fde047;
}

/* =========================================================
   ВЕРЁВОЧКА
   ========================================================= */

.rope {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s;
}

.rope.is-active,
.rope.is-snap {
  opacity: 1;
}

.rope-path {
  fill: none;
  stroke: var(--rope, #22d3ee);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 12 9;
  filter: drop-shadow(0 0 8px var(--rope, #22d3ee));
  animation: rope-flow 0.55s linear infinite;
}

.rope.is-snap .rope-path {
  stroke-width: 3.4;
  animation: rope-flow 0.6s linear infinite, rope-snap 0.85s ease-out forwards;
}

.rope-dot {
  fill: var(--rope, #22d3ee);
  filter: drop-shadow(0 0 10px var(--rope, #22d3ee));
}

.rope:not(.is-active):not(.is-snap) .rope-dot {
  opacity: 0;
}

.rope.is-snap .rope-dot {
  animation: rope-dot-pop 0.85s ease-out forwards;
}

@keyframes rope-flow {
  to { stroke-dashoffset: -21; }
}

@keyframes rope-snap {
  0% { opacity: 1; }
  70% { opacity: 0.9; }
  100% { opacity: 0; }
}

@keyframes rope-dot-pop {
  0% { opacity: 1; transform: scale(1); }
  60% { opacity: 1; transform: scale(1.9); }
  100% { opacity: 0; transform: scale(0.6); }
}

body.is-roping {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

body.is-roping .card {
  cursor: grabbing;
}

.card.is-rope-target {
  border-color: rgba(253, 224, 71, 0.85);
  box-shadow:
    0 0 0 2px rgba(253, 224, 71, 0.35),
    0 0 60px -12px rgba(253, 224, 71, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card.is-rope-origin {
  border-color: var(--heat, var(--accent));
  box-shadow:
    0 0 0 2px var(--heat-soft, var(--soft)),
    0 0 60px -10px var(--heat, var(--accent));
}

body.is-crit .wrap::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 46;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(253, 224, 71, 0.16), transparent 62%);
  animation: crit-flash 0.85s ease-out forwards;
}

@keyframes crit-flash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

/* «нищий» */
.tag-poor {
  height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 6px;
  background: rgba(251, 113, 133, 0.12);
  color: #fb7185;
  font: 700 8.5px/1.9 var(--font);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.tag-poor[hidden] {
  display: none;
}

.card.is-poor {
  border-style: dashed;
}

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

@media (min-width: 560px) {
  .wrap {
    padding: 0 26px 56px;
  }

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

@media (min-width: 900px) {
  .topbar {
    padding-left: 30px;
    padding-right: 30px;
  }

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

  .slot {
    grid-column: auto;
  }

  .card {
    min-height: 320px;
    padding-top: 48px;
  }

  .stats {
    gap: 14px;
    padding-top: 38px;
  }

  .stat {
    min-width: 168px;
    padding: 16px 24px 17px;
  }

  .stat-value {
    font-size: 27px;
  }
}

@media (min-width: 1180px) {
  .card {
    min-height: 332px;
  }
}

@media (max-width: 559px) {
  .stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 20px;
  }

  .stat {
    min-width: 0;
    padding: 11px 10px 12px;
  }

  .stat-value {
    font-size: clamp(13px, 4.4vw, 18px);
    letter-spacing: -0.01em;
  }

  .stat-value--name {
    font-size: clamp(11px, 3.6vw, 14px);
  }

  .stat-label {
    margin-top: 6px;
    font-size: 7px;
    letter-spacing: 0.1em;
    line-height: 1.35;
  }

  .card {
    min-height: 280px;
  }

  .history {
    padding: 14px 14px 10px;
  }

  .periods {
    padding: 14px 14px 10px;
  }

  .periods-head {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }

  .periods-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .history-title {
    font-size: 11px;
  }

  .history-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'delta name time'
      'reason reason reason';
    gap: 4px 8px;
  }

  .h-delta {
    grid-area: delta;
  }

  .h-name {
    grid-area: name;
  }

  .h-reason {
    grid-area: reason;
    padding-top: 1px;
    font-size: 12px;
  }

  .h-time {
    grid-area: time;
  }

  .modal-card {
    padding: 26px 18px 20px;
  }

  .reason-card {
    padding: 20px;
  }

  .toast {
    white-space: normal;
    text-align: center;
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .btn-admin {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .btn-admin span {
    display: none;
  }
}

@media (max-width: 430px) {
  .adm-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .adm-btn {
    height: 32px;
  }
}

@media (hover: none) {
  .card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
      0 30px 70px -34px rgba(0, 0, 0, 0.95),
      inset 0 1px 0 rgba(255, 255, 255, 0.16);
  }

  .card:hover::after {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
