:root {
  --bg: #0f1724;
  --panel: rgba(15, 23, 36, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef3fa;
  --muted: #9aa8bb;
  --accent: #ff8a3d;
  --danger: #ff4d5e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }
#app { position: fixed; inset: 0; min-width: 0; min-height: 0; overflow: hidden; }
#app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2); font: 600 11px/1.4 ui-monospace, monospace; text-align: center; margin-right: 2px; }
button, select, input, textarea { font: inherit; color: var(--text); }
button { background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { background: rgba(255,255,255,0.16); }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a0f05; font-weight: 600; }
button.danger { color: var(--danger); }
button.on { background: rgba(255,138,61,0.3); border-color: var(--accent); }
select, input, textarea { background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- Меню ---------- */
#menu { position: fixed; inset: 0; pointer-events: none; }
#menu > * { pointer-events: auto; }
#menu-top { position: absolute; z-index: 2; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 22px;
  backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0,0,0,0.3); white-space: nowrap; max-width: calc(100% - 32px); }
#menu-top .logo { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
#menu-tabs { display: flex; gap: 4px; }
#menu-tabs button { border-radius: 999px; padding: 9px 16px; font-size: 15px; font-weight: 600; background: transparent; border-color: transparent; }
#menu-tabs button.active { background: var(--accent); color: #1a0f05; }
#settings-open { border-radius: 999px; width: 38px; height: 38px; padding: 0; font-size: 21px; line-height: 1; flex: 0 0 auto; }
#menu > .menu-tab { position: absolute; inset: 0; pointer-events: none; display: none; }
#menu > .menu-tab.active { display: block; }
.menu-tab > * { pointer-events: auto; }
.menu-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px;
  backdrop-filter: blur(8px); box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.menu-card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 8px; }
.menu-card h2:first-child { margin-top: 0; }
.menu-chip { position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  backdrop-filter: blur(8px); font-size: 13px; }
#map-help { bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; white-space: nowrap; }
#level-card {
  position: absolute; transform: translate(-50%, -100%); z-index: 1;
  display: grid; justify-items: center; gap: 4px; padding: 7px 10px;
  min-width: 110px; max-width: min(210px, 48vw); width: max-content;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  text-align: center;
}
#lc-name { font-size: 14px; line-height: 1.15; }
#lc-time { font-size: 11px; color: var(--muted); }
#lc-play { font-size: 13px; min-height: 32px; padding: 4px 12px; }
#lc-play:disabled { opacity: 0.45; cursor: not-allowed; }
#menu-account { position: relative; }
#menu-keys {
  top: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px; padding: 3px 9px; color: #ffd23f;
}
#acc-btn.hidden + #menu-keys { position: static; transform: none; }
#acc-btn { border-radius: 999px; padding: 8px 14px; font-weight: 600; }
#acc-btn.hidden, #acc-modal.hidden, #acc-in.hidden, #acc-out.hidden { display: none; }
#acc-modal { position: absolute; inset: var(--acc-visible-top, 0px) 0 auto; height: var(--acc-visible-height, 100%); z-index: 3; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; }
#acc-modal .menu-card { position: relative; width: min(400px, calc(100% - 32px)); max-height: calc(100% - 24px); overflow: auto; }
#acc-modal form label { display: block; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
#acc-modal form input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; font-size: 16px; padding: 9px 10px; }
#acc-modal .acc-code { position: relative; margin: 6px 0 0; }
#acc-code-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(3px, 1.5vw, 8px); }
#acc-code-cells span { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line);
  border-radius: 8px; background: #0b1523; font-size: clamp(16px, 5vw, 24px); font-weight: 700; }
#acc-modal #acc-email-code { position: absolute; inset: 0; height: 100%; margin: 0; opacity: .01; }
.acc-code:focus-within #acc-code-cells { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.acc-password-input { display: block; position: relative; }
#acc-modal .acc-password-input input { padding-right: 49px; }
.acc-password-toggle { position: absolute; inset: 0 0 0 auto; width: 44px; display: grid; place-items: center; padding: 0; }
.acc-password-toggle span { width: 19px; height: 12px; border: 2px solid currentColor; border-radius: 75% 40%; position: relative; }
.acc-password-toggle span::before { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; inset: 0; margin: auto; }
.acc-password-toggle[aria-pressed="true"] span::after { content: ''; position: absolute; width: 23px; height: 2px;
  background: currentColor; left: -4px; top: 3px; transform: rotate(-45deg); }
