:root {
  --bg: #262626; --panel: #0e0e10; --btn: #08080a; --btn-hover: #1a1a1d; --line: #26262b;
  --accent: #8b1620; --accent-hover: #a51c28; --accent-text: #d4404f; --text: #ececee; --muted: #8e8e96; --chip: #1a1a1d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.hidden { display: none !important; }
code { background: #1a1a1d; padding: 1px 5px; border-radius: 5px; font-size: 12px; }

.corner { position: fixed; display: flex; gap: 10px; z-index: 5; }
.tl { top: 12px; left: 12px; flex-direction: column; align-items: flex-start; }
.tr { top: 12px; right: 12px; flex-direction: column; align-items: flex-end; }

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.round { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--btn); color: var(--text);
  display: grid; place-items: center; font-size: 20px; font-weight: 600; box-shadow: 0 3px 12px rgba(0,0,0,.6); padding: 0; overflow: hidden; }
.round:hover { background: var(--btn-hover); }
.round.active { background: var(--accent); border-color: var(--accent-hover); }
.round svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar { background: #1a1a1d; font-size: 16px; }
.avatar img, .avatar-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.marks { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 6px; max-height: calc(100vh - 230px); overflow: auto; }
.marks button { background: var(--btn); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; color: var(--text);
  box-shadow: 0 3px 12px rgba(0,0,0,.6); font-weight: 600; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marks button:hover { background: var(--btn-hover); }

.panel { position: fixed; top: 12px; right: 66px; width: 320px; max-width: calc(100vw - 150px); max-height: calc(100vh - 100px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; z-index: 6; box-shadow: 0 8px 30px rgba(0,0,0,.7); }
#p-info { right: auto; left: 66px; }
.panel h2 { margin: 2px 0 10px; font-size: 15px; }
.panel h2:not(:first-child) { margin-top: 16px; }
.panel ul { margin: 0; padding-left: 18px; color: var(--muted); } .panel li { margin: 5px 0; }
.muted { color: var(--muted); margin: 0 0 10px; font-size: 13px; }
.panel form { display: flex; gap: 8px; }
input[type=text] { flex: 1; min-width: 0; background: var(--btn); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none; }
input[type=text]:focus { border-color: var(--accent-hover); }
.primary, .wide { background: var(--accent); border: 0; color: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; text-decoration: none; display: inline-block; }
.primary:hover { background: var(--accent-hover); }
.wide { width: 100%; background: var(--btn-hover); }
button:disabled { opacity: .5; cursor: default; }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer; }
.check span { flex: 1; } .check small { color: var(--muted); font-variant-numeric: tabular-nums; }
.check input { accent-color: var(--accent-hover); width: 16px; height: 16px; }
.file input { display: none; }
.file span { display: block; text-align: center; border: 1.5px dashed #3a3a41; border-radius: 12px; padding: 18px 10px; cursor: pointer; color: var(--muted); }
.file span:hover { border-color: var(--accent-hover); color: var(--text); }
progress { width: 100%; margin-top: 10px; accent-color: var(--accent-hover); }

#s-result, #a-result { margin-top: 12px; }
.res-head { font-weight: 700; font-size: 15px; } .res-sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.areas { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; max-height: 260px; overflow: auto; }
.areas button { display: flex; justify-content: space-between; gap: 8px; background: var(--btn); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; text-align: left; }
.areas button:hover { background: var(--btn-hover); } .areas small { color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; } .row button, .row a { flex: 1; text-align: center; }
.row button:not(.primary) { background: var(--btn-hover); border: 0; border-radius: 10px; padding: 9px 12px; }
.error { color: #ff7d86; } .warn { color: #e0a96d; font-size: 13px; }

.dock { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.7); max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
.dock button:not(.primary) { background: var(--btn-hover); border: 0; color: var(--text); border-radius: 10px; padding: 9px 14px; font-weight: 600; }

/* карточка пикселя — внизу по центру */
.card { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 7; width: min(560px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 18px 20px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.8);
  display: grid; grid-template-columns: 76px 1fr; gap: 6px 16px; }
.card .x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--chip); font-size: 16px; line-height: 1; }
.card .x:hover { background: var(--btn-hover); }
.avatar-lg { width: 76px; height: 76px; border-radius: 50%; background: #17171a; border: 2px solid var(--accent); overflow: hidden; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: var(--muted); }
.card .name { font-size: 21px; font-weight: 600; padding-right: 40px; overflow-wrap: anywhere; }
.card .name b { color: var(--accent-text); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { background: var(--chip); color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.red { color: #ffb3ba; background: #2b0e12; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button { background: var(--chip); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.actions button:hover { background: var(--btn-hover); }
.actions button.main { background: var(--accent); color: #fff; } .actions button.main:hover { background: var(--accent-hover); }

.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9; background: #1c1c20; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.6); max-width: 90vw; }
.toast.bad { background: #3a0f14; }

.login { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(0,0,0,.94); text-align: center; padding: 20px; }
.login h1 { margin: 0; font-size: 34px; letter-spacing: .5px; }
.login p { margin: 0; color: var(--muted); max-width: 360px; }
.login a:not(.primary) { color: var(--accent-text); }
@media (max-width: 560px) { .panel { right: 12px; top: auto; bottom: 72px; width: auto; left: 12px; max-width: none; max-height: 55vh; } #p-info { left: 12px; }
  .card { grid-template-columns: 56px 1fr; } .avatar-lg { width: 56px; height: 56px; font-size: 22px; } }
.offscreen { position: fixed; left: -9999px; opacity: 0; }

.avatar-lg img { image-rendering: pixelated; }          /* аватарки wplace — пиксель-арт: без сглаживания при увеличении */
.dock .primary { white-space: nowrap; }

.range { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.range span { min-width: 78px; } .range input { flex: 1; min-width: 0; accent-color: var(--accent-hover); }
.range small { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
