/* Основа: шрифты, цвета, сброс, фон, экраны, кнопки, окна (modal / sheet), всплывашки, «рамка телефона» на ПК */
@font-face { font-family: Jura; src: url(../fonts/jura-light.woff2) format('woff2'); font-weight: 300; }
@font-face { font-family: Jura; src: url(../fonts/jura-regular.woff2) format('woff2'); font-weight: 400; }
@font-face { font-family: Jura; src: url(../fonts/jura-semibold.woff2) format('woff2'); font-weight: 600; }
@font-face { font-family: Jura; src: url(../fonts/jura-bold.woff2) format('woff2'); font-weight: 700; }

:root {
  --void: #05070d;
  --night: #0a1020;
  --glass: rgba(14, 22, 40, .72);
  --glass-hi: rgba(28, 42, 70, .55);
  --line: rgba(143, 196, 230, .18);
  --brass: #cfae6a;
  --brass-hi: #f1d79a;
  --brass-dim: #6f5a31;
  --holo: #8ee8ff;
  --ink: #e8eef7;
  --muted: #8b98ae;
  --main: #3fe0a5;
  --plus: #4aa3ff;
  --minus: #ff5168;
  --gold: #e9c46a;
  --ok: #5ef0b4;
  --bad: #ff6b7d;
  --circuit: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 100' preserveAspectRatio='none'><g fill='none' stroke='#fff' stroke-width='1' stroke-linejoin='round'><path d='M0 14 L8 14 L14 20 L14 30'/><path d='M0 30 L5 30 L10 35 L10 49 L7 52'/><path d='M0 62 L9 62 L14 57 L14 49'/><path d='M0 84 L6 84 L14 92'/><path d='M70 18 L63 18 L58 23 L58 35'/><path d='M70 44 L61 44 L61 54 L65 58'/><path d='M70 70 L64 70 L58 76 L58 84'/><path d='M70 88 L60 88 L56 84'/><path d='M22 0 L22 6 L26 10 L36 10'/><path d='M48 0 L48 5 L43 10 L37 10'/><path d='M18 100 L18 93 L24 87 L32 87'/><path d='M52 100 L52 94 L48 90 L48 84'/><path d='M4 4 L66 4 L66 96 L4 96 Z' stroke-width='.6' opacity='.7'/></g><g fill='#fff'><circle cx='14' cy='30' r='1.7'/><circle cx='7' cy='52' r='1.7'/><circle cx='14' cy='49' r='1.7'/><circle cx='14' cy='92' r='1.7'/><circle cx='58' cy='35' r='1.7'/><circle cx='65' cy='58' r='1.7'/><circle cx='58' cy='84' r='1.7'/><circle cx='56' cy='84' r='1.7'/><circle cx='36' cy='10' r='1.7'/><circle cx='37' cy='10' r='1.7'/><circle cx='32' cy='87' r='1.7'/><circle cx='48' cy='84' r='1.7'/></g></svg>");
  --font: Jura, "Roboto", system-ui, sans-serif;
  color-scheme: dark;
}

/* полосы прокрутки не показываем нигде (листается пальцем, колесом и тачпадом) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; overflow: hidden; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none; -webkit-touch-callout: none; }
input { font: inherit; font-size: 16px; color: var(--ink); user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- фон бара ---------- */
.bar-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(40% 26% at 12% 8%, rgba(255, 170, 80, .16), transparent 70%),
    radial-gradient(46% 30% at 92% 18%, rgba(70, 200, 255, .13), transparent 70%),
    radial-gradient(60% 40% at 50% 110%, rgba(160, 90, 255, .12), transparent 70%),
    linear-gradient(180deg, #0a1222 0%, #060a14 55%, #04060c 100%);
}
.bar-bg::before { content: ""; position: absolute; inset: -10%; opacity: .5;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 196, 120, .22) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 22%, rgba(140, 230, 255, .2) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 60%, rgba(255, 140, 200, .16) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 74%, rgba(140, 255, 200, .14) 0 2px, transparent 3px);
  background-size: 170px 190px, 230px 210px, 260px 240px, 200px 260px;
  filter: blur(2.5px);
}

.screen { position: fixed; inset: 0; z-index: 1; display: none; flex-direction: column; }
.screen.on { display: flex; animation: screen-in .2s ease-out; }
@keyframes screen-in { from { opacity: 0; } }        /* экран проявляется, а не появляется рывком */
@media (prefers-reduced-motion: reduce) { .screen.on { animation: none; } }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px 24px; }

