/* ===== CSS Variables ===== */
:root {
  --bg: #080b14;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(109,40,217,0.5);
  --text: #ffffff;
  --text-muted: rgba(255,255,255,0.4);
  --text-dim: rgba(255,255,255,0.25);
  --accent: #6d28d9;
  --accent-light: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #6d28d9, #7c3aed, #a855f7);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 56px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

/* ===== Background Glow ===== */
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.bg-glow::before {
  content: ''; position: absolute; top: -300px; left: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(109,40,217,0.14) 0%, transparent 70%);
}
.bg-glow::after {
  content: ''; position: absolute; bottom: -200px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(124,58,237,0.10) 0%, transparent 70%);
}

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  background: rgba(8,11,20,0.85);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  padding: 0 24px; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; color: #fff; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.3px; }
.brand-name span {
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Header Actions ===== */
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-btn {
  padding: 6px 14px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px; color: rgba(255,255,255,0.7);
  font-size: 13px; cursor: pointer; text-decoration: none;
  transition: all 0.2s;
}
.header-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.header-btn-primary {
  background: var(--accent-gradient); border-color: transparent; color: #fff;
}
.header-btn-primary:hover { opacity: 0.88; }
.user-name { font-size: 13px; color: rgba(255,255,255,0.8); padding-right: 4px; }

/* ===== Main ===== */
.main {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 60px 24px 48px;
  max-width: 960px; margin: 0 auto; width: 100%;
  position: relative; z-index: 1;
}

/* ===== Hero ===== */
.hero { text-align: center; margin-bottom: 36px; width: 100%; }
.hero h1 {
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 800; letter-spacing: -1.5px; line-height: 1.1;
  margin-bottom: 10px;
}
.hero h1 .gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { color: var(--text-muted); font-size: 14px; }

/* ===== Search Box ===== */
.search-box { width: 100%; max-width: 520px; margin-bottom: 0; }
.search-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 6px 6px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-form:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(109,40,217,0.12);
}
.search-form input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #fff; font-size: 15px; padding: 11px 0; min-width: 0;
}
.search-form input::placeholder { color: var(--text-dim); }
.search-btn {
  flex-shrink: 0; padding: 11px 22px;
  background: var(--accent-gradient); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s;
  display: flex; align-items: center; gap: 6px;
}
.search-btn:hover { opacity: 0.9; }
.search-btn:active { transform: scale(0.97); }
.search-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.search-btn svg { width: 14px; height: 14px; }

/* ===== Error ===== */
.error-msg {
  display: none; align-items: center; gap: 8px;
  width: 100%; max-width: 520px; margin-top: 14px;
  background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.22);
  border-radius: var(--radius-sm); padding: 13px 16px;
  color: #fca5a5; font-size: 13px;
}
.error-msg.show { display: flex; }
.error-msg svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ===== Loading ===== */
.loading-wrap {
  display: none; flex-direction: column; align-items: center;
  gap: 14px; padding: 48px 0;
}
.loading-wrap.show { display: flex; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,0.08); border-top-color: var(--accent-light);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap p { color: var(--text-muted); font-size: 13px; }

/* ===== Player Card ===== */
.player-card {
  display: none; width: 100%; max-width: 760px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  margin-top: 24px;
}
.player-card.show { display: block; }

.video-wrap {
  position: relative; background: #000;
  width: 100%;
}
.video-wrap::before { content: ''; display: block; padding-top: 56.25%; }
.video-wrap video {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.poster-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: none;
}
.poster-img.show { display: block; }
.video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.video-overlay svg { width: 56px; height: 56px; color: rgba(255,255,255,0.65); }

.player-info {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.player-meta { flex: 1; min-width: 0; }
.player-name { font-weight: 600; font-size: 15px; margin-bottom: 3px; word-break: break-all; }
.player-id { color: var(--text-muted); font-size: 12px; }
.player-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  font-size: 12px; cursor: pointer; text-decoration: none;
  transition: background 0.2s, color 0.2s; white-space: nowrap;
}
.action-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.action-btn svg { width: 13px; height: 13px; }

/* ===== Auth Modal ===== */
.auth-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.auth-overlay.show { display: flex; }
.auth-card {
  background: #111827; border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px; padding: 36px 32px;
  width: 100%; max-width: 380px;
  position: relative; animation: authIn 0.22s ease-out;
}
@keyframes authIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.auth-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.05); border: none; border-radius: 8px;
  color: rgba(255,255,255,0.40); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.auth-close:hover { background: rgba(255,255,255,0.10); color: #fff; }
.auth-close svg { width: 15px; height: 15px; }
.auth-header { text-align: center; margin-bottom: 26px; }
.auth-icon {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(109,40,217,0.15); border: 1px solid rgba(109,40,217,0.30);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.auth-icon svg { width: 22px; height: 22px; color: #a78bfa; }
.auth-header h2 { font-size: 19px; font-weight: 700; color: #fff; margin-bottom: 5px; }
.auth-header p { font-size: 13px; color: rgba(255,255,255,0.40); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; color: rgba(255,255,255,0.55); font-weight: 500; }
.form-field input {
  padding: 11px 14px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm); color: #fff; font-size: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field input::placeholder { color: rgba(255,255,255,0.22); }
.form-field input:focus {
  border-color: rgba(109,40,217,0.55);
  box-shadow: 0 0 0 3px rgba(109,40,217,0.14);
}
.form-error {
  display: none; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.22);
  border-radius: 8px; color: #fca5a5; font-size: 13px;
}
.form-error.show { display: flex; }
.auth-submit {
  position: relative;
  padding: 12px; background: var(--accent-gradient); border: none;
  border-radius: var(--radius-sm); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
}
.auth-submit:hover { opacity: 0.92; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.auth-spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.28); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.auth-spinner.show { display: block; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: rgba(255,255,255,0.38); }
.auth-switch button {
  background: none; border: none; color: #a78bfa; font-size: 13px;
  cursor: pointer; padding: 0; margin-left: 4px;
}
.auth-switch button:hover { text-decoration: underline; }

/* ===== PC Large Screen ===== */
@media (min-width: 1024px) {
  .main { padding: 80px 24px 60px; }
  .hero { margin-bottom: 44px; }
  .hero h1 { font-size: 52px; }
  .search-box { max-width: 560px; }
  .player-card { max-width: 820px; }
  .player-info { padding: 18px 24px; }
  .player-name { font-size: 16px; }
  .auth-card { padding: 40px 36px; max-width: 400px; }
}

/* ===== Tablet ===== */
@media (min-width: 768px) {
  .header-inner { padding: 0 32px; }
  .main { padding: 56px 32px 48px; }
  .player-info { gap: 20px; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; height: 52px; }
  .main { padding: 36px 16px 32px; }
  .hero { margin-bottom: 28px; }
  .hero h1 { font-size: 30px; }
  .search-box { max-width: 100%; }
  .search-form { border-radius: 12px; padding: 5px 5px 5px 14px; }
  .search-btn { padding: 9px 16px; border-radius: 8px; }
  .error-msg { border-radius: 10px; }
  .player-card { border-radius: 14px; margin-top: 20px; }
  .player-info { padding: 13px 14px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .player-actions { width: 100%; justify-content: flex-end; }
  .action-btn { flex: 1; justify-content: center; }
  .brand-name { display: none; }
  .auth-card { padding: 28px 20px; border-radius: 16px; }
  .player-card.show { display: block; }
}

@media (max-width: 400px) {
  .player-actions { flex-wrap: wrap; }
  .action-btn { flex: 1 1 45%; justify-content: center; }
  .header-btn { padding: 5px 10px; font-size: 12px; }
}
