/* =========================================================================
   GROUP PAINT — Windows-95 Paint cosplay.
   Gray chrome, beveled everything, tool palette left, colors bottom,
   status bar with world coordinates. The canvas itself renders pixelated.
   ========================================================================= */

:root {
  --w95-face: #c0c0c0;
  --w95-light: #ffffff;
  --w95-shadow: #808080;
  --w95-dark: #000000;
  --w95-title: #000080;
  --w95-title2: #1084d0;
  --desk: #008080;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--desk);
  font-family: "Pixelated MS Sans Serif", Tahoma, "MS Sans Serif", Geneva, sans-serif;
  font-size: 12px;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

/* Beveled panel helpers */
.bevel-out, #win, .tool, .btn, #toolbox, #palette-bar, .st-cell, .dlg {
  border-top: 2px solid var(--w95-light);
  border-left: 2px solid var(--w95-light);
  border-right: 2px solid var(--w95-dark);
  border-bottom: 2px solid var(--w95-dark);
  background: var(--w95-face);
}
.bevel-in, #canvas-wrap, #name-box, .swatch-wrap, #dlg-name-input {
  border-top: 2px solid var(--w95-shadow);
  border-left: 2px solid var(--w95-shadow);
  border-right: 2px solid var(--w95-light);
  border-bottom: 2px solid var(--w95-light);
}

#win {
  position: fixed; inset: 4px;
  display: flex; flex-direction: column;
  padding: 2px;
}

/* ---- title bar ---- */
#titlebar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, var(--w95-title), var(--w95-title2));
  color: #fff; font-weight: bold;
  padding: 2px 4px; margin-bottom: 2px;
  height: 20px; flex: none;
}
.ttl-btns .tb {
  display: inline-block; width: 16px; height: 14px; margin-left: 2px;
  background: var(--w95-face); color: #000; text-align: center;
  font-size: 10px; line-height: 13px; font-weight: bold;
  border-top: 1px solid var(--w95-light); border-left: 1px solid var(--w95-light);
  border-right: 1px solid var(--w95-dark); border-bottom: 1px solid var(--w95-dark);
}

/* ---- menu bar ---- */
#menubar {
  display: flex; align-items: center; gap: 2px;
  padding: 1px 2px; flex: none;
}
.menu-word { padding: 2px 6px; }
.menu-word:hover { background: var(--w95-title); color: #fff; cursor: default; }
#menu-friends, #menu-overlay { cursor: pointer; }
#menu-overlay.on { background: var(--w95-title); color: #fff; }
.menu-spacer { flex: 1; }
#name-wrap { margin-right: 6px; }
#name-box {
  width: 110px; padding: 1px 3px; font: inherit;
  background: #fff; outline: none;
}
.pill { padding: 2px 6px; font-size: 11px; }
.pill.ok { color: #006000; }
.pill.warn { color: #a00000; }

/* ---- main area ---- */
#main { display: flex; flex: 1; min-height: 0; }

#toolbox {
  flex: none; width: 66px; margin: 2px; padding: 3px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
#tools { display: grid; grid-template-columns: 28px 28px; gap: 1px; }
.tool {
  width: 28px; height: 28px; padding: 0;
  font-size: 15px; line-height: 24px; text-align: center; cursor: pointer;
}
.tool.active {
  border-top: 2px solid var(--w95-dark);
  border-left: 2px solid var(--w95-dark);
  border-right: 2px solid var(--w95-light);
  border-bottom: 2px solid var(--w95-light);
  background: #dcdcdc;
}
#sizes { display: flex; flex-direction: column; gap: 2px; width: 56px; }
.size-opt {
  height: 18px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: var(--w95-face);
  border: 1px solid transparent;
}
.size-opt.active { background: var(--w95-title); }
.size-dot { background: #000; border-radius: 50%; }
.size-opt.active .size-dot { background: #fff; }

/* ---- canvas ---- */
#canvas-wrap {
  flex: 1; margin: 2px; position: relative; overflow: hidden;
  background: #808080;   /* the void outside… is also paintable, but pre-load it reads as Paint's gray */
  min-width: 0;
}
#easel {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}
#easel.panning { cursor: grab; }
#easel.panning:active { cursor: grabbing; }
#easel.no-draw { cursor: not-allowed; }

#banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: #ffffe1; border: 1px solid #000; padding: 4px 10px;
  font-size: 12px; box-shadow: 2px 2px 0 rgba(0,0,0,.4);
}

/* ---- palette ---- */
#palette-bar {
  flex: none; margin: 2px; padding: 3px 4px;
  display: flex; align-items: center; gap: 6px;
}
#current-swatch {
  width: 30px; height: 30px; flex: none;
  border-top: 2px solid var(--w95-shadow); border-left: 2px solid var(--w95-shadow);
  border-right: 2px solid var(--w95-light); border-bottom: 2px solid var(--w95-light);
}
#palette { display: grid; grid-template-rows: 16px 16px; grid-auto-flow: column; gap: 1px; }
.swatch {
  width: 16px; height: 16px; cursor: pointer;
  border-top: 1px solid var(--w95-shadow); border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light); border-bottom: 1px solid var(--w95-light);
}
.swatch.active { outline: 2px solid var(--w95-title); outline-offset: 0; }

