:root {
  --bg: #120e24;
  --bg2: #1c1636;
  --card: #231c42;
  --line: #3a2f63;
  --text: #f1ecff;
  --muted: #a99fcb;
  --gold: #e7c27d;
  --gold2: #c99a4a;
  --radius: 16px;
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
h1 { font-size: 24px; margin: 8px 0 14px; font-weight: 700; letter-spacing: .2px; }
h2 { font-size: 21px; margin: 4px 0 6px; color: var(--gold); }
h3 { font-size: 18px; margin: 2px 0 4px; color: var(--gold); }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
main { padding: 12px 16px 24px; max-width: 560px; margin: 0 auto; }
.tab { display: none; animation: fade .25s ease; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.btn { display: block; width: 100%; margin-top: 14px; padding: 13px 16px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1a1230; font-weight: 700; font-size: 16px; }
.btn.ghost { background: var(--card); color: var(--gold); border: 1px solid var(--line); }
.link { background: none; border: 0; padding: 0; color: var(--gold); font-size: 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--card); color: var(--muted);
  border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--gold); color: #1a1230; border-color: var(--gold); font-weight: 600; }
.hello .chips { margin-top: -6px; }

/* Карта дня */
.daily { text-align: center; margin: 18px 0 8px; }
.daily-date { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.flip { background: none; border: 0; padding: 0; perspective: 1200px; width: 210px; aspect-ratio: 825 / 1429; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .8s cubic-bezier(.2,.7,.2,1);
  transform-style: preserve-3d; }
.flip.open .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 14px; overflow: hidden; backface-visibility: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(231,194,125,.25); }
.face.back { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 40%, #3b2b72, #171031 70%); color: var(--gold); }
.face.back span { font-size: 64px; animation: glow 2.4s ease-in-out infinite; }
.face.back small { color: var(--muted); font-size: 13px; }
@keyframes glow { 50% { opacity: .55; transform: scale(.94); } }
.face.front { transform: rotateY(180deg); background: #000; }
.face.front img, .rev { width: 100%; height: 100%; object-fit: cover; display: block; }
.rev { transform: rotate(180deg); }
.daily-text { margin-top: 16px; text-align: left; background: var(--card); border-radius: var(--radius); padding: 16px; }

.patron { display: flex; gap: 14px; margin-top: 18px; background: var(--card); border-radius: var(--radius); padding: 14px; }
.patron img { width: 72px; border-radius: 8px; display: block; }
#patron-img { flex: none; align-self: flex-start; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Списки */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { text-align: left; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; color: var(--text); font-size: 15px; }
.item b { display: block; font-size: 16px; margin-bottom: 3px; }
.item .meta { color: var(--gold); font-size: 13px; margin-top: 6px; }
.thumbs { display: flex; gap: 4px; margin-top: 8px; }
.thumbs img { width: 34px; border-radius: 4px; }

/* Колода */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cell { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; text-align: center; }
.cell img { width: 100%; aspect-ratio: 825 / 1429; object-fit: cover; border-radius: 8px; background: var(--card); display: block; margin-bottom: 4px; }

/* Нижнее окно */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(8,5,20,.6); display: flex; align-items: flex-end; }
.sheet-body { width: 100%; max-height: 92vh; overflow-y: auto; background: var(--bg2); border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.big { display: block; width: 62%; margin: 0 auto 14px; border-radius: 12px; }
.row-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.row-cards figure { margin: 0; flex: none; width: 92px; text-align: center; font-size: 11px; color: var(--muted); }
.row-cards img { width: 92px; border-radius: 8px; }
.text { white-space: pre-wrap; }
.positions { padding-left: 20px; color: var(--muted); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: rgba(18,14,36,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.nav button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 11px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; }
.nav button span { font-size: 20px; filter: grayscale(.6); }
.nav button.active { color: var(--gold); }
.nav button.active span { filter: none; }

.outside { position: fixed; inset: 0; background: var(--bg); padding: 40px 24px; text-align: center; z-index: 30; }
.outside a { color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
