/* Парк атракціонів — яскравий «парковий» стиль: кремові панелі, кораловий акцент, бірюза, шрифт Nunito.
   ПК (≥1100px): ліва колонка HUD+меню, права панель завжди відкрита, інструменти внизу по центру. Телефон: HUD зверху, меню знизу, панель — лист. */
:root { --cream: #fff8ec; --cream2: #fff1db; --line: #f0dcc0; --ink: #3a2f2a; --dim: #8a7a6a; --coral: #ff6b6b; --coral2: #ff8f6b; --teal: #2fb8a8; --gold: #ffb52e; --bad: #e84a4a; --ok: #3fa34d; --sat: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a8dcf5; color: var(--ink); font: 14px/1.4 Nunito, system-ui, sans-serif; user-select: none; }
#cv { position: fixed; inset: 0; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
.off { display: none !important; }

/* ---------- ліва колонка ---------- */
#side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--cream); border-right: 1px solid var(--line); z-index: 5; box-shadow: 4px 0 20px rgba(120,80,40,.08); }
.hud { display: flex; flex-direction: column; gap: 10px; }
.brand b { display: block; font-size: 22px; font-weight: 900; color: var(--coral); letter-spacing: -.01em; }
.brand small { color: var(--dim); font-weight: 700; }
.coins { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 9px 12px; }
.coins b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coins small { margin-left: auto; color: var(--ok); font-weight: 800; font-size: 12.5px; white-space: nowrap; } .coins small.neg { color: var(--bad); }
.coin { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4b8, #ffb52e 60%, #c97a00); flex: none; box-shadow: 0 1px 0 #a86400; }
.lvl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 9px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
.lvl .lv { grid-row: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--coral), var(--coral2)); color: #fff; box-shadow: 0 2px 0 #c94a4a; }
.lvl .lv small { font-size: 9px; font-weight: 800; margin-bottom: -4px; } .lvl .lv b { font-size: 19px; font-weight: 900; }
.lvl .bar { height: 8px; border-radius: 6px; background: var(--cream2); overflow: hidden; } .lvl .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coral), var(--gold)); border-radius: 6px; transition: width .3s; }
.lvl > small { color: var(--dim); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m { padding: 7px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); min-width: 0; }
.m span { display: block; font-size: 11px; color: var(--dim); font-weight: 800; } .m b { display: block; font-size: 17px; font-weight: 900; white-space: nowrap; }
.m.wide { grid-column: span 2; display: flex; justify-content: space-between; align-items: center; } .m.wide span { font-size: 13px; color: var(--ink); } .m.wide b { font-size: 13px; color: var(--coral); }
.m.warn b { color: var(--bad); }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.nav button { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--dim); cursor: pointer; text-align: left; font-weight: 800; }
.nav button:hover { background: var(--cream2); }
.nav button.on { background: #fff; color: var(--coral); box-shadow: 0 2px 8px rgba(200,120,60,.15); }
.nav svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dot { position: absolute; left: 28px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); border: 2px solid var(--cream); }

/* ---------- інструменти на карті ---------- */
#tools { position: fixed; z-index: 6; left: calc(270px + (100vw - 650px) / 2); transform: translateX(-50%); bottom: 18px; display: flex; gap: 6px; padding: 6px; border-radius: 18px; background: rgba(255,248,236,.96); box-shadow: 0 6px 24px rgba(80,50,20,.2); border: 1px solid var(--line); }
#tools button { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border: 0; border-radius: 13px; background: #fff; cursor: pointer; font-weight: 800; color: var(--ink); box-shadow: 0 1px 0 var(--line); }
#tools button.sq { width: 44px; padding: 0; justify-content: center; }
#tools button:hover { background: var(--cream2); }
#tools button.on { background: var(--coral); color: #fff; }
#tools svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#tools .sep { width: 1px; background: var(--line); margin: 4px 2px; }
#modeBar { position: fixed; z-index: 6; left: calc(270px + (100vw - 650px) / 2); transform: translateX(-50%); bottom: 82px; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100vw - 680px); }
#modeBar button { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--coral); color: #fff; cursor: pointer; font-weight: 800; white-space: nowrap; }

