@font-face { font-family: Montserrat; font-weight: 500; font-display: swap; src: url(../assets/fonts/montserrat-cyrillic-500.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Montserrat; font-weight: 500; font-display: swap; src: url(../assets/fonts/montserrat-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Montserrat; font-weight: 700; font-display: swap; src: url(../assets/fonts/montserrat-cyrillic-700.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Montserrat; font-weight: 700; font-display: swap; src: url(../assets/fonts/montserrat-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Montserrat; font-weight: 900; font-display: swap; src: url(../assets/fonts/montserrat-cyrillic-900.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Montserrat; font-weight: 900; font-display: swap; src: url(../assets/fonts/montserrat-latin-900.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ui-scale: 1;
  --pink: #ff5fb0;
  --pink2: #ff8fc4;
  --cyan: #5fd0ff;
  --yellow: #ffd23f;
  --green: #52e08a;
  --red: #ff4d5e;
  --ink: #241a3d;
  --panel: rgba(30, 20, 60, 0.72);
  --panel-solid: #2a1d52;
  --line: rgba(255, 255, 255, 0.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120b2a; color: #fff; font-family: Montserrat, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#kbd { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; font-size: 16px; }

.layer { position: fixed; inset: 0; zoom: var(--ui-scale); width: calc(100vw / var(--ui-scale)); height: calc(100vh / var(--ui-scale)); }
.hidden { display: none !important; }

/* ---------- кнопки ---------- */
.btn { border: 0; cursor: pointer; color: #fff; font-weight: 700; border-radius: 16px; transition: transform .12s, filter .12s, box-shadow .12s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { filter: grayscale(.7) brightness(.7); cursor: default; }
.btn-play {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  width: 100%; height: 92px; font-size: 38px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
  background: linear-gradient(180deg, #ff7cc0 0%, #ff3f9f 55%, #e02b86 100%);
  box-shadow: 0 7px 0 #a3125c, 0 14px 30px rgba(255, 63, 159, .45), inset 0 2px 0 rgba(255,255,255,.45);
  text-shadow: 0 3px 0 rgba(120, 10, 70, .5);
}
.btn-play:hover:not(:disabled) { box-shadow: 0 9px 0 #a3125c, 0 18px 40px rgba(255, 63, 159, .6), inset 0 2px 0 rgba(255,255,255,.45); }
.play-ico { font-size: 30px; }
.btn-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 96px; font-size: 18px; background: linear-gradient(180deg, rgba(120, 95, 220, .85), rgba(75, 52, 170, .9));
  box-shadow: 0 5px 0 #2f1f7a, inset 0 2px 0 rgba(255,255,255,.25);
}
.btn-tile .ico { font-size: 30px; line-height: 1; }
.btn-go { padding: 16px 30px; font-size: 22px; background: linear-gradient(180deg, #67eca0, #2fbf6a); box-shadow: 0 5px 0 #1b7f43; color: #0d3a20; font-weight: 900; }
.btn-sec { padding: 12px 22px; font-size: 17px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.btn-icon { width: 52px; height: 52px; font-size: 20px; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }

/* ---------- меню ---------- */
.screen { display: flex; justify-content: space-between; padding: 36px 44px; gap: 30px; pointer-events: none; }
.screen > * { pointer-events: auto; }
.menu-left { width: 470px; display: flex; flex-direction: column; gap: 18px; }
.logo { position: relative; height: 230px; border-radius: 26px; overflow: hidden; box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--pink), 0 18px 40px rgba(0,0,0,.5); transform: rotate(-1.5deg); }
.logo-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.logo-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 50px 20px 14px; background: linear-gradient(180deg, transparent, rgba(30, 12, 60, .88)); }
.logo-title { display: flex; gap: 14px; font-size: 64px; font-weight: 900; line-height: .95; letter-spacing: 1px; }
.logo-title span:first-child { color: #fff; text-shadow: 0 4px 0 var(--pink), 0 0 24px rgba(255, 95, 176, .8); }
.logo-title span:last-child { color: var(--yellow); text-shadow: 0 4px 0 #c46a00, 0 0 24px rgba(255, 210, 63, .7); }
.logo-sub { margin-top: 6px; font-size: 17px; font-weight: 700; color: #e9dcff; letter-spacing: 3px; text-transform: uppercase; }
.current-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border: 0; border-radius: 14px; background: var(--panel); color: #fff; font-size: 16px; text-align: left; cursor: pointer; box-shadow: inset 0 0 0 2px var(--line); backdrop-filter: blur(6px); }
.current-text:hover { box-shadow: inset 0 0 0 2px var(--pink2); }
.ct-label, .ct-meta { color: #bfb3e6; }
.ct-change { margin-left: auto; color: var(--pink2); font-weight: 700; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.menu-right { width: 400px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.player-card { display: grid; grid-template-columns: 92px 1fr; gap: 14px 16px; padding: 18px; border-radius: 22px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line), 0 12px 30px rgba(0,0,0,.35); backdrop-filter: blur(8px); }
.avatar { width: 92px; height: 92px; border-radius: 18px; background: radial-gradient(circle at 50% 40%, #6d4fd8, #2a1d52); image-rendering: pixelated; object-fit: contain; padding: 4px; }
.pc-name { font-weight: 900; font-size: 20px; }
.pc-level { font-size: 15px; color: #d7ccff; margin-top: 2px; }
.pc-level b { color: var(--yellow); font-size: 22px; }
.xp { height: 12px; margin-top: 8px; border-radius: 8px; background: rgba(0,0,0,.35); overflow: hidden; }
.xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--yellow)); border-radius: 8px; transition: width .6s; }
.pc-xptext { font-size: 12px; color: #bfb3e6; margin-top: 4px; }
.pc-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pc-stats div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 12px; background: rgba(255,255,255,.07); }
.pc-stats b { font-size: 24px; font-weight: 900; }
.pc-stats span { font-size: 12px; color: #bfb3e6; text-align: center; }
.hints { padding: 16px 18px; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); font-size: 15px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; backdrop-filter: blur(6px); }
.hints-title { font-weight: 900; font-size: 17px; color: var(--pink2); text-transform: uppercase; letter-spacing: 1px; }
kbd { display: inline-block; min-width: 26px; padding: 1px 7px; margin-right: 3px; border-radius: 6px; background: #f1ecff; color: var(--ink); font: 700 13px Montserrat, sans-serif; text-align: center; box-shadow: 0 3px 0 #9d8fd6; }
.hl-y { color: var(--yellow); font-weight: 700; }
.hl-r { color: var(--red); font-weight: 700; }
.mono { font-weight: 900; color: #d7ccff; }

/* ---------- HUD ---------- */
#hud { pointer-events: none; }
#hud button, #hud .vkbd { pointer-events: auto; }
.hud-top { position: absolute; top: 18px; left: 24px; right: 24px; display: flex; align-items: center; gap: 18px; }
.hud-stats { display: flex; gap: 10px; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 92px; padding: 8px 12px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); backdrop-filter: blur(6px); }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #bfb3e6; }
.stat b { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat.err b { color: #ff9aa5; }
.stat.bump b { animation: bump .3s; }
@keyframes bump { 40% { transform: scale(1.35); color: var(--red); } }
.hud-progress { position: relative; flex: 1; height: 26px; border-radius: 14px; background: rgba(0,0,0,.4); box-shadow: inset 0 0 0 2px var(--line); overflow: hidden; }
#h-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #b7f56b); border-radius: 14px; transition: width .15s; }
#h-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; text-shadow: 0 1px 2px #000; }

.lines {
  position: absolute; top: 86px; left: 50%; transform: translateX(-50%);
  padding: 12px 26px; border-radius: 20px; background: rgba(20, 12, 44, .8); box-shadow: inset 0 0 0 2px var(--line), 0 12px 30px rgba(0,0,0,.4);
  font-size: 26px; font-weight: 700; line-height: 1.5; white-space: pre; backdrop-filter: blur(8px); letter-spacing: .5px;
}
.line { color: #fff; opacity: .55; min-height: 1.55em; }
.line.cur { opacity: 1; }
.line .ok { color: var(--green); }
.line .now { position: relative; color: var(--ink); background: var(--yellow); border-radius: 6px; box-shadow: 0 0 0 2px var(--yellow), 0 0 16px rgba(255, 210, 63, .7); }
.line .now.bad { background: var(--red); box-shadow: 0 0 0 2px var(--red), 0 0 16px rgba(255, 77, 94, .8); color: #fff; animation: shake .25s; }
.line .sp { color: rgba(255,255,255,.35); }
.line .ok.sp { color: rgba(82, 224, 138, .6); }
.line .now.sp { color: var(--ink); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.layout-hint { position: absolute; top: 262px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 14px; background: var(--red); font-weight: 900; font-size: 20px; box-shadow: 0 8px 20px rgba(0,0,0,.4); animation: pop .25s; }
@keyframes pop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }
.start-hint { position: absolute; bottom: 250px; left: 50%; transform: translateX(-50%); padding: 10px 22px; border-radius: 30px; background: var(--panel); font-weight: 700; font-size: 18px; animation: pulse 1.6s infinite; white-space: nowrap; }
@keyframes pulse { 50% { opacity: .55; } }
.tap-kbd { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 14px 28px; font-size: 20px; background: var(--pink); box-shadow: 0 5px 0 #a3125c; }

/* экранная клавиатура-подсказка */
.vkbd { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 10px; border-radius: 16px; background: rgba(20, 12, 44, .78); box-shadow: inset 0 0 0 2px var(--line); display: flex; flex-direction: column; gap: 5px; backdrop-filter: blur(6px); }
.vrow { display: flex; gap: 5px; justify-content: center; }
.vkey { position: relative; width: 38px; height: 38px; border-radius: 9px; background: #f1ecff; color: var(--ink); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 #8f82c9; transition: background .08s, transform .08s; }
.vkey small { position: absolute; top: 3px; left: 6px; font-size: 10px; opacity: .55; }
.vkey.fn { background: #c9c2f0; font-size: 12px; }
.vkbd.fingers .vkey.f0 { background: #ffc2dc; } .vkbd.fingers .vkey.f1 { background: #ffd9b3; } .vkbd.fingers .vkey.f2 { background: #fff1a8; }
.vkbd.fingers .vkey.f3 { background: #c8f5c4; } .vkbd.fingers .vkey.f4 { background: #b8ecf5; } .vkbd.fingers .vkey.f5 { background: #fff1a8; }
.vkbd.fingers .vkey.f6 { background: #ffd9b3; } .vkbd.fingers .vkey.f7 { background: #ffc2dc; } .vkbd.fingers .vkey.f8 { background: #e2dcff; }
.vkey.target { background: var(--yellow) !important; transform: translateY(-3px); box-shadow: 0 7px 0 #c48a00, 0 0 18px rgba(255, 210, 63, .9); }
.vkey.pressed { transform: translateY(3px); box-shadow: 0 1px 0 #8f82c9; }
.vkey.home::after { content: ''; position: absolute; bottom: 7px; width: 12px; height: 3px; border-radius: 2px; background: currentColor; opacity: .5; }

/* ---------- модалки ---------- */
.modal-wrap { display: flex; align-items: center; justify-content: center; background: rgba(10, 5, 25, .6); backdrop-filter: blur(4px); }
.modal { overflow-x: hidden; position: relative; width: 760px; max-width: calc(100% - 40px); max-height: calc(100% - 40px); overflow: auto; padding: 28px 32px; border-radius: 26px; background: linear-gradient(180deg, #34246a, #22174a); box-shadow: 0 0 0 3px rgba(255,255,255,.15), 0 30px 70px rgba(0,0,0,.6); }
.modal section { display: none; }
.modal section.on { display: block; }
.modal h2 { margin: 0 0 16px; font-size: 32px; font-weight: 900; }
.modal-close { position: absolute; top: 18px; right: 18px; }
.muted { color: #bfb3e6; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.row .btn-go { margin-left: auto; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.lib-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.lib-item { min-width: 0; }
.lib-item { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 0; border-radius: 16px; text-align: left; color: #fff; cursor: pointer; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 2px var(--line); font-size: 14px; }
.lib-item:hover { background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 2px var(--pink2); }
.lib-item.sel { box-shadow: inset 0 0 0 3px var(--yellow); }
.lib-item b { font-size: 18px; }
.lib-item .meta { color: #bfb3e6; display: flex; gap: 10px; }
.lib-item .best { position: absolute; top: 12px; right: 14px; color: var(--yellow); font-weight: 900; }
.lib-item .prev { color: #d7ccff; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { color: var(--yellow); letter-spacing: 2px; }
.custom-text { width: 100%; height: 220px; padding: 14px; border-radius: 14px; border: 0; resize: vertical; font: 500 16px/1.5 Montserrat, sans-serif; background: rgba(0,0,0,.3); color: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.custom-text:focus { outline: none; box-shadow: inset 0 0 0 2px var(--pink2); }
.file-btn { display: inline-flex; align-items: center; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 700; }
.set input[type=range] { width: 260px; accent-color: var(--pink); }
.set input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--pink); }
table.rec { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rec th { text-align: left; color: #bfb3e6; font-weight: 700; padding: 6px 8px; }
table.rec td { padding: 8px; border-top: 1px solid var(--line); }
table.rec td b { color: var(--yellow); }

/* ---------- результат ---------- */
#result { display: flex; align-items: center; justify-content: flex-start; padding-left: 7vw; pointer-events: none; }
.result-card { pointer-events: auto; width: 520px; padding: 28px 30px; border-radius: 28px; background: rgba(34, 22, 74, .9); box-shadow: 0 0 0 3px rgba(255,255,255,.15), 0 30px 70px rgba(0,0,0,.5); animation: rise .5s cubic-bezier(.2,1.4,.4,1); backdrop-filter: blur(8px); }
@keyframes rise { from { transform: translateY(40px) scale(.9); opacity: 0; } }
.res-title { font-size: 32px; font-weight: 900; text-align: center; }
.res-record { margin: 10px auto 0; width: fit-content; padding: 6px 16px; border-radius: 20px; background: var(--yellow); color: var(--ink); font-weight: 900; animation: pulse 1s infinite; }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.res-grid div { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: 14px; background: rgba(255,255,255,.07); }
.res-grid b { font-size: 30px; font-weight: 900; }
.res-grid div:first-child b { color: var(--yellow); }
.res-grid span { font-size: 12px; color: #bfb3e6; text-align: center; }
.res-level { margin: -6px 0 16px; text-align: center; font-weight: 900; color: var(--pink2); font-size: 20px; }

.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #120b2a; font-weight: 700; font-size: 20px; transition: opacity .4s; }
.loading.fade { opacity: 0; pointer-events: none; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 6px solid rgba(255,255,255,.15); border-top-color: var(--pink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { display: flex; align-items: center; justify-content: center; padding: 40px; text-align: center; background: #120b2a; font-size: 22px; font-weight: 700; }

/* ---------- узкие/низкие экраны ---------- */
@media (max-aspect-ratio: 4/3) {
  .screen { flex-direction: column; justify-content: flex-start; padding: 24px; }
  .menu-left, .menu-right { width: 100%; max-width: 520px; margin: 0 auto; }
  .menu-right { justify-content: flex-start; }
  .hints { display: none; }
}
body.touch .vkbd { display: none; }
body.touch .start-hint { bottom: auto; top: 260px; }

/* низкий экран (телефон в альбомной ориентации): компактное меню */
body.short .screen { padding: 14px 20px; gap: 18px; }
body.short .menu-left { gap: 10px; width: 430px; }
body.short .logo { height: 104px; flex-shrink: 0; transform: none; }
body.short .logo-text { padding: 20px 14px 8px; }
body.short .logo-title { font-size: 40px; }
body.short .logo-sub { font-size: 12px; margin-top: 2px; }
body.short .btn-play { height: 64px; font-size: 28px; flex-shrink: 0; }
body.short .current-text { padding: 8px 12px; font-size: 14px; }
body.short .menu-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
body.short .btn-tile { height: 70px; font-size: 13px; }
body.short .btn-tile .ico { font-size: 22px; }
body.short .menu-right { width: 360px; justify-content: flex-start; }
body.short .player-card { padding: 12px; gap: 10px 12px; grid-template-columns: 64px 1fr; }
body.short .avatar { width: 64px; height: 64px; }
body.short .pc-stats b { font-size: 18px; }
body.short .hints { display: none; }
body.short .modal { padding: 18px 20px; }
body.short .modal h2 { font-size: 24px; margin-bottom: 10px; }
body.short .custom-text { height: 110px; }
body.short .lines { top: 70px; font-size: 22px; padding: 8px 18px; }
body.short .hud-top { top: 10px; }
body.short .stat { min-width: 70px; padding: 4px 8px; }
body.short .stat b { font-size: 20px; }
body.short .result-card { padding: 16px 20px; }
body.short .res-grid { margin: 10px 0; }
body.short .res-grid b { font-size: 22px; }
body.short .res-title { font-size: 24px; }

.ucl { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(20, 12, 44, .6); font-size: 11px; line-height: 1.35; color: #cfc4f0; }
.ucl img { height: 34px; width: auto; flex-shrink: 0; }
body.short .ucl { font-size: 9px; padding: 4px 8px; } body.short .ucl img { height: 22px; }
