:root {
  --bg: #0a080c;
  --bg-card: #15101a;
  --bg-elevated: #1f1825;
  --gold: #d4ac0d;
  --gold-bright: #f4d03f;
  --gold-pale: #f7dc6f;
  --fg: #e8e0d0;
  --fg-muted: #8a7d6e;
  --border: #2a2230;
  --yes: #4a9c5e;
  --no: #c45a4a;
  --radius: 8px;
  --max-width: 640px;
}

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ─── Language toggle ─── */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 100;
}
.lang-toggle button {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s;
}
.lang-toggle button.active {
  background: var(--bg-elevated);
  color: var(--gold-bright);
}

/* ─── Header ─── */
.header {
  text-align: center;
  padding: 40px 0 28px;
}
.coin-icon {
  display: inline-block;
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}
.coin-icon svg {
  width: 100%;
  height: 100%;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.header h1 {
  font-size: 28px;
  font-weight: normal;
  color: var(--gold-bright);
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-style: italic;
}
.header .subtitle {
  font-size: 15px;
  color: var(--fg-muted);
}

/* ─── Preset dilemmas ─── */
.presets {
  margin-bottom: 20px;
}
.presets-label {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s;
  text-align: left;
}
.preset-btn:hover {
  border-color: var(--gold);
  background: var(--bg-elevated);
  color: var(--gold-pale);
}

/* ─── Input ─── */
.input-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.input-section textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  padding: 14px;
  font-family: inherit;
  font-size: 16px;
  resize: none;
  min-height: 72px;
  outline: none;
  transition: border-color 0.15s;
}
.input-section textarea:focus {
  border-color: var(--gold);
}
.input-section textarea::placeholder {
  color: var(--fg-muted);
}
.flip-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none;
  color: #1a1520;
  padding: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 1px;
  transition: all 0.2s;
  margin-top: 12px;
}
.flip-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 172, 13, 0.3);
}
.flip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Result ─── */
.result-section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.result-section.show {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Coin animation ─── */
.coin-container {
  display: flex;
  justify-content: center;
  perspective: 800px;
  margin: 20px 0;
}
.coin-anim {
  width: 120px;
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
  animation: coinFlip 0.8s ease-out;
}
@keyframes coinFlip {
  0% { transform: rotateY(0deg) translateY(0); }
  50% { transform: rotateY(900deg) translateY(-30px); }
  100% { transform: rotateY(1800deg) translateY(0); }
}
.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: bold;
  backface-visibility: hidden;
}
.coin-heads {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1a1520;
  border: 3px solid var(--gold-pale);
}
.coin-tails {
  background: linear-gradient(135deg, var(--gold), #b7950b);
  color: #1a1520;
  border: 3px solid var(--gold);
  transform: rotateY(180deg);
}

/* ─── Verdict card ─── */
.verdict-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin-bottom: 16px;
}
.verdict-label {
  font-size: 13px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.verdict-text {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 4px;
}
.verdict-text.yes { color: var(--yes); }
.verdict-text.no { color: var(--no); }
.dilemma-display {
  font-style: italic;
  color: var(--fg-muted);
  font-size: 14px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 4px;
}
.reasoning-text {
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: left;
  font-style: italic;
}

/* ─── Actions ─── */
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.action-btn {
  flex: 1;
  min-width: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s;
  text-align: center;
}
.action-btn:hover {
  border-color: var(--gold);
  background: var(--bg-elevated);
}
.action-btn.premium {
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ─── Deep consultation ─── */
.deep-section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.deep-section.show {
  display: block;
}
.deep-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.deep-card h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.deep-card.optimist h3 { color: #5dbe6f; }
.deep-card.pessimist h3 { color: #c47a4a; }
.deep-card.trickster h3 { color: #c4a04a; }
.deep-card p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
}
.tarot-card {
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.tarot-card .card-name {
  font-size: 22px;
  color: var(--gold-bright);
  font-style: italic;
  margin-bottom: 8px;
}
.tarot-card .card-meaning {
  font-size: 15px;
  color: var(--fg);
  font-style: italic;
}

/* ─── Payment ─── */
.payment-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
}
.payment-section h3 {
  font-size: 16px;
  color: var(--gold-bright);
  margin-bottom: 12px;
}
.payment-section .price {
  font-size: 28px;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.payment-section .price-sub {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 16px;
}
.wallet-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.wallet-label {
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.wallet-address {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--gold-pale);
  word-break: break-all;
}
.copy-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
}
.copy-btn:hover {
  border-color: var(--gold);
  color: var(--gold-pale);
}

/* ─── Share card ─── */
.share-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
  text-align: center;
}
.share-card h3 {
  font-size: 14px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.share-preview {
  background: var(--bg);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  text-align: left;
}
.share-preview .preview-dilemma {
  font-size: 14px;
  color: var(--fg-muted);
  font-style: italic;
  margin-bottom: 8px;
}
.share-preview .preview-verdict {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 8px;
}
.share-preview .preview-verdict.yes { color: var(--yes); }
.share-preview .preview-verdict.no { color: var(--no); }
.share-preview .preview-reasoning {
  font-size: 14px;
  color: var(--fg);
  font-style: italic;
  line-height: 1.6;
}
.share-preview .preview-footer {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 12px;
  text-align: right;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.footer .stats {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.footer .links {
  font-size: 13px;
  color: var(--fg-muted);
}
.footer .links a {
  color: var(--gold-pale);
  text-decoration: none;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

/* ─── Loading ─── */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--fg-muted);
  font-style: italic;
}
.loading-dots::after {
  content: '...';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  #app { padding: 16px 12px 40px; }
  .header h1 { font-size: 22px; }
  .verdict-text { font-size: 28px; }
  .preset-grid { flex-direction: column; }
  .preset-btn { width: 100%; }
  .result-actions { flex-direction: column; }
}
