/* ── T.M.O.O.P. Editor — Photoshop-style UI ─────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #535353;   /* Photoshop workspace gray */
  --panel:        #3c3c3c;   /* panel body */
  --panel-hdr:    #474747;   /* panel header */
  --toolbar:      #3c3c3c;   /* toolbars */
  --titlebar:     #404040;
  --border:       #2a2a2a;
  --border-hi:    #666;
  --text:         #d4d4d4;
  --text-dim:     #9a9a9a;
  --text-bright:  #f0f0f0;
  --blue:         #3a8ee6;
  --blue-dim:     rgba(58,142,230,.18);
  --input:        #2c2c2c;
  --canvas-bg:    #404040;
  --close:        #ff5f56;
  --minimize:     #ffbd2e;
  --maximize:     #27c93f;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #1a1a1a;
}

#app {
  display: flex; flex-direction: column;
  width: 100vw; height: 100vh;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar           { width: 13px; height: 13px; }
::-webkit-scrollbar-track     { background: #333; }
::-webkit-scrollbar-thumb     { background: #707070; border: 3px solid #333; border-radius: 7px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #8c8c8c; }
::-webkit-scrollbar-corner    { background: #333; }

/* ── Title Bar ──────────────────────────────────────────────────────────── */
#titlebar {
  display: flex; align-items: center;
  height: 36px; flex-shrink: 0;
  background: var(--titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  position: relative;
}

.tbar-home {
  flex-shrink: 0; margin-right: 6px;
}

.titlebar-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  pointer-events: none;
}
.titlebar-appname {
  font-size: 11px; font-weight: 600;
  color: var(--text-bright); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.titlebar-year {
  font-size: 11px; color: var(--text-dim);
}
.titlebar-sep {
  color: var(--border-hi); font-size: 14px; line-height: 1;
}
.titlebar-artist {
  font-size: 11px; color: var(--text-dim);
}

.titlebar-actions {
  margin-left: auto;
  display: flex; gap: 4px; align-items: center;
}
.tbar-btn {
  width: 26px; height: 26px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, background .1s;
}
.tbar-btn:hover { color: var(--text-bright); background: rgba(255,255,255,.08); }

/* ── Menu Bar ───────────────────────────────────────────────────────────── */
#menubar {
  display: flex; align-items: center;
  height: 22px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 6px; gap: 0;
}
.menu-item {
  padding: 0 8px; height: 22px;
  display: flex; align-items: center;
  cursor: pointer; font-size: 11px; color: var(--text);
  border-radius: 2px; user-select: none; position: relative;
}
.menu-item:hover  { background: var(--blue); color: #fff; }
.menu-item.active { color: var(--text-bright); font-weight: 500; }
.menu-item.active::after {
  content: ''; position: absolute; bottom: 0; left: 8px; right: 8px;
  height: 2px; background: var(--blue); border-radius: 1px;
}
.menu-sep {
  width: 1px; height: 14px; background: var(--border-hi);
  margin: 0 4px; flex-shrink: 0;
}

/* ── Panel Resize Handles ────────────────────────────────────────────────── */
.resize-handle {
  width: 4px; flex-shrink: 0;
  background: transparent; cursor: col-resize;
  position: relative; z-index: 10;
  transition: background .15s;
}
.resize-handle::after {
  content: ''; position: absolute; inset: 0 -2px;
}
.resize-handle:hover, .resize-handle.dragging {
  background: var(--blue);
}

/* ── Workspace ──────────────────────────────────────────────────────────── */
#workspace {
  display: flex; flex: 1; overflow: hidden;
  min-height: 0;
}

/* ── Left Toolbar ───────────────────────────────────────────────────────── */
#toolbar-left {
  width: 36px; flex-shrink: 0;
  background: var(--toolbar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; padding: 6px 0; gap: 1px;
  overflow-y: auto; overflow-x: hidden;
}
.tool-btn {
  width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, background .1s; flex-shrink: 0;
}
.tool-btn:hover { color: var(--text-bright); background: rgba(255,255,255,.1); }
.tool-btn.active { background: rgba(58,142,230,.25); color: var(--blue); }
.tool-btn[data-tool="smudge"].active { background: rgba(58,142,230,.35); }
.tool-sep {
  width: 22px; height: 1px; background: var(--border-hi);
  margin: 3px 0; flex-shrink: 0;
}

/* ── Panels (shared) ────────────────────────────────────────────────────── */
.panel { border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  height: 26px; padding: 0 8px 0 10px;
  background: var(--panel-hdr); cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.panel-hdr:hover { background: #505050; }
.panel-title { font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.panel-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); padding: 1px 3px; font-size: 9px; line-height: 1;
  opacity: .7; border-radius: 2px;
}
.panel-toggle:hover { opacity: 1; color: var(--text-bright); }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .panel-toggle { transform: scaleX(-1); }

/* ── Left Panels Column ─────────────────────────────────────────────────── */
#panels-left {
  width: 280px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Metadata */
#panel-metadata .panel-body {
  padding: 9px 10px; max-height: 195px; overflow-y: auto;
}
.meta-grid {
  display: grid; grid-template-columns: 78px 1fr;
  gap: 3px 8px; line-height: 1.45;
}
.meta-key { color: var(--text-dim); font-size: 10.5px; }
.meta-val { color: var(--text); font-size: 10.5px; word-break: break-all; }

/* Description */
#panel-description .panel-body {
  padding: 9px 10px; max-height: 170px; overflow-y: auto;
}
.desc-text { font-size: 11px; line-height: 1.55; color: var(--text); }

/* Image Explorer */
#panel-explore {
  flex: 1; min-height: 180px;
  display: flex; flex-direction: column; overflow: hidden;
}
#panel-explore .panel-body {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.explore-search {
  padding: 6px 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.explore-search input {
  width: 100%; background: var(--input);
  border: 1px solid var(--border); color: var(--text);
  font-size: 11px; padding: 4px 8px; border-radius: 2px; outline: none;
  font-family: inherit;
}
.explore-search input:focus { border-color: var(--blue); }
.explore-search input::placeholder { color: var(--text-dim); }

