:root {
  --bg-gradient: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #0f0f1a 100%);
  --panel-bg: rgba(25, 25, 45, 0.6);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --accent: #00f0ff;
  --accent-hover: #00d0e0;
  --error: #ff4a4a;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  /* Prevent pull-to-refresh on mobile */
  overscroll-behavior: none;
  /* Disable text selection */
  user-select: none;
  -webkit-user-select: none;
}

/* Orientation Warning */
#orientation-warning {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #000;
  color: #fff;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 1.5rem;
  padding: 20px;
}

@media screen and (orientation: portrait) {
  #orientation-warning {
    display: flex;
  }
}

/* Login Screen - Glassmorphism */
#login-screen {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
  padding: 30px 0;
  background: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)" /></svg>');
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 40px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.5s ease-out;
  margin: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 5px;
  text-align: center;
  background: linear-gradient(90deg, #00f0ff, #ff4a4a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-weight: 600;
}

.input-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

input {
  width: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
  margin-top: 10px;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.error-msg {
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 15px;
  text-align: center;
  font-weight: 600;
}

/* Game Container */
#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Class Selection Screen */
#class-selection-screen {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 9;
  padding: 30px 0;
}

.class-panel {
  max-width: 850px;
  width: 95%;
  padding: 25px 30px;
}

.class-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  justify-content: center;
}

@media screen and (max-width: 768px) {
  .class-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .class-panel {
    max-height: 90%;
    overflow-y: auto;
  }
}

.class-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 290px;
}

.class-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 240, 255, 0.15);
  border-color: var(--accent);
}

.class-card h2 {
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.class-stats {
  text-align: left;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #ddd;
}

.class-stats p {
  margin-bottom: 3px;
  line-height: 1.2;
}

.class-avatar {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  padding: 3px;
  margin: 0 auto 8px auto;
  display: block;
  box-shadow: 0 4px 8px rgba(0, 240, 255, 0.15);
}

.class-card .btn-primary {
  padding: 8px;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Game UI Overlay */
#game-ui {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
  pointer-events: none;
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#health-ui {
  color: #ff4a4a;
  margin-bottom: 10px;
}

#ammo-ui {
  color: #00f0ff;
}

/* Short screen layout optimization (e.g. landscape mobile) */
@media screen and (max-height: 600px) {
  .class-panel {
    padding: 15px 20px;
    max-width: 780px;
  }
  .class-panel h1 {
    font-size: 1.6rem;
    margin-bottom: 2px;
  }
  .class-panel .subtitle {
    margin-bottom: 12px;
    font-size: 0.85rem;
  }
  .class-cards {
    gap: 10px;
  }
  .class-card {
    min-height: auto;
    padding: 8px;
    border-radius: 8px;
  }
  .class-avatar {
    width: 36px;
    height: 36px;
    padding: 2px;
    margin-bottom: 4px;
  }
  .class-card h2 {
    font-size: 0.95rem;
    margin-bottom: 4px;
  }
  .class-stats {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }
  .class-stats p {
    margin-bottom: 1px;
  }
  .class-card .btn-primary {
    padding: 6px;
    font-size: 0.8rem;
    margin-top: 2px;
  }
}
