/* GIMP Web — dark single-window theme (GIMP 2.10 "Dark" homage) */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font: 12px/1.45 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: #2b2b2b; color: #d8d8d8;
  user-select: none;
  -webkit-user-select: none;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- menu bar ---------- */
#menubar {
  display: flex; align-items: stretch;
  background: #353535;
  border-bottom: 1px solid #1c1c1c;
  height: 26px; flex: 0 0 26px;
  padding: 0 4px;
}
.menu-wrap { position: relative; display: flex; }
.menu-btn {
  background: none; border: none; color: #d8d8d8;
  padding: 0 10px; font: inherit; cursor: default;
}
.menu-btn:hover, .menu-wrap:focus-within .menu-btn { background: #4a4a4a; }
.menu-drop {
  display: none; position: absolute; top: 26px; left: 0;
  min-width: 230px; background: #3a3a3a;
  border: 1px solid #1c1c1c; box-shadow: 0 6px 18px rgba(0,0,0,0.55);
  z-index: 500; padding: 3px 0;
}
.menu-drop.open { display: block; }
.menu-drop.sub { top: -4px; left: 100%; }
.menu-item {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px 4px 6px; position: relative; white-space: nowrap;
}
.menu-item:hover { background: #4c6d8c; color: #fff; }
.menu-item.disabled { color: #777; }
.menu-check { width: 16px; text-align: center; font-size: 10px; }
.menu-label { flex: 1; }
.menu-shortcut { color: #9a9a9a; font-size: 11px; margin-left: 26px; }
.menu-item:hover .menu-shortcut { color: #d5e3ef; }
.menu-arrow { margin-left: 14px; font-size: 9px; color: #aaa; }
.menu-sep { height: 1px; background: #242424; margin: 4px 6px; }

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

#left-dock {
  width: 236px; flex: 0 0 236px;
  background: #333; border-right: 1px solid #1c1c1c;
  display: flex; flex-direction: column; min-height: 0;
}

/* ---------- swatches ---------- */
#swatch-area { padding: 8px 8px 4px; }
#swatches { position: relative; width: 76px; height: 62px; }
#fg-swatch, #bg-swatch {
  position: absolute; width: 38px; height: 38px;
  border: 2px solid #1a1a1a; box-shadow: 0 0 0 1px #555;
  cursor: pointer;
}
#fg-swatch { left: 0; top: 0; z-index: 2; background: #181818; }
#bg-swatch { left: 26px; top: 20px; z-index: 1; background: #fff; }
#swap-colors {
  position: absolute; left: 44px; top: -2px;
  background: none; border: none; color: #ccc; font-size: 13px; cursor: pointer;
}
#reset-colors {
  position: absolute; left: -2px; top: 42px;
  background: none; border: none; color: #ccc; font-size: 9px; cursor: pointer; letter-spacing: -1px;
}
#swap-colors:hover, #reset-colors:hover { color: #fff; }

/* ---------- toolbox ---------- */
#toolbox { padding: 4px 6px; border-top: 1px solid #222; }
.tool-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px;
}
.tool-btn {
  aspect-ratio: 1; background: #3d3d3d; border: 1px solid #282828;
  border-radius: 3px; color: #cfcfcf; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 4px;
}
.tool-btn svg { width: 100%; height: 100%; }
.tool-btn:hover { background: #4a4a4a; border-color: #5a5a5a; }
.tool-btn.active {
  background: #54708c; border-color: #6f93b5; color: #fff;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

/* ---------- tool options ---------- */
#tool-options {
  flex: 1; overflow-y: auto; border-top: 1px solid #222;
  padding: 6px 8px; min-height: 120px;
}
.opts-title {
  font-weight: 600; color: #e8e8e8; margin-bottom: 6px;
  border-bottom: 1px solid #444; padding-bottom: 4px;
}
.opts-sub { margin: 8px 0 4px; color: #aaa; font-size: 11px; }

.slider-row { display: flex; align-items: center; gap: 6px; margin: 5px 0; }
.dlg-label { width: 76px; flex: 0 0 76px; color: #bdbdbd; font-size: 11px; }
.slider-range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px;
  background: #222; border-radius: 2px; outline: none; min-width: 40px;
}
.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #8a8a8a; border: 1px solid #1c1c1c; cursor: pointer;
}
.slider-range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #8a8a8a; border: 1px solid #1c1c1c; cursor: pointer;
}
.slider-num {
  width: 52px; background: #262626; color: #ddd;
  border: 1px solid #1a1a1a; border-radius: 3px; padding: 2px 4px; font: inherit; font-size: 11px;
}
.opts-select, .layer-mode {
  flex: 1; background: #262626; color: #ddd; border: 1px solid #1a1a1a;
  border-radius: 3px; padding: 3px 4px; font: inherit; font-size: 11px; min-width: 0;
}
.dlg-check { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 11px; color: #cfcfcf; cursor: pointer; }
.dlg-check input { accent-color: #54708c; }

.selmode-row { display: flex; gap: 4px; margin: 5px 0; }
.selmode-btn {
  width: 34px; height: 28px; background: #3d3d3d; border: 1px solid #282828;
  border-radius: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.selmode-btn.active { background: #54708c; border-color: #6f93b5; }
.selmode-ico { width: 18px; height: 18px; display: block; position: relative; }
.selmode-replace { border: 2px dashed #ddd; }
.selmode-add { border: 2px dashed #ddd; box-shadow: 8px 4px 0 -2px #3d3d3d, 8px 4px 0 0 #ddd; }
.selmode-subtract { border: 2px dashed #ddd; }
.selmode-subtract::after { content: ''; position: absolute; right: -6px; top: 4px; width: 10px; height: 8px; background: #3d3d3d; border: 1px dashed #999; }
.selmode-intersect { border: 2px dashed #ddd; }
.selmode-intersect::after { content: ''; position: absolute; right: -5px; bottom: -5px; width: 10px; height: 8px; border: 2px dashed #8ab4d8; background: rgba(84,112,140,0.5); }

.brush-pick-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: #3d3d3d; border: 1px solid #282828; border-radius: 3px;
  padding: 4px; cursor: pointer; color: #ddd; font: inherit; margin-top: 4px;
}
.brush-pick-btn:hover { background: #4a4a4a; }
.brush-pick-btn canvas { background: #2b2b2b; border-radius: 2px; }
.brush-pick-name { font-size: 11px; }

.mini-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.mini-cell { border: 2px solid transparent; border-radius: 3px; cursor: pointer; background: #222; }
.mini-cell.active { border-color: #6f93b5; }
.grad-cell { width: 56px; height: 16px; }

/* ---------- center / canvas ---------- */
#center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#canvas-area {
  flex: 1; display: grid; min-height: 0;
  grid-template-columns: 20px 1fr; grid-template-rows: 20px 1fr;
  background: #2b2b2b;
}
#ruler-corner { grid-column: 1; grid-row: 1; background: #3c3c3c; border-right: 1px solid #222; border-bottom: 1px solid #222; }
#ruler-h { grid-column: 2; grid-row: 1; display: block; }
#ruler-v { grid-column: 1; grid-row: 2; display: block; }
#canvas-scroll {
  grid-column: 2; grid-row: 2; overflow: auto;
  background: #2b2b2b; position: relative;
}
#canvas-pad { position: relative; }
#display-canvas { position: absolute; box-shadow: 0 0 0 1px #111, 0 4px 24px rgba(0,0,0,0.5); }
.text-tool-editor {
  position: absolute; z-index: 60; background: rgba(30,30,30,0.25);
  border: 1px dashed #e8a33d; color: #fff; outline: none; resize: none;
  min-width: 120px; min-height: 1.4em; overflow: hidden; padding: 2px;
}

/* ---------- status bar ---------- */
#statusbar {
  flex: 0 0 24px; display: flex; align-items: center; gap: 8px;
  background: #353535; border-top: 1px solid #1c1c1c; padding: 0 8px;
  font-size: 11px; color: #bdbdbd;
}
#status-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.status-spacer { flex: 1; }
#status-pos { min-width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
#zoom-combo {
  width: 70px; background: #262626; color: #ddd; border: 1px solid #1a1a1a;
  border-radius: 3px; padding: 2px 4px; font: inherit; font-size: 11px; text-align: right;
}
.zoom-btn {
  width: 22px; height: 18px; background: #3d3d3d; color: #ddd;
  border: 1px solid #282828; border-radius: 3px; cursor: pointer; line-height: 1;
}
.zoom-btn:hover { background: #4a4a4a; }

/* ---------- right docks ---------- */
#right-dock {
  width: 264px; flex: 0 0 264px;
  background: #333; border-left: 1px solid #1c1c1c;
  display: flex; flex-direction: column; min-height: 0;
}
.dock-group { flex: 1; display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid #1c1c1c; }
.dock-group:last-child { border-bottom: none; }
.dock-tabs { display: flex; background: #2e2e2e; border-bottom: 1px solid #1c1c1c; flex: 0 0 auto; }
.dock-tab {
  background: none; border: none; border-right: 1px solid #262626;
  color: #a5a5a5; padding: 5px 10px; font: inherit; font-size: 11px; cursor: pointer;
}
.dock-tab:hover { color: #ddd; }
.dock-tab.active { background: #333; color: #fff; box-shadow: inset 0 2px 0 #54708c; }
.dock-pages { flex: 1; overflow-y: auto; min-height: 0; }
.dock-page { display: none; padding: 6px; }
.dock-page.active { display: block; }
.dock-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.dock-btnrow {
  display: flex; gap: 3px; margin-top: 6px; padding-top: 6px;
  border-top: 1px solid #262626; justify-content: center;
}
.dock-btn {
  width: 30px; height: 26px; background: #3d3d3d; color: #cfcfcf;
  border: 1px solid #282828; border-radius: 3px; cursor: pointer; font-size: 13px;
}
.dock-btn:hover { background: #4a4a4a; color: #fff; }
.dock-empty { color: #777; font-style: italic; padding: 12px 6px; font-size: 11px; }

/* ---------- layers panel ---------- */
.layers-list { overflow-y: auto; max-height: 100%; }
.layer-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 4px; border: 1px solid transparent; border-radius: 3px;
  cursor: default;
}
.layer-row:hover { background: #3d3d3d; }
.layer-row.active { background: #4c6d8c; color: #fff; }
.layer-row.floating { background: #5c5340; border: 1px dashed #e8a33d; }
.layer-row.drop-target { border-color: #e8a33d; }
.layer-eye {
  width: 16px; height: 16px; flex: 0 0 16px; position: relative; cursor: pointer;
}
.layer-eye.on::before {
  content: ''; position: absolute; left: 1px; top: 5px;
  width: 14px; height: 7px; border-radius: 50%;
  border: 1.6px solid #cfcfcf; background: radial-gradient(circle at center, #cfcfcf 0 2.5px, transparent 3px);
}
.layer-row.active .layer-eye.on::before { border-color: #fff; }
.layer-thumb { border: 1px solid #1c1c1c; border-radius: 2px; flex: 0 0 auto; background: #888; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.layer-rename {
  background: #262626; color: #fff; border: 1px solid #54708c;
  border-radius: 2px; padding: 1px 4px; font: inherit; font-size: 11px; flex: 1;
}

/* ---------- undo panel ---------- */
.undo-list { max-height: 100%; }
.undo-row {
  padding: 3px 8px; border-left: 3px solid #54708c; margin: 2px 4px;
  background: #3a3a3a; font-size: 11px; border-radius: 2px; cursor: pointer;
}
.undo-row:hover { background: #444; }
.undo-row.base { border-left-color: #666; color: #aaa; }
.undo-row.undone { opacity: 0.45; border-left-color: #333; }

/* ---------- brushes dock ---------- */
.brush-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.brush-cell {
  width: 52px; height: 52px; background: #2b2b2b; border: 1px solid #222;
  border-radius: 3px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.brush-cell:hover { border-color: #6f93b5; }
.grad-list { display: flex; flex-direction: column; gap: 4px; }
.grad-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #bbb; }
.grad-row canvas { border: 1px solid #1c1c1c; border-radius: 2px; }

/* ---------- dialogs ---------- */
.dlg-overlay {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
}
.dialog {
  position: absolute; background: #383838; border: 1px solid #161616;
  border-radius: 5px; box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  pointer-events: auto; display: flex; flex-direction: column;
  max-height: 86vh;
}
.dlg-title {
  display: flex; align-items: center; justify-content: space-between;
  background: #2e2e2e; padding: 7px 10px; border-bottom: 1px solid #1c1c1c;
  border-radius: 5px 5px 0 0; font-weight: 600; cursor: move;
}
.dlg-close {
  background: none; border: none; color: #aaa; font-size: 15px; cursor: pointer; line-height: 1;
}
.dlg-close:hover { color: #fff; }
.dlg-body { padding: 12px; overflow-y: auto; user-select: none; }
.dlg-buttons {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid #1c1c1c;
}
.btn {
  background: #454545; color: #ddd; border: 1px solid #242424;
  border-radius: 4px; padding: 5px 18px; font: inherit; cursor: pointer;
}
.btn:hover { background: #505050; }
.btn.primary { background: #4c6d8c; border-color: #38536e; color: #fff; }
.btn.primary:hover { background: #577b9c; }
.dlg-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.dlg-section { margin: 10px 0 4px; font-weight: 600; color: #e0e0e0; border-bottom: 1px solid #484848; padding-bottom: 3px; }
.dlg-hint { color: #8f8f8f; font-size: 10.5px; margin-top: 8px; font-style: italic; }
.levels-hist { display: block; margin: 8px auto; border: 1px solid #1c1c1c; width: 256px; height: 80px; }
.curves-widget { display: block; margin: 8px auto; border: 1px solid #1c1c1c; cursor: crosshair; }

/* ---------- color dialog ---------- */
.color-dlg { display: flex; gap: 8px; }
.color-sv { cursor: crosshair; border: 1px solid #1c1c1c; }
.color-hue { cursor: pointer; border: 1px solid #1c1c1c; }
.color-right { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.color-preview { height: 44px; border: 1px solid #1c1c1c; border-radius: 3px; }
.color-hex { background: #262626; color: #ddd; border: 1px solid #1a1a1a; border-radius: 3px; padding: 4px 6px; font: inherit; }

/* ---------- about ---------- */
.about-wrap { display: flex; gap: 14px; align-items: flex-start; }
.about-text { display: flex; flex-direction: column; gap: 4px; }
.about-title { font-size: 15px; font-weight: 700; color: #fff; }

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #3a3f45 0%, #22252a 75%);
  transition: opacity 0.35s;
}
.splash.fade { opacity: 0; pointer-events: none; }
.splash-title {
  font-size: 54px; font-weight: 800; letter-spacing: 10px; color: #d8d8d8;
  text-shadow: 0 3px 12px rgba(0,0,0,0.7);
}
.splash-sub { color: #8fa3b8; margin-bottom: 18px; letter-spacing: 2px; }
.splash canvas { filter: drop-shadow(0 6px 16px rgba(0,0,0,0.6)); }
.splash-bar {
  width: 220px; height: 6px; background: #54708c; border-radius: 3px;
  margin-top: 22px; transition: width 0.15s; box-shadow: 0 0 8px rgba(84,112,140,0.7);
}
.splash-label { margin-top: 8px; color: #9a9a9a; font-size: 11px; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #2b2b2b; }
::-webkit-scrollbar-thumb { background: #4a4a4a; border: 2px solid #2b2b2b; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }
::-webkit-scrollbar-corner { background: #2b2b2b; }