.explore-grid {
  flex: 1; overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px; padding: 5px;
  align-content: start;
}
.explore-thumb {
  cursor: pointer;
  border: 2px solid transparent; border-radius: 1px;
  background: var(--input);
  transition: border-color .1s;
  display: block;
  min-width: 0;
  position: relative;
}
.explore-thumb img {
  width: 100%; height: auto; display: block;
  border-radius: 1px;
  pointer-events: none;
}
.explore-thumb:hover  { border-color: rgba(74,144,217,.55); }
.explore-thumb.active { border-color: var(--blue); }
.explore-empty {
  grid-column: 1/-1; text-align: center;
  padding: 20px 8px; color: var(--text-dim); font-size: 11px;
}
.thumb-play-badge {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-size: 8px; line-height: 1;
  padding: 2px 4px; border-radius: 2px;
  pointer-events: none;
}
.thumb-format-badge {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,0.65); color: #aaa;
  font-size: 8px; line-height: 1;
  padding: 2px 4px; border-radius: 2px;
  pointer-events: none;
  letter-spacing: 0.04em;
}

/* ── Canvas Area ────────────────────────────────────────────────────────── */
#canvas-area {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--canvas-bg);
}
#doc-tab-bar {
  display: flex; align-items: flex-end;
  height: 24px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.doc-tab {
  height: 22px; padding: 0 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-hi); border-bottom: 1px solid var(--bg);
  border-radius: 3px 3px 0 0;
}
.doc-tab-name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-tab-zoom { color: var(--text-dim); font-size: 10px; }
#zoom-controls {
  display: flex; align-items: center; gap: 2px;
  margin-left: auto; margin-bottom: 2px; padding-right: 2px;
}
.zoom-btn {
  width: 22px; height: 18px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--input); color: var(--text);
  border: 1px solid var(--border); border-radius: 2px;
  font-size: 13px; line-height: 1; cursor: pointer;
}
.zoom-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.zoom-reset { font-size: 11px; }

#canvas-wrapper {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 24px;
  position: relative;
}
#main-image {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
  cursor: default;
  transform-origin: center center;
  will-change: transform;
}
#main-video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
}
.canvas-play-btn {
  position: absolute;
  bottom: 10px; left: 14px;
  background: none; border: none; cursor: pointer;
  color: #e0e0e0; opacity: 0.85;
  transition: opacity .15s, transform .1s;
  padding: 2px; line-height: 0;
}
.canvas-play-btn:hover { opacity: 1; transform: scale(1.08); }

