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

:root {
  --blood-red: #8B0000;
  --dark-red: #450000;
  --black: #0a0a0a;
  --gray: #1a1a1a;
  --text: #e0e0e0;
  --gold: #d4af37;
  --error: #ff4444;
  --success: #44bb44;
}

body {
  font-family: 'Lora', serif;
  background: radial-gradient(circle at top, var(--dark-red) 0%, var(--black) 50%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.8) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Container ── */

.game-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.game-box {
  background: linear-gradient(145deg, var(--gray), var(--black));
  border: 1px solid var(--blood-red);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow:
    0 0 30px rgba(139, 0, 0, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ── Logo / Title ── */

.game-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 2.2rem;
  text-align: center;
  color: var(--blood-red);
  text-shadow: 0 0 20px rgba(139, 0, 0, 0.6);
  margin-bottom: 8px;
  letter-spacing: 3px;
}

.game-subtitle {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  text-align: center;
  color: rgba(224, 224, 224, 0.5);
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ── Toggle tabs ── */

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 2px solid rgba(139, 0, 0, 0.3);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(224, 224, 224, 0.4);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  color: var(--blood-red);
  border-bottom-color: var(--blood-red);
}

/* ── Forms ── */

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(224, 224, 224, 0.6);
}

.form-group input {
  font-family: 'Lora', serif;
  font-size: 1rem;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input::placeholder {
  color: rgba(224, 224, 224, 0.25);
}

.form-group input:focus {
  border-color: var(--blood-red);
  box-shadow: 0 0 12px rgba(139, 0, 0, 0.3);
}

.password-wrapper {
  position: relative;
  display: flex;
}

.password-wrapper input {
  flex: 1;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: rgba(224, 224, 224, 0.4);
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: var(--blood-red);
}

.password-toggle.active {
  color: var(--gold);
}

/* ── Buttons ── */

.btn {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blood-red), var(--dark-red));
  color: var(--text);
  margin-top: 8px;
}

.btn-primary:hover {
  box-shadow: 0 0 25px rgba(139, 0, 0, 0.6);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

/* ── Forgot password ── */

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: rgba(224, 224, 224, 0.4);
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--gold);
}

.forgot-desc {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  color: rgba(224, 224, 224, 0.5);
  text-align: center;
  margin-bottom: 4px;
}

/* ── Messages ── */

.message {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 6px;
  text-align: center;
  display: none;
}

.message.error {
  display: block;
  background: rgba(255, 68, 68, 0.15);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--error);
}

.message.success {
  display: block;
  background: rgba(68, 187, 68, 0.15);
  border: 1px solid rgba(68, 187, 68, 0.3);
  color: var(--success);
}

/* ── Menu page ── */

.menu-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  padding: 20px;
  text-align: center;
}

