:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-alt: #1a1a25;
  --text: #e8e6e3;
  --text-muted: #8a8a9a;
  --gold: #c9a84c;
  --gold-light: #e0c06e;
  --gold-dark: #a08030;
  --red: #8b3a3a;
  --accent: #4a6fa5;
  --border: #2a2a3a;
  --yang: #c9a84c;
  --yin: #4a6fa5;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.7;
}

/* ─── HEADER ──────────────────────────────────────────────────────────── */

.header {
  background: linear-gradient(180deg, #15151f 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.logo {
  text-decoration: none;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
}

.logo-symbol {
  font-size: 1.6rem;
  opacity: 0.8;
}

.logo-text {
  font-weight: 400;
  letter-spacing: 0.1em;
}

/* ─── MAIN ────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* ─── HERO ────────────────────────────────────────────────────────────── */

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

.hero h1 {
  font-size: 2rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.15em;
  margin-bottom: 0.3rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1rem;
}

.bagua {
  font-size: 1.8rem;
  color: var(--gold-dark);
  letter-spacing: 0.5em;
  margin-bottom: 1rem;
  opacity: 0.7;
}

/* ─── INTRO ───────────────────────────────────────────────────────────── */

.intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.intro p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.method-info {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.method-info h3 {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.method-info p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* ─── FORM ────────────────────────────────────────────────────────────── */

.oracle-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

textarea, input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--gold-dark);
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-card-alt);
  transition: all 0.2s;
}

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

.btn-oracle {
  display: block;
  width: 100%;
  text-align: center;
  padding: 1rem;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #1a1510 0%, #2a2015 100%);
  border-color: var(--gold-dark);
  color: var(--gold);
  letter-spacing: 0.05em;
}

.btn-oracle:hover {
  background: linear-gradient(135deg, #2a2015 0%, #3a3020 100%);
  border-color: var(--gold);
}

.btn-oracle:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-copy {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
}

/* ─── BACK LINK ───────────────────────────────────────────────────────── */

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

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

/* ─── QUESTION BOX ────────────────────────────────────────────────────── */

.question-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
}

.question-box h3 {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 0.3rem;
}

.question-box p {
  font-size: 1.1rem;
}

/* ─── HEXAGRAM DISPLAY ────────────────────────────────────────────────── */

.hexagram-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}

.hexagram-display.transformed {
  border-color: var(--yin);
  background: linear-gradient(135deg, var(--bg-card) 0%, #101520 100%);
}

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

.hexagram-number {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 1rem;
}

/* ─── HEXAGRAM LINES ──────────────────────────────────────────────────── */

.hexagram-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 1rem 0;
}

.hex-line {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: lineReveal 0.4s ease-out forwards;
  opacity: 0;
}

@keyframes lineReveal {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.line-bar {
  flex: 1;
  max-width: 140px;
  margin: 0 auto;
}

.solid-line {
  height: 10px;
  background: var(--yang);
  border-radius: 2px;
}

.yin .solid-line { background: var(--yin); }

.broken-line {
  height: 10px;
  display: flex;
  gap: 14px;
}

.broken-line span {
  display: none;
}

.broken-line::before,
.broken-line::after {
  content: '';
  flex: 1;
  background: var(--yin);
  border-radius: 2px;
}

.yang .broken-line::before,
.yang .broken-line::after {
  background: var(--yang);
}

.line-label {
  font-size: 0.7rem;
  color: var(--red);
  white-space: nowrap;
  min-width: 70px;
  text-align: left;
}

.hex-line.changing .solid-line,
.hex-line.changing .broken-line::before,
.hex-line.changing .broken-line::after {
  animation: changingPulse 2s ease-in-out infinite;
}

@keyframes changingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.trigram-labels {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.trigram-label {
  color: var(--text-muted);
}

.trigram-label.upper { color: var(--gold-dark); }
.trigram-label.lower { color: var(--yin); }

/* ─── HEXAGRAM INFO ───────────────────────────────────────────────────── */

.hexagram-info {
  min-width: 0;
}

.hexagram-title {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.chinese-char {
  font-size: 2rem;
  color: var(--gold);
  vertical-align: middle;
}

.pinyin {
  color: var(--text-muted);
  font-style: italic;
}

.czech-name {
  color: var(--gold-light);
}

.section {
  margin-bottom: 1.2rem;
}

.section h3 {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--gold-dark);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.oracle-text {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ─── CHANGING LINES ──────────────────────────────────────────────────── */

.changing-lines {
  background: var(--bg-card);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.changing-lines h2 {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 0.3rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.changing-line-item {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}

.cl-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.cl-position {
  color: var(--gold);
  font-weight: 600;
}

.cl-type {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: monospace;
}

/* ─── TRANSFORM ARROW ─────────────────────────────────────────────────── */

.transform-arrow {
  text-align: center;
  padding: 1rem 0;
  color: var(--yin);
  font-size: 1.3rem;
  letter-spacing: 0.2em;
}

/* ─── AI SECTION ──────────────────────────────────────────────────────── */

.ai-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.ai-section h2 {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 0.3rem;
}

.ai-prompt-box {
  margin: 1rem 0;
}

.ai-prompt-box textarea {
  width: 100%;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-muted);
}

.ai-links {
  display: flex;
  gap: 1rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.ai-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.2s;
}

.ai-link:hover {
  border-color: var(--gold-dark);
  color: var(--gold);
}

.ai-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.9rem;
}

.ai-link.claude .ai-icon { background: #cc785c; color: #fff; }
.ai-link.chatgpt .ai-icon { background: #10a37f; color: #fff; }
.ai-link.gemini .ai-icon { background: #4285f4; color: #fff; }

/* ─── NEW READING ─────────────────────────────────────────────────────── */

.new-reading {
  text-align: center;
  margin: 2rem 0;
}

/* ─── FOOTER ──────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer a {
  color: #b0b0be;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--gold-dark);
}

/* ─── ERROR ───────────────────────────────────────────────────────────── */

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

.error-page h1 {
  color: var(--gold);
  margin-bottom: 1rem;
}

.error-page .btn {
  margin-top: 1.5rem;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .hexagram-display {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hexagram-visual {
    order: -1;
  }

  .hero h1 { font-size: 1.5rem; }
  .bagua { font-size: 1.3rem; letter-spacing: 0.3em; }
  .hexagram-title { font-size: 1.2rem; }
  .chinese-char { font-size: 1.6rem; }
  .ai-links { flex-direction: column; }
}
