@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

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

body {
  font-family: 'Outfit', sans-serif;
  background: #0a0a1a;
  color: #e0e0ff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(120, 40, 200, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 50, 120, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(40, 100, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 2.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff6ec7, #7c4dff, #448aff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.header .subtitle {
  font-size: 1rem;
  color: rgba(200, 200, 255, 0.5);
  font-weight: 300;
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.game-card {
  background: rgba(20, 20, 40, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(120, 80, 220, 0.2);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 720px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(120, 60, 200, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  position: relative;
  border: 1px solid rgba(120, 80, 220, 0.15);
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-wrapper.hidden-video video {
  opacity: 0;
}

.video-wrapper.visible-video video {
  opacity: 1;
  transition: opacity 0.6s ease;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 2;
}

.video-overlay.fade-out {
  opacity: 0;
}

.overlay-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

.overlay-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(200, 200, 255, 0.7);
}

.timer-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c4dff, #ff6ec7);
  border-radius: 4px;
  width: 100%;
  transition: width linear;
}

.title-reveal {
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.anime-title {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6ec7, #7c4dff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.anime-title.show {
  opacity: 1;
  transform: translateY(0);
}

.song-name {
  font-size: 1rem;
  color: rgba(200, 200, 255, 0.5);
  font-weight: 400;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease 0.15s, transform 0.5s ease 0.15s;
}

.song-name.show {
  opacity: 1;
  transform: translateY(0);
}

.hidden-text {
  font-size: 1.1rem;
  color: rgba(200, 200, 255, 0.35);
  font-style: italic;
  letter-spacing: 1px;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.song-counter {
  font-size: 0.85rem;
  color: rgba(200, 200, 255, 0.4);
  font-weight: 400;
}

.phase-label {
  font-size: 0.85rem;
  color: rgba(200, 200, 255, 0.4);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 0;
}

.start-screen .icon {
  font-size: 4rem;
}

.start-screen p {
  font-size: 1rem;
  color: rgba(200, 200, 255, 0.5);
  text-align: center;
  line-height: 1.6;
  max-width: 400px;
}

.btn-start {
  background: linear-gradient(135deg, #7c4dff, #651fff);
  color: white;
  border: none;
  padding: 14px 48px;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(124, 77, 255, 0.3);
  letter-spacing: 0.5px;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(124, 77, 255, 0.45);
}

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

.btn-shuffle {
  background: transparent;
  border: 1px solid rgba(120, 80, 220, 0.3);
  color: rgba(200, 200, 255, 0.6);
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-shuffle:hover {
  border-color: rgba(120, 80, 220, 0.6);
  color: rgba(200, 200, 255, 0.9);
  background: rgba(120, 80, 220, 0.1);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-skip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(200, 200, 255, 0.5);
  padding: 8px 24px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-skip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(200, 200, 255, 0.8);
}

.btn-stop {
  background: rgba(255, 60, 80, 0.12);
  border: 1px solid rgba(255, 60, 80, 0.3);
  color: rgba(255, 130, 140, 0.8);
  padding: 8px 24px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-stop:hover {
  background: rgba(255, 60, 80, 0.25);
  border-color: rgba(255, 60, 80, 0.5);
  color: rgba(255, 160, 170, 1);
}

.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(124, 77, 255, 0.4);
  border-radius: 50%;
  animation: float linear infinite;
}

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

.end-screen {
  text-align: center;
  padding: 48px 0;
}

.end-screen h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ff6ec7, #7c4dff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.end-screen p {
  color: rgba(200, 200, 255, 0.5);
  margin-bottom: 24px;
}

.user-bar {
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.user-greeting {
  font-size: 0.9rem;
  color: rgba(200, 200, 255, 0.5);
  font-weight: 400;
}

.user-menu-wrap {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(124, 77, 255, 0.08);
  border: 1px solid rgba(124, 77, 255, 0.15);
  border-radius: 50px;
  padding: 5px 14px 5px 5px;
  cursor: pointer;
  transition: all 0.2s;
  color: rgba(200, 200, 255, 0.7);
  font-family: inherit;
  font-size: 0.85rem;
}

.user-menu-btn:hover,
.user-menu-btn.active {
  background: rgba(124, 77, 255, 0.15);
  border-color: rgba(124, 77, 255, 0.3);
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.4), rgba(255, 110, 199, 0.4));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-menu-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-caret {
  opacity: 0.5;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.user-menu-btn.active .user-menu-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(18, 14, 35, 0.95);
  border: 1px solid rgba(124, 77, 255, 0.2);
  border-radius: 12px;
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.dropdown-username {
  font-size: 0.85rem;
  color: rgba(200, 200, 255, 0.8);
  font-weight: 500;
}

.dropdown-role {
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.dropdown-divider {
  height: 1px;
  background: rgba(124, 77, 255, 0.12);
  margin: 4px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: rgba(200, 200, 255, 0.7);
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.dropdown-item:hover {
  background: rgba(124, 77, 255, 0.12);
  color: #fff;
}

.dropdown-item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.dropdown-item:hover svg {
  opacity: 1;
}

.dropdown-item-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.dropdown-item-danger {
  color: rgba(255, 120, 120, 0.8);
}

.dropdown-item-danger:hover {
  background: rgba(255, 70, 70, 0.12);
  color: rgba(255, 120, 120, 1);
}

.role-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 6px;
}

.role-admin {
  background: linear-gradient(135deg, rgba(255, 110, 199, 0.2), rgba(124, 77, 255, 0.2));
  border: 1px solid rgba(255, 110, 199, 0.4);
  color: #ff6ec7;
}

.role-user {
  background: rgba(124, 77, 255, 0.15);
  border: 1px solid rgba(124, 77, 255, 0.3);
  color: rgba(200, 200, 255, 0.7);
}

.user-bar-links {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-panel {
  text-align: left;
}

.admin-section {
  margin-bottom: 30px;
}

.admin-section-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(200, 200, 255, 0.6);
  margin-bottom: 15px;
}

.admin-desc {
  font-size: 0.85rem;
  color: rgba(200, 200, 255, 0.5);
  margin-bottom: 12px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(124, 77, 255, 0.1);
}

.admin-table th {
  color: rgba(200, 200, 255, 0.5);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

.admin-table td {
  color: rgba(200, 200, 255, 0.8);
}

.btn-toggle {
  background: rgba(124, 77, 255, 0.2);
  border: 1px solid rgba(124, 77, 255, 0.3);
  color: rgba(200, 200, 255, 0.8);
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle:hover {
  background: rgba(124, 77, 255, 0.35);
  border-color: rgba(124, 77, 255, 0.5);
}

.btn-delete {
  background: rgba(255, 70, 70, 0.15);
  border-color: rgba(255, 70, 70, 0.25);
  color: rgba(255, 120, 120, 0.9);
}

.btn-delete:hover {
  background: rgba(255, 70, 70, 0.3);
  border-color: rgba(255, 70, 70, 0.5);
}

.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.admin-section-header .admin-section-title {
  margin-bottom: 0;
}

.admin-count {
  font-size: 0.75rem;
  color: rgba(200, 200, 255, 0.4);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: rgba(200, 200, 255, 0.7);
  background: rgba(124, 77, 255, 0.1);
  border: 1px solid rgba(124, 77, 255, 0.15);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.page-btn:hover {
  background: rgba(124, 77, 255, 0.25);
  border-color: rgba(124, 77, 255, 0.4);
  color: #fff;
}

.page-active {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.4), rgba(255, 110, 199, 0.3));
  border-color: rgba(124, 77, 255, 0.5);
  color: #fff;
  cursor: default;
}

.page-ellipsis {
  color: rgba(200, 200, 255, 0.3);
  font-size: 0.85rem;
  padding: 0 4px;
}

.btn-logout {
  font-size: 0.8rem;
  color: rgba(200, 200, 255, 0.4);
  text-decoration: none;
  padding: 4px 14px;
  border: 1px solid rgba(200, 200, 255, 0.15);
  border-radius: 50px;
  transition: all 0.3s ease;
  font-family: 'Outfit', sans-serif;
}

.btn-logout:hover {
  color: rgba(200, 200, 255, 0.8);
  border-color: rgba(200, 200, 255, 0.3);
  background: rgba(200, 200, 255, 0.05);
}

.auth-card {
  max-width: 420px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6ec7, #7c4dff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: rgba(200, 200, 255, 0.5);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(120, 80, 220, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: 'Outfit', sans-serif;
  color: #e0e0ff;
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.form-group input::placeholder {
  color: rgba(200, 200, 255, 0.25);
}

.form-group input:focus {
  border-color: rgba(124, 77, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

.auth-btn {
  margin-top: 8px;
  width: 100%;
}

.auth-switch {
  font-size: 0.9rem;
  color: rgba(200, 200, 255, 0.4);
  text-align: center;
}

.auth-switch a {
  color: #7c4dff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.auth-switch a:hover {
  color: #ff6ec7;
}

.flash-msg {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  text-align: center;
}

.flash-error {
  background: rgba(255, 60, 80, 0.12);
  border: 1px solid rgba(255, 60, 80, 0.3);
  color: rgba(255, 150, 160, 0.9);
}

.flash-success {
  background: rgba(60, 255, 140, 0.1);
  border: 1px solid rgba(60, 255, 140, 0.25);
  color: rgba(140, 255, 190, 0.9);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(200, 200, 255, 0.4);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: rgba(200, 200, 255, 0.7);
}

.pw-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 110, 199, 0.1), rgba(124, 77, 255, 0.1));
  border: 1px solid rgba(124, 77, 255, 0.15);
  margin: 0 auto 12px;
}

@media (max-width: 600px) {
  .header h1 {
    font-size: 1.8rem;
  }
  .game-card {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .anime-title {
    font-size: 1.2rem;
  }
}
