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

body {
  background: #0a0a12;
  color: #e8e0d0;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

nav {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #c9a84c33;
  padding: 1rem 2rem;
}

.logo {
  color: #c9a84c;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.1em;
  text-decoration: none;
  font-size: 1.3rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: #e8e0d0;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #c9a84c;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: #1a1a2e;
  border: 1px solid #c9a84c33;
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.2);
  transform: scale(1.02);
}

.card-symbol {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.card-description {
  color: #6b6878;
  font-size: 0.9rem;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input,
select,
textarea {
  background: #0a0a12;
  border: 1px solid #c9a84c33;
  color: #e8e0d0;
  padding: 0.75rem;
  border-radius: 4px;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #c9a84c;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #6b6878;
}

button {
  background: #c9a84c;
  color: #0a0a12;
  font-weight: bold;
  padding: 0.75rem 2rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: background 0.2s;
}

button:hover {
  background: #d4af37;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-option {
  display: inline-block;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-option label {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid #c9a84c33;
  border-radius: 20px;
  cursor: pointer;
  margin: 0.25rem;
  transition: background 0.2s, border-color 0.2s;
}

.radio-option input[type="radio"]:checked + label,
.radio-option label.selected {
  background: #c9a84c22;
  border-color: #c9a84c;
}

.flash {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.flash-error {
  background: #8b3a3a33;
  border-left: 3px solid #8b3a3a;
}

.flash-info {
  background: #c9a84c22;
  border-left: 3px solid #c9a84c;
}

.flash-success {
  background: #3a6b3a33;
  border-left: 3px solid #3a6b3a;
}

.result-card {
  background: #1a1a2e;
  border: 1px solid #c9a84c;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.result-card .card-name {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.result-card .card-detail {
  color: #6b6878;
  font-size: 0.85rem;
}

.result-card.reversed {
  border-color: #8b3a3a;
}

.result-card.reversed .card-name {
  color: #8b3a3a;
}

.results-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin: 2rem 0;
}

.position-label {
  color: #6b6878;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 1.8rem;
  text-align: center;
  margin: 2rem 0;
}

.disclaimer {
  color: #6b6878;
  font-style: italic;
  text-align: center;
  font-size: 0.8rem;
  margin-top: 2rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid #c9a84c33;
  color: #c9a84c;
  font-family: Georgia, 'Times New Roman', serif;
}

.history-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #c9a84c11;
}

.history-table tr:hover {
  background: #1a1a2e;
}

.back-link {
  color: #6b6878;
  transition: color 0.2s;
  margin-bottom: 1rem;
  display: inline-block;
  text-decoration: none;
}

.back-link:hover {
  color: #c9a84c;
}

.profile {
  text-align: center;
  padding: 2rem 0;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 1.5rem;
}

.profile-stat {
  text-align: center;
}

.profile-stat-value {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 2rem;
  display: block;
}

.profile-stat-label {
  color: #6b6878;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-form {
  max-width: 400px;
  margin: 0 auto;
}

.auth-form h1 {
  text-align: center;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
}

.auth-link a {
  color: #c9a84c;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

.gold-divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a84c, transparent);
  margin: 2rem 0;
}

.hero {
  text-align: center;
  padding: 3rem 0;
}

.hero-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  color: #6b6878;
  font-size: 1.1rem;
}

.htmx-settling {
  opacity: 0;
}

.htmx-settling.htmx-added {
  opacity: 1;
  transition: opacity 0.3s;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline;
}

.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #c9a84c33;
  border-top-color: #c9a84c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid #c9a84c33;
  margin-top: 3rem;
}

a {
  color: #c9a84c;
}

h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
}

.mono {
  font-family: 'Courier New', monospace;
}

