@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Lora:ital,wght@0,500;0,600;0,700;1,500;1,600&display=swap');

:root {
  /* Gamilar Refined Academic Gaming Palette (Sleek, Matte, Modern) */
  --bg-gradient: radial-gradient(ellipse at 50% 0%, #111a2e 0%, #070a12 100%);
  --bg-dark: #070a12;
  --surface-card: rgba(17, 24, 39, 0.7);
  --surface-card-hover: rgba(30, 41, 59, 0.85);
  --card-border: rgba(255, 255, 255, 0.09);
  --card-border-hover: rgba(255, 255, 255, 0.22);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Sophisticated Gaming Option Colors (A, B, C, D) */
  --color-opt-a: #6366f1; /* Royal Indigo */
  --color-opt-a-glow: rgba(99, 102, 241, 0.35);
  --color-opt-b: #0284c7; /* Cyber Cyan */
  --color-opt-b-glow: rgba(2, 132, 199, 0.35);
  --color-opt-c: #d97706; /* Amber Gold */
  --color-opt-c-glow: rgba(217, 119, 6, 0.35);
  --color-opt-d: #e11d48; /* Crimson Rose */
  --color-opt-d-glow: rgba(225, 29, 72, 0.35);

  --color-accent: #38bdf8;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;

  /* Ivy League & University Press Typography */
  --font-serif: 'Lora', Georgia, Cambria, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-family: var(--font-sans);
  
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Universal Sleek Academic Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.38);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(0, 0, 0, 0.25);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

button:active {
  transform: scale(0.98);
}

/* Choice Option Letter Badges (A, B, C, D) */
.choice-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Glassmorphism card */
.glass-panel {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px 0 rgba(0, 0, 0, 0.4);
}

/* Animations */
@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-float-in {
  animation: floatIn 0.3s ease-out forwards;
}

/* Responsive container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Persistent Gamilar Brand Header for in-game screens */
.gamilar-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: white;
}

.gamilar-brand-badge .brand-logo-icon {
  font-size: 1.35rem;
}

.gamilar-brand-badge .brand-logo-text {
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Headings: Scholarly Ivy League Typography */
h1, h2, h3, .academic-title, .hero-title, .prompt-title, .question-text-banner {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

/* UI Controls, badges, numbers: Tabular Figures for crisp counts */
button, input, select, .stat-pill, .pin-badge, .choice-badge, .q-counter-badge, .player-timer-badge {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

/* Standardized Static Gamilar Header across all pages */
.static-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  background: rgba(9, 13, 22, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 50;
  height: 60px;
}

.static-header-left {
  display: flex;
  align-items: center;
}

.static-brand-link {
  text-decoration: none;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #ffffff;
  transition: opacity 0.2s;
}

.static-brand-link:hover {
  opacity: 0.88;
}

.static-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Sub-Header Centered Joining PIN Bar (Hidden: PIN removed altogether from all screens) */
.sub-header-pin-bar {
  display: none !important;
}

.center-pin-badge {
  display: none !important;
}

/* Standardized Static Footer across all pages */
.gamilar-footer {
  margin-top: auto;
  padding: 1rem 2rem;
  background: rgba(7, 10, 18, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.gamilar-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.gamilar-footer-left {
  font-weight: 600;
  color: #cbd5e1;
}

.gamilar-footer-right .footer-link {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.gamilar-footer-right .footer-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}

/* Standardized Static Header Buttons & Controls */
.action-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.42rem 0.95rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn-sm:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.action-btn-sm:active {
  transform: translateY(1px) scale(0.98);
}

.action-btn-sm.danger {
  background: rgba(225, 29, 72, 0.18);
  border-color: rgba(225, 29, 72, 0.45);
  color: #fca5a5;
}

.action-btn-sm.danger:hover {
  background: rgba(225, 29, 72, 0.32);
  border-color: rgba(225, 29, 72, 0.65);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

.action-btn-sm.green {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: rgba(16, 185, 129, 0.5);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.action-btn-sm.green:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.icon-btn-sm {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn-sm:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.38);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.icon-btn-sm:active {
  transform: translateY(1px) scale(0.96);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xl);
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* Universal QR Modal */
.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.qr-modal-backdrop.open {
  display: flex;
}

.qr-modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.qr-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.qr-modal-header h2 {
  font-size: 1.8rem;
  color: white;
  margin-bottom: 0.3rem;
}

.qr-modal-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.qr-image-box {
  background: white;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  margin: 1.3rem auto;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.qr-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qr-url-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  color: #38bdf8;
  word-break: break-all;
}

.qr-pin-pill {
  display: none !important;
}

/* Mobile-First Responsive Safety Rules */
@media (max-width: 640px) {
  .static-header {
    padding: 0.5rem 0.8rem;
    height: 52px;
  }
  .static-brand-link {
    font-size: 1.25rem;
    letter-spacing: 0.8px;
  }
  .static-header-right {
    gap: 0.35rem;
  }
  .action-btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
  }
  .icon-btn-sm {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
  .stat-pill {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
  .gamilar-footer {
    padding: 0.75rem 1rem;
  }
  .gamilar-footer-inner {
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
  }
  .container {
    padding: 1rem 0.8rem;
  }
  .qr-modal-card {
    padding: 1.5rem 1rem;
    width: 95%;
  }
  .qr-image-box {
    width: 200px;
    height: 200px;
    padding: 0.8rem;
    margin: 1rem auto;
  }
}

/* ==========================================================================
   Gamilar Universal In-DOM Fullscreen-Safe Modal & Dialog System
   ========================================================================== */

.gamilar-modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  pointer-events: none;
}

.gamilar-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gamilar-modal-card {
  position: relative;
  background: linear-gradient(155deg, rgba(22, 30, 48, 0.96) 0%, rgba(10, 15, 28, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 25px 65px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 2.2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: scale(0.93) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.gamilar-modal-backdrop.open .gamilar-modal-card {
  transform: scale(1) translateY(0);
}

.gamilar-modal-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  margin-bottom: 1.25rem;
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #f43f5e;
  box-shadow: 0 0 24px rgba(225, 29, 72, 0.25);
  flex-shrink: 0;
}

.gamilar-modal-icon-wrap.info {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.gamilar-modal-icon-wrap.warning {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.25);
}

.gamilar-modal-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.65rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.gamilar-modal-message {
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.85rem;
  padding: 0 0.5rem;
}

.gamilar-modal-actions {
  display: flex;
  gap: 0.85rem;
  width: 100%;
  justify-content: center;
}

.gamilar-modal-btn {
  flex: 1;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans);
}

.gamilar-modal-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}

.gamilar-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.gamilar-modal-btn.danger {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  border: 1px solid #f43f5e;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.35);
}

.gamilar-modal-btn.danger:hover {
  filter: brightness(1.12);
  box-shadow: 0 6px 22px rgba(225, 29, 72, 0.5);
  transform: translateY(-1px);
}

.gamilar-modal-btn.primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  border: 1px solid #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

.gamilar-modal-btn.primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}

.gamilar-modal-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

