/* Hide element utility */
.hide-solo {
  display: none !important;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #a855f7;
  --primary-dark: #9333ea;
  --secondary: #f472b6;
  --accent: #c084fc;
  --bg-dark: #0f0a1a;
  --bg-card: #1a1225;
  --bg-lighter: #251a35;
  --text: #ffffff;
  --text-muted: #a78bba;
  --gradient-primary: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
  --gradient-secondary: linear-gradient(135deg, #f472b6 0%, #fb7185 100%);
  --glow-primary: 0 0 20px rgba(168, 85, 247, 0.4);
  --glow-secondary: 0 0 20px rgba(244, 114, 182, 0.4);
}

html {
  font-size: 90%;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.container {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.menu-container {
  max-width: 900px;
}

/* Logo */
.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.logo.small {
  font-size: 1.5rem;
}

.logo .accent {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo .gradient-d {
  background: linear-gradient(
    135deg,
    #ffffff 0%,
    #ffffff 50%,
    var(--primary) 50%,
    var(--primary) 100%
  );

  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 40px;
  letter-spacing: 0.2em;
}

/* Floating code animation */
.floating-code {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.floating-code span {
  position: absolute;
  font-family: 'Courier New', monospace;
  color: rgba(0, 255, 136, 0.1);
  font-size: 1.5rem;
  animation: float 15s infinite linear;
  opacity: 0;
}

.floating-code span:nth-child(1) { left: 10%; animation-delay: 0s; }
.floating-code span:nth-child(2) { left: 30%; animation-delay: 3s; }
.floating-code span:nth-child(3) { left: 60%; animation-delay: 6s; }
.floating-code span:nth-child(4) { left: 80%; animation-delay: 9s; }

@keyframes float {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

/* Side Decorations */
.side-decoration {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

.side-decoration.left {
  left: 30px;
}

.side-decoration.right {
  right: 30px;
}

.side-decoration .deco-item {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  color: var(--primary);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.3em;
}

.side-decoration .deco-line {
  width: 2px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, var(--primary), transparent);
  margin: 0 auto;
}

.side-decoration .deco-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
}

/* Input Groups */
.input-group {
  margin-top: 50px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.cf-note {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--bg-card);
  border: 2px solid var(--bg-lighter);
  border-radius: 12px;
  padding: 15px 25px;
  font-size: 1.2rem;
  color: var(--text);
  width: 100%;
  max-width: 350px;
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  background: var(--gradient-primary);
  border: none;
  border-radius: 12px;
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bg-dark);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.large {
  padding: 20px 50px;
  font-size: 1.3rem;
}

.btn.small {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.btn.secondary {
  background: var(--gradient-secondary);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  margin-bottom: 40px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 10px 20px;
  border-radius: 30px;
}

.user-icon {
  font-size: 1.5rem;
}

/* Menu Options */
.menu-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  align-items: center;
}

.menu-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  width: 100%;
}

.menu-row .btn.large {
  flex: 1;
  max-width: 320px;
  min-width: 260px;
}

.btn.create, .btn.solo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 50px;
  background: var(--bg-card);
  border: 2px solid var(--bg-lighter);
  color: var(--text);
}

.btn.join,
.btn.bot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 50px;
  background: var(--bg-card);
  border: 2px solid var(--bg-lighter);
  color: var(--text);
  max-width: 320px;
  min-width: 260px;
}

.btn.join .btn-icon,
.btn.bot .btn-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.btn.join .btn-text,
.btn.bot .btn-text {
  font-size: 1.5rem;
}

.btn.join .btn-desc,
.btn.bot .btn-desc {
  font-size: 0.9rem;
}

.btn.create:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.btn.join:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn.bot:hover {
  border-color: var(--secondary);
  box-shadow: var(--glow-secondary);
}

.btn.solo:hover {
  border-color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

/* Features Section */
.features-section {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 50px;
  margin-top: 40px;
  padding: 25px 20px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.feature-icon {
  font-size: 1.5rem;
}

.feature-text {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Menu Auth */
.menu-container {
  position: relative;
}

.menu-auth {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.menu-auth .btn {
  padding: 10px 18px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: none;
}

.menu-level {
  display: none;
  min-width: 420px;
  width: 420px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--bg-lighter);
  text-align: left;
  position: relative;
}

.menu-level-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.menu-level-bar {
  height: 8px;
  background: var(--bg-lighter);
  border-radius: 999px;
  overflow: visible;
  margin: 8px 0 6px;
  position: relative;
}

.menu-level:hover {
  box-shadow: var(--glow-primary);
}

.menu-level-progress {
  height: 100%;
  width: 0%;
  background: var(--gradient-secondary);
  transition: width 0.3s ease;
}

.xp-pop {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary);
  text-shadow: 0 0 12px rgba(244, 114, 182, 0.6);
  pointer-events: none;
  animation: xpPop 1.2s ease forwards;
  letter-spacing: 0.08em;
}

.menu-level.xp-burst {
  animation: levelPulse 0.8s ease;
}

.menu-level.xp-burst .menu-level-progress {
  animation: progressGlow 0.8s ease;
}

.menu-level-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.menu-main {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 20px;
}

.menu-options {
  width: 100%;
  max-width: 720px;
}

.tasks-panel {
  position: absolute;
  top: 0;
  right: -360px;
  width: 320px;
  padding: 18px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--bg-lighter);
  text-align: left;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tasks-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tasks-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-item-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.task-item-xp {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  color: var(--secondary);
}

.task-item-desc {
  font-size: 0.9rem;
  color: var(--text);
}

.task-pending {
  position: relative;
  overflow: hidden;
}

.task-claim-btn {
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 12px;
  background: var(--gradient-secondary);
  color: var(--bg-dark);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.task-claim-btn:hover {
  box-shadow: var(--glow-secondary);
}

.daily-xp-item .btn {
  width: 100%;
  margin-top: 4px;
}

.daily-xp-item .btn:disabled {
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

@keyframes levelPulse {
  0% { box-shadow: 0 0 0 rgba(244, 114, 182, 0.0); }
  30% { box-shadow: 0 0 18px rgba(244, 114, 182, 0.5); }
  100% { box-shadow: 0 0 0 rgba(244, 114, 182, 0.0); }
}

@keyframes progressGlow {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

@keyframes xpPop {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-14px);
  }
}

.menu-auth .btn.signed-in {
  background: var(--gradient-secondary);
  color: var(--bg-dark);
}

/* Auth Modal */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 26, 0.65);
  display: none;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 80px 24px;
  z-index: 50;
}

.auth-modal.active {
  display: flex;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--bg-lighter);
  padding: 22px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

/* Bot Selection */
.bot-section {
  background: var(--bg-dark);
  border-radius: 16px;
  border: 1px solid var(--bg-lighter);
  padding: 18px;
}

.bot-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.bot-empty {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--bg-lighter);
}

.bot-option {
  background: var(--bg-dark);
  border: 2px solid var(--bg-lighter);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.bot-option.unrated {
  --bot-color: #c0c0c0;
}

.bot-option:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.bot-option.active {
  border-color: var(--bot-color, var(--primary));
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.35);
}

.bot-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--bg-dark);
  background: radial-gradient(circle at 30% 30%, #fff, var(--bot-color, var(--primary)));
}

.bot-name {
  font-weight: 700;
  margin-bottom: 6px;
}

.bot-rating {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  color: var(--bot-color, var(--primary));
}


.auth-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.auth-card-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.auth-close {
  background: transparent;
  border: 1px solid var(--bg-lighter);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tab {
  border: 1px solid var(--bg-lighter);
  background: transparent;
  color: var(--text-muted);
  padding: 8px 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 10px;
}

.auth-tab.active {
  background: var(--gradient-primary);
  color: var(--bg-dark);
  border-color: transparent;
}

.auth-panel {
  display: none;
  gap: 12px;
}

.auth-panel.active {
  display: grid;
}

.auth-panel input {
  max-width: none;
  text-align: left;
}

.auth-panel .btn {
  width: 100%;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--primary);
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  cursor: pointer;
}

.auth-link:hover {
  text-shadow: var(--glow-primary);
}

.auth-helper {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.auth-footer {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.auth-logged-in {
  display: none;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--primary);
  text-align: center;
}

.auth-logged-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.auth-logged-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 6px;
}

.is-hidden {
  display: none !important;
}

/* How To Play */
.how-to-play {
  margin-top: 20px;
  padding: 20px 100px;
  background: var(--bg-card);
  border-radius: 15px;
  border: 1px solid var(--bg-lighter);
}

.how-to-play h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.steps {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 35px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.step-num {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--bg-dark);
}

.step-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Menu Footer */
.menu-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-lighter);
}