#acc-email button:disabled { cursor: wait; opacity: .7; }
#acc-delete-dialog { color: var(--text); }
#acc-delete-dialog::backdrop { background: #080d17b8; }
.acc-error { color: #ff8a80; min-height: 18px; font-size: 13px; margin: 10px 0 4px; }
.acc-error:empty { display: none; }
#acc-google { display: block; margin: 14px 0; padding: 10px; text-align: center; text-decoration: none;
  background: #f1f4f8; color: #182b41; border-radius: 8px; font-weight: 800; }
#acc-email { margin: 12px 0; }
#acc-email-back, #acc-email-retry, #acc-email-reset { margin-top: 8px; }
#acc-email-status:empty { display: none; }
.acc-google-retry { display: inline-block; margin-top: 12px; color: #ffd0a1; }
.acc-close { position: absolute; top: 10px; right: 10px; border-radius: 999px; width: 32px; height: 32px; padding: 0; }
#settings-panel {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
  padding: 14px; background: #081322a6;
}
#settings-panel .menu-card { width: min(480px, 100%); max-height: 100%; overflow: auto; }
#settings-panel header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
#settings-panel h1 { font-size: 22px; margin: 0; }
.settings-toggle { display: flex; align-items: center; gap: 8px; }
.settings-toggle input, .settings-range input { accent-color: var(--accent); }
.settings-range { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 0; }
.settings-range input { grid-column: 1 / -1; width: 100%; }
.settings-range output { font-variant-numeric: tabular-nums; color: var(--muted); }
#settings-panel details { border-top: 1px solid var(--line); padding-top: 10px; }
#settings-panel summary { cursor: pointer; }
#settings-keys { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 10px; margin: 10px 0 0; }
#settings-keys button { min-width: 70px; min-height: 32px; padding: 4px 7px; }
#settings-status { color: #ffc08c; margin: 8px 0 0; }
#settings-status:empty { display: none; }
.admin-page #menu > .menu-tab, .admin-page #menu-top,
.admin-page #menu:not(.hidden) ~ #sound-ctl { display: none; }
#admin-signin, #admin-panel { position: absolute; inset: 0; z-index: 4; overflow: auto; }
#admin-signin { display: grid; place-items: center; padding: 18px; background: #0b1523; }
#admin-signin > .menu-card { width: min(360px, 100%); }
#admin-signin h1 { margin: 0 0 18px; font-size: 22px; }
#admin-signin label { display: grid; gap: 4px; margin-bottom: 12px; }
#admin-login-status { margin: 10px 0 0; color: var(--danger); }
#admin-panel { background: #0b1523; }
.admin-shell { width: min(1160px, 100%); margin: auto;
  padding: max(clamp(16px, 4vw, 44px), env(safe-area-inset-top))
    max(clamp(16px, 4vw, 44px), env(safe-area-inset-right))
    max(clamp(16px, 4vw, 44px), env(safe-area-inset-bottom))
    max(clamp(16px, 4vw, 44px), env(safe-area-inset-left)); }
.admin-shell a { color: #ffd0a1; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.admin-header a { font-size: 13px; text-decoration: none; }
.admin-header h1 { margin: 4px 0 0; font-size: clamp(24px, 4vw, 36px); line-height: 1.12; overflow-wrap: anywhere; }
#admin-status { margin: 12px 0; min-height: 1.4em; color: var(--muted); }
#admin-home, .admin-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#admin-home a, .admin-box, .admin-map-tools {
  background: #152338; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
#admin-home a { display: grid; gap: 6px; padding: clamp(14px, 4vw, 28px); color: var(--text); text-decoration: none; }
#admin-home a:hover, #admin-home a:focus-visible { border-color: var(--accent); }
#admin-home strong { font-size: 19px; }
#admin-home span, #admin-results { color: var(--muted); }
#admin-panel form, .admin-toolbar, #admin-pages { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
#admin-panel label { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.admin-back { display: inline-block; margin-bottom: 12px; }
.admin-box { margin-bottom: 12px; overflow-wrap: anywhere; }
.admin-box h2, .admin-map-tools h2 { margin: 0 0 9px; font-size: 16px; }
#admin-quantity { width: 78px; }
#admin-records { margin: 8px 0 0; padding-left: 20px; }
#admin-users, #admin-level-list, #admin-achievement-list, #admin-local-list, .admin-columns ul, #admin-map-edges { list-style: none; padding: 0; margin: 0 0 12px; }
#admin-users { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
#admin-users a, .admin-shell .admin-link-button {
  display: block; padding: 8px 11px; border-radius: 7px; background: #192b40; border: 1px solid var(--line); text-decoration: none;
}
#admin-pages { margin-top: 20px; }
#admin-level-list, #admin-achievement-list { margin-top: 12px; }
#admin-achievement-dialog, #admin-level-achievements-dialog { max-height: 90dvh; overflow: auto; width: min(480px, calc(100% - 24px)); color: var(--text); }
#admin-panel :is(#admin-achievement-form, #admin-level-achievements-form) { display: grid; align-items: start; margin: 0; }
#admin-achievement-form label { display: grid; }
#admin-level-achievement-options { display: grid; gap: 5px; }
#admin-level-achievement-options label { display: flex; align-items: center; gap: 8px; }
.admin-achievement-preview:not([hidden]) { display: grid; gap: 6px; justify-items: start; }
.admin-achievement-preview .achievement-art { width: min(240px, 100%); height: auto; aspect-ratio: 1; }
.admin-achievement-preview .achievement-art img { object-fit: contain; }
#admin-level-list li, #admin-achievement-list li, #admin-local-list li, .admin-columns li, #admin-map-edges li {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.admin-level-actions, .admin-columns li > div { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-columns li button { padding: 4px 8px; }
#admin-open-levels li button:first-child { color: #ff9aab; }
#admin-closed-levels li button:first-child { color: #a4efbf; }
.admin-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 255px); gap: 12px; align-items: start; }
#admin-map-viewport { min-width: 0; overflow: auto; max-height: 65vh; min-height: 280px; border-radius: 10px; border: 1px solid var(--line); }
#admin-map-world {
  position: relative; background-color: #183e54;
  background-image: linear-gradient(#ffffff0e 1px, transparent 1px), linear-gradient(90deg, #ffffff0e 1px, transparent 1px);
  background-size: 28px 28px;
}
#admin-map-paths { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.admin-island {
  position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; padding: 0; border-color: #a5d597;
  background: #4f8a66; color: #fdf4c4; touch-action: none; cursor: grab;
}
.admin-island b { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 3px; color: var(--text); white-space: nowrap; pointer-events: none; }
.admin-island > span { pointer-events: none; }
.admin-island[aria-pressed="true"] { outline: 2px solid var(--accent); z-index: 1; }
.admin-map-tools { min-width: 0; }
.admin-map-tools form { margin-bottom: 10px; }
#admin-panel .admin-map-tools form > label { display: grid; width: 100%; min-width: 0; }
.admin-map-tools select { width: 100%; min-width: 0; }
#admin-map-selected h2 { overflow-wrap: anywhere; }
#admin-map-selected > label { display: grid; gap: 4px; margin-bottom: 10px; }
#admin-map-hint { width: 100%; resize: vertical; user-select: text; }
#admin-map-price { width: 80px; }
#admin-map-icon { width: 150px; }
.admin-island[data-start] { box-shadow: 0 0 0 3px #e1bf77; }
#admin-map-selected > button { margin: 0 3px 8px 0; }
@media (max-width: 650px) {
  .admin-map-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (any-pointer: coarse) {
  .admin-map-tools :is(select, input, textarea) { font-size: 16px; }
  .admin-map-tools :is(select, button) { min-height: 44px; }
}
@media (max-width: 470px) {
  #admin-home { grid-template-columns: 1fr; }
  .admin-columns { gap: 7px; }
  .admin-columns .admin-box { padding: 8px; }
  #menu-top { gap: 5px; padding-left: 8px; }
  #menu-top #acc-btn { padding: 7px; font-size: 12px; }
}
@media (max-width: 720px) {
  #menu-top { flex-wrap: wrap; justify-content: center; width: max-content; gap: 5px; padding: 7px 8px; border-radius: 19px; }
  #menu-top .logo { flex-basis: 100%; text-align: center; font-size: 15px; }
  #menu-tabs button { padding: 8px 10px; font-size: 13px; }
  #map-help { display: none; }
}
button.big { width: 100%; margin-top: 18px; padding: 12px; font-size: 16px; font-weight: 600; background: var(--accent); color: #1a0f05; border: none; }

/* ---------- HUD ---------- */
#hud-collect { font-weight: 700; color: #ffd23f; }
#hud-collect.hidden { display: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center;
  background: var(--panel); padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); }
#hud-level { font-weight: 600; }
#hud-timer { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 60px; }
#hud-pause { position: absolute; top: 12px; right: 14px; width: 44px; height: 44px; padding: 0; font-size: 20px; border-radius: 12px;
  background: var(--panel); pointer-events: auto; }
