* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }

/* Fixed Top */
.fixed-top { position: fixed; top: 0; left: 0; right: 0; z-index: 100; }

/* Header */
.header { background: #1e293b; padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #3b82f6; }
.header h1 { font-size: 1.4rem; color: #60a5fa; }
.header .user-info { display: flex; align-items: center; gap: 16px; }
.header .user-info span { color: #94a3b8; font-size: 0.9rem; }
.header .role-badge { background: #3b82f6; color: white; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; text-transform: uppercase; }

/* Login */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-box { background: #1e293b; padding: 48px; border-radius: 16px; width: 400px; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.login-box h2 { text-align: center; margin-bottom: 32px; color: #60a5fa; font-size: 1.6rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; background: #0f172a; border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #3b82f6; }

.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.95rem; font-weight: 600; transition: all 0.2s; }
.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: #475569; color: white; }
.btn-secondary:hover { background: #64748b; }
.btn-success { background: #22c55e; color: white; }
.btn-success:hover { background: #16a34a; }
.btn-full { width: 100%; }

/* Tabs Wrapper */
.tabs-wrapper { background: #0f172a; padding: 0; border-bottom: 1px solid #334155; }
.tabs-wrapper .tabs { max-width: 90%; margin: 0 auto; padding: 16px 32px 16px; }

/* Layout */
.container { max-width: 90%; margin: 0 auto; padding: 16px 32px 32px; padding-top: 150px; }
.card { background: #1e293b; border-radius: 12px; padding: 24px; margin-bottom: 24px; border: 1px solid #334155; }
.card h3 { color: #60a5fa; margin-bottom: 16px; font-size: 1.1rem; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 0; padding-bottom: 16px; }
.tab { padding: 10px 24px; background: #1e293b; border: 1px solid #334155; border-radius: 8px; cursor: pointer; color: #94a3b8; font-weight: 500; transition: all 0.2s; }
.tab.active { background: #3b82f6; border-color: #3b82f6; color: white; }
.tab:hover:not(.active) { background: #334155; color: #e2e8f0; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #334155; }
th { color: #94a3b8; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
td { color: #e2e8f0; }
tr:hover { background: #334155; }

/* Leaderboard */
.rank { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 0.9rem; }
.rank-1 { background: #fbbf24; color: #0f172a; }
.rank-2 { background: #94a3b8; color: #0f172a; }
.rank-3 { background: #cd7f32; color: #0f172a; }
.rank-default { background: #475569; color: #e2e8f0; }

.rating-bar { background: #334155; border-radius: 4px; height: 8px; width: 100%; max-width: 200px; overflow: hidden; }
.rating-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #450a0a; border: 1px solid #ef4444; color: #fca5a5; }
.alert-success { background: #052e16; border: 1px solid #22c55e; color: #86efac; }

/* Poll status */
.poll-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; }
.poll-active { background: #052e16; border: 1px solid #22c55e; color: #86efac; }
.poll-none { background: #1c1917; border: 1px solid #78716c; color: #a8a29e; }
.poll-dot { width: 8px; height: 8px; border-radius: 50%; }
.poll-dot-active { background: #22c55e; animation: pulse 2s infinite; }
.poll-dot-none { background: #78716c; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Poll history card */
.poll-history-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 20px; margin-bottom: 16px; cursor: pointer; transition: border-color 0.2s; }
.poll-history-card:hover { border-color: #3b82f6; }
.poll-history-card .poll-title { font-size: 1.1rem; font-weight: 600; color: #e2e8f0; }
.poll-history-card .poll-meta { color: #94a3b8; font-size: 0.85rem; margin-top: 4px; }
.poll-ended-badge { background: #78716c; color: white; padding: 2px 8px; border-radius: 8px; font-size: 0.7rem; text-transform: uppercase; }

.hidden { display: none !important; }

/* Judge not rated (dimmed row) */
tr.judge-not-rated { opacity: 0.4; }
tr.judge-not-rated:hover { opacity: 0.6; }

/* Tab icons */
.tab i { margin-right: 4px; }

/* Modal animations */
#modalOverlay .login-box {
  animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Rating card */
.presenter-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 20px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; transition: border-color 0.2s; }
.presenter-card:hover { border-color: #3b82f6; }
.presenter-card .name { font-size: 1.1rem; font-weight: 600; }
.presenter-card .rated { color: #22c55e; font-size: 0.85rem; margin-top: 4px; }

.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 12px; padding-top: 130px; }
  .header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .header h1 { font-size: 1.1rem; width: 100%; text-align: center; }
  .header .user-info { width: 100%; justify-content: center; gap: 8px; flex-wrap: wrap; }
  .tabs-wrapper .tabs { padding: 10px 12px 10px; }
  .tabs { flex-wrap: wrap; gap: 6px; }
  .tab { padding: 8px 14px; font-size: 0.8rem; }
  .card { padding: 16px; border-radius: 8px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form .form-group input,
  .inline-form .form-group select { width: 100% !important; }
  .presenter-card { flex-direction: column; gap: 12px; align-items: flex-start; }
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; font-size: 0.85rem; }
  .rating-bar { max-width: 100px; }
  .poll-history-card { padding: 14px; }
  .login-box { width: 90vw; padding: 28px 20px; }
  #modalOverlay .login-box { width: 90vw; }
  .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 8px; padding-top: 120px; }
  .header h1 { font-size: 1rem; }
  .header .user-info { font-size: 0.8rem; }
  .tab { padding: 6px 10px; font-size: 0.75rem; }
  .tab i { margin-right: 2px; }
  .card { padding: 12px; }
  .card h3 { font-size: 1rem; }
  .rank { width: 26px; height: 26px; font-size: 0.75rem; }
  .btn { padding: 8px 14px; font-size: 0.85rem; }
}

/* Clickable username */
.username-link { cursor: pointer; transition: color 0.2s; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.username-link:hover { color: #60a5fa !important; }