#video-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: none;
  color: #e0e0e0;
}
#video-toggle-btn {
  background: none; border: none; cursor: pointer;
  color: #e0e0e0; padding: 2px; line-height: 0;
  opacity: 0.85; transition: opacity .12s, transform .1s;
  flex-shrink: 0;
}
#video-toggle-btn:hover { opacity: 1; transform: scale(1.1); }
#video-time {
  font-size: 10px; font-family: var(--ui-font, monospace);
  color: var(--text-dim); letter-spacing: 0.03em;
  user-select: none;
}

/* ── Right Panels Column ────────────────────────────────────────────────── */
#panels-right {
  width: 260px; flex-shrink: 0;
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}

/* Arrays */
#panel-arrays .panel-body {
  max-height: 320px; overflow-y: auto;
}
.array-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.array-row:hover { background: rgba(255,255,255,.05); }
.array-row.active { background: var(--blue-dim); }
.array-eye {
  font-size: 10px; color: var(--text-dim); width: 14px;
  text-align: center; flex-shrink: 0;
}
.array-thumb {
  width: 36px; height: 48px; object-fit: cover; flex-shrink: 0;
  background: var(--input); border: 1px solid var(--border);
  display: block;
}
.array-info { flex: 1; min-width: 0; }
.array-label { font-size: 11px; color: var(--text); }
.array-sublabel { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.array-lock { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }

/* Activity */
#panel-activity .panel-body {
  max-height: 220px; overflow-y: auto;
}
.activity-table {
  width: 100%; border-collapse: collapse;
}
.activity-table th {
  font-size: 9.5px; color: var(--text-dim); text-align: left;
  padding: 5px 6px; border-bottom: 1px solid var(--border);
  font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; background: var(--panel-hdr); position: sticky; top: 0;
}
.activity-table td {
  font-size: 10px; color: var(--text);
  padding: 5px 6px; border-bottom: 1px solid var(--border);
  white-space: nowrap; max-width: 60px;
  overflow: hidden; text-overflow: ellipsis;
}
.activity-table tr:hover td { background: rgba(255,255,255,.04); }
.ev-icon { margin-right: 3px; }
.activity-empty {
  padding: 18px 8px; text-align: center;
  color: var(--text-dim); font-size: 11px;
}

/* Links */
#panel-links .panel-body {
  padding: 10px;
}
.links-by {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-dim);
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.links-by a { color: var(--text); text-decoration: none; }
.links-by a:hover { color: #fff; }
.link-group-label {
  font-size: 9.5px; color: var(--text-dim); letter-spacing: .08em;
  text-transform: uppercase; font-weight: 500; margin-bottom: 6px;
}
.link-group-label--spaced {
  margin-top: 14px;
}
.social-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.social-btn {
  width: 28px; height: 28px;
  background: var(--input); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; text-decoration: none;
  transition: color .1s, border-color .1s;
}
.social-btn:hover { color: var(--text-bright); border-color: var(--border-hi); }
.ext-link {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; color: var(--text); font-size: 11px;
  text-decoration: none; border-bottom: 1px solid var(--border);
}
.ext-link:last-child { border-bottom: none; }
.ext-link:hover { color: #fff; }
.ext-link-icon { color: var(--text-dim); font-size: 12px; }

/* ── Status Bar ─────────────────────────────────────────────────────────── */
#statusbar {
  height: 22px; flex-shrink: 0;
  background: var(--panel); border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 12px; gap: 18px;
  font-size: 10.5px; color: var(--text-dim);
}
.status-item { display: flex; align-items: center; gap: 4px; }
.status-sep { color: var(--border-hi); }
#status-work-idx { font-weight: 500; color: var(--text); }
.status-version {
  margin-left: auto; font-size: 10px;
  color: var(--border-hi); letter-spacing: 0.04em;
}

/* ── Search Overlay ─────────────────────────────────────────────────────── */
#search-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 200;
  align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
#search-overlay.open { display: flex; }
#search-modal {
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 5px; width: 520px; max-width: 92vw;
  overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.55);
}
.search-modal-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
#search-input {
  flex: 1; background: none; border: none;
  color: var(--text-bright); font-size: 14px;
  outline: none; padding: 2px 0; font-family: inherit;
}
#search-input::placeholder { color: var(--text-dim); }
.search-close-hint {
  font-size: 10px; color: var(--text-dim); white-space: nowrap;
}
.search-results { max-height: 440px; overflow-y: auto; }
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.search-result:hover, .search-result.highlighted { background: var(--blue-dim); }
.search-result-thumb {
  width: 30px; height: 40px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--input);
}
.search-result-title { font-size: 12px; color: var(--text); }
.search-result-idx   { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.search-no-results {
  padding: 24px; text-align: center;
  color: var(--text-dim); font-size: 12px;
}
.search-footer {
  padding: 7px 14px;
  font-size: 10px; color: var(--text-dim);
  border-top: 1px solid var(--border);
  display: flex; gap: 12px;
}
.search-footer kbd {
  background: var(--input); border: 1px solid var(--border);
  border-radius: 2px; padding: 1px 4px; font-family: inherit;
}

/* ── Works View (inline, replaces workspace) ────────────────────────────── */
#works-overlay {
  display: none; flex: 1; min-height: 0;
  background: var(--panel);
  flex-direction: column; overflow: hidden;
}
#works-overlay.open { display: flex; }

