/* Агнес — Таро, руны, карты. Тёмный фон, золото. */

@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-garamond-cyrillic-500-normal.woff2") format("woff2");
  font-weight: 500; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-garamond-cyrillic-600-normal.woff2") format("woff2");
  font-weight: 600; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant";
  src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0d0a15;
  --bg-2: #171126;
  --panel: rgba(32, 24, 50, 0.72);
  --panel-line: rgba(214, 178, 108, 0.22);
  --gold: #d6b26c;
  --gold-hi: #f0d79c;
  --gold-dim: #9c8150;
  --text: #ebe4d6;
  --muted: #a49bae;
  --danger: #e08a7a;
  --radius: 16px;
  --serif: "Cormorant", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a1d45 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 110%, #1d1430 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* звёзды */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,240,200,.7), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,240,200,.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,240,200,.45), transparent 60%),
    radial-gradient(1px 1px at 88% 60%, rgba(255,240,200,.6), transparent 60%),
    radial-gradient(1px 1px at 22% 88%, rgba(255,240,200,.4), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 35%, rgba(255,240,200,.35), transparent 60%),
    radial-gradient(1px 1px at 5% 55%, rgba(255,240,200,.5), transparent 60%),
    radial-gradient(1px 1px at 95% 90%, rgba(255,240,200,.4), transparent 60%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

a { color: var(--gold); }

#app {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
  display: flex; flex-direction: column;
}

/* ── шапка ── */
.top {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; margin-bottom: 8px;
}
.top .back {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--panel-line); background: transparent; color: var(--gold);
  font-size: 20px; display: grid; place-items: center; cursor: pointer;
}
.top .title { flex: 1; font: 600 22px/1.2 var(--serif); color: var(--gold-hi); letter-spacing: .02em; }
.chip {
  border: 1px solid var(--panel-line); border-radius: 999px; padding: 6px 12px;
  color: var(--gold); font-size: 14px; background: rgba(214,178,108,.06);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}

main { flex: 1; display: flex; flex-direction: column; }
.screen { animation: fade-in .35s ease both; display: flex; flex-direction: column; gap: 14px; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--gold-hi); margin: 0; line-height: 1.15; }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
.lead { color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ── главная ── */
.hero { text-align: center; padding: 18px 0 6px; }
.hero .logo { width: 96px; height: 96px; margin: 0 auto 12px; display: block;
  filter: drop-shadow(0 0 18px rgba(214,178,108,.35)); }
.hero h1 { font-size: 30px; }
.hero h1 span { display: block; font-size: 20px; color: var(--gold); font-weight: 500; margin-top: 4px; }

/* ── панели и кнопки ── */
.panel {
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: var(--radius); padding: 16px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border-radius: 14px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, #e3c27f 0%, #b8924d 100%);
  color: #1b1326; font: 600 17px/1.2 var(--sans); letter-spacing: .01em;
  cursor: pointer; text-decoration: none; text-align: center;
  box-shadow: 0 6px 22px rgba(214,178,108,.18);
  transition: transform .12s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
  background: transparent; color: var(--gold); box-shadow: none;
  border-color: var(--panel-line);
}

.tile {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--panel-line);
  color: var(--text); text-align: left; font: inherit; cursor: pointer;
  text-decoration: none; transition: border-color .2s, transform .12s;
}
.tile:active { transform: scale(.985); }
.tile:hover { border-color: rgba(214,178,108,.5); }
.tile .ico { font-size: 28px; width: 40px; text-align: center; flex: none; }
.tile .t { font: 600 21px/1.2 var(--serif); color: var(--gold-hi); }
.tile .s { color: var(--muted); font-size: 14px; margin-top: 2px; }
.tile .go { margin-left: auto; color: var(--gold-dim); font-size: 20px; }
.tiles { display: flex; flex-direction: column; gap: 10px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .tile { flex-direction: column; align-items: flex-start; gap: 6px; }

/* ── формы ── */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
textarea, input[type=text], input[type=email], input[type=time] {
  width: 100%; padding: 14px; border-radius: 12px;
  border: 1px solid var(--panel-line); background: rgba(10,8,18,.6);
  color: var(--text); font: 16px/1.45 var(--sans); outline: none;
}
textarea { min-height: 120px; resize: vertical; }
textarea:focus, input:focus { border-color: var(--gold); }
.counter { text-align: right; font-size: 12px; color: var(--muted); }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; margin: 1px 0 0; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 48px; height: 28px; accent-color: var(--gold); }

