:root {
  color-scheme: light dark;
  --font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-color: #f5f6ff;
  --bg-color: #050816;
  --primary: #7c5dff;
  --primary-strong: #9676ff;
  --text-secondary: #b7c2f2;
  --text-muted: var(--text-secondary);
  --shadow-soft: 0 18px 36px rgba(8, 14, 40, 0.35);
  --shadow-strong: 0 26px 52px rgba(5, 9, 26, 0.45);
  --glow-primary: 0 18px 34px rgba(124, 93, 255, 0.35);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-color);
  background: radial-gradient(circle at 15% 20%, #1F2B60, transparent 45%),
    radial-gradient(circle at 80% 0%, #4F2DD3, transparent 45%),
    linear-gradient(135deg, #050816, #151F45);
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

body::before {
  inset: 12% auto auto 58%;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(124, 93, 255, 0.2) 0%, transparent 65%);
  filter: blur(6px);
  animation: panel-pulse 12s ease-in-out infinite;
}

body::after {
  inset: auto auto 6% 6%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(77, 131, 255, 0.18) 0%, transparent 60%);
  filter: blur(4px);
  animation: panel-pulse 16s ease-in-out infinite reverse;
}

@keyframes panel-pulse {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.08) translateY(-12px);
    opacity: 0.82;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}


.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(7, 11, 24, 0.65);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  box-sizing: border-box;
}

.app-topbar__brand {
  justify-self: center;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.app-topbar__spacer {
  justify-self: flex-start;
}

.app-topbar__group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-topbar__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(9, 14, 32, 0.75);
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.app-topbar__back:hover,
.app-topbar__profile-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.app-topbar__profile {
  position: relative;
  justify-self: flex-end;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-topbar__profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.35), rgba(82, 109, 255, 0.35));
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.app-topbar__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-radius: 16px;
  background: rgba(12, 18, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 36px rgba(5, 8, 22, 0.45);
}

.app-topbar__menu p {
  margin: 0;
  color: rgba(222, 227, 255, 0.85);
  font-size: 0.92rem;
}

.app-topbar__menu-action {
  margin-top: 0.25rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.65), rgba(150, 118, 255, 0.65));
  color: #fff;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.app-topbar__menu-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.app-topbar__overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  opacity: 0;
  cursor: default;
}

[hidden] {
  display: none !important;
}

body.login-modal-open {
  overflow: hidden;
}

.login-modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: rgba(5, 9, 20, 0.75);
  backdrop-filter: blur(6px);
}

.login-modal__dialog {
  position: relative;
  width: min(420px, 100%);
  border-radius: 24px;
  background: rgba(12, 18, 38, 0.95);
  border: 1px solid rgba(124, 93, 255, 0.25);
  box-shadow: 0 30px 60px rgba(5, 8, 22, 0.55);
  padding: clamp(1.75rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: var(--text-color);
}

.login-modal__dialog--blur {
  filter: blur(3px);
}

.login-modal__loader {
  position: fixed;
  inset: 0;
  z-index: 205;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 9, 20, 0.35);
  backdrop-filter: blur(4px);
}

.login-modal__loader[aria-hidden="true"] {
  display: none;
}

.login-modal__loader[aria-hidden="false"] {
  display: flex;
}

.login-modal__spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(124, 93, 255, 0.85);
  animation: login-spin 0.8s linear infinite;
}

.login-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 14, 32, 0.85);
  color: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.login-modal__close:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.login-modal__header h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.7rem);
}

.login-modal__header p {
  margin: 0.4rem 0 0;
  color: rgba(222, 227, 255, 0.75);
  font-size: 0.95rem;
}

.login-modal__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-modal__field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.login-modal__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(235, 240, 255, 0.95);
}

.login-modal__input {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 14, 32, 0.9);
  color: var(--text-color);
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-modal__input:focus-visible {
  outline: 2px solid rgba(124, 93, 255, 0.65);
  outline-offset: 3px;
}

.login-modal__error {
  border-radius: 16px;
  padding: 0.85rem 1rem;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
  font-size: 0.92rem;
}

.login-modal__actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.login-modal__btn {
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-modal__btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
}

.login-modal__btn--primary {
  background: linear-gradient(135deg, rgba(124, 93, 255, 0.85), rgba(150, 118, 255, 0.85));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 14px 28px rgba(124, 93, 255, 0.35);
}

.login-modal__btn--loading {
  position: relative;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.75);
}

.login-modal__btn--loading::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 1.1rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
  animation: login-spin 0.75s linear infinite;
}

@keyframes login-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

.login-modal__btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.file-drop {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  background: rgba(12, 18, 35, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.file-drop:hover {
  border-color: rgba(124, 93, 255, 0.45);
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-drop strong {
  font-size: 0.95rem;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}
