/* Retro "Windows 98"-style Paint. The chrome is intentionally classic gray
   regardless of the arcade skin. */
.paint-wrap { max-width: 940px; margin: 0 auto; padding: .8rem .5rem 2.5rem; }

.win98 {
  background: #c0c0c0;
  color: #000;
  font-family: Tahoma, 'MS Sans Serif', Arial, sans-serif;
  font-size: 12px;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 1px 1px 0 #000, 0 12px 30px rgba(0,0,0,.55);
  padding: 2px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.titlebar {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff; font-weight: 700; padding: 3px 4px;
}
.titlebar .ttl { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.titlebar .tb-btns { display: flex; gap: 2px; }
.titlebar .tb-btns span, .titlebar .tb-btns a {
  width: 16px; height: 14px; background: #c0c0c0; color: #000;
  border: 1px solid; border-color: #fff #404040 #404040 #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; text-decoration: none; font-weight: 900;
}

.menubar { display: flex; position: relative; padding: 2px 0; border-bottom: 1px solid #808080; flex-wrap: wrap; }
.menu { position: relative; }
.menu > .mt { padding: 3px 8px; cursor: default; display: block; }
.menu.open > .mt, .menu > .mt:hover { background: #000080; color: #fff; }
.dropdown {
  display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 170px;
  background: #c0c0c0; border: 2px solid; border-color: #fff #404040 #404040 #fff; box-shadow: 1px 1px 0 #000;
  padding: 2px;
}
.menu.open .dropdown { display: block; }
.dropdown button {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 20px 5px 18px;
  font: inherit; color: #000; cursor: default; white-space: nowrap;
}
.dropdown button:hover { background: #000080; color: #fff; }
.dropdown hr { border: 0; border-top: 1px solid #808080; border-bottom: 1px solid #fff; margin: 3px 2px; }

.paint-body { display: flex; gap: 3px; padding: 3px 0; align-items: flex-start; }
.left-col { display: flex; flex-direction: column; gap: 4px; width: 70px; flex: none; }
.toolbox {
  display: grid; grid-template-columns: repeat(2, 32px); gap: 0;
  padding: 3px; background: #c0c0c0;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  justify-content: center;
}
.tool {
  width: 32px; height: 32px; padding: 0; background: #c0c0c0; font-size: 17px; line-height: 1; color: #000;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
  display: flex; align-items: center; justify-content: center; cursor: default;
  touch-action: manipulation;
}
.tool.active { border-color: #404040 #fff #fff #404040; background: repeating-conic-gradient(#c0c0c0 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
.tool .dash { width: 16px; height: 12px; border: 1px dashed #000; display: block; }
.tool svg { display: block; }

.options {
  display: flex; flex-direction: column; gap: 3px; padding: 3px; min-height: 60px;
  border: 2px solid; border-color: #808080 #fff #fff #808080; align-items: center;
}
.options .grp { display: flex; flex-wrap: wrap; gap: 1px; justify-content: center; }
.opt {
  min-width: 26px; height: 22px; padding: 0 3px; background: #c0c0c0; font-size: 13px; line-height: 1;
  border: 1px solid; border-color: #fff #404040 #404040 #fff;
  display: flex; align-items: center; justify-content: center; cursor: default; color: #000;
}
.opt.active { background: #000080; color: #fff; border-color: #404040 #fff #fff #404040; }
.opt.active i { background: #fff !important; }
.opt i { display: block; background: #000; }

.work { flex: 1; min-width: 0; }
.canvas-scroll {
  background: #808080; overflow: auto; padding: 4px;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
  max-height: 74vh;
}
.canvas-wrap { position: relative; width: 100%; max-width: 640px; background: #fff; box-shadow: 0 0 0 1px #000; line-height: 0; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; }
.canvas-wrap.zoomed canvas { image-rendering: pixelated; }
#ov { position: absolute; left: 0; top: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.text-box {
  position: absolute; z-index: 5; margin: 0; padding: 0; background: transparent; border: 1px dashed #000;
  outline: none; resize: none; overflow: hidden; font-family: Arial, sans-serif; line-height: 1.2; min-width: 60px;
  user-select: text; -webkit-user-select: text; white-space: pre;
}

.colorbar { display: flex; gap: 6px; padding: 3px; align-items: center; flex-wrap: wrap; border-top: 1px solid #fff; }
.colorbox {
  position: relative; width: 40px; height: 38px; flex: none;
  border: 2px solid; border-color: #808080 #fff #fff #808080;
}
.colorbox .sw { position: absolute; width: 22px; height: 22px; border: 2px solid; border-color: #fff #404040 #404040 #fff; }
.colorbox #fgBox { left: 2px; top: 2px; z-index: 2; }
.colorbox #bgBox { left: 12px; top: 10px; z-index: 1; }
.colorbox .sw.active { outline: 2px solid #ff0; outline-offset: 0; }
.palette { display: grid; grid-template-columns: repeat(14, 20px); grid-auto-rows: 20px; gap: 0; }
.pal {
  width: 20px; height: 20px; padding: 0; border: 2px solid; border-color: #808080 #fff #fff #808080; cursor: default;
}
.custom-btn { height: 24px; padding: 0 8px; font: inherit; background: #c0c0c0; border: 2px solid; border-color: #fff #404040 #404040 #fff; }
.custom-btn:active { border-color: #404040 #fff #fff #404040; }
#custom { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

.statusbar { display: flex; gap: 4px; font-size: 11px; padding-top: 3px; }
.statusbar span { padding: 2px 6px; border: 1px solid; border-color: #808080 #fff #fff #808080; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar #hint { flex: 1; }

@media (max-width: 720px) {
  .paint-body { flex-direction: column; }
  .left-col { width: 100%; flex-direction: column; }
  .toolbox { grid-template-columns: repeat(8, 1fr); width: 100%; }
  .tool { width: 100%; height: 38px; }
  .options { flex-direction: row; flex-wrap: wrap; justify-content: center; min-height: 34px; }
  .opt { min-width: 34px; height: 30px; }
  .work { width: 100%; }
  .palette { grid-template-columns: repeat(14, 1fr); width: 100%; grid-auto-rows: 24px; }
  .pal { width: 100%; height: 24px; }
  .colorbar { flex-wrap: nowrap; }
  .palette { flex: 1; }
  .statusbar #coords { display: none; }
}