#works-topbar {
  display: flex; align-items: center; gap: 12px;
  height: 40px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.works-topbar-title {
  font-size: 12px; font-weight: 500; color: var(--text); letter-spacing: .05em;
  text-transform: uppercase;
}
.works-topbar-count {
  font-size: 11px; color: var(--text-dim);
}
.works-topbar-spacer { flex: 1; }
#works-search {
  width: 220px; background: var(--input);
  border: 1px solid var(--border); color: var(--text);
  font-size: 11px; padding: 4px 10px; border-radius: 2px; outline: none;
  font-family: inherit;
}
#works-search:focus { border-color: var(--blue); }
#works-search::placeholder { color: var(--text-dim); }
.works-filter {
  background: var(--input); border: 1px solid var(--border); color: var(--text);
  font-size: 11px; padding: 4px 6px; border-radius: 2px; outline: none;
  font-family: inherit; cursor: pointer; max-width: 140px;
}
.works-filter:focus { border-color: var(--blue); }
.works-close-btn {
  width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 16px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, background .1s;
}
.works-close-btn:hover { color: var(--text-bright); background: rgba(255,255,255,.08); }

/* Size slider */
.works-size-row {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.works-size-btn {
  width: 22px; height: 22px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 16px; line-height: 1;
  border-radius: 3px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, background .1s;
}
.works-size-btn:hover { color: var(--text-bright); background: rgba(255,255,255,.08); }
.works-size-label { font-size: 10px; color: var(--text-dim); }
#works-size-slider {
  -webkit-appearance: none; appearance: none;
  width: 80px; height: 4px;
  background: var(--border-hi); border-radius: 2px; outline: none; cursor: pointer;
}
#works-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-dim); cursor: pointer;
}
#works-size-slider::-webkit-slider-thumb:hover { background: var(--text-bright); }

/* Grid area */
#works-grid-wrap {
  flex: 1; overflow-y: auto; padding: 16px;
}
#works-bridge-grid {
  display: grid;
  grid-template-columns: repeat(var(--col-count, 4), 1fr);
  gap: 20px; align-items: start;
}
.bridge-item {
  cursor: pointer; position: relative;
  border-radius: 2px;
  overflow: hidden;
  transition: opacity .12s;
}
.bridge-item:hover  { opacity: .85; }
.bridge-item.active { outline: 2px solid var(--blue); outline-offset: 0; }
.bridge-item img {
  width: 100%; height: auto; display: block;
  pointer-events: none;
}
.bridge-label {
  padding: 5px 6px;
  font-size: 10px; line-height: 1.35;
  color: var(--text-bright); word-break: break-word;
}
.bridge-item:hover .bridge-label { color: var(--text-bright); }
.bridge-item.active .bridge-label { color: var(--text-bright); }

.bridge-empty {
  grid-column: 1/-1; text-align: center;
  padding: 48px; color: var(--text-dim); font-size: 13px;
}

/* Works footer bar */
#works-footerbar {
  height: 22px; flex-shrink: 0;
  background: var(--panel); border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 16px;
  font-size: 10.5px; color: var(--text-dim);
}

/* ── About View (inline, replaces workspace) ────────────────────────────── */
#about-page {
  display: none; flex: 1; min-height: 0;
  overflow-y: auto;
  background: var(--panel);
}
#about-page.open { display: block; }

