:root {
  --bg: #07111f;
  --sidebar: #081321;
  --line: #26364c;
  --text: #f5f7fb;
  --muted: #9aa8bc;
  --green: #5ef2b2;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(87, 183, 255, 0.12), transparent 32%),
    radial-gradient(circle at 55% 35%, rgba(167, 121, 255, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.app {
  display: grid;
  grid-template-columns: 242px 1fr;
  min-height: 100vh;
}

.app.sidebar-collapsed {
  grid-template-columns: 86px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(8, 19, 33, 0.92);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 10px 34px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  background: #020814;
  box-shadow: 0 12px 30px rgba(40, 120, 255, 0.38);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 43px;
  padding: 0 15px;
  color: #c7d1df;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
}

.nav a.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(112, 105, 255, 0.55), rgba(167, 121, 255, 0.34));
  font-weight: 800;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.28);
}

.nav a.active b {
  color: #d9e6ff;
}

.creator-link span {
  background: linear-gradient(90deg, #ff6f9f, #ffc95c, #5ef2b2, #57b7ff, #a779ff);
  background-size: 220% 100%;
  animation: creatorRainbowFlow 2.8s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

@keyframes creatorRainbowFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.lang-switch {
  display: flex;
  margin: 12px 0 0;
  padding: 3px;
  border-radius: 10px;
  background: rgba(6, 14, 26, 0.85);
  border: 1px solid rgba(38, 54, 76, 0.95);
  gap: 3px;
}

.lang-switch-btn {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switch-btn:hover {
  color: #e8eef8;
}

.lang-switch-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(112, 105, 255, 0.45), rgba(87, 183, 255, 0.35));
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.auth-box {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  padding: 12px;
  border: 1px solid rgba(87, 183, 255, 0.16);
  border-radius: 12px;
  background: rgba(13, 23, 38, 0.92);
}

.auth-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.auth-widget-title {
  font-size: 12px;
  color: #9db0c8;
}

#telegram-login-widget {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.telegram-login-fallback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.telegram-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #2ca5e0, #1b85d6);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.telegram-login-label-short {
  display: none;
}

.user-info-box {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.user-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(167, 121, 255, 0.5);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.user-label {
  color: #8ea0b8;
  font-size: 11px;
}

.user-name {
  color: #edf5ff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  height: 36px;
  border: 1px solid rgba(255, 111, 159, 0.28);
  border-radius: 9px;
  background: rgba(255, 111, 159, 0.12);
  color: #ffd8e4;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.logout-btn:hover {
  background: rgba(255, 111, 159, 0.18);
}

.x-link-box {
  border: 1px solid rgba(87, 183, 255, 0.2);
  border-radius: 10px;
  padding: 8px;
  background: rgba(9, 19, 34, 0.9);
}

.x-link-title {
  font-size: 11px;
  color: #9db0c8;
  margin-bottom: 6px;
}

.x-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.x-link-row + .x-link-row {
  margin-top: 6px;
}

.x-linked-name {
  font-size: 12px;
  color: #d7e8ff;
  font-weight: 700;
}

.x-username-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #2b4464;
  background: rgba(11, 25, 44, 0.95);
  color: #e8f2ff;
  padding: 0 8px;
  font-size: 12px;
}

.x-link-btn,
.x-unlink-btn {
  height: 30px;
  border-radius: 8px;
  border: 1px solid #335883;
  background: rgba(51, 88, 131, 0.22);
  color: #dcecff;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main {
  min-width: 0;
  padding: 20px 28px 26px;
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 17px;
}

.hamburger {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #b7c5d9;
  font-size: 22px;
  cursor: pointer;
  user-select: none;
  border: 0;
  background: transparent;
}

.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 16, 0.55);
  z-index: 40;
}

.mobile-backdrop.show {
  display: block;
}

.app.sidebar-collapsed .brand h1,
.app.sidebar-collapsed .brand p,
.app.sidebar-collapsed .nav span,
.app.sidebar-collapsed .auth-widget-title,
.app.sidebar-collapsed .user-label,
.app.sidebar-collapsed .user-name,
.app.sidebar-collapsed .logout-btn {
  display: none;
}

.app.sidebar-collapsed .brand {
  justify-content: center;
  margin: 0 0 30px;
}

.app.sidebar-collapsed .nav a {
  justify-content: center;
  padding: 0;
}

.app.sidebar-collapsed .auth-box {
  left: 10px;
  right: 10px;
  padding: 10px 8px;
}

.app.sidebar-collapsed .user-profile-row,
.app.sidebar-collapsed #telegram-login-widget {
  justify-content: center;
}

.app.sidebar-collapsed .telegram-login-label-full {
  display: none;
}

.app.sidebar-collapsed .telegram-login-label-short {
  display: inline;
}

@media (max-width: 860px) {
  .app {
    display: block;
  }

  .sidebar {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    width: 242px;
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 50;
  }

  .app.sidebar-open-mobile .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 18px;
  }

  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
}