.menu-footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.menu-footer a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.menu-footer a:hover {
  color: var(--accent);
}

.btn-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.btn-text {
  font-size: 1.5rem;
}

.btn-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
}

/* Back Button */
.back-btn {
  align-self: flex-start;
  margin-bottom: 20px;
}

.back-btn.btn {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 30px;
  background: var(--bg-card);
  border-radius: 20px;
  margin-top: 20px;
}

.setting {
  text-align: left;
}

.setting label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

input[type="range"] {
  flex: 1;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-lighter);
  border-radius: 4px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider-container span {
  min-width: 40px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.difficulty-select {
  display: flex;
  align-items: center;
  gap: 15px;
}

select {
  flex: 1;
  background: var(--bg-lighter);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 1rem;
  font-family: 'Rajdhani', sans-serif;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Tags Selection */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-lighter);
  border-radius: 10px;
  margin-bottom: 10px;
}

.tag-option {
  background: var(--bg-dark);
  border: 1px solid var(--bg-lighter);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.tag-option:hover {
  border-color: var(--primary);
  color: var(--text);
}

.tag-option.selected {
  background: var(--primary);
  color: var(--bg-dark);
  border-color: var(--primary);
  font-weight: 600;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.selected-tag {
  background: var(--gradient-primary);
  color: var(--bg-dark);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.selected-tag .remove {
  cursor: pointer;
  font-weight: bold;
}

.no-tags {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Join Form */
.join-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  padding: 40px;
  background: var(--bg-card);
  border-radius: 20px;
  margin-top: 20px;
}

.join-form .setting {
  width: 50%;
  text-align: left;
}

.join-form .setting label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#game-code-input {
  width: min(350px, 90vw);
  max-width: 350px;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Orbitron', sans-serif;
}

/* Lobby */
.game-code-display {
  margin: 30px 0;
}

.game-code-display p {
  color: var(--text-muted);
  margin-bottom: 15px;
}

.code-box {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  background: var(--bg-card);
  padding: 20px 30px;
  border-radius: 15px;
  border: 2px dashed var(--primary);
}

#lobby-game-code {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.2em;
}

.players-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.player-card {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 20px;
  min-width: 180px;
  border: 2px solid var(--bg-lighter);
  transition: all 0.3s ease;
}

.player-card.host {
  border-color: var(--primary);
}

.player-card.guest.ready {
  border-color: var(--accent);
}

.player-avatar {
  font-size: 3rem;
  margin-bottom: 15px;
}

.player-card span {
  display: block;
}

.player-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.player-status.ready {
  color: #22c55e;
  font-weight: 700;
}

.player-status.not-ready {
  color: #ef4444;
  font-weight: 700;
}

#ready-btn {
  margin-bottom: 15px;
}