#about-content {
  max-width: 1040px; margin: 0 auto;
  padding: 40px 32px 80px;
  font-family: inherit; font-size: 15px; color: var(--text);
}
#about-content .page-eyebrow {
  font-size: 14px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 16px;
}
#about-content h1 {
  font-size: clamp(26px, 3.4vw, 32px); font-weight: 700;
  color: var(--text-bright); letter-spacing: -.01em; line-height: 1.08; margin-bottom: 10px;
}
#about-content .acronym-expand {
  font-size: 18px; color: var(--text-dim); margin-bottom: 40px; font-style: italic;
}
#about-content .facts {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 8px 22px; font-size: 14px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 16px 0; margin: 16px 0 40px;
}
#about-content .facts dt {
  color: var(--text-dim); text-transform: uppercase;
  font-size: 11px; letter-spacing: .07em; font-weight: 500; padding-top: 3px;
}
#about-content .facts dd { color: var(--text); }
#about-content .facts a  { color: var(--blue); text-decoration: none; }
#about-content .facts a:hover { color: var(--text-bright); }

/* Artwork rows — 6 across, like the project website */
.about-work-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 8px 0 14px;
}
.about-work-row figure { margin: 0; }
.about-work-row img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block;
  border-radius: 1px; opacity: .86; transition: opacity .15s, transform .15s;
}
.about-work-row figure:hover img { opacity: 1; transform: translateY(-2px); }
.about-work-row figcaption { margin-top: 6px; font-size: 11px; line-height: 1.35; color: var(--text-dim); }
.about-row-cap { font-size: 12px; color: var(--text-dim); font-style: italic; margin: 2px 0 44px; }
@media (max-width: 760px) { .about-work-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 440px) { .about-work-row { grid-template-columns: repeat(2, 1fr); } }

.about-block { margin-bottom: 24px; }

#about-content h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); font-weight: 600; margin-bottom: 14px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.about-prose { font-size: 15px; line-height: 1.8; color: var(--text); }
.about-prose p { margin-bottom: 16px; }
.about-prose p:last-child { margin-bottom: 0; }
.about-prose a  { color: var(--blue); text-decoration: none; }
.about-prose a:hover { color: var(--text-bright); }
.about-prose strong { color: var(--text-bright); font-weight: 600; }
.about-prose em { color: var(--text-bright); }

.about-hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

.about-link-list { list-style: none; }
.about-link-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 11px; font-size: 14px;
}
.about-link-list li:first-child { border-top: 1px solid var(--border); }
.about-link-list a { color: var(--text); text-decoration: none; }
.about-link-list a:hover { color: var(--text-bright); }
.about-link-icon { color: var(--text-dim); font-size: 14px; width: 18px; text-align: center; }

.about-footer {
  margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}

