:root {
  --bg: #090816;
  --bg-soft: #120f2a;
  --panel: rgba(26, 21, 54, 0.9);
  --panel-border: rgba(120, 95, 220, 0.35);
  --text: #f3ecff;
  --muted: #d4c7ff;
  --accent: #8f66ff;
  --accent-soft: #a67bff;
  --danger: #ff646a;
  --danger-strong: #ff3f62;
  --timer: #ff7c8d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--text);
  background:
    radial-gradient(700px 420px at 50% -120px, rgba(141, 104, 255, 0.32) 0%, transparent 70%),
    radial-gradient(560px 340px at 85% 100%, rgba(255, 94, 168, 0.2) 0%, transparent 75%),
    linear-gradient(180deg, #0c0a1f 0%, var(--bg) 100%);
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(147, 127, 220, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 127, 220, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 78%);
}

.site {
  width: min(1140px, 100% - 40px);
  margin: 8px auto 8px;
  position: relative;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.hero-spacer {
  min-width: 1px;
}

.hero-title {
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 4vw, 54px);
  letter-spacing: 0.03em;
  font-weight: 800;
  color: #8366ff;
}

.lang-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(132, 104, 236, 0.55);
  border-radius: 999px;
  min-height: 38px;
  padding: 6px 14px;
  color: #efe8ff;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(120deg, rgba(62, 43, 127, 0.85), rgba(37, 29, 92, 0.85));
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.lang-flag {
  font-size: 16px;
  line-height: 1;
}

.lang-label {
  line-height: 1;
}

.lang-toggle:hover {
  background: linear-gradient(120deg, rgba(84, 58, 168, 0.88), rgba(50, 37, 120, 0.88));
  box-shadow: 0 8px 18px rgba(125, 92, 233, 0.32);
  transform: translateY(-1px) scale(1.02);
}

.lang-toggle:active {
  transform: scale(0.98);
}

.hero-warning {
  margin: 6px 0 10px;
  text-align: center;
  color: var(--danger);
  font-size: clamp(20px, 2.2vw, 34px);
  font-weight: 700;
  text-shadow: 0 0 18px rgba(255, 88, 108, 0.45);
  animation: pulse-warning 5s ease-in-out infinite;
}

.refresh-banner {
  border-radius: 18px;
  border: 1px solid rgba(152, 125, 245, 0.52);
  background: linear-gradient(115deg, #7757dd 0%, #9868ff 100%);
  min-height: 62px;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 2vw, 32px);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 0 30px rgba(138, 99, 255, 0.38);
}

.mirror-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mirror-card {
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(145deg, rgba(27, 23, 54, 0.95), rgba(18, 16, 40, 0.95));
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.mirror-card:hover {
  transform: translateY(-4px);
  border-color: rgba(151, 125, 250, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 10px 28px rgba(0, 0, 0, 0.42);
}

.mirror-id {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #d5ccff;
  background: rgba(11, 10, 24, 0.82);
  border: 1px solid rgba(129, 104, 230, 0.45);
}

.mirror-title {
  margin: 0;
  font-size: clamp(20px, 1.9vw, 38px);
  font-weight: 700;
}

.mirror-open {
  border: 0;
  border-radius: 12px;
  height: 44px;
  min-width: min(82%, 260px);
  padding: 0 18px;
  cursor: pointer;
  color: #f8f5ff;
  font-family: inherit;
  font-size: clamp(18px, 1.2vw, 24px);
  font-weight: 700;
  background: linear-gradient(115deg, var(--accent), var(--accent-soft));
  box-shadow: 0 10px 24px rgba(143, 102, 255, 0.34);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.mirror-open:hover {
  box-shadow: 0 12px 26px rgba(143, 102, 255, 0.45);
}

.mirror-open:active {
  transform: scale(0.97);
}

.actions {
  margin-top: 10px;
  display: grid;
  place-items: center;
}

.btn-random {
  border: 0;
  border-radius: 999px;
  min-height: 54px;
  min-width: min(620px, 88%);
  padding: 0 28px;
  cursor: pointer;
  font-family: inherit;
  color: #fff0f6;
  font-size: clamp(18px, 1.6vw, 28px);
  font-weight: 700;
  background: linear-gradient(115deg, var(--danger), var(--danger-strong));
  box-shadow: 0 0 26px rgba(255, 73, 116, 0.38);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-random:hover {
  box-shadow: 0 10px 30px rgba(255, 73, 116, 0.5);
  transform: translateY(-2px);
}

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

.timer {
  margin-top: 6px;
  text-align: center;
}

.timer-label {
  margin: 0;
  color: var(--timer);
  font-size: clamp(18px, 1.5vw, 24px);
  font-weight: 600;
}

.timer-value {
  margin: 2px 0 0;
  color: var(--timer);
  font-size: clamp(32px, 2.4vw, 48px);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(255, 102, 125, 0.4);
}

@keyframes pulse-warning {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.018);
  }
}

.mirror-empty {
  grid-column: 1 / -1;
  min-height: 160px;
  border-radius: 18px;
  border: 1px dashed rgba(152, 126, 248, 0.5);
  background: rgba(26, 21, 54, 0.6);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 24px;
}

@media (max-width: 1240px) {
  .hero-title {
    font-size: clamp(30px, 3.4vw, 44px);
  }

  .hero-warning {
    font-size: clamp(20px, 2.4vw, 30px);
  }

  .refresh-banner {
    min-height: 58px;
    font-size: clamp(20px, 2.4vw, 30px);
  }

  .mirror-title {
    font-size: clamp(18px, 2vw, 28px);
  }

  .mirror-open {
    height: 42px;
    font-size: clamp(18px, 1.6vw, 24px);
  }

  .btn-random {
    min-height: 52px;
    font-size: clamp(18px, 1.8vw, 28px);
  }

  .timer-label {
    font-size: clamp(18px, 2vw, 24px);
  }

  .timer-value {
    font-size: clamp(30px, 3vw, 42px);
  }
}

@media (max-width: 900px) {
  .site {
    width: min(100%, calc(100% - 24px));
    margin-top: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-spacer {
    display: none;
  }

  .hero-title {
    order: 1;
  }

  .lang-toggle {
    order: 2;
    justify-self: center;
    font-size: 14px;
    min-height: 34px;
    padding: 5px 12px;
  }

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

  .mirror-card {
    min-height: 132px;
  }
}

@media (max-width: 620px) {
  .mirror-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 34px;
  }

  .hero-warning {
    font-size: 18px;
  }

  .refresh-banner {
    min-height: 72px;
    font-size: 20px;
    border-radius: 18px;
  }

  .mirror-title {
    font-size: 28px;
  }

  .mirror-open {
    font-size: 20px;
    min-width: 90%;
  }

  .btn-random {
    min-height: 62px;
    font-size: 20px;
  }

  .timer-label {
    font-size: 20px;
  }

  .timer-value {
    font-size: 48px;
  }
}