:root {
  --bg: #0d0f14; --panel: #171a22; --panel2: #232733; --line: #2d3240;
  --text: #f1f3f8; --mut: #8f97ab; --gold: #f5b301; --energy: #8f74ff; --ok: #3ecf8e; --bad: #ff5d5d;
  --glow: #9aa3b2;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { font: 15px/1.4 system-ui, "Segoe UI", Roboto, sans-serif; user-select: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }
.title { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- Шапка ---------- */
#top { position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 22px; background: linear-gradient(var(--bg) 55%, transparent); pointer-events: none; }
#top > * { pointer-events: auto; }
#top.over { background: linear-gradient(rgba(8, 10, 14, .6), transparent); }
.ava { width: 42px; height: 42px; border-radius: 12px; background: var(--panel2); display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--mut); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.xpbar { height: 4px; width: min(180px, 100%); background: rgba(255, 255, 255, .12); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: var(--gold); transition: width .4s; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: rgba(60, 65, 80, .78); backdrop-filter: blur(8px); border-radius: 12px; padding: 8px 13px; font-weight: 800; font-size: 16px; white-space: nowrap; }

/* ---------- Экран и вкладки ---------- */
#screen { flex: 1; min-height: 0; overflow-y: auto; padding: 78px 16px 112px; }
#screen.full { padding: 0; overflow: hidden; position: relative; }
.wrap { max-width: 760px; margin: 0 auto; }

#tabs { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; gap: 2px; padding: 5px; border-radius: 18px; background: rgba(52, 56, 70, .82); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
#tabs button { width: 82px; padding: 9px 0 7px; border-radius: 13px; color: #b3bacb; font-size: 11px; font-weight: 800; font-style: italic; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 3px; }
#tabs button .ic { width: 22px; height: 22px; }
#tabs button.on { background: var(--gold); color: #1a1300; }
@media (max-width: 380px) { #tabs button { width: 74px; } }

/* ---------- Кнопки и общие блоки ---------- */
h2 { font-size: 26px; margin: 6px 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--gold); color: #1a1300; font-weight: 800; border-radius: 13px; padding: 12px 18px; }
.btn.ghost { background: var(--panel2); color: var(--text); }
.btn.glass { background: rgba(255, 255, 255, .16); color: var(--text); backdrop-filter: blur(8px); }
.btn.white { background: #fff; color: #14161c; }
.btn.wide { display: flex; width: 100%; }
.btn.big { padding: 15px 26px; font-size: 17px; border-radius: 15px; text-transform: uppercase; font-style: italic; font-weight: 900; }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.mut { color: var(--mut); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
input[type=text], textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; user-select: text; }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--gold); }
.st-new { color: var(--gold); } .st-done { color: var(--ok); } .st-rejected { color: var(--bad); }
.dot { position: relative; }
.dot::after { content: ""; position: absolute; top: 8px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }

/* ---------- Карусель (игры на главной и товары в магазине) ---------- */
.carwrap { position: relative; flex: 1; min-height: 0; display: flex; }
.car { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.car::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; padding: 0 16px; }
.nav { position: absolute; top: 50%; margin-top: -24px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .1); display: none; place-items: center; z-index: 2; }
.nav .ic { width: 22px; height: 22px; }
.nav.l { left: max(16px, 50% - 380px); } .nav.r { right: max(16px, 50% - 380px); }
.nav:disabled { opacity: .25; }
@media (hover: hover) and (min-width: 700px) { .nav { display: grid; } }
.float { animation: float 2.6s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(-9px); } to { transform: translateY(9px); } }

