/* ============ GameHelper — RGB HUD theme ============ */

@property --h {
  syntax: '<number>';
  inherits: true;
  initial-value: 190;
}

:root {
  --void: #05060b;
  --panel: #0d0f18;
  --panel-2: #141725;
  --panel-3: #1b1f31;
  --line: #23283d;
  --line-2: #30364f;
  --text: #e9ecf7;
  --muted: #8c92ae;
  --dim: #5b6180;
  --danger: #ff4d6d;
  --ok: #3df5a3;
  --warn: #ffb547;

  --h: 190;
  --rgb-dur: 8s;
  --grad-a: hsl(var(--h) 100% 60%);
  --grad-b: hsl(calc(var(--h) + 120) 100% 62%);
  --grad-c: hsl(calc(var(--h) + 240) 100% 62%);
  --rgb: linear-gradient(90deg, var(--grad-a), var(--grad-b), var(--grad-c));
  --glow: 0 0 0 1px hsl(var(--h) 100% 60% / .5), 0 8px 32px -8px hsl(var(--h) 100% 55% / .55);

  --display: 'Tektur', 'Chakra Petch', 'Bahnschrift', system-ui, sans-serif;
  --ui: 'Chakra Petch', 'Bahnschrift', 'Segoe UI', system-ui, sans-serif;
  --r: 6px;
  --r-lg: 12px;
  --side: 248px;

  color-scheme: dark;
  background: var(--void);
}

html.rgb-on { animation: hue-spin var(--rgb-dur) linear infinite; }
@keyframes hue-spin { from { --h: 0; } to { --h: 360; } }
@media (prefers-reduced-motion: reduce) { html.rgb-on { animation: none; } }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, hsl(var(--h) 90% 50% / .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, hsl(calc(var(--h) + 150) 90% 50% / .06), transparent 60%),
    var(--void);
  background-attachment: fixed;
  color: var(--text);
  font: 500 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
kbd {
  font: 600 11px var(--ui); padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ico { flex: none; }
:focus-visible { outline: 2px solid var(--grad-a); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, var(--panel), #090a12);
  border-right: 1px solid var(--line);
}
.logo {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px;
  text-decoration: none; font: 700 22px/1 var(--display); letter-spacing: .01em;
}
.logo b { font-weight: 800; background: var(--rgb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--r); text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: 15.5px; letter-spacing: .01em;
  border: 1px solid transparent;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--panel-3); border-color: var(--line-2); }
.nav a.active::before {
  content: ''; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 0 12px var(--grad-a);
}
.nav a.active .nav-ico { color: var(--grad-a); }
.nav-ico { display: grid; place-items: center; }
.nav-settings { margin-top: auto; }
.side-foot { border-top: 1px solid var(--line); padding: 14px 8px 0; display: grid; gap: 10px; }
.side-foot p { margin: 0; line-height: 1.55; }
.save-state { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.save-state.saved i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.save-state.saving i { background: var(--warn); }
.save-state.error i, .save-state.offline i { background: var(--danger); }

.main { min-width: 0; padding: 22px 36px 60px; }
.top { display: flex; align-items: center; gap: 16px; min-height: 52px; margin-bottom: 18px; }
.top h1 { margin: 0; font: 700 30px/1.1 var(--display); letter-spacing: .01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.banner {
  margin-bottom: 16px; padding: 12px 16px; border-radius: var(--r);
  border: 1px solid hsl(350 100% 65% / .4); background: hsl(350 100% 60% / .08); color: #ffc2cd; font-size: 14px;
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--panel-2);
  font-weight: 600; font-size: 14.5px; letter-spacing: .01em; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--panel-3); border-color: #424a6a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn-primary {
  position: relative; border: 0; color: #05060b; font-weight: 700;
  background: var(--rgb);
  box-shadow: var(--glow);
}
.btn-primary:hover { background: var(--rgb); filter: brightness(1.1); }
.btn-danger { border-color: hsl(350 100% 65% / .45); background: hsl(350 100% 60% / .12); color: #ff9fb1; }
.btn-danger:hover { background: hsl(350 100% 60% / .22); border-color: var(--danger); }
.btn-flat { background: transparent; border-color: transparent; color: var(--muted); }
.btn-flat:hover { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.btn.on { border-color: var(--grad-a); color: var(--text); background: hsl(var(--h) 100% 60% / .12); box-shadow: inset 0 0 0 1px hsl(var(--h) 100% 60% / .35); }

.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--void); color: var(--text); font-weight: 500;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; line-height: 1.45; }
.input::placeholder, textarea::placeholder { color: var(--dim); }
.input:focus, .select:focus, textarea:focus { outline: none; border-color: var(--grad-a); box-shadow: 0 0 0 3px hsl(var(--h) 100% 60% / .18); }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 17px top 19px, right 12px top 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--r); background: var(--void); border: 1px solid var(--line-2); }
.seg button { height: 34px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--grad-a); }

