:root {
  --bg: #0b0f1d;
  --bg-2: #141a2e;
  --panel: rgba(20, 26, 46, 0.72);
  --line: rgba(214, 186, 128, 0.22);
  --gold: #d6ba80;
  --gold-2: #f1dcab;
  --text: #ece7dc;
  --muted: #a39d92;
  --danger: #c0574f;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --level: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at 75% -10%, #26304f 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 9%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 84% 32%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 62%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 78%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 88%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 50% 40%, #fff4 50%, transparent 51%);
}

.layout {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 16px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(44px, 7vw, 80px);
  line-height: 1;
  background: linear-gradient(180deg, #fff, #b9b3a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1 em {
  display: block;
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
}

.lead { margin: 22px 0 6px; font-family: var(--serif); font-size: clamp(22px, 3vw, 30px); line-height: 1.25; }
.sub { margin: 0; color: var(--muted); max-width: 46ch; }
/* Krediidihoiatus: riba kõnenupu all, ei hüppa lehel ringi (peidetud kuni hoiatuseni) */
.call-warning {
  margin: 0;
  max-width: 46ch;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: rgba(192, 87, 79, 0.12);
  font-size: 15px;
  color: var(--text);
  text-align: center;
  animation: rise 0.3s ease both;
}
/* Ikoon, et hoiatus ei toetuks ainult värvile */
.call-warning::before { content: "\26A0\FE0E  "; color: var(--danger); }

.call {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 20px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(10px);
}

.orb-wrap { padding: 12px; }

.orb {
  --s: calc(1 + var(--level) * 0.35);
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #3a4672, #141a33 70%);
  border: 1px solid var(--gold);
  box-shadow:
    0 0 calc(20px + var(--level) * 70px) rgba(214, 186, 128, calc(0.15 + var(--level) * 0.5)),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
  transform: scale(var(--s));
  transition: transform 0.08s linear, box-shadow 0.08s linear;
}

.orb::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed var(--line);
  animation: spin 40s linear infinite;
}

.orb-moon { font-size: 64px; color: var(--gold-2); text-shadow: 0 0 20px rgba(241, 220, 171, 0.5); }
.orb[data-state="idle"] { filter: saturate(0.6) brightness(0.85); }
.orb[data-state="connecting"] .orb-moon { animation: pulse 1.2s infinite; }
.orb[data-state="listening"] { border-color: #8fa6e0; }

.status { margin: 0; min-height: 1.6em; color: var(--gold-2); font-family: var(--serif); font-size: 21px; text-align: center; }
.timer { margin: -8px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1408;
  font: 500 16px var(--sans);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(214, 186, 128, 0.25);
}

.call-btn.active { background: var(--danger); color: #fff; box-shadow: 0 6px 24px rgba(192, 87, 79, 0.3); }
.call-btn.active svg { transform: rotate(135deg); }
.call-btn:disabled { opacity: 0.6; cursor: wait; }

.ghost-btn {
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: 14px var(--sans);
  cursor: pointer;
}
.ghost-btn[aria-pressed="true"] { border-color: var(--danger); color: #f0b4ae; }

.text-form { display: flex; gap: 8px; width: 100%; max-width: 420px; }
.text-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: 15px var(--sans);
  outline: none;
}
.text-form input:focus { border-color: var(--gold); }
.text-form button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-2);
  font: 14px var(--sans);
  cursor: pointer;
}

.options { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.voice-pick input { accent-color: var(--gold); }

.voice-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.voice-pick select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
}

.spread { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; animation: rise 0.4s ease both; }
.spread-q { margin: 0; font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--gold-2); text-align: center; }
.spread-cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.tarot { display: flex; flex-direction: column; align-items: center; gap: 6px; perspective: 900px; }
.tarot-inner {
  position: relative;
  width: 104px;
  height: 172px;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tarot.flipped .tarot-inner { transform: rotateY(180deg); }

.tarot-back, .tarot-front {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  border: 1px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tarot-back {
  background: repeating-linear-gradient(45deg, #ffffff08 0 6px, transparent 6px 12px), linear-gradient(160deg, #1d2544, #0f1428);
  color: var(--gold);
  font-size: 34px;
}
.tarot-back span { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 50%; }

.tarot-front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, #f6eedc, #e3d3b0);
  color: #2b2418;
  padding: 10px 8px;
  justify-content: space-between;
  text-align: center;
}
.tarot.reversed .t-symbol { transform: rotate(180deg); }
.t-num { font-family: var(--serif); font-weight: 600; font-size: 15px; }
.t-symbol { font-size: 38px; color: #7a5a22; line-height: 1; }
.t-name { font-family: var(--serif); font-weight: 600; font-size: 15px; line-height: 1.15; }
.t-rev { display: none; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #8a3b2a; }
.tarot.reversed .t-rev { display: block; }
.t-pos { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.transcript-box { width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.transcript-box summary { cursor: pointer; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.transcript { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 2px 2px; font-size: 15px; }
.transcript:empty::before { content: "Siia ilmub kõne tekst."; color: var(--muted); font-size: 14px; }
.line { margin: 0; overflow-wrap: anywhere; }
.line b { font-weight: 500; color: var(--gold); margin-right: 6px; }
.line.user b { color: #9fb2e6; }
.line.sys { color: #e8b4b4; font-size: 14px; }

.disclaimer { margin: 0; font-size: 13px; color: var(--muted); align-self: end; }
.disclaimer a { color: var(--gold); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding-top: 32px; }
  .call { grid-row: auto; }
  .orb { width: 150px; height: 150px; }
}

@media (max-width: 420px) {
  .tarot-inner { width: 88px; height: 146px; }
  .t-symbol { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

.back-link { color: var(--gold); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