/* ---------- Главная ---------- */
#screen.home { display: flex; flex-direction: column; overflow: hidden; padding-left: 0; padding-right: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 16px; }
.tile { background: linear-gradient(#272b36, rgba(39, 43, 54, 0)); border-radius: 4px; padding: 16px 6px 22px; text-align: center; font-size: 11px; font-weight: 900; font-style: italic; text-transform: uppercase; color: #c9cfdc; }
.tile .ic { display: block; width: 30px; height: 30px; margin: 0 auto 8px; color: var(--gold); }
.home .slide { background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .07), transparent 55%); }
.home .art { height: min(38vh, 300px); width: auto; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); }
.home .slide h3 { font-size: 28px; margin: 14px 0 4px; }
.home .slide p { margin: 0 0 14px; color: var(--mut); }
.slide.locked .art { filter: grayscale(1) brightness(.6); animation: none; }
.modes { display: flex; justify-content: center; gap: 14px; padding: 12px 16px 0; }
.mode { width: 76px; font-size: 10px; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--mut); text-align: center; }
.mode i { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 6px; border-radius: 50%; background: #262a35; border: 2px solid transparent; transition: border-color .2s, transform .2s; }
.mode .art { width: 42px; height: 42px; }
.mode.on { color: var(--text); }
.mode.on i { border-color: var(--gold); transform: scale(1.06); }
.mode.locked .art { filter: grayscale(1) brightness(.6); }

/* ---------- Задания ---------- */
.seg { display: flex; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.seg button { flex: 1; padding: 12px 8px; font-weight: 800; font-size: 17px; text-transform: uppercase; color: var(--mut); border-bottom: 3px solid transparent; }
.seg button.on { color: var(--text); border-color: var(--gold); background: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(245, 179, 1, .28), transparent); }
.task { display: flex; gap: 12px; }
.task .ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.task .ico .ic { width: 24px; height: 24px; }
.p-telegram { background: #2aa1df; } .p-youtube { background: #e53935; } .p-twitch { background: #8f4bff; } .p-tiktok { background: #14161c; border: 1px solid var(--line); }
.p-game { background: var(--gold); color: #1a1300 !important; } .p-other { background: var(--panel2); }
.task .body { flex: 1; min-width: 0; }
.task b { display: block; font-size: 17px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 9px 0 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.tag.w { background: #fff; color: #14161c; }
.task .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.task.done { opacity: .5; }

/* ---------- Магазин ---------- */
#screen.shop { display: flex; flex-direction: column;
  background: radial-gradient(ellipse 75% 46% at 50% 46%, color-mix(in srgb, var(--glow) 75%, transparent), transparent 72%),
    linear-gradient(color-mix(in srgb, var(--glow) 45%, #10131a), color-mix(in srgb, var(--glow) 16%, #0d0f14)); }
.shop .slide { padding: 84px 16px 116px; justify-content: space-between; }
.shop .slide h3 { font-size: clamp(26px, 6vw, 44px); margin: 0; text-shadow: 0 2px 14px rgba(0, 0, 0, .35); }
.shop .slide .sub { font-weight: 800; text-transform: uppercase; opacity: .85; margin-top: 6px; }
.pic { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; padding: 10px 0; }
.pic img, .pic .art { max-width: min(86%, 620px); max-height: 100%; height: auto; object-fit: contain; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .45)); }
.pic .art { height: min(40vh, 320px); }
.buy { display: flex; gap: 6px; }
.buy .btn { min-width: 132px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.cell { border-radius: 14px; padding: 10px 8px; text-align: center; font-size: 12px; font-weight: 700; background: linear-gradient(color-mix(in srgb, var(--c) 40%, var(--panel2)), var(--panel2)); border-bottom: 3px solid var(--c); }
.cell img, .cell .art { width: 100%; height: 64px; object-fit: contain; }
.cell span { display: block; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* ---------- Карта ---------- */
#world { position: absolute; left: 0; top: 0; touch-action: none; cursor: grab; }
#world svg { display: block; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.pin .b { width: 54px; height: 54px; border-radius: 16px; background: var(--gold); display: grid; place-items: center; box-shadow: 0 8px 18px rgba(0, 0, 0, .35); position: relative; }
.pin .b .ic { width: 30px; height: 30px; }
.pin .b::after { content: ""; position: absolute; bottom: -8px; left: 50%; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--gold); border-bottom: 0; }
.pin label { margin-bottom: 5px; font-size: 11px; font-weight: 900; font-style: italic; text-transform: uppercase; color: #1c2230; background: rgba(255, 255, 255, .88); padding: 2px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.pin.locked .b { background: #8a93a5; color: #fff; }
.pin.locked .b::after { border-top-color: #8a93a5; }
.pin .ready { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; background: var(--bad); border: 3px solid #fff; animation: bob 1.2s infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- Окна (по центру экрана) ---------- */
#modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .72); z-index: 20; display: grid; place-items: center; padding: 16px; }
.sheet { width: 100%; max-width: 440px; max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px 18px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.sheet h3 { margin: 0 0 14px; font-size: 24px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet h3 button { width: 34px; height: 34px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; color: var(--mut); flex-shrink: 0; }
.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.day { background: var(--panel2); border-radius: 14px; padding: 10px 4px; text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--mut); border: 2px solid transparent; }
.day b { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 18px; color: var(--text); margin-top: 4px; }
.day.got { opacity: .4; } .day.now { border-color: var(--gold); background: rgba(245, 179, 1, .16); }
.day:last-child { grid-column: 1 / -1; }
.tier { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tier .n { width: 36px; height: 36px; border-radius: 10px; background: var(--panel2); display: grid; place-items: center; font-weight: 900; flex-shrink: 0; }
.tier .r { flex: 1; }
.reflink { display: flex; gap: 8px; margin: 12px 0; }
.reflink input { flex: 1; min-width: 0; font-family: Consolas, monospace; font-size: 13px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--gold); color: #1a1300; font-weight: 800; border-radius: 20px; padding: 4px 11px; white-space: nowrap; }

/* ---------- Игра ---------- */
#game { position: fixed; inset: 0; background: #090b0f; z-index: 30; display: flex; flex-direction: column; }
#hud { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-weight: 900; font-size: 18px; }
#hud button { color: var(--mut); font-size: 14px; font-weight: 700; }
#stage { flex: 1; position: relative; overflow: hidden; touch-action: none; width: 100%; max-width: 560px; margin: 0 auto; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pad { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.pad .keys { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.pad .keys button { height: 84px; border-radius: 18px; background: var(--panel2); border: 2px solid var(--line); transition: background .1s; }
.pad .keys button.lit { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 24px rgba(245, 179, 1, .6); }
.pad .keys button.err { background: var(--bad); border-color: var(--bad); }
.result { text-align: center; }
.result .big { font-size: 56px; font-weight: 900; font-style: italic; line-height: 1; }
.result .gain { display: flex; gap: 16px; font-weight: 800; font-size: 18px; }

#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90%; text-align: center; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
