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

:root {
  --primary: #ff6b6b;
  --secondary: #4ecdc4;
  --accent: #ffe66d;
  --dark: #2c3e50;
  --darker: #1a252f;
  --light: #ecf0f1;
  --gray: #95a5a6;

  --rarity-god: #ff0000;
  --rarity-holo: #ffd700;
  --rarity-legendary: #f39c12;
  --rarity-epic: #9b59b6;
  --rarity-rare: #4a90e2;
  --rarity-common: #888888;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
  color: #ecf0f1;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
}

/* Screens */
.screen {
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* Authentication Screen */
#authScreen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
  background: rgba(44, 62, 80, 0.95);
  padding: 60px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 400px;
  border: 2px solid #ff6b6b;
}

.logo {
  font-size: 48px;
  text-align: center;
  margin-bottom: 10px;
  color: #ff6b6b;
  text-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.subtitle {
  text-align: center;
  color: #4ecdc4;
  margin-bottom: 30px;
  font-size: 14px;
  letter-spacing: 1px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.tab-button {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 2px solid #4ecdc4;
  color: #4ecdc4;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.tab-button.active {
  background: #4ecdc4;
  color: #2c3e50;
}

.tab-button:hover {
  transform: translateY(-2px);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: slideIn 0.3s ease;
}

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

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #ecf0f1;
}

.form-group input {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #4ecdc4;
  border-radius: 8px;
  color: #ecf0f1;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #ff6b6b;
  background: rgba(255, 255, 255, 0.15);
}

.form-group input::placeholder {
  color: rgba(236, 240, 241, 0.5);
}

.error-message {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 10px;
  display: none;
}

.error-message.show {
  display: block;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.btn-primary {
  background: #ff6b6b;
  color: white;
  width: 100%;
  margin-top: 10px;
}

.btn-primary:hover:not(:disabled) {
  background: #ee5a52;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
  background: #4ecdc4;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #3db5ad;
  transform: translateY(-2px);
}

.btn-small {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  width: 100%;
}

/* Game Screen */
.game-header {
  background: rgba(0, 0, 0, 0.3);
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #ff6b6b;
  flex-shrink: 0;
}

.game-header h1 {
  font-size: 32px;
  color: #ff6b6b;
  text-shadow: 0 2px 10px rgba(255, 107, 107, 0.2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.username {
  font-size: 16px;
  font-weight: bold;
  color: #4ecdc4;
}

.game-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  overflow-y: auto;
  border-right: 2px solid #ff6b6b;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 30px;
  background: rgba(44, 62, 80, 0.3);
  padding: 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.sidebar-section h3 {
  margin-bottom: 15px;
  color: #4ecdc4;
  font-size: 16px;
}

.hourglass-display {
  text-align: center;
}

.hourglass-count {
  font-size: 48px;
  font-weight: bold;
  color: #ffe66d;
  text-shadow: 0 4px 10px rgba(255, 230, 109, 0.3);
  margin-bottom: 15px;
}

.hourglass-count .limit {
  font-size: 24px;
  color: #95a5a6;
  opacity: 0.7;
}

.cooldown-timer {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 10px;
  font-weight: bold;
}

.booster-info {
  text-align: center;
}

.booster-info p {
  margin-bottom: 10px;
  font-size: 13px;
  color: #bdc3c7;
}

.stats {
  font-size: 13px;
}

.stat {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(78, 205, 196, 0.1);
}

.stat label {
  color: #95a5a6;
}

.stat span {
  color: #4ecdc4;
  font-weight: bold;
}

/* Game Content */
.game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-tabs {
  display: flex;
  gap: 10px;
  padding: 20px 30px;
  border-bottom: 1px solid rgba(255, 107, 107, 0.2);
  flex-shrink: 0;
}

.content-tab {
  padding: 10px 20px;
  background: transparent;
  border: 2px solid transparent;
  color: #95a5a6;
  border-bottom: 2px solid #95a5a6;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.content-tab.active {
  color: #ff6b6b;
  border-bottom-color: #ff6b6b;
}

.content-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px 30px;
}

.content-panel.active {
  display: block;
}

/* Inventory Filters */
.inventory-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 107, 107, 0.2);
}

.filter-btn {
  padding: 8px 16px;
  background: transparent;
  border: 2px solid #95a5a6;
  color: #95a5a6;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  font-size: 12px;
}

.filter-btn.active {
  background: #ff6b6b;
  border-color: #ff6b6b;
  color: white;
}

.filter-btn:hover {
  transform: translateY(-2px);
}

/* Cards Grid */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.card {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
  border: 2px solid;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.card.rarity-god {
  border-color: #ff0000;
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.1), rgba(255, 0, 0, 0.05));
}