#ready-btn.ready-up {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

#ready-btn.is-ready {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.vs-divider {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: var(--glow-secondary);
}

/* Game Screen */
#game-screen.active {
  flex-direction: column;
  padding: 0;
}

.game-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 40px;
  background: var(--bg-card);
  border-bottom: 2px solid var(--bg-lighter);
  width: 100%;
  position: relative;
}

.center-group {
  display: flex;
  align-items: center;
  gap: 30px;
}

.player-score {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.player-score .player-name {
  font-size: 1rem;
  color: var(--text-muted);
}

.player-score .score {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
}

.player-score.left .score { color: var(--primary); }
.player-score.right .score { color: var(--accent); }

.timer-container {
  background: var(--gradient-secondary);
  padding: 15px 30px;
  border-radius: 15px;
}

#timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--bg-dark);
}

/* Game Main Layout - LeetCode Style */
.game-main {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Problems Tabs - Horizontal at top */
.problems-tabs {
  display: flex;
  gap: 5px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 2px solid var(--bg-lighter);
  overflow-x: auto;
  flex-wrap: nowrap;
}

.problem-tab {
  background: var(--bg-lighter);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.problem-tab:hover {
  border-color: var(--primary);
  background: rgba(0, 255, 136, 0.05);
}

.problem-tab.active {
  border-color: var(--primary);
  background: rgba(0, 255, 136, 0.15);
}

.problem-tab.solved-by-me {
  border-color: var(--primary);
  background: rgba(0, 255, 136, 0.25);
}

.problem-tab.solved-by-me::after {
  content: '✓';
  color: var(--primary);
  font-weight: bold;
  font-size: 0.8rem;
}

.problem-tab.solved-by-opponent {
  border-color: var(--secondary);
  background: rgba(244, 114, 182, 0.15);
}

.problem-tab.solved-by-opponent::after {
  content: '👤';
  font-size: 0.7rem;
}

.problem-tab .tab-num {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.problem-tab .tab-rating {
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 600;
}

/* Problem Panel - Left side */
.problem-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 2px solid var(--bg-lighter);
  min-width: 0;
}

.problem-header {
  padding: 15px 20px;
  background: var(--bg-card);
  border-bottom: 2px solid var(--bg-lighter);
}

.problem-header h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.problem-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  line-height: 1.6;
  background: var(--bg-dark);
}

/* Editor Panel - Right side */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-card);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-lighter);
  border-bottom: 2px solid var(--bg-lighter);
}