/* ---------- кнопки ---------- */
.btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 50px; padding: 10px 18px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(36, 52, 84, .7), rgba(14, 22, 40, .8));
  box-shadow: inset 0 0 0 1px rgba(143, 196, 230, .22), inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 16px rgba(0, 0, 0, .35);
  font-weight: 600; font-size: 17px; letter-spacing: .02em; transition: transform .1s ease, filter .15s ease;
}
.btn small { font-weight: 400; font-size: 13px; color: var(--muted); letter-spacing: 0; }
.btn:active { transform: scale(.98); filter: brightness(1.2); }
.btn:disabled { opacity: .38; filter: grayscale(.5); }
.btn.primary { color: #1b1305;
  background: linear-gradient(180deg, #f3dca2 0%, #cfae6a 52%, #a8853f 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .6), inset 0 -2px 0 rgba(90, 60, 10, .35), 0 0 22px rgba(207, 174, 106, .25), 0 6px 16px rgba(0, 0, 0, .4);
}
.btn.primary small { color: rgba(40, 26, 4, .75); }
.btn.danger { color: #ffd3d9; box-shadow: inset 0 0 0 1px rgba(255, 81, 104, .55), 0 6px 16px rgba(0, 0, 0, .35); }
.btn.wide { width: 100%; }
.icon-btn { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; font-size: 24px; line-height: 1;
  background: rgba(14, 22, 40, .7); box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { filter: brightness(1.3); }

.topbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: max(env(safe-area-inset-top), 12px) 14px 10px; }
.topbar h2 { font-size: 21px; flex: 1; }
.purse-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(207, 174, 106, .1); box-shadow: inset 0 0 0 1px rgba(207, 174, 106, .4); color: var(--brass-hi); font-weight: 600; font-size: 15px; white-space: nowrap; }
.purse-chip .cr { width: 14px; height: 14px; }

.btn.quiet { color: var(--muted); background: rgba(10, 14, 26, .55); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; flex: none; }
.btn.danger:disabled { opacity: .5; }

.pimg { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }

.diff { display: inline-flex; gap: 3px; }
.diff i { width: 7px; height: 7px; transform: rotate(45deg); background: rgba(207, 174, 106, .22); }
.diff i.on { background: var(--brass-hi); box-shadow: 0 0 6px rgba(241, 215, 154, .6); }
.hint { color: var(--muted); font-size: 14px; margin: 2px 0 14px; }

.label { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--brass-hi); letter-spacing: .02em; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.label-row .label { margin: 0; }
.small { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ---------- всплывающие окна ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(2, 4, 9, .66); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { width: 100%; max-width: 560px; padding: 18px 16px max(env(safe-area-inset-bottom), 16px); border-radius: 22px 22px 0 0; display: grid; gap: 10px;
  background: rgba(10, 16, 30, .97); box-shadow: inset 0 1px 0 rgba(207, 174, 106, .45), 0 -20px 50px rgba(0, 0, 0, .6); animation: up .22s ease-out; }
.sheet-head { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; --cw: 52px; }
.sheet-head h3 { font-size: 19px; }
.sheet-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.res { font-size: 13px; }
.res.bad { color: var(--bad); }
.res.gold { color: var(--brass-hi); }
.btn.primary .res.gold { color: #3a2706; }
.modal-wrap { align-items: center; padding: 18px; }
.modal { width: 100%; max-width: 420px; max-height: calc(100vh - 36px); overflow-y: auto; padding: 18px; border-radius: 22px; text-align: center;
  background: rgba(10, 16, 30, .97); box-shadow: inset 0 0 0 1px rgba(207, 174, 106, .38), 0 20px 60px rgba(0, 0, 0, .7); animation: pop .22s ease-out; }
.modal > .portrait { width: 112px; height: 112px; margin: 2px auto 12px; border-radius: 22px; overflow: hidden; box-shadow: 0 0 26px var(--glow, rgba(207, 174, 106, .3)); }
.modal h2 { font-size: 26px; }
.modal .sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.modal .quote { margin: 14px 0 4px; font-size: 15.5px; color: #dbe3ee; }
.modal .reason { color: var(--muted); margin-top: 6px; }
.modal .quote .who { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.modal .score { font-size: 34px; font-weight: 600; letter-spacing: .1em; margin: 6px 0; }
.modal .score.wage { color: var(--ok); font-size: 30px; }
.modal .money { font-size: 16px; font-weight: 600; margin-top: 4px; }
.modal .btns { display: grid; gap: 10px; margin-top: 16px; }
.modal p { text-wrap: pretty; }        /* без висячих коротких слов в конце абзаца («20 с.» одной строкой) */
/* невысокие экраны: окну — чуть больше места по высоте */
@media (max-height: 820px) { .modal-wrap { padding: 12px; } .modal { max-height: calc(100vh - 24px); } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.toast { position: fixed; z-index: 40; left: 50%; bottom: max(calc(env(safe-area-inset-bottom) + 90px), 100px); transform: translate(-50%, 10px); max-width: calc(100% - 40px);
  padding: 10px 16px; border-radius: 12px; background: rgba(14, 22, 40, .97); box-shadow: inset 0 0 0 1px rgba(207, 174, 106, .4); font-size: 14.5px; text-align: center; opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.crash-log { max-height: 40vh; overflow: auto; margin: 10px 0; padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px var(--line);
  font: 11px/1.4 ui-monospace, monospace; color: #9fb0c6; text-align: left; white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }

@media (min-width: 600px) {
  .scroll, .menu-body { max-width: 620px; margin-left: auto; margin-right: auto; width: 100%; }
}

/* ---------- Компьютер: игра в «экране телефона» ---------- */
@media (min-width: 760px) and (min-height: 600px) and (hover: hover) and (pointer: fine) {
  html { background: #05070d; }
  html::before { content: ""; position: fixed; inset: -40px; background: url(../img/bar.webp) center 22% / cover no-repeat; filter: blur(22px) brightness(.42) saturate(1.25); }
  html::after { content: "Лучше всего — на телефоне. Как установить: twosun.ru/install"; position: fixed; left: 0; right: 0; bottom: 14px; text-align: center; font: 13px/1.4 var(--font); color: rgba(233, 225, 211, .55); letter-spacing: .02em; }
  body { position: relative; width: 390px; height: min(844px, calc(100vh - 64px)); margin: max(20px, calc((100vh - 844px) / 2 - 10px)) auto 0; border-radius: 48px; overflow: hidden; transform: translateZ(0);
    box-shadow: 0 0 0 9px #0c0e13, 0 0 0 11px #2b3140, 0 0 0 12px #0a0b0f, 0 40px 90px rgba(0, 0, 0, .65), 0 0 120px rgba(255, 150, 80, .12); }
  .screen { top: 20px; bottom: 12px; }
  #s-menu { top: 0; bottom: 0; }
}