/* ---------- panels ---------- */
.panel {
  position: relative; background: linear-gradient(180deg, var(--panel), #0a0b13);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
}
/* HUD corner ticks */
.panel::before, .panel::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--line-2); border-style: solid;
}
.panel::before { top: 7px; left: 7px; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 4px; }
.panel::after { bottom: 7px; right: 7px; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 4px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head h2, .panel-head h3 { margin: 0; flex: 1; font: 700 18px/1.2 var(--display); letter-spacing: .01em; }
.panel-link { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.panel-link:hover { color: var(--text); }

.bar { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--rgb); transition: width .25s ease; }
.bar.full i { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 20px; }
.empty h3 { margin: 6px 0 0; font: 700 20px var(--display); }
.empty p { margin: 0 0 10px; max-width: 46ch; }
.empty-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: var(--grad-a); border: 1px dashed var(--line-2); }

/* ---------- home ---------- */
.hero { padding: 6px 0 34px; }
.hero-greet { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 15px; letter-spacing: .04em; }
.hero-greet i { width: 8px; height: 8px; border-radius: 2px; background: var(--grad-a); box-shadow: 0 0 10px var(--grad-a); transform: rotate(45deg); }
.hero-date {
  margin: 10px 0 0; font-family: var(--display); font-weight: 800; font-stretch: 75%;
  font-size: clamp(54px, 9.5vw, 132px); line-height: .9; letter-spacing: -.01em; text-transform: uppercase;
}
.hero-date span { display: block; }
.hero-date .d2 {
  background: var(--rgb); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px hsl(var(--h) 100% 55% / .35));
}
.hero-sum { margin: 22px 0 0; font-size: 18px; color: #c4c8dc; max-width: 62ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.home-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.home-grid .span-7 { grid-column: span 7; }
.home-grid .span-5 { grid-column: span 5; }
.home-grid .span-12 { grid-column: span 12; }

.mini-list { display: grid; gap: 14px; }
.mini-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; text-decoration: none; padding: 4px 0; }
.mini-row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .v { color: var(--muted); font-size: 14px; }
.mini-row .bar { grid-column: 1 / -1; }
.mini-row:hover .t { color: var(--grad-a); }

.stat-big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.stat-big .num { font-size: 56px; font-weight: 800; font-stretch: 80%; line-height: 1; }
.cat-counts { display: flex; flex-wrap: wrap; gap: 8px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { position: relative; display: block; aspect-ratio: 16/10; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.thumb:hover img { transform: scale(1.04); }
.thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; font-weight: 600; font-size: 13.5px; background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.online-list { display: grid; gap: 10px; }
.online-row { display: flex; align-items: center; gap: 12px; }
.online-row img { width: 36px; height: 36px; border-radius: 6px; }
.online-row .n { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2);
  font-size: 13.5px; font-weight: 600; color: var(--text); cursor: default; white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); box-shadow: 0 0 8px var(--c, transparent); }
