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

:root {
  --primary: #9333ea;
  --primary-dark: #7e22ce;
  --secondary: #ec4899;
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #2d2d44;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #38bdf8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --border: #475569;
  --glow: #a855f7;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #cbd5e1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: all 0.3s ease;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(147, 51, 234, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(236, 72, 153, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(56, 189, 248, 0.1) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 60px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(147, 51, 234, 0.3);
}

header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: shimmer 3s linear infinite;
}

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

h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  color: white;
  letter-spacing: -1px;
}

.subtitle {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.2rem;
  position: relative;
  z-index: 1;
  margin-top: 10px;
}

.auto-save-indicator {
  position: fixed;
  top: 20px;
  left: 20px;
  background: var(--bg-secondary);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  z-index: 1000;
  display: none;
  animation: fadeIn 0.3s ease;
}

.auto-save-indicator.show {
  display: block;
}

.auto-save-indicator.saving {
  color: var(--warning);
}

.auto-save-indicator.saved {
  color: var(--success);
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 1000;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--primary);
  box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

.game-selector {
  display: flex;
  gap: 10px;
  margin: 30px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.game-btn {
  padding: 15px 35px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  color: var(--text-primary);
  border-radius: 15px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.game-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.game-btn.active::before {
  width: 300px;
  height: 300px;
}

.game-btn.active {
  color: white;
  border-color: var(--primary);
  box-shadow: 0 5px 20px rgba(147, 51, 234, 0.4);
}

.game-btn span {
  position: relative;
  z-index: 1;
}

.tabs {
  display: flex;
  gap: 5px;
  margin: 30px 0 20px;
  border-bottom: 2px solid var(--border);
  justify-content: center;
}

.tab {
  padding: 12px 25px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

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

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    width: 0;
    left: 50%;
  }
  to {
    width: 100%;
    left: 0;
  }
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-section {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 30px;
  margin: 20px 0;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

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

label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.item-counter {
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.item-counter.warning {
  background: var(--warning);
  color: white;
}

.item-counter.success {
  background: var(--success);
  color: white;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 12px 15px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

textarea {
  min-height: 200px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.help-text {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.variable-helper {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.var-chip {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--accent);
  font-family: "Courier New", monospace;
  font-weight: bold;
}

.var-chip:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(147, 51, 234, 0.3);
}

.button-group {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 25px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(147, 51, 234, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
}

.preview-room {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-radius: 20px;
  padding: 40px;
  margin: 30px 0;
  border: 2px solid var(--border);
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-room::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: 0.05;
  animation: rotate 20s linear infinite;
  z-index: 0;
  pointer-events: none;
}

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

.card-display {
  background: white;
  color: #1a1a2e;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 2;
  transform: perspective(1000px) rotateY(0deg);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-display.flip {
  transform: perspective(1000px) rotateY(360deg);
}

.card-type {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  display: inline-block;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-text {
  font-size: 1.3rem;
  line-height: 1.6;
  color: #2d2d44;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-chips {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.player-chip {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
}

.player-chip::before {
  content: "👤";
}

.preview-controls {
  margin-top: 30px;
  display: flex;
  gap: 15px;
  position: relative;
  z-index: 2;
}

.saved-decks {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 30px;
  margin: 30px 0;
  border: 1px solid var(--border);
}

.deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.deck-card {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: 15px;
  border: 2px solid var(--border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.deck-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.deck-card:hover::before {
  transform: scaleX(1);
}

.deck-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

.deck-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.deck-meta {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: column;
  gap: 10px;
}

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

.deck-btn {
  padding: 6px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.deck-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.deck-btn.danger {
  background: var(--error);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.modal-content {
  max-width: 900px;
  margin: 50px auto;
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 30px;
  position: relative;
  border: 2px solid var(--primary);
  box-shadow: 0 0 50px rgba(147, 51, 234, 0.3);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--error);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.close-modal:hover {
  transform: rotate(90deg);
}

pre {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 10px;
  overflow-x: auto;
  color: var(--accent);
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 15px 30px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  display: none;
  animation: slideInUp 0.5s ease;
  z-index: 3000;
  font-weight: 500;
}

@keyframes slideInUp {
  from {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.info-box {
  background: linear-gradient(
    135deg,
    rgba(147, 51, 234, 0.1),
    rgba(236, 72, 153, 0.1)
  );
  border-left: 4px solid var(--primary);
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.info-box ul {
  text-align: left;
  padding-left: 20px;
  margin: 10px 0;
}

.info-note {
  margin-top: 15px;
  font-size: 0.95rem;
  /* color: var(--text-secondary); */
  text-align: center;
}

footer {
  margin-top: 80px;
  padding: 40px 20px;
  background: var(--bg-secondary);
  border-top: 2px solid var(--border);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-links a:hover {
  color: var(--primary);
  transform: translateY(-2px);
}

.copyright {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.share-section {
  background: var(--bg-secondary);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid var(--border);
}

.share-url {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.share-input {
  flex: 1;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .container {
    padding: 10px;
  }

  .form-section {
    padding: 20px;
  }

  .preview-room {
    padding: 20px;
  }

  .card-display {
    padding: 20px;
  }
}

.hidden {
  display: none !important;
}

input[type="file"] {
  display: none;
}

.file-label {
  display: inline-block;
  padding: 12px 25px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.file-label:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.merge-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
}

.merge-arrow {
  font-size: 2rem;
  color: var(--primary);
}

.duplicate-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.loader {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

.vibe-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  opacity: 0.6;
  transition: all 0.3s ease;
  display: inline-block;
  margin-top: 5px;
}

.vibe-link:hover {
  opacity: 1;
  color: var(--primary);
  transform: scale(1.05);
}

.epic-yes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  background: radial-gradient(circle, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  animation: pulseBackground 0.5s ease infinite;
}

@keyframes pulseBackground {
  0%,
  100% {
    background: radial-gradient(
      circle,
      transparent 0%,
      rgba(0, 0, 0, 0.8) 100%
    );
  }
  50% {
    background: radial-gradient(
      circle,
      transparent 0%,
      rgba(0, 0, 0, 0.6) 100%
    );
  }
}

.yes-text {
  font-size: 15vw;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5),
    0 0 20px rgba(255, 255, 255, 0.5), 0 0 30px rgba(255, 255, 255, 0.5),
    0 0 40px currentColor, 0 0 70px currentColor, 0 0 80px currentColor,
    0 0 100px currentColor, 0 0 150px currentColor;
  animation: rainbowText 0.5s ease infinite, spinScale 2s ease infinite,
    float 3s ease-in-out infinite;
  transform-origin: center;
  user-select: none;
}

@keyframes rainbowText {
  0% {
    color: #ff0000;
  }
  14% {
    color: #ff7f00;
  }
  28% {
    color: #ffff00;
  }
  42% {
    color: #00ff00;
  }
  57% {
    color: #0000ff;
  }
  71% {
    color: #4b0082;
  }
  85% {
    color: #9400d3;
  }
  100% {
    color: #ff0000;
  }
}

@keyframes spinScale {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(10deg) scale(1.1);
  }
  50% {
    transform: rotate(-10deg) scale(1.2);
  }
  75% {
    transform: rotate(5deg) scale(1.1);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}