/* ---- status bar ---- */
#statusbar {
  flex: none; display: flex; gap: 2px; margin: 0 2px 2px; height: 20px;
}
.st-cell {
  border-top: 1px solid var(--w95-shadow); border-left: 1px solid var(--w95-shadow);
  border-right: 1px solid var(--w95-light); border-bottom: 1px solid var(--w95-light);
  background: var(--w95-face);
  padding: 2px 8px; white-space: nowrap; overflow: hidden;
}
#st-hint { flex: 1; min-width: 60px; }
#st-owner { min-width: 140px; }
#st-coords { min-width: 130px; }
#st-zoom { min-width: 70px; }

/* ---- dialogs ---- */
.hidden { display: none !important; }
#dlg-shade, #dlg-guide-shade {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}

/* ---- first-run guide ---- */
#dlg-guide { width: 400px; max-width: calc(100vw - 24px); }
.guide-row { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; }
.guide-key {
  flex: none; width: 92px; padding: 3px 4px; text-align: center;
  line-height: 14px; font-size: 11px; background: var(--w95-face);
  border-top: 1px solid var(--w95-light); border-left: 1px solid var(--w95-light);
  border-right: 1px solid var(--w95-dark); border-bottom: 1px solid var(--w95-dark);
}
.guide-txt { flex: 1; line-height: 16px; }
.dlg { width: 340px; padding: 2px; }
.dlg-title {
  background: linear-gradient(90deg, var(--w95-title), var(--w95-title2));
  color: #fff; font-weight: bold; padding: 3px 6px;
}
.dlg-body { padding: 10px 12px; }
.dlg-body input { width: 100%; padding: 2px 4px; font: inherit; background: #fff; outline: none; }
.dlg-btns { display: flex; justify-content: center; gap: 8px; padding: 6px 0 10px; }
.btn { min-width: 70px; padding: 4px 10px; font: inherit; cursor: pointer; }
.dlg-note { color: #606060; }
#dlg-chunk-shade {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
#chunk-mode-set { border: 1px solid var(--w95-shadow); margin: 6px 0; }
#chunk-mode-set label { line-height: 20px; }

#dlg-friends-shade {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
#dlg-friends { width: 420px; }
#friend-lists { max-height: 220px; overflow-y: auto; margin-top: 4px; }
#nearby-section { margin-top: 6px; }
#nearby-list { max-height: 132px; overflow-y: auto; }
.friend-section { font-weight: bold; margin: 8px 0 2px; }
.friend-row {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 4px; background: #fff;
  border: 1px solid var(--w95-shadow); margin-bottom: 2px;
}
.friend-row .fr-name { flex: 1; }
.friend-row .btn { min-width: 0; padding: 1px 6px; }
#friend-code-input, #import-phrase { font: inherit; padding: 2px 4px; background: #fff; width: 130px; }
#import-phrase { width: 230px; }
#backup-phrase { background: #fff; padding: 2px 4px; border: 1px solid var(--w95-shadow); }
#dlg-friends hr { border: 0; border-top: 1px solid var(--w95-shadow); }
#default-mode-set { border: 1px solid var(--w95-shadow); margin: 2px 0 8px; }
#default-mode-set label { line-height: 20px; }
.friend-toggle { display: block; line-height: 20px; }
#friend-settings input[type="radio"],
#friend-settings input[type="checkbox"] { width: auto; margin-right: 4px; }
.btn:active {
  border-top: 2px solid var(--w95-dark); border-left: 2px solid var(--w95-dark);
  border-right: 2px solid var(--w95-light); border-bottom: 2px solid var(--w95-light);
}
