:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #222;
  --border: #2a2a2a;
  --accent: #e8ff47;
  --accent2: #47c8ff;
  --text: #f0f0f0;
  --muted: #777;
  --card-radius: 16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Loader ───────────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(48px, 10vw, 100px);
  letter-spacing: 0.05em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}

.loader-title span {
  color: var(--accent);
}

.loader-bar-wrap {
  width: 260px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 32px;
}

.loader-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  animation: loadbar 2.2s cubic-bezier(.4, 0, .2, 1) forwards;
}

@keyframes loadbar {
  0%   { width: 0% }
  60%  { width: 75% }
  90%  { width: 92% }
  100% { width: 100% }
}

.loader-sub {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Main ─────────────────────────────────────────────────── */
#app {
  opacity: 0;
  transition: opacity 0.7s ease;
  padding-bottom: 60px;
}

#app.visible {
  opacity: 1;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 60px 24px 40px;
  text-align: center;
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-eyebrow a {
  text-decoration: none;
  color: #414141;
}

.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(52px, 12vw, 130px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--text);
}

.hero-title .hl {
  color: var(--accent);
}

.hero-typewriter-wrap {
  margin-top: 14px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-typewriter {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(22px, 5vw, 36px);
  color: var(--accent2);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.cursor {
  display: inline-block;
  width: 3px;
  height: 1.1em;
  background: var(--accent2);
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0 }
}

/* ── Controls ─────────────────────────────────────────────── */
.controls {
  max-width: 900px;
  margin: 0 auto 36px;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.group-input-wrap {
  position: relative;
  flex: 0 0 auto;
}

.group-input-wrap label {
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.group-input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 18px;
  width: 120px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.group-input:focus {
  border-color: var(--accent);
}

.mode-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border-radius: 12px;
  padding: 5px;
  border: 1.5px solid var(--border);
}

.mode-tab {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: background 0.18s, color 0.18s;
}

.mode-tab.active {
  background: var(--accent);
  color: #0f0f0f;
}

.mode-tab:hover:not(.active) {
  color: var(--text);
}

.load-btn {
  padding: 12px 28px;
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.load-btn:hover {
  transform: translateY(-2px);
  background: #d4eb3a;
}

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

/* ── Schedule output ──────────────────────────────────────── */
#schedule-out {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.day-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--card-radius);
  padding: 20px;
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.4s ease forwards;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0) }
}

.day-card-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.day-date {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.06em;
}

.day-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.pair {
  margin-bottom: 14px;
}

.pair:last-child {
  margin-bottom: 0;
}

.pair-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.subgroup {
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
}

.subgroup:last-child {
  margin-bottom: 0;
}

.subgroup-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--accent2);
  color: #0f0f0f;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.subj {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 4px;
}

.meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.meta-room::before    { content: "🏫 "; }
.meta-teacher::before { content: "👤 "; }

/* ── Error / spinner ──────────────────────────────────────── */
.msg-error {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  font-size: 14px;
}

.msg-error strong {
  color: var(--text);
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.spinner {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Skeleton shimmer ─────────────────────────────────────── */
.skeleton-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--card-radius);
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: -200% 0 }
  100% { background-position: 200% 0 }
}

/* ── Random section ───────────────────────────────────────── */
.random-section {
  max-width: 1100px;
  margin: 60px auto 0;
  padding: 0 24px 60px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.04em;
  color: var(--text);
}

.section-title span       { color: var(--accent); }
.section-title.blue span  { color: var(--accent2); }

.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
  margin-bottom: 28px;
  opacity: 0.35;
}

.section-divider.blue {
  background: linear-gradient(90deg, var(--accent2) 0%, transparent 60%);
  opacity: 0.3;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-btn:active { transform: scale(0.97); }

.refresh-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.5s ease;
}

.refresh-btn.spinning svg { transform: rotate(360deg); }