/* ── Progress view ──────────────────────────────────────────────────── */
#progress-page {
  display: none; flex: 1; min-height: 0;
  flex-direction: column; background: var(--panel); overflow: hidden;
}
#progress-page.open { display: flex; }
#progress-topbar {
  display: flex; align-items: center; gap: 12px;
  height: 40px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border); padding: 0 16px;
}
.prog-topbar-note { font-size: 11px; color: var(--text-dim); }
#progress-body {
  flex: 1; overflow-y: auto; padding: 32px 28px 64px;
}
.prog-inner { max-width: 920px; margin: 0 auto; }
.prog-hero { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.prog-bignum { font-size: 52px; font-weight: 700; color: var(--text-bright); line-height: 1; font-variant-numeric: tabular-nums; }
.prog-bignum span { font-size: 20px; color: var(--text-dim); font-weight: 400; }
.prog-sub { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.prog-bar { height: 8px; background: #2c2c2c; border-radius: 5px; overflow: hidden; margin: 18px 0 8px; }
.prog-bar > i { display: block; height: 100%; background: var(--blue); border-radius: 5px; }
.prog-pct { font-size: 12px; color: var(--text-dim); }
.prog-timeline { margin: 22px 0 4px; }
.prog-tl-head { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin-bottom: 8px; }
.prog-tl-bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; }
.prog-tl-col { flex: 1 1 0; height: 100%; padding: 0; border: none; background: none; cursor: pointer; display: flex; align-items: flex-end; }
.prog-tl-col[disabled] { cursor: default; }
.prog-tl-bar { width: 100%; height: 100%; background: #2c2c2c; border-radius: 2px; overflow: hidden; display: flex; align-items: flex-end; transition: background .1s; }
.prog-tl-bar > i { display: block; width: 100%; min-height: 2px; background: var(--blue); border-radius: 2px 2px 0 0; transition: height .25s; }
.prog-tl-col.future .prog-tl-bar > i { background: #596472; }
.prog-tl-col.current .prog-tl-bar { outline: 1px solid var(--blue); outline-offset: -1px; }
.prog-tl-col:not([disabled]):hover .prog-tl-bar { background: #3a3a3a; }
.prog-tl-col:not([disabled]):hover .prog-tl-bar > i { background: var(--text-bright); }
.prog-tl-axis { display: flex; gap: 2px; margin-top: 6px; }
.prog-tl-tick { flex: 1 1 0; text-align: center; font-size: 9px; color: var(--text-dim); white-space: nowrap; }
.prog-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 28px 0 40px; }
.prog-stat { background: #363636; border: 1px solid var(--border); border-radius: 4px; padding: 14px 16px; }
.prog-stat .num { font-size: 24px; font-weight: 600; color: var(--text-bright); font-variant-numeric: tabular-nums; }
.prog-stat .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin-top: 5px; }
.prog-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.prog-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.prog-table td { padding: 7px 10px; border-bottom: 1px solid #333; color: var(--text); font-variant-numeric: tabular-nums; }
.prog-table td.num-col, .prog-table th.num-col { text-align: right; }
.prog-table tr.future td { color: var(--text-dim); }
.prog-table tr.current td { background: rgba(90,166,240,.10); color: var(--text-bright); }
.prog-now { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--blue); padding: 1px 5px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.prog-minibar { height: 6px; width: 100%; max-width: 180px; background: #2c2c2c; border-radius: 4px; overflow: hidden; }
.prog-minibar > i { display: block; height: 100%; background: var(--blue); }
.prog-foot { margin-top: 22px; font-size: 11px; color: var(--text-dim); line-height: 1.6; }

/* ── Image Lightbox (About) ─────────────────────────────────────────────── */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(18,18,18,.7);
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lb-trigger { cursor: zoom-in; }
.lb-img {
  max-width: 90vw; max-height: 86vh; object-fit: contain;
  box-shadow: 0 10px 50px rgba(0,0,0,.6); border-radius: 2px;
}
.lb-caption {
  position: absolute; bottom: 22px; left: 0; right: 0; text-align: center;
  font-size: 13px; color: #ddd; letter-spacing: .02em; padding: 0 16px;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute; background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.18); color: #fff; cursor: pointer;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.lb-close { top: 18px; right: 18px; width: 38px; height: 38px; font-size: 16px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 26px; line-height: 1; padding-bottom: 3px; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(0,0,0,.65); }
@media (max-width: 520px) { .lb-prev, .lb-next { width: 38px; height: 38px; font-size: 22px; } }

/* ── Workspace toolbar: hidden — tools live in Edit view ────────────────── */
#toolbar-left { display: none !important; }

/* ── View dropdown ──────────────────────────────────────────────────────── */
.menu-dropdown {
  position: fixed; background: var(--panel);
  border: 1px solid var(--border-hi); border-radius: 3px;
  min-width: 180px; z-index: 300; overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  display: none;
}
.menu-dropdown.open { display: block; }
.dropdown-item {
  padding: 7px 14px; font-size: 11px; color: var(--text);
  cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
  border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--blue); color: #fff; }
.dropdown-item.checked::before {
  content: '✓'; margin-right: 6px; color: var(--blue);
}
.dropdown-item:hover.checked::before { color: #fff; }
.dropdown-item:not(.checked)::before { content: '\00a0\00a0'; margin-right: 6px; }
.dropdown-shortcut { font-size: 10px; color: var(--text-dim); }
.dropdown-item:hover .dropdown-shortcut { color: rgba(255,255,255,.7); }
.dropdown-sep {
  height: 1px; background: var(--border-hi); margin: 3px 0;
}

/* ── Submissions View ────────────────────────────────────────────────────── */
#submissions-page {
  display: none; flex: 1; min-height: 0;
  flex-direction: column; background: var(--panel); overflow: hidden;
}
#submissions-page.open { display: flex; }
#submissions-topbar {
  display: flex; align-items: center; gap: 12px;
  height: 40px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
#submissions-body {
  flex: 1; overflow-y: auto; padding: 32px 28px 64px;
  max-width: 1100px; width: 100%;
}
.sub-section { margin-bottom: 40px; }
.sub-section-hdr { margin-bottom: 20px; }
.sub-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); font-weight: 600; margin-bottom: 8px;
  padding-bottom: 5px; border-bottom: 1px solid var(--border);
}
.sub-section-desc { font-size: 12px; color: var(--text); line-height: 1.6; margin: 0; }
.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; align-items: start;
}
.sub-empty {
  grid-column: 1/-1; padding: 40px 0;
  color: var(--text-dim); font-size: 12px; text-align: center;
}
.sub-placeholder {
  padding: 32px 20px; color: var(--text-dim); font-size: 12px;
  border: 1px dashed var(--border-hi); border-radius: 3px; text-align: center;
}
.sub-item { cursor: default; }
.sub-item img { width: 100%; height: auto; display: block; border-radius: 2px; }
.sub-item-label {
  padding: 5px 2px; font-size: 10px; color: var(--text-dim); line-height: 1.35;
}
.sub-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 3px; overflow: hidden;
}
.sub-card-img { width: 100%; height: auto; display: block; }
.sub-card-info {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
}
.sub-card-name { font-size: 10.5px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-card-date { font-size: 9.5px; color: var(--text-dim); flex-shrink: 0; }
.sub-card-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 11px; padding: 0 2px;
  line-height: 1; flex-shrink: 0;
  transition: color .1s;
}
.sub-card-delete:hover { color: #e05555; }

/* ── Layer eye button (clickable) ───────────────────────────────────────── */
.layer-eye {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--text-dim); width: 16px; text-align: center;
  flex-shrink: 0; padding: 0; line-height: 1;
  transition: opacity .1s;
}
.layer-eye:hover { opacity: .7; }
.layer-eye.hidden { opacity: .25; }
.layer-eye-static { background: none; border: none; cursor: default; }

/* ── Key reference (Tool Options panel) ─────────────────────────────────── */
.key-ref { padding: 2px 10px 10px; }
.key-ref-row {
  display: flex; align-items: baseline; gap: 6px;
  padding: 3px 0; font-size: 10px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.key-ref-row:last-child { border-bottom: none; }
.key-ref-row span { color: var(--text-dim); flex: 1; }
.key-ref-row kbd {
  font-family: inherit; font-size: 9px; flex-shrink: 0;
  background: rgba(255,255,255,.1); border: 1px solid var(--border-hi);
  border-radius: 2px; padding: 1px 5px; color: var(--text);
}

/* ── Edit View ───────────────────────────────────────────────────────────── */
#edit-page {
  display: none; flex: 1; min-height: 0;
  flex-direction: row;
  background: var(--bg);
  overflow: hidden;
}
#edit-page.open { display: flex; }

/* Edit toolbar (left) — mirrors #toolbar-left */
#edit-toolbar {
  width: 52px; flex-shrink: 0;
  background: var(--toolbar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; padding: 6px 0; gap: 1px;
  overflow: hidden;
}
.edit-tool-btn {
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: color .1s, background .1s; flex-shrink: 0;
}
.edit-tool-btn:hover          { color: var(--text-bright); background: rgba(255,255,255,.1); }
.edit-tool-btn.active         { background: rgba(58,142,230,.25); color: var(--blue); }
.edit-tool-btn:disabled       { opacity: .35; cursor: default; pointer-events: none; }

/* Edit canvas area — mirrors #canvas-area */
#edit-canvas-area {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--canvas-bg);
}
#edit-tab-bar {
  display: flex; align-items: flex-end;
  height: 24px; flex-shrink: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
#edit-canvas-wrap {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 24px;
}
#p5-container canvas {
  display: block;
  box-shadow: 0 6px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.3);
  cursor: none; /* p5 draws its own brush cursor */
}