#hud-hp { position: absolute; top: 14px; left: 16px; display: flex; align-items: center; gap: 8px; background: var(--panel);
  padding: 6px 10px; border-radius: 10px; }
#hud-hp .hp-label { font-weight: 800; color: #ff6b7a; font-size: 13px; }
#hud-hp .hp-bar { position: relative; width: 190px; height: 18px; background: rgba(0,0,0,0.45); border-radius: 6px; overflow: hidden; }
#hud-hp-fill, #hud-hp-trail { position: absolute; left: 0; top: 0; bottom: 0; display: block; }
#hud-hp-fill { background: #4cd964; transition: width .12s, background .3s; }
#hud-hp-trail { background: #fff; opacity: .85; transition: width .6s ease-in .35s; }
#hud-hp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); font-variant-numeric: tabular-nums; }
#hud-size { position: absolute; top: 54px; left: 18px; background: var(--panel); padding: 4px 10px; border-radius: 8px; font-size: 12px; }
#hud-modes { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
#hud-modes .mode { background: var(--panel); border: 2px solid transparent; border-radius: 10px; padding: 6px 12px; opacity: 0.6;
  display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; transition: all .15s; pointer-events: auto; }
#hud-modes .mode small { grid-column: 2; color: var(--muted); font-size: 11px; }
#hud-modes .mode.active { opacity: 1; border-color: var(--c); box-shadow: 0 0 16px color-mix(in srgb, var(--c) 50%, transparent); }
#hud-modes .mode b { color: var(--c); }
#hud-level-help { flex: 0 0 36px; min-height: 36px; padding: 0; border-radius: 50%; font-weight: 800; pointer-events: auto; }
#level-help-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 22px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; overflow: auto; pointer-events: auto; }
#level-help-dialog::backdrop { background: #080d17b8; }
#level-help-title { margin: 0 0 12px; }
#level-help-text { white-space: pre-wrap; overflow-wrap: anywhere; }
#hud-toast { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font-size: 22px; font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6); opacity: 0; white-space: nowrap; }
#hud-toast.show { animation: toast 1.6s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -30%); } 15% { opacity: 1; transform: translate(-50%, -50%); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }
#hud-flash { position: absolute; inset: 0; background: radial-gradient(transparent 40%, rgba(255,0,30,0.55)); opacity: 0; }
#hud-flash.show { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

