:root {
  --bg: #120e1f;
  --bg2: #1b1530;
  --card: #231b3d;
  --card2: #2d2450;
  --line: rgba(232, 208, 150, .16);
  --text: #f1ebdf;
  --muted: #a99fbf;
  --gold: #e3c27a;
  --gold2: #b8913f;
  --rose: #e48aa6;
  --ok: #7fd1a5;
  --bad: #ef8a8a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
body {
  background:
    radial-gradient(ellipse at 20% -10%, rgba(120, 80, 200, .35), transparent 55%),
    radial-gradient(ellipse at 110% 30%, rgba(228, 138, 166, .15), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + var(--safe-b)); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; margin: 0 0 8px; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.gold { color: var(--gold); }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 4px; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--gold); letter-spacing: .5px; }
.moon { display: inline-block; transform: translateY(1px); }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 12px; width: 38px; height: 38px;
  font-size: 18px; color: var(--muted); }

main { padding: 6px 16px 16px; }
.section { margin: 14px 0 18px; }
.panel { background: linear-gradient(160deg, var(--card), var(--bg2)); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.panel.glow { box-shadow: 0 0 0 1px rgba(227, 194, 122, .25), 0 10px 40px -10px rgba(140, 90, 220, .45); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 14px 16px; font-weight: 600;
  background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1d1404; font-size: 16px; }
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid rgba(227, 194, 122, .45); }
.btn.soft { background: var(--card2); color: var(--text); }
.btn:disabled { opacity: .45; }
.btn + .btn { margin-top: 10px; }
.btns3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btns3 .btn { padding: 11px 6px; font-size: 14px; margin: 0; }
.btn.ok { background: rgba(127, 209, 165, .16); color: var(--ok); border: 1px solid rgba(127, 209, 165, .35); }
.btn.mid { background: rgba(227, 194, 122, .12); color: var(--gold); border: 1px solid rgba(227, 194, 122, .35); }
.btn.bad { background: rgba(239, 138, 138, .12); color: var(--bad); border: 1px solid rgba(239, 138, 138, .35); }
.link { background: none; border: 0; color: var(--gold); padding: 0; text-decoration: underline; }

input[type=text], textarea, select {
  width: 100%; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 13px 14px; font: inherit; outline: none; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { border-color: rgba(227, 194, 122, .6); }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 14px; }
label.check input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--gold); }
.field { margin: 12px 0; }
.field .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 999px; padding: 9px 13px;
  font-size: 14px; }
.chip.on { border-color: var(--gold); background: rgba(227, 194, 122, .14); color: var(--gold); }

.bubble { background: var(--card2); border-radius: 18px 18px 18px 6px; padding: 12px 14px; margin: 8px 0 14px;
  border: 1px solid var(--line); }
.bubble .who { font-family: var(--serif); color: var(--gold); font-weight: 700; font-size: 16px; display: block; }
.text p { margin: 0 0 10px; }

.score { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(227, 194, 122, .1); border: 1px solid rgba(227, 194, 122, .3); color: var(--gold);
  font-weight: 600; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--card2);
  color: var(--muted); }

/* карты */
.table { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; perspective: 900px; }
.tcard { aspect-ratio: 2 / 3.2; border-radius: 12px; position: relative; transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1); border: 0; padding: 0; background: none; }
.tcard .face { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 8px; }
.tcard .back { background:
    radial-gradient(circle at 50% 50%, rgba(227, 194, 122, .25) 0 14%, transparent 15%),
    repeating-linear-gradient(45deg, rgba(227, 194, 122, .12) 0 2px, transparent 2px 10px),
    linear-gradient(160deg, #3a2b6b, #1d1638);
  border: 1px solid rgba(227, 194, 122, .45); }
.tcard .back::after { content: "☾"; font-size: 26px; color: var(--gold); }
.tcard .front { background: linear-gradient(170deg, #f6ecd6, #e5d2a8); color: #2b1d3d; transform: rotateY(180deg);
  border: 1px solid #b8913f; box-shadow: inset 0 0 0 4px #f6ecd6, inset 0 0 0 5px #b8913f; }
.tcard.flipped { transform: rotateY(180deg); }
.tcard.sel .back { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(227, 194, 122, .6); }
.tcard .num { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: #1d1404; font-weight: 700; font-size: 13px; display: flex; align-items: center;
  justify-content: center; z-index: 3; transform: translateZ(1px); }
.front .sym { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.front .rn { font-family: var(--serif); font-size: 15px; font-weight: 700; color: #7a5a1a; }
.front .nm { font-family: var(--serif); font-size: 15px; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.front .rv { font-size: 10px; color: #8a3b55; margin-top: 4px; }
.front.rev .sym { transform: rotate(180deg); }
.spread { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 16px; }
.spread .pos { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; line-height: 1.2; }
.daily-card { width: 132px; margin: 4px auto 12px; }

/* загрузка */
.loading { text-align: center; padding: 34px 10px; }
.orb { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #e3c27a 30%, #6b4bb4 70%, transparent 72%);
  animation: pulse 1.6s ease-in-out infinite; box-shadow: 0 0 40px rgba(227, 194, 122, .5); }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }

/* дневник */
.ritem { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.ritem:last-child { border-bottom: 0; }
.ritem .st { font-size: 20px; width: 26px; text-align: center; }
.ritem .q { font-weight: 500; }

/* матрица */
.points { display: grid; grid-template-columns: 1fr; gap: 10px; }
.point { display: flex; gap: 12px; align-items: center; }
.point .ar { flex: 0 0 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 20px; font-weight: 700; color: #1d1404;
  background: radial-gradient(circle at 35% 30%, #fff1c9, var(--gold) 60%, var(--gold2)); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.grid3 div { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 10px; padding: 10px 4px;
  text-align: center; font-family: var(--serif); font-size: 18px; color: var(--gold); min-height: 44px; }

.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.months button { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 12px;
  padding: 10px 0; font-size: 13px; }
.months button.on { border-color: var(--gold); color: var(--gold); background: rgba(227, 194, 122, .12); }

/* навигация */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center;
  background: rgba(18, 14, 31, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); z-index: 10; }
.tabs[hidden], .icon-btn[hidden], .toast[hidden] { display: none; }
.tabs button { flex: 1; max-width: 112px; background: none; border: 0; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; }
.tabs button span { font-size: 19px; line-height: 1.1; }
.tabs button.on { color: var(--gold); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + var(--safe-b)); max-width: 528px; margin: 0 auto;
  background: #2d2450; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.fade { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 6px 4px; }
