/* Pixel Map's look (owner's pick, 28 Oct: the reviewed direction "C"). Layered over style.css.
   Layout: World / Test server stacked as labelled buttons top left with zoom under them; shop, templates, share in
   a row top right; menu and see-through button bottom left; a coordinates bar bottom middle; the round red PAINT
   button bottom right with the launch-boost badge beside it; colours in a column down the left side.
   Frames: flat buttons with a 2 px ink border, a paper gap and an outer ink ring. Colours: cool off-white and grey
   with near-black ink, an untinted map. Lettering: Pixelify Sans, bold, no extra letter-spacing.
   The Paint button is a real pixel circle: img/round-disc.svg masks the shape, img/round-ring.svg draws the stepped
   outline and bevel. Every other button is a plain square. */

:root {
  --ink: #101018; --paper: #f6f6f0; --paper2: #dcdcd2; --hi: #fff; --lo: #b9b9ae; --muted: #55556a;
  --accent: #ff2d2d; --accent-lo: #b30f0f; --accent-hi: #ff8a8a; --gold: #ffd400; --ok: #19c24b;
  --stamp: 80px; --legend: 148px;
}
:root body { background: #e9e9ef; }
:root #map canvas.maplibregl-canvas, :root #lmap canvas { filter: saturate(1.35) contrast(1.08); }
:root button { background: var(--paper); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
:root button:active:not(:disabled), :root button.on { transform: none; background: var(--paper2); box-shadow: 0 0 0 2px var(--paper2), 0 0 0 4px var(--ink); }
:root button.primary { color: var(--paper); background: var(--accent); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
:root .corner { --g: 12px; }
:root #tl { left: 12px; top: 12px; }
:root .card-head h2, :root #panel-title, :root .charges b { font-weight: 700; letter-spacing: 0; }

/* World / Test server: labelled buttons stacked down the left edge, zoom under them */
:root .seg { flex-direction: column; gap: 8px; }
:root .seg .tab + .tab { margin-left: 0; }
:root .seg .tab { text-transform: uppercase; font-size: 16px; font-weight: 700; letter-spacing: 0; }
:root .seg .tab.on { background: var(--gold); color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
:root .zoom { flex-direction: row; gap: 8px; margin-top: 4px; }
:root .zoom .ib + .ib { margin-top: 0; }
/* Tools in a row in the top-right corner */
:root #tr { flex-direction: row; top: 12px; right: 12px; gap: 12px; }

/* Bottom: menu left, coordinates centre, Paint right. The Paint control stays on screen as an on/off toggle. */
:root body.painting #bar { transform: none; }
:root #bar { left: 12px; right: 12px; bottom: 12px; }
:root .paint { left: auto; right: 0; transform: none; width: var(--stamp); height: var(--stamp); flex-direction: column; justify-content: center; gap: 0; padding: 0;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; color: #fff;
  border: 0; box-shadow: none; background: url(img/round-ring.svg) center / 100% 100% no-repeat, var(--accent);
  -webkit-mask: url(img/round-disc.svg) center / 100% 100% no-repeat; mask: url(img/round-disc.svg) center / 100% 100% no-repeat; }
:root .paint:hover:not(:disabled) { background: url(img/round-ring.svg) center / 100% 100% no-repeat, #ff4a4a; }
:root .paint:active:not(:disabled), :root body.painting .paint { transform: translateY(2px); background: url(img/round-ring.svg) center / 100% 100% no-repeat, var(--accent-lo); }
:root .paint i[data-icon] { width: 28px; height: 28px; }
:root .paint > span:not(.count) { display: block; font-size: 12px; }
:root .paint .count { display: none; }

/* Launch boost: a readable pill beside Paint ("⚡ 3×"); tap or hover explains it (#boost-pop) */
:root #bar .boost { margin-left: auto; margin-right: calc(var(--stamp) + 16px); width: auto; padding: 0 10px; display: flex; align-items: center; gap: 4px;
  background: var(--gold); color: var(--ink); }
:root #bar .boost[hidden] { display: none; }
:root #bar .boost i[data-icon] { width: 24px; height: 24px; }
:root #bar .boost .badge { position: static; height: auto; min-width: 0; padding: 0; background: none; color: var(--ink); font-size: 18px; line-height: 1; font-weight: 700; }
:root #boost-pop { position: fixed; z-index: 40; right: calc(var(--stamp) + 28px); bottom: calc(var(--b) + 28px); width: min(280px, calc(100% - 24px));
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); padding: 10px 12px; display: grid; gap: 6px; }
:root #boost-pop b { font-size: 16px; }
:root #boost-pop .bar { width: 100%; }
:root #boost-pop #boost-pop-fill { height: 100%; width: 0; background: var(--gold); }

:root #gridref { display: flex; position: fixed; z-index: 9; bottom: 18px; left: 50%; transform: translateX(-50%); align-items: center; gap: 8px;
  max-width: calc(100% - 2 * var(--b) - var(--stamp) - 72px); padding: 0 8px; height: 28px; font-size: 14px; font-weight: 700; letter-spacing: 0;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); pointer-events: none; }