.editor-header .btn {
  padding: 10px 25px;
}

#code-editor {
  flex: 1;
  width: 100%;
  background: var(--bg-dark);
  border: none;
  padding: 15px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  color: var(--text);
  resize: none;
  line-height: 1.6;
  tab-size: 4;
}

#code-editor:focus {
  outline: none;
}

#code-editor::placeholder {
  color: var(--text-muted);
}

/* Leave Button */
.leave-btn {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  font-size: 0.7rem;
  padding: 8px 14px;
  letter-spacing: 1px;
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
  font-weight: 600;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.leave-btn:hover {
  transform: translateY(-50%);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.8);
}

.timer-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.duel-stats-btn.btn {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  font-size: 0.7rem;
  padding: 8px 14px;
  letter-spacing: 1px;
  border: 2px solid #60a5fa !important;
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.45);
  font-weight: 600;
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.duel-stats-btn.btn:hover {
  transform: translateY(-50%);
  box-shadow: 0 0 25px rgba(96, 165, 250, 0.8);
}

.duel-stats-panel {
  position: fixed;
  left: 20px;
  top: 110px;
  width: min(360px, 90vw);
  max-height: 60vh;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--bg-lighter);
  padding: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
}

.duel-stats-panel.active {
  display: flex;
}

.duel-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.duel-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 6px;
}

.duel-stat-item {
  background: var(--bg-dark);
  border-radius: 10px;
  border: 1px solid var(--bg-lighter);
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--text);
}

.duel-stats-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 10px;
}

.game-header {
  position: relative;
}