.random-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.rcard {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  animation: cardIn 0.4s ease forwards;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.rcard:hover {
  border-color: #3a3a3a;
  transform: translateY(-3px);
}

.rcard-top {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rcard-group {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1;
}

.rcard-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0f0f0f;
  background: var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
}

.rcard-badge.empty-badge {
  background: var(--surface2);
  color: var(--muted);
}

.rcard-body { padding: 14px 18px 16px; }

.rcard-pair {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.rcard-pair:last-child { border-bottom: none; }

.rcard-pair-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 1px;
}

.rcard-pair-info {
  flex: 1;
  min-width: 0;
}

.rcard-subj {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.rcard-subj.split {
  white-space: normal;
  font-size: 12px;
}

.rcard-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rcard-empty {
  padding: 20px 0 4px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.rcard-more {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.06em;
}

/* ── Stats section ────────────────────────────────────────── */
.stats-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--card-radius);
  padding: 22px 22px 18px;
  opacity: 0;
  transform: translateY(16px);
  animation: cardIn 0.45s ease forwards;
}

.stat-card:nth-child(2) { animation-delay: 80ms; }

.stat-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-card-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.chart-wrap {
  position: relative;
  height: 180px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child { border-bottom: none; }

.user-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
  border: 1.5px solid var(--border);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.user-group-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .group-input { width: 100%; }
  .mode-tabs   { justify-content: center; }
  .load-btn    { width: 100%; }
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  padding: 24px 24px 32px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-widgets {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1100px;
}

.footer-widget {
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

/* Ряд 1: два телеграма */
.footer-row-top {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-row-top .footer-widget {
  flex: 1;
  min-width: 280px;
  max-width: 540px;
}

/* Ряд 2: Minecraft + портфолио */
.footer-row-bottom {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
}

.footer-row-bottom .footer-server-widget {
  flex: 2;
  min-width: 280px;
  max-width: 760px;
}

.footer-row-bottom .footer-portfolio {
  flex: 1;
  min-width: 220px;
  max-width: 320px;
}

.footer-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(71,200,255,0.12), rgba(232,255,71,0.08));
  border: 1.5px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  height: 100%;
}

.footer-cta:hover {
  border-color: var(--accent2);
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(71,200,255,0.18), rgba(232,255,71,0.12));
}

.footer-cta.channel-widget:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(232,255,71,0.18), rgba(71,200,255,0.12));
}

.footer-cta:active { transform: translateY(0); }

.footer-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #0f0f0f;
  font-weight: 700;
}

.footer-icon.bot-icon     { background: var(--accent2); }
.footer-icon.channel-icon { background: var(--accent); }

.footer-icon svg {
  width: 20px;
  height: 20px;
}

.footer-content {
  flex: 1;
  text-align: left;
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.footer-title strong { font-weight: 700; }
.footer-bot     .footer-title strong { color: var(--accent2); }
.footer-channel .footer-title strong { color: var(--accent); }

.footer-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.footer-copy {
  font-size: 11px;
  color: var(--muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  width: 100%;
  text-align: center;
}

@media (max-width: 650px) {
  .footer-row-top,
  .footer-row-bottom { flex-direction: column; align-items: stretch; }
  .footer-widget { width: 100%; max-width: 100%; }
  .footer-row-bottom .footer-portfolio { max-width: 100%; }
  .footer-cta { padding: 12px 16px; }
}

/* ── Pair time ────────────────────────────────────────────── */
.pair-time {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent2);
  letter-spacing: 0.05em;
  margin-left: 6px;
  opacity: 0.8;
}
/* ── Server widget (footer) ───────────────────────────────── */
.footer-server-widget {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.footer-server-widget:hover {
  border-color: #3a3a3a;
}

.footer-server-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.footer-server-label svg {
  color: var(--accent);
  flex-shrink: 0;
}

.footer-server-inner {
  padding: 12px;
  background: #111;
}

/* ── Portfolio widget (footer) ────────────────────────────── */
.footer-icon.portfolio-icon {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  width: 44px;
  height: 44px;
}

.portfolio-widget {
  background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(168,85,247,0.08)) !important;
  height: 100%;
  align-items: center;
}

.portfolio-widget:hover {
  border-color: #a855f7 !important;
  background: linear-gradient(135deg, rgba(124,58,237,0.22), rgba(168,85,247,0.14)) !important;
  transform: translateY(-2px);
}

.footer-portfolio .footer-title strong {
  color: #a855f7;
}

.footer-portfolio-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #7c3aed;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
}

.footer-portfolio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-avatar-fallback {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: #a855f7;
}

.footer-portfolio-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.footer-portfolio-tags span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(168,85,247,0.3);
  color: #a855f7;
  border-radius: 4px;
  padding: 2px 7px;
}