/* Edit right panels */
#edit-panels-right {
  width: 260px; flex-shrink: 0;
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}

/* Instructions panel */
#panel-instructions .panel-body {
  padding: 12px 14px;
}
.instructions-text {
  font-size: 11px; color: var(--text-dim); line-height: 1.6;
  margin: 0 0 10px; padding: 0;
}
.instructions-text:last-child { margin-bottom: 0; }
.instructions-text strong { color: var(--text); font-weight: 600; }
.instructions-text em { font-style: normal; color: var(--text-dim); }

/* Tool Options panel */
.tool-option-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
}
.tool-option-label {
  font-size: 10px; color: var(--text-dim);
  width: 68px; flex-shrink: 0; line-height: 1.3;
}
.tool-option-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--border-hi); border-radius: 2px;
  outline: none; cursor: pointer;
}
.tool-option-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-dim); cursor: pointer;
}
.tool-option-slider::-webkit-slider-thumb:hover { background: var(--text-bright); }
.tool-option-val {
  font-size: 10px; color: var(--text-dim);
  width: 32px; text-align: right; flex-shrink: 0;
}
.tool-option-hint {
  padding: 2px 10px 8px; font-size: 10px;
  color: var(--text-dim); line-height: 1.55;
}
.tool-option-hint kbd {
  font-family: inherit; font-size: 9px;
  background: rgba(255,255,255,.1); border: 1px solid var(--border-hi);
  border-radius: 2px; padding: 1px 4px; color: var(--text);
}