.note {
  border-left: 3px solid var(--gold-dim); padding: 8px 12px;
  background: rgba(214,178,108,.06); border-radius: 0 10px 10px 0;
  font-size: 14px; color: var(--muted);
}
.error { color: var(--danger); font-size: 14px; }

/* ── пакеты ── */
.pack { display: flex; align-items: center; gap: 12px; }
.pack input { accent-color: var(--gold); width: 20px; height: 20px; }
.pack .p { margin-left: auto; font: 600 22px/1 var(--serif); color: var(--gold-hi); }
.pack.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

/* ── код восстановления ── */
.code {
  font: 600 34px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: .12em; color: var(--gold-hi); text-align: center;
  padding: 18px 10px; border: 1px dashed var(--gold); border-radius: 14px;
  background: rgba(214,178,108,.06); user-select: all;
}

/* ── баланс ── */
.balance-big { text-align: center; }
.balance-big .n { font: 600 64px/1 var(--serif); color: var(--gold-hi); }
.balance-big .l { color: var(--muted); }

/* ── карты ── */
.spread {
  display: flex; justify-content: center; gap: 10px;
  perspective: 1200px; min-height: 230px; padding: 8px 0;
}
.slot { width: 31%; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.spread.one .slot { width: 52%; max-width: 220px; }
.slot .pos { font: 600 15px/1.1 var(--serif); color: var(--gold); text-transform: uppercase; letter-spacing: .08em; min-height: 17px; text-align: center; }
.slot .name { font: 600 18px/1.15 var(--serif); color: var(--text); text-align: center; }
.slot .rev { font-size: 12px; color: var(--muted); margin-top: -4px; }
.slot .name, .slot .rev { opacity: 0; transition: opacity .5s ease .3s; }
.slot.open .name, .slot.open .rev { opacity: 1; }

.card {
  position: relative; width: 100%; aspect-ratio: 340 / 580;
  transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,.7,.3,1);
  border-radius: 10px;
}
.card .face, .card .back {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 0 1px rgba(214,178,108,.35);
}
.card .back { background: url("../img/card-back.svg") center/cover, #22183a; }
.card .face { transform: rotateY(180deg); background: #1a1428; }
.card .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.open .card { transform: rotateY(180deg); }

/* раздача: карты прилетают из колоды */
.slot.deal { animation: deal .6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes deal {
  from { opacity: 0; transform: translateY(-60px) scale(.7) rotate(-8deg); }
  to   { opacity: 1; transform: none; }
}

/* ожидание: колода тасуется */
.shuffle { position: relative; width: 120px; height: 205px; margin: 30px auto 10px; }
.shuffle .card { position: absolute; inset: 0; }
.shuffle .card:nth-child(1) { animation: shuf 1.6s ease-in-out infinite; }
.shuffle .card:nth-child(2) { animation: shuf 1.6s ease-in-out -.53s infinite; }
.shuffle .card:nth-child(3) { animation: shuf 1.6s ease-in-out -1.06s infinite; }
@keyframes shuf {
  0%, 100% { transform: translateX(0) rotate(0); z-index: 1; }
  25% { transform: translateX(-46px) rotate(-10deg); }
  50% { transform: translateX(0) rotate(0); z-index: 3; }
  75% { transform: translateX(46px) rotate(10deg); }
}
.wait-text { text-align: center; font: 500 22px/1.3 var(--serif); color: var(--gold); min-height: 30px; }
.glow { position: absolute; inset: -30px; background: radial-gradient(closest-side, rgba(214,178,108,.25), transparent); filter: blur(8px); animation: twinkle 2s ease-in-out infinite alternate; }

/* ── толкование ── */
.reading { opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s ease; }
.reading.show { opacity: 1; transform: none; }
.reading p { margin: 0 0 12px; }
.reading p:last-child { margin-bottom: 0; }
.reading .h { font: 600 21px/1.25 var(--serif); color: var(--gold-hi); margin: 18px 0 6px; }
.reading .h:first-child { margin-top: 0; }

.disclaimer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 22px; opacity: .8; }

/* ── всплывашка ── */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; transition: .3s ease;
  background: #2a2040; color: var(--text); border: 1px solid var(--panel-line);
  border-radius: 12px; padding: 12px 16px; max-width: calc(100% - 32px);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 15px;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.spinner {
  width: 28px; height: 28px; margin: 0 auto; border-radius: 50%;
  border: 2px solid var(--panel-line); border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── страницы документов ── */
.doc h1 { font-size: 30px; margin-bottom: 6px; }
.doc h2 { font-size: 22px; margin: 22px 0 8px; }
.doc p, .doc li { color: var(--text); }
.doc ul { padding-left: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