.menu-box {
  background: linear-gradient(145deg, var(--gray), var(--black));
  border: 1px solid var(--blood-red);
  border-radius: 12px;
  padding: 48px 40px;
  box-shadow:
    0 0 30px rgba(139, 0, 0, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.player-name {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: rgba(224, 224, 224, 0.5);
  margin-bottom: 36px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.player-name span {
  color: var(--gold);
  font-weight: 600;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-menu {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 16px 24px;
  border: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 3px;
  transition: all 0.3s;
  background: rgba(139, 0, 0, 0.1);
  color: var(--text);
}

.btn-menu:hover {
  background: linear-gradient(135deg, var(--blood-red), var(--dark-red));
  border-color: var(--blood-red);
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.4);
  transform: translateY(-2px);
}

.btn-menu:active {
  transform: translateY(0);
}

.btn-menu.btn-logout {
  margin-top: 12px;
  background: transparent;
  border-color: rgba(139, 0, 0, 0.2);
  font-size: 0.9rem;
  color: rgba(224, 224, 224, 0.5);
}

.btn-menu.btn-logout:hover {
  background: rgba(139, 0, 0, 0.15);
  color: var(--text);
  border-color: rgba(139, 0, 0, 0.4);
  box-shadow: none;
  transform: none;
}

/* ── Loading spinner ── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(224, 224, 224, 0.3);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ── Glow animation ── */

@keyframes glow {
  0%, 100% { text-shadow: 0 0 20px rgba(139, 0, 0, 0.6); }
  50% { text-shadow: 0 0 35px rgba(139, 0, 0, 0.9), 0 0 60px rgba(139, 0, 0, 0.3); }
}

.game-title {
  animation: glow 3s ease-in-out infinite;
}

/* ── Collection page ── */

body.collection-page {
  display: block;
  align-items: initial;
  justify-content: initial;
}

.collection-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.collection-layout {
  display: flex;
  gap: 20px;
}

.collection-main {
  flex: 1;
  min-width: 0;
}

.collection-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px 0;
}

.collection-header .game-title {
  flex: 1;
  text-align: left;
  font-size: 1.6rem;
  margin-bottom: 0;
}

.btn-back {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 6px;
  color: rgba(224, 224, 224, 0.6);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-back:hover {
  border-color: var(--blood-red);
  color: var(--text);
}

/* Search bar */

.search-bar {
  width: 100%;
  font-family: 'Lora', serif;
  font-size: 1rem;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  margin-bottom: 20px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-bar::placeholder {
  color: rgba(224, 224, 224, 0.25);
}

.search-bar:focus {
  border-color: var(--blood-red);
  box-shadow: 0 0 12px rgba(139, 0, 0, 0.3);
}

/* Filters */

.filters-section {
  margin-bottom: 20px;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(224, 224, 224, 0.4);
  margin-bottom: 8px;
  display: block;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: rgba(224, 224, 224, 0.5);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: capitalize;
}

.filter-btn:hover {
  border-color: rgba(139, 0, 0, 0.5);
  color: var(--text);
}

.filter-btn.active {
  background: var(--blood-red);
  border-color: var(--blood-red);
  color: #fff;
}

.filter-btn.reset {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(224, 224, 224, 0.4);
  font-style: italic;
}

.filter-btn.reset:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Card counter */

.card-counter {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: rgba(224, 224, 224, 0.4);
  margin-bottom: 16px;
  text-align: right;
}

.card-counter span {
  color: var(--gold);
  font-weight: 600;
}

/* Cards grid */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

.card-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  background: var(--gray);
  max-height: 500px;
  aspect-ratio: 1217/1807;
}

.card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Card preview on hover */
.card-preview {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  width: 300px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.15s;
}

.card-preview.visible {
  opacity: 1;
}

.card-preview img {
  width: 100%;
  display: block;
}

.card-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-item .card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: rgba(224, 224, 224, 0.2);
  font-family: 'Open Sans', sans-serif;
}


/* Golden card shine effect */
.card-golden {
  position: relative;
}

.card-golden::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(212, 175, 55, 0.08) 35%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(212, 175, 55, 0.08) 65%,
    transparent 80%
  );
  animation: shine 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shine {
  0%, 100% { left: -100%; }
  50% { left: 140%; }
}

/* Modal */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

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

.modal-content {
  background: linear-gradient(145deg, var(--gray), var(--black));
  border: 1px solid var(--blood-red);
  border-radius: 12px;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  gap: 32px;
  padding: 36px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(224, 224, 224, 0.5);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-image {
  flex-shrink: 0;
  width: 440px;
  border-radius: 8px;
  overflow: hidden;
}

.modal-image img {
  width: 100%;
  display: block;
}

.modal-info {
  flex: 1;
  min-width: 0;
}

.modal-info h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: 4px;
}

.modal-info .card-code {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  color: rgba(224, 224, 224, 0.4);
  margin-bottom: 16px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-tag {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: capitalize;
  border: 1px solid;
}

.modal-tag.tag-type {
  border-color: var(--blood-red);
  color: var(--blood-red);
}

.modal-tag.tag-dimension {
  border-color: #4488ff;
  color: #4488ff;
}

.modal-tag.tag-rarity-commune { border-color: #666; color: #aaa; }
.modal-tag.tag-rarity-rare { border-color: #4488ff; color: #4488ff; }
.modal-tag.tag-rarity-super_rare { border-color: #cc44ff; color: #cc44ff; }
.modal-tag.tag-rarity-mythique { border-color: var(--gold); color: var(--gold); }

.modal-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-stat {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: rgba(224, 224, 224, 0.6);
}

.modal-stat strong {
  color: var(--text);
}

.modal-description {
  font-family: 'Lora', serif;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(224, 224, 224, 0.7);
}

/* ── Deck Panel ── */

.deck-panel {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, var(--gray), var(--black));
  border: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 12px;
  overflow: hidden;
}

.deck-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(139, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deck-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deck-select {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--blood-red);
  background: transparent;
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  flex: 1;
  min-width: 0;
}

.deck-select option {
  background: var(--black);
  color: var(--text);
}

.btn-rename {
  background: none;
  border: none;
  color: rgba(224, 224, 224, 0.4);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.btn-rename:hover {
  color: var(--gold);
}

.deck-validity {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.deck-validity.valid {
  background: var(--success);
  box-shadow: 0 0 6px rgba(68, 187, 68, 0.5);
}

.deck-validity.invalid {
  background: var(--error);
  box-shadow: 0 0 6px rgba(255, 68, 68, 0.4);
}

.deck-count {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  color: rgba(224, 224, 224, 0.4);
}

.deck-count span {
  color: var(--gold);
  font-weight: 600;
}

.deck-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.deck-section {
  margin-bottom: 16px;
}

.deck-section-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(224, 224, 224, 0.35);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.deck-section-count {
  color: var(--gold);
}

.deck-zone {
  min-height: 4px;
  padding: 2px 0;
}

.deck-body.drag-over {
  background: rgba(139, 0, 0, 0.08);
  box-shadow: inset 0 0 20px rgba(139, 0, 0, 0.12);
}

.deck-body.drag-invalid {
  background: rgba(255, 68, 68, 0.06);
  box-shadow: inset 0 0 20px rgba(255, 68, 68, 0.1);
}

.deck-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.deck-card:hover {
  background: rgba(139, 0, 0, 0.15);
  border-color: rgba(139, 0, 0, 0.3);
}

.deck-card-img {
  width: 30px;
  height: 42px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.deck-card-name {
  flex: 1;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  color: rgba(224, 224, 224, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.deck-card-name .golden-mark {
  color: var(--gold);
  font-size: 0.6rem;
}

.deck-card-count {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  padding: 0 4px;
}

.deck-card[draggable="true"] {
  cursor: grab;
}

.deck-card.dragging {
  opacity: 0.3;
}

.deck-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.btn-clear-deck {
  width: 100%;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(224, 224, 224, 0.4);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.btn-clear-deck:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Drag feedback on grid cards */
.card-item[draggable="true"] {
  cursor: grab;
}

.card-item.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

/* Toast notification */
.deck-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 68, 68, 0.9);
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  padding: 10px 20px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
}

.deck-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Settings page ── */

body.settings-page {
  display: block;
  align-items: initial;
  justify-content: initial;
}

.settings-wrapper {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 20px 0;
}

.settings-header .game-title {
  flex: 1;
  text-align: left;
  font-size: 1.6rem;
  margin-bottom: 0;
}

.settings-section {
  background: linear-gradient(145deg, var(--gray), var(--black));
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--blood-red);
  letter-spacing: 1px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(139, 0, 0, 0.2);
}

.settings-row {
  margin-bottom: 20px;
}

.settings-row:last-child {
  margin-bottom: 0;
}

.settings-label {
  display: block;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(224, 224, 224, 0.5);
  margin-bottom: 8px;
}

.settings-hint {
  font-family: 'Lora', serif;
  font-size: 0.8rem;
  color: rgba(224, 224, 224, 0.35);
  margin-bottom: 10px;
}

.settings-value {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: rgba(224, 224, 224, 0.7);
}

.settings-link {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s;
}

.settings-link:hover {
  color: #fff;
  text-decoration: underline;
}

.settings-input-group {
  display: flex;
  gap: 8px;
}

.settings-input {
  flex: 1;
  font-family: 'Lora', serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.settings-input:focus {
  border-color: var(--blood-red);
  box-shadow: 0 0 12px rgba(139, 0, 0, 0.3);
}

.btn-settings {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 6px;
  background: rgba(139, 0, 0, 0.15);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-settings:hover {
  background: var(--blood-red);
  border-color: var(--blood-red);
}

.btn-danger {
  border-color: rgba(255, 68, 68, 0.4);
  background: rgba(255, 68, 68, 0.1);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

/* Loading state */

.loading-text {
  text-align: center;
  font-family: 'Open Sans', sans-serif;
  color: rgba(224, 224, 224, 0.4);
  padding: 60px 0;
  font-size: 0.9rem;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
  .collection-layout {
    flex-direction: column;
  }

  .deck-panel {
    width: 100%;
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .modal-content {
    flex-direction: column;
    padding: 20px;
  }

  .modal-image {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .game-box,
  .menu-box {
    padding: 28px 20px;
  }

  .game-title {
    font-size: 1.8rem;
  }

  .btn-menu {
    padding: 14px 18px;
    font-size: 0.95rem;
    letter-spacing: 2px;
  }

  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .collection-header .game-title {
    font-size: 1.3rem;
  }
}

/* ── Lobby (play) page ── */

.lobby-decks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.lobby-deck-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(139, 0, 0, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.lobby-deck-card:hover {
  border-color: rgba(139, 0, 0, 0.5);
  background: rgba(139, 0, 0, 0.08);
  transform: translateY(-2px);
}

.lobby-deck-card.selected {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
}

.lobby-deck-thumb {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-deck-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-width: 56px;
  max-height: 80px;
}

.lobby-deck-placeholder {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: rgba(224, 224, 224, 0.2);
}

.lobby-deck-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lobby-deck-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-deck-count {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  color: rgba(224, 224, 224, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Lobby page ── */

.lobby-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.lobby-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s;
}

.lobby-card:hover {
  border-color: rgba(139, 0, 0, 0.6);
  background: rgba(139, 0, 0, 0.06);
}

.lobby-card-mine {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.lobby-card-mine:hover {
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.12);
}

.lobby-card-playing {
  opacity: 0.85;
}

.lobby-card-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.lobby-card-status.playing {
  background: rgba(212, 175, 55, 0.2);
  color: #d4af37;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.lobby-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.lobby-card-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-card-lock {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.lobby-card-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lobby-card-host,
.lobby-card-players {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  color: rgba(224, 224, 224, 0.4);
}

.lobby-card-actions {
  display: flex;
  gap: 8px;
}

.lobby-card-actions .btn-settings {
  flex: 1;
  padding: 6px 12px;
  font-size: 0.7rem;
  text-align: center;
}

.lobby-error {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 8px;
  min-height: 1em;
}

.lobby-players-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(139, 0, 0, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.lobby-players-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(224, 224, 224, 0.4);
  margin-bottom: 8px;
}

.lobby-players-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lobby-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.lobby-player-item.lobby-player-empty {
  border-style: dashed;
  opacity: 0.5;
}

.lobby-player-name {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
}

.lobby-player-ready {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(224, 224, 224, 0.3);
}

.lobby-player-ready.is-ready {
  color: var(--success);
}

.lobby-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.lobby-actions .btn {
  flex: 1;
}

.lobby-actions .btn-danger {
  flex: 0 0 auto;
}

.lobby-btn-unready {
  background: linear-gradient(135deg, #333, #222) !important;
  border: 1px solid rgba(224, 224, 224, 0.2) !important;
}

.lobby-btn-unready:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.lobby-status-badge {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 12px;
  vertical-align: middle;
}

.lobby-refresh-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