/* Layers panel */
.layer-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; cursor: default;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.layer-row.active { background: rgba(58,142,230,.15); }
.layer-eye { font-size: 11px; color: var(--text-dim); width: 16px; text-align: center; flex-shrink: 0; }
.layer-thumb {
  width: 30px; height: 40px; object-fit: cover; flex-shrink: 0;
  background: var(--input); border: 1px solid var(--border);
  display: block;
}
.layer-name { flex: 1; font-size: 11px; color: var(--text); }
.layer-lock { font-size: 10px; color: var(--text-dim); flex-shrink: 0; }

/* Export & Submit panel */
.export-actions {
  display: flex; gap: 6px; padding: 8px 10px 4px;
}
.export-btn {
  flex: 1; height: 26px; font-size: 10.5px;
  background: var(--input); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; border-radius: 2px;
  font-family: inherit; transition: background .1s, border-color .1s;
  white-space: nowrap;
}
.export-btn:hover         { background: #555; border-color: var(--border-hi); }
.export-btn:disabled      { opacity: .38; cursor: default; pointer-events: none; }
.export-btn-primary       { background: var(--blue); border-color: var(--blue); color: #fff; }
.export-btn-primary:hover { background: #4a9ef6; border-color: #4a9ef6; }
.export-btn-submit        { background: rgba(58,142,230,.18); border-color: var(--blue); color: var(--blue); }
.export-btn-submit:hover  { background: rgba(58,142,230,.35); }
.export-hint {
  padding: 2px 10px 10px; font-size: 10px;
  color: var(--text-dim); line-height: 1.55;
}

/* ── Submit Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.72);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--panel); border: 1px solid var(--border-hi);
  border-radius: 4px; width: 480px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  animation: modal-in .12s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.96) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  height: 36px; padding: 0 14px;
  background: var(--panel-hdr); border-bottom: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
}
.modal-title { font-size: 12px; font-weight: 500; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 13px; padding: 3px 7px;
  border-radius: 2px; transition: color .1s, background .1s;
}
.modal-close:hover { color: var(--text-bright); background: rgba(255,255,255,.1); }
.modal-body { padding: 16px 16px 20px; }
.modal-intro { font-size: 11.5px; color: var(--text); line-height: 1.55; margin: 0 0 14px; }
.modal-optional { color: var(--text-dim); font-size: 10px; }
.modal-field { margin-bottom: 10px; }
.modal-field label {
  display: block; font-size: 10.5px; color: var(--text-dim); margin-bottom: 4px;
}
.modal-field input, .modal-field textarea {
  width: 100%; background: var(--input); border: 1px solid var(--border);
  color: var(--text); font-size: 11px; padding: 5px 8px;
  border-radius: 2px; outline: none; font-family: inherit;
  box-sizing: border-box;
}
.modal-field input:focus, .modal-field textarea:focus { border-color: var(--blue); }
.modal-field textarea { resize: vertical; min-height: 60px; }
.modal-consent {
  font-size: 10px; color: var(--text-dim); line-height: 1.55;
  margin: 12px 0 14px; padding: 8px 10px;
  background: rgba(255,255,255,.04); border-radius: 2px;
  border-left: 2px solid var(--border-hi);
}
.modal-actions {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.modal-actions .export-btn {
  height: 30px; font-size: 11px; padding: 0 4px;
}
.modal-hint {
  font-size: 10px; color: var(--text-dim); line-height: 1.55; margin: 0;
}
.modal-hint strong { color: var(--text); }
