:root {
  --bg: #232323;
  --ink: #fff;
  --muted: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.38);
  --line-soft: rgba(255, 255, 255, 0.16);
  --bar: #1e1e1e;
  --window: #2a2a2a;
  --hover: rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.35 Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, a { font: inherit; }
button {
  background: none;
  border: 0;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.topbar {
  height: 34px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 8px 0 4px;
  background: var(--bar);
  position: relative;
  z-index: 20;
}
.brand, .nav a, .tools a, .tools button {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 8px;
  font-weight: 600;
}
.brand { gap: 8px; }
.mark {
  width: 14px;
  height: 14px;
  border: 1.5px solid #fff;
  border-radius: 2px;
}
.nav { display: flex; align-items: center; }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.tools { display: flex; align-items: center; gap: 2px; color: var(--ink); }
.clock { padding: 0 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.iconbtn { width: 34px; justify-content: center; }

.stage { height: calc(100% - 34px); position: relative; }

.desktop {
  height: 100%;
  padding: 18px 16px;
  display: grid;
  grid-template-columns: 220px 220px;
  grid-auto-rows: 28px;
  align-content: start;
  gap: 2px 28px;
}
.desk-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  text-align: left;
}
.desk-icon svg { flex: none; }

.win {
  position: absolute;
  min-width: 280px;
  background: var(--window);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}
.win[hidden] { display: none; }
.win-bar {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-soft);
  cursor: grab;
  user-select: none;
}
.win-bar:active { cursor: grabbing; }
.win-title { font-weight: 600; }
.win-close {
  margin-left: auto;
  width: 22px;
  height: 22px;
}
.win-body { padding: 12px 14px 16px; overflow: auto; }
.muted { color: var(--muted); margin: 0; }

.works {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 12px;
  padding: 12px;
}
.panel {
  border: 1px solid var(--line);
  background: #262626;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-bar {
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
}
.list { overflow: auto; flex: 1; }
.group {
  padding: 8px 10px 4px;
  color: var(--muted);
  font-size: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-top: 1px solid var(--line-soft);
}
.row:hover { background: var(--hover); }
.note { padding: 14px 12px 16px; color: var(--muted); }
.field { position: relative; background: #111; overflow: hidden; }
.field canvas { width: 100%; height: 100%; display: block; }

.page-copy {
  height: 100%;
  padding: 16px;
}
.page-copy .panel { max-width: 420px; height: 180px; }

@media (max-width: 800px) {
  body { overflow: auto; }
  .nav { display: none; }
  .works { grid-template-columns: 1fr; height: auto; }
  .field { height: 52vh; }
  .desktop { grid-template-columns: 1fr; }
  .win { position: relative; width: auto !important; left: auto !important; top: auto !important; margin: 12px; }
  .stage { height: auto; min-height: calc(100% - 34px); }
}
