/* Dev Tycoon — інтерфейс */
:root {
    --bg: #0b0f1a;
    --glass: rgba(14, 20, 36, 0.9);
    --glass2: rgba(19, 27, 48, 0.97);
    --line: rgba(96, 165, 250, 0.28);
    --line2: rgba(148, 163, 184, 0.16);
    --txt: #e7ecf6;
    --dim: #93a1bd;
    --blue: #60a5fa;
    --yellow: #facc15;
    --green: #4ade80;
    --red: #f87171;
    --orange: #fb923c;
    --r: 14px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    color-scheme: dark;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(96, 165, 250, 0.45) rgba(255, 255, 255, 0.04); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: rgba(96, 165, 250, 0.45); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
html, body { margin: 0; height: 100%; }
body { position: fixed; inset: 0; overflow: hidden; background: var(--bg); color: var(--txt); font-family: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.off { display: none !important; }
.h { font-family: 'Unbounded', 'Rubik', sans-serif; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: var(--r); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5); }
.ib { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); color: #dbeafe; }
.ib svg { width: 22px; height: 22px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #0e1424; }
.badge.ok { background: var(--green); color: #052e16; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 13px; border-radius: 10px; font-weight: 700; font-size: 13px; background: rgba(96, 165, 250, 0.12); border: 1px solid rgba(96, 165, 250, 0.5); color: #dbeafe; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn.gold { background: linear-gradient(180deg, #fde047, #f59e0b); color: #241503; border-color: #facc15; }
.btn.green { background: rgba(74, 222, 128, 0.14); border-color: rgba(74, 222, 128, 0.5); color: #bbf7d0; }
.btn.red { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.5); color: #fecaca; }
.btn.dim, .btn:disabled { background: rgba(148, 163, 184, 0.06); border-color: rgba(148, 163, 184, 0.2); color: #7d8aa5; }
.btn:disabled { cursor: not-allowed; }
.btn.sm { padding: 6px 9px; font-size: 12px; }
.btn.xs { padding: 3px 7px; font-size: 11px; border-radius: 7px; }
.muted { color: var(--dim); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width 0.25s; }
.money { color: var(--yellow); font-weight: 800; }

/* ---------- верх ---------- */
#top { position: absolute; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; z-index: 20; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; flex-wrap: wrap; }
#top > * { pointer-events: auto; }
#studioChip { display: flex; flex-direction: column; padding: 5px 12px; min-height: 44px; justify-content: center; text-align: left; max-width: 40vw; }
#studioChip b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#studioChip small { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.stat { display: flex; flex-direction: column; align-items: flex-end; padding: 5px 12px; min-width: 84px; }
.stat small { font-size: 9px; letter-spacing: 0.14em; color: var(--dim); font-weight: 700; text-transform: uppercase; }
.stat b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { font-size: 10.5px; font-weight: 700; }
#moneyStat b { color: #fff; font-size: 19px; }
#moneyStat b::before { content: '₴ '; color: var(--yellow); }

/* ---------- проєкт ---------- */
#proj { position: absolute; z-index: 19; left: 50%; transform: translateX(-50%); top: calc(64px + var(--safe-t)); width: min(560px, calc(100% - 16px)); padding: 10px 12px; }
#proj .ttl { display: flex; align-items: center; gap: 8px; }
#proj .ttl b { font-size: 14px; }
#proj .ttl small { font-size: 11px; color: var(--dim); }
#proj .pts { display: flex; gap: 12px; font-size: 12px; font-weight: 800; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.pd { color: #93c5fd; } .pt { color: #fdba74; } .pb { color: #fca5a5; } .pr { color: #86efac; }
#proj .bar { margin-top: 6px; height: 8px; }

/* ---------- низ ---------- */
#dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 8px calc(8px + var(--safe-b)); display: flex; justify-content: center; pointer-events: none; }
#nav { display: flex; gap: 4px; padding: 6px; pointer-events: auto; overflow-x: auto; max-width: 100%; }
.nb { flex: none; width: 70px; height: 58px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: #dbe4f5; position: relative; }
.nb svg { width: 23px; height: 23px; color: var(--blue); }
.nb.main svg { color: var(--yellow); }
.nb:active { transform: scale(0.95); }

/* ---------- картка ---------- */
#card { position: absolute; z-index: 25; left: 8px; right: 8px; bottom: calc(84px + var(--safe-b)); max-width: 430px; margin: 0 auto; padding: 12px; max-height: 58vh; overflow-y: auto; }
#card h3 { margin: 0; font-size: 16px; }
#card .x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; color: var(--dim); }
.sec { margin-top: 10px; }
.lbl { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; margin-bottom: 5px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed rgba(148, 163, 184, 0.12); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.av { width: 54px; height: 54px; flex: none; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line2); }
.skills { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; font-size: 12px; }

/* ---------- панелі ---------- */
#sheet { position: absolute; inset: 0; z-index: 40; background: rgba(4, 6, 12, 0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: calc(10px + var(--safe-t)) 10px calc(10px + var(--safe-b)); }
.sheet-box { width: min(700px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--glass2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); animation: pop 0.18s ease-out; overflow: hidden; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.sheet-box > header { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line2); }
.sheet-box > header h2 { margin: 0; font-size: 16px; flex: 1; font-family: 'Unbounded', 'Rubik', sans-serif; font-weight: 700; }
.sheet-box > header svg { width: 22px; height: 22px; color: var(--yellow); }
.sheet-box > header .x { width: 34px; height: 34px; border-radius: 10px; color: var(--dim); font-size: 18px; }
#sheetBody { padding: 12px 14px 16px; overflow-y: auto; min-height: 0; }
.subtabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.subtabs button { padding: 6px 11px; border-radius: 9px; font-size: 12px; font-weight: 700; color: var(--dim); border: 1px solid var(--line2); }
.subtabs button.on { color: #fff; border-color: var(--blue); background: rgba(96, 165, 250, 0.14); }
.card { position: relative; padding: 10px 12px; border-radius: 13px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line2); margin-bottom: 8px; }
.card h4 { margin: 0; font-size: 14px; }
.card p { margin: 3px 0 0; font-size: 12px; color: var(--dim); line-height: 1.35; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.opt { position: relative; padding: 8px 9px; border-radius: 11px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.03); font-size: 12.5px; font-weight: 700; text-align: left; min-height: 40px; }
.opt small { display: block; font-size: 10.5px; font-weight: 500; color: var(--dim); margin-top: 2px; }
.opt.on { border-color: var(--yellow); background: rgba(250, 204, 21, 0.12); box-shadow: 0 0 12px rgba(250, 204, 21, 0.2); }
.opt.lock { opacity: 0.45; }
.opt .tag { position: absolute; top: 4px; right: 6px; font-size: 12px; }
.step { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: var(--yellow); text-transform: uppercase; margin: 12px 0 6px; }
.inp { width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); outline: none; font-size: 14px; }
.slider-row { padding: 10px 0; border-bottom: 1px dashed rgba(148, 163, 184, 0.14); }
.slider-row .row b { font-size: 14px; }
.slider-row input[type=range] { width: 100%; accent-color: var(--yellow); height: 26px; }
.stars { color: var(--yellow); font-size: 12px; letter-spacing: 1px; }
.rev { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.rev > div { padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); text-align: left; animation: flip 0.45s ease-out backwards; }
.rev > div:nth-child(2) { animation-delay: 0.25s; } .rev > div:nth-child(3) { animation-delay: 0.5s; } .rev > div:nth-child(4) { animation-delay: 0.75s; }
.rev b { display: block; font-size: 12px; color: var(--dim); }
.rev .sc { font-size: 30px; font-weight: 900; font-family: 'Unbounded', sans-serif; }
.rev i { display: block; font-size: 11.5px; color: #cbd5e1; margin-top: 4px; }
@keyframes flip { from { transform: rotateY(90deg); opacity: 0; } }
.staff { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.03); margin-bottom: 6px; }
.staff img { width: 46px; height: 46px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); flex: none; }
.staff .nm { font-weight: 700; font-size: 13px; }
.staff small { display: block; font-size: 11px; color: var(--dim); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.chips span { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); }
.gm { padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.03); margin-bottom: 6px; }
.score { font-family: 'Unbounded', sans-serif; font-weight: 800; font-size: 18px; min-width: 44px; text-align: center; padding: 3px 6px; border-radius: 9px; }
.combo-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.combo-table th, .combo-table td { padding: 3px 4px; text-align: center; border-bottom: 1px solid rgba(148, 163, 184, 0.1); }
.combo-table th { color: var(--dim); font-weight: 700; }
.combo-table td:first-child, .combo-table th:first-child { text-align: left; white-space: nowrap; }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.03); font-weight: 700; font-size: 14px; text-align: left; }
.menu-list svg { width: 20px; height: 20px; color: var(--blue); flex: none; }
.menu-list .danger { color: #fca5a5; }
.ach { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 11px; border: 1px solid var(--line2); margin-bottom: 6px; opacity: 0.45; }
.ach.got { opacity: 1; border-color: rgba(250, 204, 21, 0.5); background: rgba(250, 204, 21, 0.06); }
.ach b { font-size: 13px; } .ach small { display: block; font-size: 11.5px; color: var(--dim); }
.help p { font-size: 13px; line-height: 1.5; margin: 0 0 9px; color: #d6deec; }
.help b { color: var(--yellow); }
.help h4 { margin: 14px 0 6px; font-size: 14px; color: var(--blue); }

.modal { position: absolute; inset: 0; z-index: 60; background: rgba(4, 6, 12, 0.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .box { width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: 18px; text-align: center; border-radius: 18px; background: var(--glass2); border: 1px solid rgba(250, 204, 21, 0.45); box-shadow: 0 0 60px rgba(96, 165, 250, 0.12); animation: pop 0.2s ease-out; }
.modal h2 { margin: 4px 0; font-size: 19px; font-family: 'Unbounded', 'Rubik', sans-serif; }
.modal .btn.wide { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.sumrow { display: flex; justify-content: space-between; padding: 6px 2px; font-size: 14px; border-bottom: 1px dashed rgba(148, 163, 184, 0.12); }
#toasts { position: absolute; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(150px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(460px, 92vw); }
.toast { padding: 9px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; background: rgba(14, 20, 36, 0.96); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); animation: tin 0.2s ease-out; transition: opacity 0.3s, transform 0.3s; text-align: center; }
.toast.err { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.toast.good { border-color: rgba(74, 222, 128, 0.6); color: #bbf7d0; }
.toast.gold { border-color: rgba(250, 204, 21, 0.7); color: #fde68a; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
#hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 18; width: min(460px, calc(100% - 16px)); padding: 9px 34px 9px 12px; font-size: 13px; line-height: 1.35; border-color: rgba(250, 204, 21, 0.55); }
#hint b { color: var(--yellow); }
#hint .x { position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; color: var(--dim); }
#hint .stp { font-size: 10px; font-weight: 800; letter-spacing: 0.15em; color: var(--yellow); display: block; margin-bottom: 2px; }
body.carded #hint { display: none; }

@media (min-width: 900px) { #card { left: auto; right: 12px; bottom: auto; top: calc(130px + var(--safe-t)); margin: 0; width: 370px; } }
@media (max-width: 520px) {
    .stat { min-width: 0; padding: 4px 8px; } .stat b { font-size: 14px; } #moneyStat b { font-size: 16px; }
    #studioChip { max-width: 100%; flex: 1; }
    .nb { width: 58px; font-size: 9.5px; }
    #proj { top: calc(112px + var(--safe-t)); }
    #toasts { top: calc(200px + var(--safe-t)); }
    .rev { grid-template-columns: 1fr 1fr; }
}
