/* ДеМарк - главная страница Mini App: развилка на мероприятия, магазин и базу знаний.
   У каждой плитки цвет своего раздела. Тема - по Telegram либо по системе. */

:root {
    color-scheme: light;
    --ground: #F1F3F8;
    --card: #FFFFFF;
    --ink: #12151C;
    --ink-2: #4A5265;
    --ink-3: #7B8497;
    --line: #DFE3EC;
    --events: #F0452E;  --events-soft: #FDE9E5;
    --shop: #5B5BE8;    --shop-soft: #EBEBFD;
    --kb: #0E9F6E;      --kb-soft: #DFF5EC;
    --display: "Unbounded", "Golos Text", system-ui, sans-serif;
    --body: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --ground: #0F1116;
    --card: #191C24;
    --ink: #F1F3F8;
    --ink-2: #B3BACB;
    --ink-3: #7F889C;
    --line: #2A2F3B;
    --events: #FF5A43;  --events-soft: #3A1D18;
    --shop: #8C8CFF;    --shop-soft: #22224A;
    --kb: #3FCB97;      --kb-soft: #12332A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.hub { max-width: 920px; margin: 0 auto; padding: 28px 16px calc(32px + env(safe-area-inset-bottom)); }
.hub-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.hub-kicker { font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.hub-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 7vw, 40px); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.hub-balance { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--shop); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .hub-balance { color: #14142E; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.tile { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon body arrow" "badge badge badge"; align-items: center; gap: 0 14px; padding: 18px; min-height: 96px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; transition: transform 160ms ease-out, border-color 160ms; touch-action: manipulation; }
.tile:hover { transform: translateY(-2px); border-color: var(--tile); }
.tile:active { transform: scale(0.985); }
.tile-events { --tile: var(--events); --tile-soft: var(--events-soft); }
.tile-shop { --tile: var(--shop); --tile-soft: var(--shop-soft); }
.tile-kb { --tile: var(--kb); --tile-soft: var(--kb-soft); }
.tile-icon { grid-area: icon; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--tile-soft); color: var(--tile); }
.tile-icon svg.i { width: 26px; height: 26px; }
.tile-body { grid-area: body; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-title { font-family: var(--display); font-weight: 500; font-size: 16px; line-height: 1.2; }
.tile-text { color: var(--ink-2); font-size: 13.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-arrow { grid-area: arrow; color: var(--ink-3); transition: transform 160ms, color 160ms; }
.tile:hover .tile-arrow { transform: translateX(3px); color: var(--tile); }
.tile-badge { grid-area: badge; justify-self: start; margin-top: 12px; padding: 4px 10px; border-radius: 999px; background: var(--tile-soft); color: var(--tile); font-size: 12.5px; font-weight: 600; }

.hub-hint { margin-top: 20px; color: var(--ink-3); font-size: 13px; max-width: 60ch; }

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.gate-card h2 { font-family: var(--display); font-weight: 500; font-size: 19px; line-height: 1.2; text-wrap: balance; }
.gate-card p { color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 600; background: var(--ink); color: var(--ground); }
.btn svg.i { width: 18px; height: 18px; }

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