#game-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5,10,20,0.45); }
#game-overlay .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 34px; text-align: center; min-width: 320px; }
#game-overlay h1 { margin: 0 0 6px; font-size: 34px; }
#game-overlay.win h1 { color: #ffd84d; }
#game-overlay.lose h1 { color: var(--danger); }
#go-text { color: var(--muted); margin: 0 0 18px; white-space: pre-line; }
#game-overlay.brief { background: rgba(5,10,20,0.25); }
#game-overlay.brief .panel { max-width: 440px; text-align: left; }
#game-overlay.brief h1 { font-size: 28px; }
#game-overlay.brief #go-text { color: var(--text, #e8eef7); line-height: 1.6; }
#go-buttons { display: flex; flex-direction: column; gap: 8px; }
#go-buttons button:first-child { background: var(--accent); color: #1a0f05; border: none; font-weight: 600; }

/* ---------- Редактор ---------- */
#editor-ui { position: fixed; inset: 0; pointer-events: none; }
#editor-ui > * { pointer-events: auto; }
#ed-top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
#ed-top button, #ed-top select { padding: 6px 10px; flex-shrink: 0; }
#ed-top .spacer { flex: 1; }
#ed-name { width: 180px; min-width: 120px; font-weight: 600; }
#ed-tools { position: absolute; top: 64px; left: 10px; bottom: 56px; width: 200px; display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px; align-content: start; overflow-y: auto; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
#ed-tools .tool-group { grid-column: 1 / -1; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 6px 2px 0; }
#ed-tools .tool-group:first-child { margin-top: 0; }
#ed-tools .tool { display: flex; align-items: center; gap: 5px; text-align: left; padding: 5px 6px; font-size: 12px; background: rgba(255,255,255,0.06); min-width: 0; }
#ed-tools .tool .ico { width: 16px; text-align: center; flex-shrink: 0; }
#ed-tools .tool .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ed-tools .tool.active { border-color: var(--accent); background: rgba(255,138,61,0.25); }
#ed-props { position: absolute; top: 64px; right: 10px; width: 260px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; max-height: calc(100% - 120px); overflow: auto; }
#ed-props h3 { margin: 0 0 10px; font-size: 15px; }
#ed-props label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
#ed-props label.inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#ed-props label.inline input[type=number] { width: 90px; }
#ed-props label.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
#ed-props textarea, #ed-props select { width: 100%; }
#ed-props .vec { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr; gap: 4px; align-items: center; }
#ed-props .vec span { color: var(--muted); font-size: 11px; }
#ed-props .vec input { width: 100%; min-width: 0; padding: 4px 5px; }
#ed-props .row { display: flex; gap: 6px; margin-top: 12px; }
#ed-props .row button { flex: 1; padding: 6px 8px; font-size: 12px; }
#ed-props .stats { font-size: 13px; margin: 10px 0; }
#ed-props .info { color: #8fd3ff; font-size: 12px; margin: 10px 0; padding: 6px 8px; background: rgba(95,211,255,0.1); border-radius: 6px; }
#ed-props .warn { color: #ffcf4d; font-size: 12px; margin-bottom: 8px; }
#ed-props input[type=color] { width: 60px; height: 28px; padding: 0 2px; }
#ed-help { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 6px 14px;
  border-radius: 8px; font-size: 12px; color: var(--muted); max-width: calc(100% - 20px); text-align: center; }
#ed-status { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); background: #2e7d4f; padding: 6px 14px; border-radius: 8px;
  opacity: 0; transition: opacity .3s; pointer-events: none; }
#ed-status.show { opacity: 1; }

/* ---------- Звук ---------- */
#sound-ctl { position: fixed; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 10; }
#sound-ctl button { width: 38px; height: 38px; padding: 0; font-size: 17px; background: var(--panel); }
#sound-ctl #fullscreen { font-size: 24px; line-height: 1; }
#fullscreen[aria-pressed="true"] { color: var(--accent); }
#fullscreen-hint {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(260px, calc(100vw - 32px));
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#sound-ctl button.off { opacity: 0.4; text-decoration: line-through; filter: grayscale(1); }