.card.rarity-holo {
  border-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
}

.card.rarity-legendary {
  border-color: #f39c12;
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), rgba(243, 156, 18, 0.05));
}

.card.rarity-epic {
  border-color: #9b59b6;
  background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), rgba(155, 89, 182, 0.05));
}

.card.rarity-rare {
  border-color: #4a90e2;
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(74, 144, 226, 0.05));
}

.card.rarity-common {
  border-color: #888888;
  background: linear-gradient(135deg, rgba(136, 136, 136, 0.1), rgba(136, 136, 136, 0.05));
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}

.card-info {
  padding: 15px;
  background: rgba(0, 0, 0, 0.4);
}

.card-name {
  font-weight: bold;
  margin-bottom: 8px;
  color: #ecf0f1;
  font-size: 14px;
}

.card-rarity {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rarity-badge {
  font-size: 12px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rarity-badge.god {
  background: #ff0000;
  color: white;
}

.rarity-badge.holo {
  background: #ffd700;
  color: #1a252f;
}

.rarity-badge.legendary {
  background: #f39c12;
  color: white;
}

.rarity-badge.epic {
  background: #9b59b6;
  color: white;
}

.rarity-badge.rare {
  background: #4a90e2;
  color: white;
}

.rarity-badge.common {
  background: #888888;
  color: white;
}

.card-quantity {
  color: #4ecdc4;
  font-weight: bold;
  font-size: 14px;
}

/* Recent Draws */
.recent-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-card-item {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid rgba(78, 205, 196, 0.2);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recent-card-name {
  font-weight: bold;
  color: #ecf0f1;
}

.recent-card-rarity {
  font-size: 12px;
  font-weight: bold;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #95a5a6;
  font-size: 16px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: #2c3e50;
  padding: 40px;
  border-radius: 15px;
  border: 2px solid #ff6b6b;
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
  color: #ff6b6b;
  margin-bottom: 20px;
  text-align: center;
  font-size: 24px;
}

.modal-content p {
  color: #bdc3c7;
  text-align: center;
  margin-bottom: 20px;
}

.draw-modal-content {
  max-width: 600px;
}

.drawn-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.drawn-card {
  text-align: center;
  padding: 10px;
  background: rgba(44, 62, 80, 0.5);
  border-radius: 8px;
  border: 2px solid;
}

.drawn-card-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 8px;
}

.drawn-card-name {
  font-weight: bold;
  color: #ecf0f1;
  font-size: 12px;
  word-break: break-word;
  margin-bottom: 5px;
}

.drawn-card-rarity {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

/* Success Message */
.success-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #27ae60;
  color: white;
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 999;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  border: 4px solid rgba(255, 107, 107, 0.3);
  border-top: 4px solid #ff6b6b;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-overlay p {
  color: #4ecdc4;
  font-size: 16px;
  font-weight: bold;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: #ff6b6b;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ee5a52;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .sidebar {
    width: 240px;
  }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #ff6b6b;
    max-height: 150px;
    display: flex;
    overflow-x: auto;
    gap: 20px;
  }

  .sidebar-section {
    min-width: 200px;
  }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .game-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .header-right {
    width: 100%;
  }

  .auth-container {
    max-width: 90%;
    padding: 40px 30px;
  }

  .modal-content {
    padding: 30px 20px;
  }

  .drawn-cards-list {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
}