/* ---------- права панель ---------- */
#panel { position: fixed; right: 0; top: 0; bottom: 0; width: 380px; background: var(--cream); border-left: 1px solid var(--line); z-index: 7; display: flex; flex-direction: column; box-shadow: -4px 0 20px rgba(120,80,40,.08); }
#panel header { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; }
#panel h2 { margin: 0; font-size: 21px; font-weight: 900; flex: 1; }
#panel .x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--cream2); cursor: pointer; display: none; }
#panelBody { flex: 1; overflow-y: auto; padding: 0 16px 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 900; color: var(--coral); text-transform: uppercase; letter-spacing: .05em; }
.card p { margin: 0 0 6px; }
.note { color: var(--dim); font-size: 12.5px; margin: 6px 0 0; line-height: 1.45; }
.hint { padding: 9px 12px; border-radius: 12px; margin-bottom: 8px; font-size: 13px; font-weight: 600; background: #fff; border-left: 4px solid var(--gold); }
.hint.bad { border-left-color: var(--bad); background: #fff1ef; } .hint.warn { border-left-color: var(--gold); background: #fff8e6; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px; margin-top: 8px; border-radius: 13px; border: 1px solid var(--line); cursor: pointer; font-weight: 800; font-size: 14.5px; background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.btn:hover { background: var(--cream2); }
.btn.go { background: linear-gradient(180deg, var(--coral2), var(--coral)); color: #fff; border-color: transparent; box-shadow: 0 3px 0 #c94a4a; }
.btn.go:hover { filter: brightness(1.05); }
.btn.warn { background: #fff3d6; border-color: var(--gold); }
.btn.bad { background: #fff1ef; border-color: #f5c2bb; color: var(--bad); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn small { font-weight: 700; opacity: .85; font-size: 12px; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 6px; }
.bulk { display: flex; gap: 4px; margin-top: 6px; } .bulk button { flex: 1; padding: 7px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; color: var(--dim); }
.bulk button.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.stats div { background: var(--cream); border-radius: 10px; padding: 6px 8px; } .stats small { display: block; color: var(--dim); font-size: 11px; font-weight: 700; } .stats b { font-size: 16px; font-weight: 900; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13.5px; } .kv span { color: var(--dim); font-weight: 700; } .kv b { font-weight: 800; } .kv.tot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; } .kv b.bad, .bad { color: var(--bad); }
.mbar { width: 46%; height: 8px; border-radius: 6px; background: var(--cream2); overflow: hidden; flex: none; } .mbar i { display: block; height: 100%; background: var(--teal); border-radius: 6px; } .mbar.bad i { background: var(--bad); }
.row { display: flex; align-items: center; gap: 10px; } .row .ic img { width: 72px; height: 72px; } .row .tx b { display: block; font-size: 16px; font-weight: 900; } .row .tx small { color: var(--dim); font-weight: 700; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; } .tabs button { flex: 1; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; font-size: 12.5px; color: var(--dim); }
.tabs button.on { background: var(--coral); border-color: var(--coral); color: #fff; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.it { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 10px; border-radius: 16px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: center; box-shadow: 0 2px 0 var(--line); }
.it:hover { border-color: var(--coral); }
.it img { width: 64px; height: 64px; } .it b { font-size: 13.5px; font-weight: 900; line-height: 1.15; } .it b small { color: var(--teal); font-size: 11px; } .it small { color: var(--dim); font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.it .cost { margin-top: 3px; font-weight: 900; color: var(--ok); } .it.poor .cost { color: var(--bad); } .it.lock { opacity: .5; cursor: default; } .it.lock .cost { color: var(--dim); }
.it i { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 11px; font-weight: 900; color: #fff; background: var(--teal); border-radius: 8px; padding: 0 6px; }
.ach { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; } .ach .a { padding: 8px; border-radius: 10px; background: #fff; color: var(--dim); font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); }
.ach .a.on { color: var(--ink); border-color: var(--gold); background: #fff8e6; }
.big { font-size: 32px; font-weight: 900; color: var(--coral); }

/* ---------- модалка й тости ---------- */
#modal { position: fixed; inset: 0; z-index: 60; background: rgba(60,40,20,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
#modal .box { width: 100%; max-width: 440px; background: var(--cream); border-radius: 22px; padding: 22px; text-align: center; box-shadow: 0 20px 60px rgba(60,30,10,.35); max-height: 90vh; overflow-y: auto; border-top: 8px solid var(--coral); }
#modal h2 { margin: 0 0 10px; font-size: 24px; font-weight: 900; color: var(--coral); }
#modal p { color: var(--ink); margin: 0 0 12px; line-height: 1.5; }
#modal .btns { display: flex; gap: 8px; } #modal .btns .btn { flex: 1; }
#modal .list { text-align: left; font-size: 13.5px; margin: 0 0 6px; padding: 10px 12px; border-radius: 12px; background: #fff; display: flex; flex-direction: column; gap: 7px; }
#toasts { position: fixed; left: calc(270px + (100vw - 650px) / 2); top: 14px; transform: translateX(-50%); z-index: 45; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #fff; border-radius: 14px; padding: 9px 16px; font-weight: 700; box-shadow: 0 8px 24px rgba(80,50,20,.22); animation: tin .25s ease-out; max-width: 90vw; border-left: 5px solid var(--teal); }
.toast.bad { border-left-color: var(--bad); } .toast.gold { border-left-color: var(--gold); } .toast.good { border-left-color: var(--ok); }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: #ead2b0; border-radius: 6px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- телефон ---------- */
@media (max-width: 1099px) {
    #side { inset: 0 0 auto 0; width: auto; height: auto; padding: 0; background: none; border: 0; box-shadow: none; display: block; pointer-events: none; }
    .hud { position: fixed; top: 0; left: 0; right: 0; padding: 6px 8px; padding-top: calc(6px + var(--sat)); display: grid; grid-template-columns: 1fr auto auto; gap: 6px; background: var(--cream); border-bottom: 1px solid var(--line); pointer-events: auto; }
    .brand { display: none; }
    .coins { padding: 4px 9px; gap: 0 6px; flex-wrap: wrap; min-width: 0; } .coins b { font-size: 17px; } .coin { width: 16px; height: 16px; } .coins small { font-size: 11px; flex-basis: 100%; margin: -3px 0 0 22px; }
    .lvl { padding: 4px 8px; gap: 1px 8px; } .lvl .lv { width: 34px; height: 34px; } .lvl .lv b { font-size: 15px; } .lvl .lv small { font-size: 7px; } .lvl > small, .lvl .bar { display: none; } .lvl { display: flex; }
    .meters { grid-template-columns: auto auto; gap: 4px; } .m { padding: 3px 7px; } .m span { font-size: 9px; } .m b { font-size: 13px; } .m.wide { display: none; }
    .nav { position: fixed; left: 0; right: 0; bottom: 0; height: 62px; flex-direction: row; gap: 0; margin: 0; background: var(--cream); border-top: 1px solid var(--line); pointer-events: auto; padding-bottom: env(safe-area-inset-bottom); }
    .nav button { flex: 1; flex-direction: column; gap: 2px; padding: 7px 0 5px; border-radius: 0; font-size: 10px; text-align: center; min-width: 0; }
    .nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .nav button.on { box-shadow: inset 0 3px 0 var(--coral); background: none; }
    .dot { left: calc(50% + 6px); top: 5px; }
    #tools { left: 50%; bottom: 72px; gap: 4px; padding: 4px; } #tools button { height: 40px; padding: 0 10px; font-size: 13px; } #tools button.sq { width: 40px; }
    #tools span { display: none; } #tools button[data-tool] { padding: 0; width: 44px; justify-content: center; }
    #modeBar { left: 50%; bottom: 124px; max-width: 94vw; font-size: 13px; }
    #panel { top: auto; left: 0; width: auto; max-height: 70vh; border-left: 0; border-radius: 22px 22px 0 0; bottom: 62px; transition: transform .2s ease, visibility .2s; box-shadow: 0 -12px 40px rgba(80,50,20,.25); }
    #panel.closed { transform: translateY(calc(100% + 90px)); visibility: hidden; pointer-events: none; }
    #panel .x { display: grid; place-items: center; }
    #toasts { left: 50%; top: calc(66px + var(--sat)); width: 92vw; }
    .toast { font-size: 13px; padding: 7px 11px; text-align: center; }
}