/* ---------- Скины ---------- */
#skin-carousel {
  position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%);
  width: min(880px, calc(100% - max(28px, 2 * env(safe-area-inset-left), 2 * env(safe-area-inset-right)))); display: flex; align-items: center;
  justify-content: space-between; pointer-events: none;
}
#skin-carousel > button {
  display: grid; place-items: center;
  width: 50px; height: 50px; padding: 0; border-radius: 15px;
  border-color: #ffffff45; background: #182c43; box-shadow: 0 3px 0 #10233666;
  pointer-events: auto; touch-action: manipulation;
}
#skin-carousel > button span {
  width: 12px; height: 12px; border: solid currentColor; border-width: 0 3px 3px 0;
  transform: translateX(2px) rotate(135deg); pointer-events: none;
}
#skin-carousel #skin-next span { transform: translateX(-2px) rotate(-45deg); }
#skin-carousel > button:hover, #skin-carousel > button:focus-visible { border-color: var(--accent); color: var(--accent); }
#skin-carousel > button:active { transform: translateY(2px); box-shadow: none; }
#skin-selection {
  position: absolute; left: 50%; top: calc(50% + clamp(44px, 18vh, 160px));
  transform: translateX(-50%); display: grid; justify-items: center; gap: 6px;
}
#skin-name { font-size: clamp(19px, 4vh, 28px); font-weight: 800; text-shadow: 0 2px 8px #172839; }
#skin-apply { min-width: 112px; min-height: 36px; pointer-events: auto; }
#skin-apply:disabled { opacity: .55; cursor: default; }
.shop-status { color: #ffd5a3; font-size: 12px; text-align: center; }
.shop-status:empty { display: none; }

/* ---------- Предметы: пушка, джетпак ---------- */
#hud-items { position: absolute; top: 84px; left: 18px; display: flex; flex-direction: column; gap: 6px; }
#hud-items .item { background: var(--panel); padding: 6px 10px; border-radius: 8px; width: 200px; }
#hud-items .item-title { font-size: 12px; display: flex; align-items: center; gap: 6px; }
#hud-items .item-time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
#hud-items .item-bar { height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; margin-top: 5px; overflow: hidden; }
#hud-items .item-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff8a3d, #ffd34d); }
#hud-items .item-bar i.armor { background: linear-gradient(90deg, #ff4d5e, #ffb0b8); }
#hud-items .item-bar i.jet { background: linear-gradient(90deg, #2aa8ff, #9be7ff); }

/* ---------- Сенсорное управление ---------- */
#touch-controls { display: none; }
@media (any-pointer: coarse) {
  html { touch-action: pan-y; }
  #hud {
    --hud-left: max(12px, env(safe-area-inset-left));
    --hud-right: max(12px, env(safe-area-inset-right));
    --hud-bottom: max(12px, env(safe-area-inset-bottom));
    --hud-stats-top: calc(58px + var(--hud-top));
    --hud-top: env(safe-area-inset-top);
  }
  #touch-controls {
    --touch-size: clamp(92px, 25vmin, 126px);
    position: absolute;
    inset: auto var(--hud-right) calc(var(--hud-bottom) + 52px) var(--hud-left);
    display: flex;
    align-items: end;
    justify-content: space-between;
  }
  #touch-stick, #touch-actions button { pointer-events: auto; touch-action: none; }
  #touch-stick {
    display: grid;
    place-items: center;
    width: var(--touch-size);
    aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,0.32);
    border-radius: 50%;
    background: rgba(15,23,36,0.62);
  }
  #touch-stick span {
    width: 44%;
    aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 50%;
    background: rgba(238,243,250,0.3);
    pointer-events: none;
  }
  #touch-actions { display: grid; grid-template-columns: auto auto; align-items: end; gap: 10px; }
  #touch-actions button {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 50%;
    color: #f4f8ff;
    border: 1px solid rgba(255,255,255,0.36);
    background: linear-gradient(150deg, #394a62, #192737);
    box-shadow: inset 0 1px 1px #ffffff35, 0 4px 10px #0007;
  }
  #touch-actions button:active { transform: scale(0.91); }
  #touch-actions #touch-jump {
    width: 76px;
    height: 76px;
    color: #251404;
    background: linear-gradient(150deg, #ffd58d, #f28b39);
    border-color: #ffe4b3;
  }
  #touch-jump span, #touch-attack span, #touch-shoot span {
    display: block;
    width: 28px;
    height: 28px;
    background: currentColor;
  }
  #touch-jump span { clip-path: polygon(50% 0%, 100% 48%, 70% 48%, 70% 100%, 30% 100%, 30% 48%, 0 48%); }
  #touch-attack span { clip-path: polygon(52% 0%, 63% 34%, 97% 13%, 82% 48%, 100% 64%, 72% 70%, 76% 100%, 50% 82%, 23% 100%, 28% 70%, 0% 62%, 21% 46%, 5% 15%, 37% 34%); }
  #touch-shoot { grid-column: 1 / -1; justify-self: end; margin-right: 7px; }
  #touch-shoot span { clip-path: polygon(25% 36%, 47% 36%, 47% 25%, 59% 14%, 76% 14%, 76% 23%, 62% 23%, 56% 29%, 56% 36%, 68% 36%, 81% 49%, 86% 70%, 77% 89%, 60% 100%, 35% 100%, 18% 88%, 11% 69%, 15% 50%); }
  #hud-modes {
    bottom: var(--hud-bottom); gap: 6px; width: max-content;
    max-width: calc(100% - var(--hud-left) - var(--hud-right));
  }
  #hud-modes .mode { display: block; min-height: 44px; padding: 4px 10px; touch-action: manipulation; }
  #hud-modes kbd, #hud-modes .mode small, #hud-items kbd { display: none; }
  #hud:not(.hidden) ~ #sound-ctl { top: calc(12px + env(safe-area-inset-top)); right: calc(66px + env(safe-area-inset-right)); bottom: auto; }
  #hud:not(.hidden) ~ #sound-ctl #fullscreen-hint { top: calc(100% + 8px); bottom: auto; width: min(250px, calc(100vw - 88px)); }
  #hud-pause { top: calc(12px + var(--hud-top)); right: calc(14px + env(safe-area-inset-right)); }
  #hud-hp { top: calc(14px + var(--hud-top)); left: max(16px, env(safe-area-inset-left)); }
  #hud-size { top: calc(54px + var(--hud-top)); left: max(18px, env(safe-area-inset-left)); }
  #hud-items { top: calc(84px + var(--hud-top)); left: max(18px, env(safe-area-inset-left)); }
  #hud-top {
    top: var(--hud-stats-top); left: auto; right: var(--hud-right); transform: none;
    gap: 6px; max-width: min(62%, 340px); padding: 2px 4px 2px 10px; font-size: 12px;
  }
  #hud-collect { flex-shrink: 0; max-width: 65%; overflow-wrap: anywhere; }
  #hud-level-help { flex-basis: 44px; min-height: 44px; }
  #hud-toast { width: min(85%, 540px); white-space: normal; text-align: center; overflow-wrap: anywhere; font-size: clamp(16px, 4vw, 22px); }
  #hud-level { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #hud-timer { min-width: max-content; }
  #hud-hp .hp-bar { width: min(110px, 25vw); }
  #hud-items .item { width: min(140px, 38vw); }
  #game-overlay .panel { width: min(440px, calc(100% - 24px)); min-width: 0; padding: 20px; }
}
@media (any-pointer: coarse) and (orientation: portrait) {
  #menu-top { top: calc(12px + env(safe-area-inset-top)); }
  #hud-top { left: var(--hud-left); max-width: none; }
  #hud-level { flex: 1; }
  #hud-size { top: calc(114px + var(--hud-top)); }
  #hud-items { top: calc(144px + var(--hud-top)); }
  #hud #hud-duo { top: calc(144px + var(--hud-top)); max-width: 55%; }
  #hud-modes .mode { padding-inline: clamp(4px, 2vw, 10px); font-size: clamp(12px, 3.6vw, 14px); }
}
@media (any-pointer: coarse) and (orientation: landscape) and (max-height: 420px) {
  #touch-controls { --touch-size: clamp(76px, 23vh, 98px); }
  #touch-actions button { width: 56px; height: 56px; }
  #touch-actions #touch-jump { width: 68px; height: 68px; }
  #touch-jump span, #touch-attack span, #touch-shoot span { width: 24px; height: 24px; }
}

