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

:root {
  --primary: #1a1a2e;
  --secondary: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --text: #eaeaea;
  --text-muted: #999;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--accent);
}

h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #e94560, #0f3460);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1em;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--accent);
}

.tab-button {
  padding: 12px 24px;
  background: var(--secondary);
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1em;
  border-radius: 4px 4px 0 0;
  transition: all 0.3s ease;
}

.tab-button:hover {
  background: var(--accent);
  color: var(--highlight);
}

.tab-button.active {
  background: var(--highlight);
  color: white;
  border-bottom: 3px solid var(--highlight);
}

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

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

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

/* Grid of Archetypes */
.archetypes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.archetype-card {
  background: var(--secondary);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.archetype-card:hover {
  transform: translateY(-5px);
  border-color: var(--highlight);
  box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

.archetype-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--highlight);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.archetype-card:hover::before {
  opacity: 1;
}

.card-number {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-name {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--highlight);
}

.card-color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 2px solid var(--text);
  display: inline-block;
}

.card-description {
  font-size: 0.85em;
  color: var(--text-muted);
  line-height: 1.4;
  max-height: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conjugation Section */
.conjugation-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 15px;
  align-items: start;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.conjugation-input {
  display: flex;
  flex-direction: column;
}

.conjugation-label {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: bold;
}

.conjugation-selector {
  background: var(--secondary);
  border: 2px solid var(--accent);
  color: var(--text);
  padding: 10px;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
}

.conjugate-button {
  padding: 12px 24px;
  background: var(--highlight);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1em;
  transition: all 0.3s ease;
  align-self: flex-end;
}

.conjugate-button:hover {
  background: #d63a4a;
  transform: scale(1.05);
}

.conjugate-button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: scale(1);
}

.conjugation-result {
  background: var(--secondary);
  border: 2px solid var(--highlight);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.result-label {
  color: var(--highlight);
  font-size: 0.9em;
  margin-bottom: 10px;
  font-weight: bold;
}

.result-details {
  background: var(--primary);
  padding: 15px;
  border-radius: 4px;
  font-size: 0.95em;
  line-height: 1.6;
}

/* Drawing Section */
.draw-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.draw-input {
  display: flex;
  gap: 10px;
  align-items: center;
}

.draw-input input {
  background: var(--secondary);
  border: 2px solid var(--accent);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  width: 100px;
  font-size: 1em;
}

.draw-button {
  padding: 8px 20px;
  background: var(--highlight);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.draw-button:hover {
  background: #d63a4a;
}

.draw-result {
  background: var(--secondary);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.draw-result h3 {
  color: var(--highlight);
  margin-bottom: 15px;
}

.drawn-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.drawn-card {
  background: var(--primary);
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 10px;
  text-align: center;
}

.drawn-card-number {
  color: var(--text-muted);
  font-size: 0.9em;
}

.drawn-card-name {
  color: var(--highlight);
  font-weight: bold;
  margin: 8px 0;
}

/* Loading and Messages */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--accent);
  border-top-color: var(--highlight);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error-message {
  background: rgba(233, 69, 96, 0.2);
  border: 2px solid var(--highlight);
  color: var(--highlight);
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.success-message {
  background: rgba(0, 200, 100, 0.2);
  border: 2px solid #00c864;
  color: #00c864;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
}

/* Search Box */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  max-width: 400px;
  padding: 12px;
  background: var(--secondary);
  border: 2px solid var(--accent);
  color: var(--text);
  border-radius: 4px;
  font-size: 1em;
  margin-bottom: 15px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.filter-controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 15px;
  background: var(--secondary);
  border-radius: 4px;
}

.filter-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95em;
}

.filter-controls input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--primary);
  border: 2px solid var(--highlight);
  border-radius: 8px;
  padding: 30px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--highlight);
  font-size: 2em;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}

/* Visualization */
.visualization-container {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  background: var(--secondary);
  padding: 20px;
  border-radius: 8px;
  border: 2px solid var(--accent);
}

.chromatic-circle {
  max-width: 100%;
  height: auto;
}

.chromatic-circle circle {
  fill: none;
}

.chromatic-circle text {
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

.archetype-point {
  cursor: pointer;
  transition: all 0.2s ease;
}

.archetype-point:hover {
  filter: brightness(1.3);
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 1.8em;
  }

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

  .conjugation-section {
    grid-template-columns: 1fr;
  }

  .conjugate-button {
    align-self: start;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-button {
    width: 100%;
    text-align: left;
  }
}
