/* Шрифт хранится у нас на сервере (пакет @fontsource/oswald) — не зависим от Google. */
@font-face { font-family: 'Oswald'; font-weight: 500; font-display: swap; src: url(/vendor/oswald/oswald-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-weight: 600; font-display: swap; src: url(/vendor/oswald/oswald-cyrillic-600-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url(/vendor/oswald/oswald-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-weight: 500; font-display: swap; src: url(/vendor/oswald/oswald-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: 'Oswald'; font-weight: 600; font-display: swap; src: url(/vendor/oswald/oswald-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url(/vendor/oswald/oswald-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC; }

:root {
  --bg: #141519; --panel: #1d1e23; --panel2: #2a2c33; --line: #30333c;
  --text: #f3f4f7; --mut: #8e93a1; --gold: #7360ff; --gold2: #ffd23f;
  --acc: linear-gradient(100deg, #5b7cff, #8b4dff);  /* главный цвет интерфейса — сине-фиолетовый */
  --acc1: #7360ff; --acc2: #9b7bff;               /* он же сплошным цветом и светлее */
  --ok: #3ecf8e; --bad: #ff4d4d; --glow: #9aa3b2;
  --disp: 'Oswald', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
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-family: var(--disp); font-weight: 700; font-style: italic; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; }
.center { text-align: center; }
.mut { color: var(--mut); }

/* Плавное поэтапное появление: элементы с .ap проявляются по очереди (--i — порядковый номер). */
.ap { animation: ap .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes ap { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.fade { animation: fade .45s ease both; }
@keyframes fade { from { opacity: 0; } }
/* Левитация картинок (предметы магазина, герои лобби) */
.float { animation: float 3s ease-in-out infinite alternate; will-change: transform; }
@keyframes float { from { transform: translateY(-9px); } to { transform: translateY(9px); } }

/* Скошенная панель со скруглёнными углами: фон рисуется наклонённым ::before. */
.sk, .btn, .chip, #tabs, #tabs button, .gpanel, .gpause, .btn .cost { position: relative; isolation: isolate; }
.sk::before, .btn::before, .chip::before, #tabs::before, #tabs button::before, .gpanel::before, .gpause::before, .btn .cost::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--skb, var(--panel2)); border-radius: var(--skr, 10px);
  transform: skewX(-9deg); transition: filter .15s, opacity .2s; }

#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 14px 20px; pointer-events: none; transition: opacity .3s; }
#top > * { pointer-events: auto; }
#top.lobby .ava, #top.lobby .who, #top.lobby [data-info="gold"] { visibility: hidden; }
.ava { width: 40px; height: 40px; border-radius: 6px; background: var(--panel2); display: grid; place-items: center; font-family: var(--disp); font-weight: 700; 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: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: #b5bac6; font-family: var(--disp); font-size: 12px; font-weight: 500; text-transform: uppercase; }
.chip { --skb: rgba(86, 88, 98, .72); display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px;
  font-family: var(--disp); font-weight: 500; font-size: 16px; white-space: nowrap; }
.chip::before { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.chip .ic { width: 19px; height: 19px; }
.chip:active::before { filter: brightness(1.25); }

/* ---------- Плашки-подсказки у монет и энергии ---------- */
#tip { position: fixed; z-index: 15; width: min(330px, calc(100vw - 24px)); background: rgba(30, 32, 42, .7); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 10px 30px rgba(10, 12, 30, .3);
  border-radius: 14px; padding: 14px 16px 16px; transform-origin: top right; animation: tipIn .28s var(--ease) both; }
#tip.out { animation: tipOut .18s ease both; }
@keyframes tipIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } }
@keyframes tipOut { to { opacity: 0; transform: translateY(-6px) scale(.97); } }
#tip h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 9px; font-size: 21px; }
#tip h4 .ic { width: 24px; height: 24px; }
#tip p { margin: 0; white-space: pre-line; color: #d0d3db; font-family: var(--disp); font-weight: 500; font-size: 15px; line-height: 1.35; }
#tip .box { margin-top: 12px; background: rgba(255, 255, 255, .07); border-radius: 10px; padding: 12px 14px; font-family: var(--disp); font-weight: 500; text-transform: uppercase; color: #c9ccd5; }

/* ---------- Экран и нижняя панель ---------- */
#screen { flex: 1; min-height: 0; overflow-y: auto; padding: 72px 14px 104px; }
#screen.full { padding: 0; overflow: hidden; position: relative; }
.wrap { max-width: 760px; margin: 0 auto; }

#tabs { --skb: rgba(46, 48, 57, .92); --skr: 12px; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; padding: 4px 8px; }
#tabs::before { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#tabs button { --skb: var(--acc); --skr: 10px; width: 72px; padding: 8px 0 6px; color: #a9afbd; font-family: var(--disp); font-size: 11px; font-weight: 600; font-style: italic; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: color .25s; }
#tabs button::before { opacity: 0; transform: skewX(-9deg) scale(.85); transition: opacity .25s, transform .3s var(--ease); }
#tabs button .ic { width: 20px; height: 20px; }
#tabs button.on { color: #fff; }
#tabs button.on::before { opacity: 0; }
#tabs button { z-index: 1; transition: color .3s; }
/* плавная плашка выбранной вкладки — переезжает между кнопками */
#tabs .tabind { position: absolute; top: 4px; bottom: 4px; left: 0; width: 72px; z-index: 0; border-radius: 10px; background: var(--acc);
  transition: transform .38s var(--ease), width .38s var(--ease), opacity .2s; pointer-events: none; }
@media (max-width: 380px) { #tabs button { width: 66px; } }

/* ---------- Кнопки и общие блоки ---------- */
h2 { font-size: 34px; margin: 4px 0 14px; }
.btn { --skb: var(--acc); display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #fff;
  font-family: var(--disp); font-weight: 600; font-style: italic; text-transform: uppercase; letter-spacing: .02em; padding: 12px 26px; transition: transform .12s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:active::before { filter: brightness(.92); }
.btn.ghost { --skb: var(--panel2); color: var(--text); }
.btn.glass { --skb: rgba(255, 255, 255, .22); color: #fff; }
.btn.glass::before { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.white { --skb: #fff; color: #15171c; }
.btn.wide { display: flex; width: 100%; }
.btn.big { padding: 14px 28px; font-size: 19px; font-weight: 700; }
.btn.sm { padding: 8px 18px; font-size: 14px; --skr: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn .cost { --skb: rgba(0, 0, 0, .14); --skr: 12px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; font-size: .75em; font-style: normal; }
.btn .cost .ic { width: 18px; height: 18px; }
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: 4px; background: rgba(255, 255, 255, .14); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--acc1); transition: width .6s var(--ease); }
.st-new { color: var(--acc1); } .st-done { color: var(--ok); } .st-rejected { color: var(--bad); }
.dot { position: relative; }
.dot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 13px; height: 13px; border-radius: 50%; background: #c42b2b; border: 2px solid #4a1414; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }

/* ---------- Окна: заголовок над карточкой, круглый крестик снизу ---------- */
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(12, 13, 16, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .25s ease both; }
#modal.out { animation: fadeOut .2s ease both; }
@keyframes fadeOut { to { opacity: 0; } }
.mbox { width: 100%; max-width: 440px; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mbox > * { animation: ap .5s var(--ease) both; }
.mbox > :nth-child(2) { animation-delay: .07s; } .mbox > :nth-child(3) { animation-delay: .14s; } .mbox > :nth-child(4) { animation-delay: .21s; }
.mtitle { margin: 0; font-size: clamp(32px, 9vw, 46px); text-align: center; }
.mgain { display: flex; align-items: center; gap: 8px; margin-top: -8px; font-family: var(--disp); font-size: 22px; font-weight: 600; }
.mgain .ic { width: 28px; height: 28px; }
.sheet { width: 100%; min-height: 0; overflow-y: auto; background: #fff; color: #16181d; border-radius: 20px; padding: 18px; }
.sheet.glass { background: none; color: var(--text); padding: 0; overflow: visible; }
.mclose { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); backdrop-filter: blur(8px); display: grid; place-items: center; color: #fff; transition: transform .15s; }
.mclose:active { transform: scale(.92); }
.mclose .ic { width: 24px; height: 24px; }
.sheet:not(.glass) .mut { color: #6b7180; }
.sheet:not(.glass) input[type=text], .sheet:not(.glass) textarea { background: #f2f3f6; border-color: #e3e5ea; color: #16181d; }
.sheet:not(.glass) .btn.ghost { --skb: #eceef2; color: #16181d; }
.sheet:not(.glass) .bar { background: #e6e8ec; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eceef2; }
.kv b { display: inline-flex; align-items: center; gap: 6px; }

/* Светлая стеклянная панель и шапка поверх карты и магазина */
#tabs.light { --skb: rgba(255, 255, 255, .72); }
#tabs.light button { color: #6b7284; }
#tabs.light button.on { color: #fff; }
#top.light .chip { --skb: rgba(255, 255, 255, .28); }
#top.light .who small { color: rgba(255, 255, 255, .85); }

/* Значок-картинка вместо векторного (например, джойстик) */
.icimg { object-fit: contain; }

/* ---------- Экран загрузки ---------- */
/* Обои во весь экран; на широком экране — колонкой по центру поверх размытых обоев. Сверху — название и «Бета»,
   снизу слева — «Gold City загружается», справа — проценты. Пока не 100 %, приложение под ним недоступно. */
#boot { position: fixed; inset: 0; z-index: 100; background: #1a1240; overflow: hidden; transition: opacity .45s ease, transform .45s ease; }
#boot::before { content: ""; position: absolute; inset: -40px; background: var(--boot-bg, none) center / cover; filter: blur(26px) brightness(.7); }
#boot.done { opacity: 0; transform: scale(1.04); pointer-events: none; }
#boot .bt-col { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 60vh); background: var(--boot-bg, linear-gradient(#2a1d6e, #140c3c)) center / cover;
  box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
#boot .bt-col::before, #boot .bt-col::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; }
#boot .bt-col::before { top: 0; height: 160px; background: linear-gradient(rgba(20, 16, 60, .55), transparent); }
#boot .bt-col::after { bottom: 0; height: 220px; background: linear-gradient(transparent, rgba(16, 10, 50, .75)); }
#boot .bt-top { position: absolute; z-index: 1; left: 0; right: 0; top: calc(26px + env(safe-area-inset-top)); text-align: center; color: #fff;
  font-family: var(--disp); font-weight: 700; font-style: italic; font-size: clamp(34px, 11vw, 48px); letter-spacing: .02em; text-shadow: 0 3px 14px rgba(40, 20, 120, .6); }
#boot .bt-top sup { font-size: 13px; font-weight: 600; letter-spacing: .08em; vertical-align: top; margin-left: 6px; position: relative; top: 4px; text-shadow: none; opacity: .95; }
#boot .bt-bot { position: absolute; z-index: 1; left: 22px; right: 22px; bottom: calc(30px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
#boot .bt-l { color: #fff; font-family: var(--disp); font-weight: 700; font-style: italic; text-transform: uppercase; font-size: clamp(22px, 7vw, 30px); line-height: 1.08; text-shadow: 0 2px 12px rgba(0, 0, 0, .55); }
#boot .bt-p { color: #fff; font-family: var(--disp); font-weight: 700; font-style: italic; font-size: clamp(26px, 8vw, 34px); padding: 6px 26px; border-radius: 14px; white-space: nowrap;
  background: linear-gradient(100deg, #5b7cff, #8b4dff); box-shadow: 0 8px 24px rgba(91, 76, 255, .55); transform: skewX(-8deg); min-width: 116px; text-align: center; }
#boot .bt-p b { display: inline-block; min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
#tip .tipbtn { margin-top: 10px; }
/* плашка-подсказка из окна (например «i» в инвентаре) — поверх окна */
#modal:not([hidden]) ~ #tip, body:has(#modal:not([hidden])) #tip { z-index: 45; }