@media (any-pointer: coarse) and (orientation: landscape) and (max-height: 350px) {
  #touch-actions { grid-template-columns: repeat(3, auto); }
  #touch-shoot { grid-column: auto; margin-right: 0; }
}

/* ---------- Друзья и совместный забег ---------- */
#friends-open { border-radius: 999px; white-space: nowrap; }
#friends-count {
  display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 99px;
  color: #1a0f05; background: var(--accent); font-size: 11px; font-weight: 800;
}
#friends-panel {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
  padding: 14px; background: #081322a6;
}
#friends-panel > .menu-card { position: relative; width: min(460px, 100%); max-height: 100%; overflow: auto; }
#friends-title { margin: 0 0 12px; font-size: 23px; }
#friends-add { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#friends-add label { display: grid; flex: 1; gap: 4px; min-width: 0; }
#friends-add input { width: 100%; font-size: 16px; }
#friends-panel ul { list-style: none; margin: 0; padding: 0; }
#friends-panel li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); }
#friends-panel li span { flex: 1 1 135px; overflow-wrap: anywhere; }
#friends-status { color: #ffc08c; margin: 8px 0 0; }
#hud-duo {
  position: absolute; top: 66px; right: 14px; padding: 5px 9px;
  border-radius: 8px; background: var(--panel); font-size: 12px;
}
@media (any-pointer: coarse) {
  #hud-duo { top: calc(122px + var(--hud-top)); right: var(--hud-right); }
}
@media (max-width: 470px) {
  #friends-open { padding: 6px 8px; font-size: 12px; }
}
.duo-tag {
  position: absolute; top: 0; left: 0; translate: -50% -100%;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center;
  max-width: 178px; padding: 3px 6px; border-radius: 6px;
  background: #102033e8; font-size: 11px; line-height: 1.15;
  white-space: nowrap; pointer-events: none;
}
.duo-tag b { overflow: hidden; text-overflow: ellipsis; }
.duo-tag span { color: #bed0dd; font-variant-numeric: tabular-nums; }
.duo-tag i {
  grid-column: 1 / -1; height: 3px; border-radius: 3px;
  background: linear-gradient(to right, #69d994 var(--hp), #5d2432 var(--hp));
}

/* Коллекция наград и экран победы */
.achievement-book { position: absolute; inset: var(--achievements-top, 88px) 0 0; overflow: auto;
  padding: 12px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #0b1638ec, #131936f5 40%, #1f1741f7); touch-action: pan-y; }
.achievement-book > header, #achievements-list { max-width: 940px; margin: 0 auto; }
.achievement-book h1 { margin: 0; font-size: clamp(22px, 5vw, 38px); }
#achievements-count { color: #ffe29b; margin: 6px 0 16px; }
#achievements-list { list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.achievement-card { background: #192543; border: 1px solid #566686; border-radius: 16px; overflow: hidden; }
.achievement-card.unlocked { background: linear-gradient(135deg, #4b3063, #2e294c); border-color: #bc885b; }
.achievement-card small { color: #b2bed8; }
.achievement-card.unlocked small { color: #ffdb89; }
.achievement-art { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; overflow: hidden;
  background: radial-gradient(circle at 35% 25%, #fff3ad, #d78548 70%, #8d4c58); color: #251a36; font-size: 30px; }
.achievement-card:not(.unlocked) .achievement-art { background: #2b3655; }
.achievement-art img { width: 100%; height: 100%; object-fit: cover; }
#game-overlay .panel { position: relative; max-height: calc(100% - 24px); overflow: auto; }
#go-achievement { display: flex; align-items: center; gap: 12px; margin: 12px auto; padding: 8px 12px; text-align: left;
  background: linear-gradient(110deg, #59377b, #402d69); border: 1px solid #efc782; border-radius: 14px;
  animation: reward-open .55s cubic-bezier(.16, 1.35, .5, 1) both; overflow-wrap: anywhere; }
#go-achievement { flex-direction: column; align-items: stretch; max-height: min(26dvh, 180px); overflow: auto; }
.achievement-reward { display: flex; align-items: center; gap: 12px; }
#go-achievement small, #go-achievement strong { display: block; }
#go-achievement small { color: #ffe09a; margin-bottom: 4px; }
#go-achievement .achievement-art { flex: 0 0 50px; width: 50px; height: 50px; }
@keyframes reward-open { from { opacity: 0; transform: translateY(12px) scale(.75); } }
#win-fireworks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#win-fireworks i { position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: var(--spark); box-shadow: 0 0 12px var(--spark); opacity: 0; animation: win-spark 1.1s ease-out both; }
@keyframes win-spark {
  0% { opacity: 0; transform: scale(.25); }
  14% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.25); }
}
@media (prefers-reduced-motion: reduce) { #go-achievement { animation: none; } }
@media (max-width: 480px) {
  #menu-top { gap: 4px; }
  #menu-tabs button { padding-inline: 7px; }
  #game-overlay.win h1 { font-size: clamp(22px, 6vw, 34px); }
}

.achievement-card { max-width: 340px; }
.achievement-card > button { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center;
  width: 100%; min-height: 88px; gap: 12px; padding: 12px; text-align: left;
  border: 0; background: transparent; border-radius: 0; }
.achievement-card > button > strong { font-size: 16px; overflow-wrap: anywhere; }
.achievement-card > button > .achievement-art { width: 64px; height: 64px; }
.achievement-card:not(.unlocked) img, #achievement-details.locked img { filter: grayscale(.85) brightness(.74); }
#achievement-details { width: min(450px, calc(100% - 32px)); max-height: calc(100% - 24px); overflow: auto;
  background: #181e3b; color: var(--text); border: 1px solid #706285; border-radius: 18px; padding: 18px; }
#achievement-details::backdrop { background: #080d17ca; }
#achievement-details-art .achievement-art { width: 100%; height: auto; aspect-ratio: 384 / 280; }
#achievement-details-title { margin: 12px 0 4px; }
#achievement-details-text { white-space: pre-wrap; overflow-wrap: anywhere; }
#pwa-offline { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2; pointer-events: none; }
.settings-pwa { margin: 14px 0 8px; }
.settings-pwa p { margin: 6px 0 0; }

#character-customize { pointer-events: auto; min-height: 36px; background: #173654; }
#character-appearance { position: absolute; left: max(16px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  width: min(245px, 43vw); max-height: calc(100% - 105px); overflow: auto; touch-action: pan-y;
  background: #142740f5; border: 1px solid #7eadd288; border-radius: 17px; padding: 12px; z-index: 1; }
#character-appearance header, #character-appearance footer { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
#character-appearance h2 { margin: 0; font-size: 18px; }
#character-close { display: grid; place-items: center; width: 33px; height: 33px; font-size: 22px; padding: 0; }
#character-options { display: grid; gap: 6px; margin: 10px 0; }
#character-options label { display: grid; gap: 3px; color: #dbe9fa; font-size: 12px; min-width: 0; }
#character-options select { width: 100%; min-width: 0; padding: 5px 6px; }
#tab-skins.customizing #skin-prev { visibility: hidden; }
#tab-skins.customizing #skin-apply { display: none; }
@media (max-width: 620px), (max-height: 500px) {
  #character-appearance { left: max(7px, env(safe-area-inset-left)); top: auto; bottom: max(8px, env(safe-area-inset-bottom));
    transform: none; max-height: calc(100% - 100px); width: min(210px, 42vw); padding: 8px; }
  #character-appearance footer { flex-wrap: wrap; }
  #character-appearance footer button { padding: 5px 7px; }
  #character-customize { font-size: 12px; min-height: 30px; }
}

#hud-talk { position: absolute; z-index: 1;
  transform: translate(-50%, -50%); pointer-events: auto; background: #173653; border-color: #8fc9eb; font-weight: 700; min-height: 42px; }
#game-dialogue, #ed-dialogue { color: var(--text); width: min(600px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; }
#game-dialogue { position: fixed; inset: auto 0 max(10px, env(safe-area-inset-bottom)); margin: 0 auto; }
#game-dialogue::backdrop, #ed-dialogue::backdrop { background: #080c1b65; }
#game-dialogue header, .dialogue-edit-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#game-dialogue header { justify-content: space-between; }
#game-dialogue h2, #ed-dialogue h2 { margin: 0; font-size: 19px; }
#game-dialogue .muted { margin: 3px 0; }
#game-dialogue-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 12px; }
#game-dialogue-choices { display: flex; gap: 6px; flex-wrap: wrap; }
#game-dialogue-choices button { text-align: left; overflow-wrap: anywhere; max-width: 100%; }
#ed-dialogue label { display: grid; gap: 4px; margin: 6px 0; }
#ed-dialogue input, #ed-dialogue textarea { width: 100%; }
#ed-dialogue-ending { display: flex; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); margin: 9px 0; }
#ed-dialogue-replies > div { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; margin-bottom: 8px; }
#ed-dialogue-replies > div > input { flex: 1 1 145px; width: auto; }
#ed-dialogue-replies > div > label { margin: 0; }
#ed-dialogue-status:empty { display: none; }

#admin-cinematics { max-width: 760px; }
#admin-cinematics label { display: grid; gap: 4px; margin: 8px 0; }
#admin-cinematic-shots, #admin-cinematic-locations { width: 100%; font-family: ui-monospace, monospace; }
#cinematic-overlay { position: fixed; z-index: 12; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #080c18a8, transparent 24%, transparent 60%, #080c18d9); }
#cinematic-heading { position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left));
  max-width: 65%; text-shadow: 0 2px 8px #000; }
#cinematic-title { margin: 0; font-size: clamp(16px, 3.5vw, 27px); }
#cinematic-location { margin: 3px 0 0; color: #ffe0a0; font-size: clamp(13px, 2.4vh, 16px); }
#cinematic-location:empty { display: none; }
#cinematic-skip { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  background: #172740ed; pointer-events: auto; }
#cinematic-caption { position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(660px, calc(100% - 30px)); text-align: center; }
#cinematic-text { margin: 0 0 8px; color: #fff3d4; overflow-wrap: anywhere; max-height: 43vh; overflow-y: auto; pointer-events: auto;
  text-shadow: 0 1px 5px #000; font-size: clamp(16px, 3vh, 22px); }

#ed-channels-dialog { color: var(--text); width: min(430px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; }
#ed-channels-dialog::backdrop { background: #080c1b65; }
#ed-channels-dialog h2 { margin: 0; font-size: 19px; }
#ed-channel-list { display: grid; gap: 6px; max-height: 32vh; overflow: auto; padding: 0; list-style: none; }
.channel-swatch { display: inline-block; width: .9em; height: .9em; margin-right: .5em; border-radius: 50%; }
#ed-channel-form label { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
#ed-channel-name { flex: 1; min-width: 0; }

#game-overlay.finish-flight-result {
  justify-content: flex-end;
  padding: max(12px, env(safe-area-inset-top)) max(16px, 5vw, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(16px, 5vw, env(safe-area-inset-left));
  background: linear-gradient(90deg, transparent 16%, rgba(7, 5, 20, .48) 65%);
}
#game-overlay.finish-flight-result .panel {
  width: min(100%, clamp(280px, 48%, 500px));
  min-width: 0;
  padding: clamp(12px, 3vh, 28px);
  background: rgba(15, 17, 36, .82);
}
#game-overlay.finish-flight-result h1 { font-size: clamp(18px, 5.3vh, 34px); }
@media (orientation: portrait) {
  #game-overlay.finish-flight-result { align-items: flex-end; justify-content: center; padding-bottom: max(56px, calc(44px + env(safe-area-inset-bottom))); background: linear-gradient(transparent 16%, #09061873 70%); }
  #game-overlay.finish-flight-result .panel { width: min(100%, 440px); max-height: 67%; }
}

#hud-shop { position: absolute; z-index: 2; pointer-events: auto; left: 50%; top: 28%; transform: translateX(-50%); min-height: 44px; color: #ffe6a3; background: #2d2031ed; }
#game-shop { color: var(--text); width: min(390px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; }
#game-shop::backdrop { background: #080c1b80; }
#game-shop h2 { margin: 0; }
#game-shop-items { display: grid; gap: 7px; }
#game-shop-items button { min-height: 40px; }
#game-shop-items:empty::before { content: 'Здесь пока ничего нет'; color: var(--muted); }
#game-shop-status:empty { display: none; }
#game-shop-close { margin-top: 10px; }

#ed-groups-dialog { color: var(--text); width: min(470px, calc(100% - 24px)); max-height: calc(100% - 20px); overflow: auto; }
#ed-groups-dialog::backdrop { background: #080c1b65; }
#ed-groups-dialog h2 { margin: 0; font-size: 19px; }
#ed-groups-dialog label { display: grid; gap: 5px; margin: 10px 0; }
#ed-groups-dialog .menu-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

#ed-face-handles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
#ed-top, #ed-tools, #ed-props { z-index: 2; }
.ed-face-handle {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; touch-action: none;
  min-width: 32px; height: 29px; padding: 0 4px; border: 1px solid #ffe0a2; border-radius: 6px;
  color: #43240b; background: #ffc260; font-size: 12px; font-weight: 800; box-shadow: 0 2px 8px #231604aa;
}
.ed-face-handle:hover, .ed-face-handle:active { background: #fff0bf; }

#settings-nickname-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
#settings-nickname-form label { display: grid; gap: 5px; }
#settings-achievements-confirm { color: var(--text); max-width: min(440px, calc(100% - 24px)); }
#settings-achievements-confirm::backdrop { background: #070a1690; }
#settings-nickname-status:empty, #settings-achievements-status:empty { display: none; }