button.chip { cursor: pointer; }
button.chip:hover { border-color: #424a6a; }
.chip.on { border-color: var(--c, var(--grad-a)); background: color-mix(in srgb, var(--c, var(--grad-a)) 14%, var(--panel-2)); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: .03em; background: var(--panel-3); color: var(--muted); }
.badge.bad { background: hsl(350 100% 60% / .16); color: #ff8ea3; }
.badge.warn { background: hsl(38 100% 60% / .14); color: #ffcc7a; }

/* ---------- checklists ---------- */
.split { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.split > *, .item > *, .home-grid > * { min-width: 0; }
.list-nav { display: grid; gap: 8px; position: sticky; top: 20px; }
.list-nav a {
  display: grid; gap: 8px; padding: 13px 14px; border-radius: var(--r); text-decoration: none;
  border: 1px solid var(--line); background: var(--panel);
}
.list-nav a:hover { border-color: var(--line-2); }
.list-nav a.active { border-color: var(--grad-a); background: hsl(var(--h) 100% 60% / .07); }
.list-nav .ln-top { display: flex; gap: 10px; align-items: baseline; }
.list-nav .ln-top b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-nav .ln-top span { color: var(--muted); font-size: 13px; }

.list-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.list-title { font: 700 24px/1.2 var(--display); margin: 0; flex: 1; min-width: 200px; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 4px 8px; margin-left: -9px; }
.list-title:hover { border-color: var(--line); }
.list-title:focus { outline: none; border-color: var(--grad-a); }
.list-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.list-meta .bar { flex: 1; min-width: 160px; }

.adder { display: grid; gap: 12px; padding: 16px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); margin-bottom: 20px; background: hsl(230 30% 8% / .5); }
.adder-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.adder .hint { margin: 0; font-size: 13px; color: var(--dim); }

.items { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 13px 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel);
  transition: border-color .15s, background .15s;
}
.item:hover { border-color: var(--line-2); }
.item.done { background: hsl(155 90% 60% / .045); border-color: hsl(155 90% 60% / .22); }
.item.done .item-name { color: var(--muted); text-decoration: line-through; text-decoration-color: hsl(155 90% 60% / .6); }
.item-name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.item-sub { font-size: 13px; color: var(--muted); }
.tick {
  width: 28px; height: 28px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--void);
  display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.tick:hover { border-color: var(--grad-a); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #04130c; box-shadow: 0 0 14px hsl(155 90% 60% / .5); }

.counter { display: flex; align-items: center; gap: 8px; }
.counter .num { font-size: 26px; font-weight: 800; font-stretch: 80%; min-width: 3.4ch; text-align: center; line-height: 1; }
.counter .num small { font-size: 16px; color: var(--dim); font-weight: 600; }
.count-body { display: grid; gap: 8px; cursor: pointer; user-select: none; }
.count-body:hover .item-name { color: var(--grad-a); }
.item.done .count-body:hover .item-name { color: var(--muted); }

.multi { grid-template-columns: 1fr auto; }
.multi .multi-body { grid-column: 1 / -1; display: grid; gap: 12px; }
.subs { display: flex; flex-wrap: wrap; gap: 8px; }
.sub {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 8px;
  border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer;
  font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, opacity .15s;
}
.sub:hover { border-color: #49527a; }
.sub .box { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; }
.sub.on { background: hsl(155 90% 60% / .08); border-color: hsl(155 90% 60% / .35); color: var(--muted); }
.sub.on .box { background: var(--ok); border-color: var(--ok); color: #04130c; }
.sub.on .lbl { text-decoration: line-through; }
.sub .pinmark { color: var(--c, var(--grad-a)); display: inline-flex; }
.sub-add { display: flex; gap: 8px; max-width: 420px; }
.sub-add .input { height: 36px; }

/* ---------- maps ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.map-card { display: grid; gap: 10px; text-decoration: none; }
.map-card .thumb { aspect-ratio: 16/10; }
.map-card .mc-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13.5px; }
.map-card .mc-meta b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone {
  display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px; aspect-ratio: 16/10;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); cursor: pointer;
  background: hsl(230 30% 8% / .5); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--grad-a); background: hsl(var(--h) 100% 60% / .06); color: var(--text); }
.dropzone b { font-family: var(--display); font-size: 17px; color: var(--text); }

.editor { display: grid; grid-template-columns: 1fr 300px; gap: 16px; height: calc(100vh - 130px); min-height: 520px; }
.editor-main { container-type: inline-size; display: grid; grid-template-rows: auto 1fr; gap: 10px; min-width: 0; min-height: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); }
@container (max-width: 880px) { .toolbar .seg span { display: none; } }
.toolbar .sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 4px; }
.swatches { display: flex; gap: 5px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; background: var(--c); }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--void), 0 0 10px var(--c); }
.size-range { width: 90px; accent-color: hsl(var(--h) 100% 60%); }
.viewport {
  position: relative; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    #07080e;
  background-blend-mode: normal;
  touch-action: none; user-select: none;
}
.viewport::after { content: ''; position: absolute; inset: 0; background: radial-gradient(transparent 60%, rgba(0,0,0,.35)); pointer-events: none; }
.viewport.tool-pan { cursor: grab; }
.viewport.tool-pan.dragging { cursor: grabbing; }
.viewport.tool-pen, .viewport.tool-eraser { cursor: crosshair; }
.viewport.tool-point { cursor: copy; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage img { image-rendering: auto; }
.markers { position: absolute; inset: 0; }
.viewport.tool-pen .markers, .viewport.tool-eraser .markers { pointer-events: none; }
.marker {
  position: absolute; transform: translate(-50%, -100%) scale(var(--inv, 1)); transform-origin: 50% 100%;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; border: 0; background: none; cursor: pointer;
}
.marker .pin { width: 30px; height: 30px; display: grid; place-items: center; color: #05060b; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.marker .pin svg { width: 30px; height: 30px; }
.marker .lbl {
  order: -1; padding: 2px 8px; border-radius: 4px; background: rgba(5,6,11,.85); border: 1px solid var(--c);
  font: 600 13px/1.3 var(--ui); color: var(--text); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.marker:hover .lbl, .marker:focus-visible .lbl { background: var(--c); color: #05060b; }
.marker.done { opacity: .85; }
.marker.done .pin svg { filter: grayscale(1) brightness(.7); }
.marker.done .lbl { color: var(--muted); border-color: var(--line-2); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--text); }
.marker.done:hover .lbl, .marker.done:focus-visible .lbl { background: var(--muted); color: #05060b; }
.marker.flash .pin { animation: flash 1s ease 2; }
@keyframes flash { 50% { transform: scale(1.5); } }
.zoom-ctl { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 2; }
.zoom-ctl .btn { background: rgba(13,15,24,.9); }
.zoom-lvl { position: absolute; left: 12px; bottom: 12px; z-index: 2; font-size: 12.5px; color: var(--muted); background: rgba(13,15,24,.85); padding: 4px 9px; border-radius: 4px; border: 1px solid var(--line); }

.pt-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; padding: 16px; }
.pt-panel .panel-head { margin-bottom: 0; }
.pt-scroll { overflow: auto; display: grid; gap: 16px; align-content: start; margin: 0 -6px; padding: 0 6px; }
.pt-group h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font: 700 14px var(--display); }
.pt-group h4 .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.pt-group h4 > span { color: var(--muted); font: 600 12.5px var(--ui); font-variant-numeric: tabular-nums; }
.pt-group h4 > span:first-child { flex: 1; color: var(--text); font: 700 14px var(--display); }
.pt-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; }
.pt-row:hover { background: var(--panel-2); }
.pt-row .tick { width: 22px; height: 22px; border-radius: 5px; }
.pt-row .tick svg { width: 14px; height: 14px; }
.pt-row .n { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: none; border: 0; text-align: left; padding: 0; }
.pt-row.done .n { color: var(--muted); text-decoration: line-through; }
.pt-row .btn-sm.btn-icon { width: 28px; height: 28px; opacity: .6; }
.pt-row:hover .btn-sm.btn-icon { opacity: 1; }
.place-hint { padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--grad-a); background: hsl(var(--h) 100% 60% / .08); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }

/* ---------- players ---------- */
.p-toolbar { display: grid; gap: 14px; margin-bottom: 18px; }
.p-add { display: flex; gap: 10px; flex-wrap: wrap; }
.p-add .input { flex: 1; min-width: 240px; }
.p-add .select { width: 170px; }
.p-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.p-filter .search { margin-left: auto; width: 220px; height: 34px; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard {
  position: relative; display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 16px;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); overflow: hidden;
}
.pcard::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c); box-shadow: 0 0 16px var(--c); }
.pcard .av { position: relative; width: 72px; height: 72px; }
.pcard .av img, .pcard .av .ph { width: 72px; height: 72px; border-radius: 8px; display: block; object-fit: cover; background: var(--panel-3); border: 2px solid var(--c); }
.pcard .av .ph { display: grid; place-items: center; color: var(--dim); }
.pcard .av .st { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--panel); background: var(--dim); }
.pcard .av .st.online { background: #57cbff; box-shadow: 0 0 10px #57cbff; }
.pcard .av .st.in-game { background: #90ba3c; box-shadow: 0 0 10px #90ba3c; }
.pcard .pc-main { min-width: 0; display: grid; gap: 5px; align-content: start; }
.pcard .pname { font: 700 19px/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pstate { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pstate.online { color: #57cbff; }
.pcard .pstate.in-game { color: #a8d65a; }
.pcard .aka { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.pcard .pc-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.pcard .note { grid-column: 1 / -1; font-size: 14px; color: #c4c8dc; background: var(--void); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 11px; cursor: text; white-space: pre-wrap; overflow-wrap: anywhere; }
.pcard .note.emptynote { color: var(--dim); border-style: dashed; }
.pcard textarea.input { grid-column: 1 / -1; min-height: 64px; }
.pcard .err { color: #ff8ea3; font-size: 13px; }
.pcard.loading .pname { opacity: .6; }
.cat-chip { --c: var(--muted); }

.cat-editor { display: grid; gap: 10px; }
.cat-row { display: flex; gap: 10px; align-items: center; }
.cat-row input[type=color] { width: 42px; height: 42px; padding: 3px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--void); cursor: pointer; }

/* ---------- settings ---------- */
.settings { display: grid; gap: 18px; max-width: 760px; }
.set-row { display: flex; align-items: center; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .lbl { flex: 1; }
.set-row .lbl b { display: block; font-weight: 600; }
.set-row .lbl span { color: var(--muted); font-size: 14px; }
.switch { position: relative; width: 50px; height: 28px; border-radius: 28px; border: 1px solid var(--line-2); background: var(--void); cursor: pointer; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.switch.on { background: hsl(var(--h) 100% 60% / .2); border-color: var(--grad-a); }
.switch.on::after { transform: translateX(22px); background: var(--grad-a); box-shadow: 0 0 10px var(--grad-a); }
input[type=range] { accent-color: hsl(var(--h) 100% 60%); }
.hue-range { width: 220px; height: 10px; -webkit-appearance: none; appearance: none; border-radius: 10px; background: linear-gradient(90deg, hsl(0 100% 60%), hsl(60 100% 60%), hsl(120 100% 60%), hsl(180 100% 60%), hsl(240 100% 60%), hsl(300 100% 60%), hsl(360 100% 60%)); }
.hue-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--text); border: 3px solid var(--void); cursor: pointer; }

/* ---------- modal, menu, toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(2,3,8,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 30px 80px -20px #000, 0 0 0 1px hsl(var(--h) 100% 60% / .15); animation: pop .18s ease; }
.modal-wide { width: min(620px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 0 22px; }
.modal-head h2 { margin: 0; flex: 1; font: 700 20px var(--display); }
.modal-head .btn { border-color: transparent; background: transparent; }
.modal-body { padding: 14px 22px 4px; display: grid; gap: 14px; }
.modal-body p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.menu { position: fixed; z-index: 60; min-width: 190px; padding: 6px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px #000; animation: pop .12s ease; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 4px; cursor: pointer; text-align: left; font-weight: 600; font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-3); outline: none; }
.menu-item.danger { color: #ff8ea3; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.toasts { position: fixed; z-index: 70; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { padding: 11px 16px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--grad-a); font-weight: 600; font-size: 14px; box-shadow: 0 16px 40px -10px #000; animation: pop .18s ease; max-width: 380px; }
.toast-error { border-left-color: var(--danger); }
.toast-ok { border-left-color: var(--ok); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .home-grid .span-7, .home-grid .span-5 { grid-column: span 12; }
  .editor { grid-template-columns: 1fr; height: auto; }
  .editor-main { grid-template-rows: auto 70vh; }
  .pt-panel { max-height: 420px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); }
  .logo, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11.5px; }
  .nav a.active::before { left: 12px; right: 12px; top: -7px; bottom: auto; width: auto; height: 3px; }
  .nav-settings { margin-top: 0; }
  .main { padding: 16px 16px 96px; }
  .top { flex-wrap: wrap; }
  .top h1 { font-size: 24px; flex-basis: 100%; }
  .top-actions { justify-content: flex-start; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .seg { display: flex; } .seg button { flex: 1; justify-content: center; padding: 0 8px; }
  .list-head .select { flex: 1; min-width: 0 !important; }
  .list-nav { position: static; }
  .p-filter .search { margin-left: 0; width: 100%; }
  .players { grid-template-columns: 1fr; }
}

/* ---------- pin groups: hide & fold ---------- */
.pt-group h4 .g-name { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: 700 14px var(--display); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-group h4 .g-name::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.pt-group.closed h4 .g-name::after { transform: translateY(-1px) rotate(-45deg); }
.pt-group h4 .btn-sm.btn-icon { width: 30px; height: 30px; }
.pt-group.off h4 .g-name, .pt-group.off h4 > span { opacity: .45; text-decoration: line-through; }
.pt-group.off .pt-row { opacity: .5; }

/* ---------- share dialog ---------- */
.share-body { display: grid; gap: 14px; }
.share-list { display: grid; gap: 4px; max-height: 300px; overflow: auto; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-weight: 600; }
.share-row input { width: 18px; height: 18px; accent-color: hsl(var(--h) 100% 60%); margin: 0; }
.share-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.pt-scroll > * { min-width: 0; } .pt-group h4 { min-width: 0; }

/* ---------- pin colour picker ---------- */
.cp { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cp .swatch { width: 28px; height: 28px; }
.cp-custom { width: 36px; height: 30px; padding: 2px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--void); cursor: pointer; }
.cp-custom.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--void), 0 0 10px var(--grad-a); }
.pt-group h4 .dot-btn { width: 13px; height: 13px; flex: none; border: 0; padding: 0; border-radius: 50%; cursor: pointer; background: var(--c); box-shadow: 0 0 8px var(--c); }
.pt-group h4 .dot-btn:hover { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.pt-group h4 .btn-sm.btn-icon { width: 28px; height: 28px; flex: none; }

/* ---------- hold-and-drag reordering ---------- */
.item, .sub, .pt-row, .pt-group[data-id], .list-nav a { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sort-ready { transition: transform .2s ease .12s, box-shadow .2s ease .12s; }
.sort-drag { position: relative; z-index: 5; transform: scale(1.02); cursor: grabbing !important;
  box-shadow: 0 0 0 1.5px var(--grad-a), 0 14px 34px -10px rgba(0,0,0,.8), 0 0 22px -6px var(--grad-a) !important; }
.sorting, .sorting * { cursor: grabbing !important; }
.pt-group.sort-drag, .pt-row.sort-drag { background: var(--panel-2); border-radius: 6px; }

/* ---------- dragging pins on the map ---------- */
.viewport:not(.tool-pen):not(.tool-eraser) .marker { cursor: grab; touch-action: none; }
.marker.moving { cursor: grabbing; z-index: 10; }
.marker.moving .pin { transform: translateY(-4px) scale(1.15); filter: drop-shadow(0 8px 10px rgba(0,0,0,.7)); }
.marker.moving .lbl { background: var(--c); color: #05060b; }
.viewport.pin-moving, .viewport.pin-moving * { cursor: grabbing !important; }