.text-muted {
  color: #6b6878;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.filter-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-links a {
  color: #6b6878;
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.filter-links a:hover,
.filter-links a.active {
  color: #c9a84c;
  background: #c9a84c22;
}

.delete-btn {
  background: transparent;
  color: #8b3a3a;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #8b3a3a;
}

.delete-btn:hover {
  background: #8b3a3a33;
}

.view-link {
  color: #c9a84c;
  text-decoration: none;
}

.view-link:hover {
  text-decoration: underline;
}

.interpretation {
  background: #1a1a2e;
  border: 1px solid #c9a84c33;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.interpretation-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: #c9a84c;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.reading-summary {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.reading-meta {
  color: #6b6878;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ============================================================
   MISSING CLASSES — Phase 0 fixes
   ============================================================ */

/* Form groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  color: #c9a84c;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: Georgia, 'Times New Roman', serif;
}

/* Result card wrapper */
.result-card-wrapper {
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

/* Card detail elements */
.card-numeral {
  font-family: 'Courier New', monospace;
  color: #6b6878;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  letter-spacing: 0.12em;
}

.card-subtitle {
  color: #6b6878;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.card-keywords {
  color: #a89060;
  font-size: 0.82rem;
  font-style: italic;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* I Ching hexagram lines */
.hexagram-line {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  line-height: 1.6;
  letter-spacing: 0.05em;
  text-align: center;
  color: #c9a84c;
  transition: color 0.3s;
}

/* Reading detail page */
.reading-detail {
  max-width: 800px;
  margin: 0 auto;
}

.reading-question {
  font-size: 1.15rem;
  color: #e8e0d0;
  font-style: italic;
  text-align: center;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.reading-date {
  color: #6b6878;
  font-size: 0.82rem;
  text-align: center;
  letter-spacing: 0.06em;
}

.reading-summary {
  color: #a89060;
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Dashboard recent readings */
.recent-readings {
  margin-top: 2rem;
}

.recent-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.recent-list li {
  padding: 0.75rem 1rem;
  background: #1a1a2e;
  border: 1px solid #c9a84c22;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.recent-list li:hover {
  border-color: #c9a84c55;
}

/* Aliases and utilities */
.muted {
  color: #6b6878;
}

.description {
  color: #6b6878;
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.error {
  color: #c0504d;
  padding: 0.75rem;
  background: #8b3a3a22;
  border-left: 3px solid #8b3a3a;
  border-radius: 4px;
  margin: 1rem 0;
}

.form-link {
  color: #c9a84c;
  text-decoration: none;
  font-size: 0.9rem;
}

.form-link:hover {
  text-decoration: underline;
}

/* ============================================================
   VISUAL POLISH
   ============================================================ */

/* Enhanced card hover glow */
.result-card:hover {
  box-shadow: 0 0 25px rgba(201, 168, 76, 0.18);
  transform: translateY(-2px);
  transition: box-shadow 0.3s, transform 0.3s;
}

.result-card.reversed:hover {
  box-shadow: 0 0 25px rgba(139, 58, 58, 0.25);
}

/* Logo glow */
.logo {
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
}

/* Section title glow */
.section-title {
  text-shadow: 0 0 30px rgba(201, 168, 76, 0.2);
}

/* Staggered result card reveal animation */
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card-wrapper:nth-child(1) { animation: cardReveal 0.4s ease forwards; }
.result-card-wrapper:nth-child(2) { animation: cardReveal 0.4s ease 0.08s forwards; opacity: 0; }
.result-card-wrapper:nth-child(3) { animation: cardReveal 0.4s ease 0.16s forwards; opacity: 0; }
.result-card-wrapper:nth-child(4) { animation: cardReveal 0.4s ease 0.24s forwards; opacity: 0; }
.result-card-wrapper:nth-child(5) { animation: cardReveal 0.4s ease 0.32s forwards; opacity: 0; }
.result-card-wrapper:nth-child(6) { animation: cardReveal 0.4s ease 0.4s forwards; opacity: 0; }
.result-card-wrapper:nth-child(n+7) { animation: cardReveal 0.4s ease 0.48s forwards; opacity: 0; }

/* Mobile responsive nav */
@media (max-width: 600px) {
  nav {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 0.9rem;
  }

  .container {
    padding: 1rem;
  }

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

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    gap: 1.5rem;
  }
}

/* Canvas background positioning (for Three.js) */
#canvas-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Backdrop blur for elements over 3D */
nav {
  background: rgba(10, 10, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card {
  background: rgba(26, 26, 46, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero {
  position: relative;
  z-index: 1;
}

.hero-title {
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.35), 0 2px 4px rgba(0,0,0,0.8);
}

.hero-tagline {
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* Three.js result canvases */
.scene-canvas-container {
  width: 100%;
  height: 320px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid #c9a84c22;
  background: #05050f;
  position: relative;
}

.scene-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