.problem-meta-view {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.problem-rating-badge {
  background: var(--secondary);
  color: var(--bg-dark);
  padding: 4px 12px;
  border-radius: 15px;
  font-weight: 700;
  font-size: 0.85rem;
}

.problem-tags-view {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.problem-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  line-height: 1.7;
}

.problem-content .select-hint {
  color: var(--text-muted);
  text-align: center;
  padding: 50px;
}

.problem-section {
  margin-bottom: 25px;
}

.problem-section h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.problem-section p {
  color: var(--text);
}

.sample-test {
  background: var(--bg-lighter);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
}

.sample-test h4 {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.sample-test pre {
  background: var(--bg-dark);
  padding: 12px;
  border-radius: 8px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

.problem-actions-bar {
  display: flex;
  gap: 15px;
  padding: 15px 30px;
  background: var(--bg-card);
  border-top: 2px solid var(--bg-lighter);
  align-items: center;
}

.language-select {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-select label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.language-select select {
  min-width: 150px;
}

/* Submit Status */
.submit-status {
  background: var(--bg-lighter);
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid var(--primary);
  display: none;
  margin: 10px;
  text-align: center;
  resize: vertical;
  overflow: auto;
  min-height: 140px;
  height: 160px;
  max-height: 60vh;
  flex: 0 0 auto;
  align-self: stretch;
}

.submit-status.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.submit-status.running {
  border-color: var(--accent);
}

.submit-status.accepted {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.submit-status.wrong_answer,
.submit-status.error,
.submit-status.runtime_error {
  border-color: var(--secondary);
}

.submit-status .verdict {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 5px;
}

.submit-status .details {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.submit-status pre {
  background: var(--bg-dark);
  padding: 8px;
  border-radius: 5px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  margin-top: 10px;
  text-align: left;
  max-height: 100px;
  overflow-y: auto;
}

/* Loading indicator */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--bg-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.game-info {
  padding: 20px;
  background: var(--bg-card);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 2px solid var(--bg-lighter);
}

.game-info p {
  margin: 5px 0;
}

/* Results Screen */
.results-display {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.result-player {
  background: var(--bg-card);
  padding: 30px 50px;
  border-radius: 20px;
  text-align: center;
  border: 3px solid var(--bg-lighter);
  transition: all 0.3s ease;
}

.result-player.winner {
  border-color: gold;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.result-avatar {
  font-size: 4rem;
  margin-bottom: 15px;
}

.result-name {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.result-score {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
}

.result-solved {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.winner-announcement {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  margin: 30px 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  padding: 15px 30px;
  border-radius: 10px;
  border: 2px solid var(--primary);
  box-shadow: var(--glow-primary);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--secondary);
  box-shadow: var(--glow-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .logo {
    font-size: 2.5rem;
  }
  
  .menu-auth {
    position: static;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }

  .menu-level {
    width: 100%;
  }

  .menu-main {
    flex-direction: column;
    align-items: stretch;
  }

  .tasks-panel {
    position: static;
    width: 100%;
    margin-top: 20px;
  }
  
  .game-header {
    padding: 15px 20px;
  }
  
  .player-score .score {
    font-size: 1.8rem;
  }
  
  #timer {
    font-size: 1.3rem;
  }
  
  .problem-card {
    flex-direction: column;
    text-align: center;
  }
  
  .problem-info {
    text-align: center;
    margin-bottom: 15px;
  }
  
  .players-container {
    flex-direction: column;
  }
  
  .vs-divider {
    transform: rotate(90deg);
  }

  .duel-stats-panel {
    right: auto;
    left: 10px;
    top: 90px;
    width: auto;
  }

  .menu-options {
    padding: 10px;
  }

  .menu-row {
    flex-direction: column;
    gap: 12px;
  }

  .menu-row .btn.large {
    max-width: 100%;
    min-width: 0;
  }

  .btn.create,
  .btn.join,
  .btn.bot,
  .btn.solo {
    padding: 18px 24px;
  }

  .btn-icon {
    font-size: 2.2rem;
  }

  .btn-text {
    font-size: 1.2rem;
  }

  .btn-desc {
    font-size: 0.85rem;
  }

  .features-section {
    flex-direction: column;
    gap: 20px;
  }

  .feature-text {
    white-space: normal;
    text-align: center;
  }

  .how-to-play {
    padding: 18px 20px;
  }

  .steps {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .step {
    white-space: normal;
    justify-content: center;
  }

  .auth-modal {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

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

  .auth-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }

  .settings-form,
  .join-form {
    padding: 20px;
  }

  .join-form {
    width: 100%;
  }

  #game-code-input {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
  }

  .difficulty-select {
    flex-direction: column;
    align-items: stretch;
  }

  .players-container {
    gap: 15px;
  }

  .player-card {
    min-width: 0;
    padding: 20px;
  }

  .game-header {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }

  .center-group {
    flex-direction: column;
    gap: 10px;
  }

  .timer-container {
    padding: 10px 18px;
  }

  .duel-stats-btn.btn,
  .leave-btn {
    position: static;
    transform: none;
    width: 100%;
    max-width: 260px;
  }

  .game-main {
    flex-direction: column;
  }

  .problem-panel {
    border-right: none;
    border-bottom: 2px solid var(--bg-lighter);
    min-height: 40vh;
  }

  .editor-panel {
    min-height: 45vh;
  }

  .problem-content {
    padding: 16px;
  }

  .editor-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .editor-header .btn {
    width: 100%;
  }

  .language-select {
    width: 100%;
    justify-content: space-between;
  }

  .language-select select {
    width: 100%;
  }

  .problem-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }

  .submit-status {
    min-height: 120px;
    height: 140px;
  }

  .problems-tabs {
    padding: 8px 10px;
    gap: 8px;
  }

  .problem-tab {
    min-width: 80px;
    padding: 8px 12px;
  }

  .problem-tab .tab-num {
    font-size: 0.7rem;
  }

  .problem-tab .tab-rating {
    font-size: 0.65rem;
  }

  .results-display {
    gap: 20px;
    margin: 20px 0;
  }

  .result-player {
    padding: 20px 24px;
  }

  .winner-announcement {
    font-size: 1.4rem;
  }

  .floating-code,
  .side-decoration {
    display: none;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
  }

  .how-to-play {
    padding: 14px 16px;
  }

  .step-num {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .step-text {
    font-size: 0.85rem;
  }

  .btn.large {
    padding: 16px 20px;
    font-size: 1.1rem;
  }

  .player-score .score {
    font-size: 1.6rem;
  }

  #timer {
    font-size: 1.1rem;
  }

  .duel-stats-panel {
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 50vh;
  }
}