:root #gridref i[data-icon] { width: 24px; height: 24px; flex: none; }
:root #gridref span { overflow: hidden; text-overflow: ellipsis; }
:root #coords { display: none; }

/* Colours: a column down the left side */
:root #tray { left: 0; top: 0; bottom: 0; width: var(--legend); transform: translateX(-110%); border: 0; border-right: 2px solid var(--ink);
  box-shadow: 2px 0 0 var(--paper), 4px 0 0 var(--ink); overflow-y: auto; padding: 12px; }
:root body.painting #tray { transform: translateX(0); }
:root .tray-head { flex-direction: column; align-items: stretch; gap: 8px; position: relative; margin-bottom: 12px; padding-top: 4px; }
:root .tray-head::before { content: 'LEGEND'; font-weight: 700; letter-spacing: 0; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
:root .tray-head #tray-close { position: absolute; right: -4px; top: -4px; }
:root .charges { flex-wrap: wrap; }
:root .charges .bar { width: 100%; order: 3; }
:root #palette { grid-template-columns: repeat(3, var(--sw)); justify-content: start; gap: 8px; }
:root .sw { box-shadow: 0 0 0 2px var(--paper); }
:root .sw.on { transform: none; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
:root body.painting #tl, :root body.painting #bar { left: calc(var(--legend) + 16px); }
:root body.painting #gridref { left: calc(50% + var(--legend) / 2); }
:root .chip, :root body.painting .chip { bottom: 60px; background: var(--ink); color: var(--paper); }
:root body.painting .maplibregl-ctrl-bottom-right { bottom: calc(var(--stamp) + 24px); }
:root .maplibregl-ctrl-bottom-right { bottom: calc(var(--stamp) + 24px); }
:root #panel { top: 96px; right: 12px; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink), 8px 8px 0 4px rgba(16,16,24,.25); }
:root .card { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
:root #toast { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); top: 96px; }

/* See-through: the opacity button above the menu, the art slider opening to its right */
:root #peek-wrap { left: 12px; bottom: calc(var(--b) + 28px); }
:root body.painting #peek-wrap { left: calc(var(--legend) + 16px); bottom: calc(var(--b) + 28px); }
:root body.peeking #peek { background: var(--ink); color: var(--paper); }
:root .art-pop { left: calc(100% + 12px); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

@media (max-width: 560px), (max-height: 480px) {
  :root { --stamp: 64px; --legend: 80px; }
  :root #tr { right: 8px; top: 8px; gap: 8px; }
  :root #tl { left: 8px; top: 8px; }
  :root .seg { gap: 6px; }
  :root #bar { left: 8px; right: 8px; bottom: 8px; }
  :root .paint i[data-icon] { width: 22px; height: 22px; }
  :root .paint > span:not(.count) { font-size: 10px; }
  :root #bar .boost { padding: 0 6px; margin-right: calc(var(--stamp) + 12px); }
  :root #bar .boost i[data-icon] { width: 20px; height: 20px; }
  :root #bar .boost .badge { font-size: 16px; }
  :root #boost-pop { right: 8px; bottom: calc(var(--stamp) + 20px); }
  :root #gridref { font-size: 12px; height: 24px; bottom: 12px; left: calc(var(--b) + 20px); transform: none; max-width: calc(100% - 2 * var(--b) - var(--stamp) - 104px); }
  :root #gridref .sheet { display: none; }
  :root body.painting #tl, :root body.painting #gridref, :root body.painting #menu-btn, :root body.painting #bar .boost { display: none; }
  :root #gridref i[data-icon] { display: none; }
  :root #panel { top: 64px; right: 8px; max-height: calc(100% - 72px); }
  :root #toast { top: 64px; }
  /* Phones and the Discord pop-out: colours are one scrollable column of big swatches (>= 44 px, no fat-fingering),
     defaults first, then the player's own slots, then the colour-code button. */
  :root #tray { padding: 6px 8px; display: flex; flex-direction: column; overflow: hidden; }
  :root .tray-head { margin-bottom: 6px; gap: 2px; align-items: center; padding-top: 0; flex: none; }
  :root .tray-head::before { display: none; }
  :root .tray-head #tray-close { position: static; order: -1; }
  :root .charges { justify-content: center; }
  :root .charges b { font-size: 14px; }
  :root .charges .bar, :root #charge-next { display: none; }
  :root .boost-row { display: none !important; }
  :root #palette { --sw: 52px; flex: 1; min-height: 0; grid-template-columns: var(--sw); grid-auto-rows: 48px; justify-content: center; gap: 8px;
    overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 8px 0; scrollbar-width: thin; scrollbar-color: var(--ink) var(--paper2);
    border-top: 2px solid var(--ink); }
  :root .sw { width: var(--sw); height: 48px; }
  :root .sw.hexb i[data-icon] { width: 24px; height: 24px; }
  :root #peek-wrap { left: 8px; bottom: calc(var(--b) + 20px); }
  :root body.painting #peek-wrap { left: calc(var(--legend) + 12px); bottom: 8px; }
}
@media (max-width: 440px) {
  :root #tr { gap: 6px; }
  :root #tr .ib { --b: 32px; }
}

/* Template move / resize frame: dashed outline, a square handle on each corner, a small bar with size and − / + */
:root #tpl-edit { position: fixed; z-index: 8; outline: 2px dashed var(--ink); box-shadow: 0 0 0 2px var(--paper); cursor: move; touch-action: none; }
:root #tpl-edit .h { position: absolute; width: 16px; height: 16px; background: var(--paper); border: 2px solid var(--ink); touch-action: none; }
:root #tpl-edit .h.nw { left: -10px; top: -10px; cursor: nwse-resize; }
:root #tpl-edit .h.ne { right: -10px; top: -10px; cursor: nesw-resize; }
:root #tpl-edit .h.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
:root #tpl-edit .h.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
:root .tpl-bar { position: fixed; z-index: 30; left: 50%; top: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); white-space: nowrap; font-weight: 700; }
:root .tpl-bar[hidden] { display: none; }
:root .tpl-bar button { min-width: 32px; }
@media (max-width: 560px) { :root .tpl-bar { top: auto; bottom: calc(var(--stamp) + 24px); max-width: calc(100% - 16px); } }
@media (pointer: coarse) {   /* bigger handles for fingers */
  :root #tpl-edit .h { width: 28px; height: 28px; }
  :root #tpl-edit .h.nw { left: -16px; top: -16px; } :root #tpl-edit .h.ne { right: -16px; top: -16px; }
  :root #tpl-edit .h.sw { left: -16px; bottom: -16px; } :root #tpl-edit .h.se { right: -16px; bottom: -16px; }
}
