:root {
  --face: #c0c0c0;
  --face-dark: #808080;
  --highlight: #ffffff;
  --shadow: #404040;
  --black: #000000;
  --titlebar-from: #0a246a;
  --titlebar-to: #a6caf0;
  --field-bg: #ffffff;
  --accent: #000080;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #008080;
  color: #000000;
  font-family: Tahoma, "MS Sans Serif", Geneva, sans-serif;
  font-size: 11px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--face);
  border: 2px outset var(--face);
}

/* ---- Title bar ---- */
.titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  background: linear-gradient(90deg, var(--titlebar-from), var(--titlebar-to));
  color: #ffffff;
  font-weight: bold;
  font-size: 12px;
}

.titlebar-icon {
  width: 14px;
  height: 14px;
  background: var(--face);
  border: 1px solid #000000;
  flex-shrink: 0;
}

.titlebar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-buttons {
  display: flex;
  gap: 2px;
}

.win-btn {
  width: 16px;
  height: 14px;
  background: var(--face);
  border: 1px outset var(--face);
  font-family: Marlett, Tahoma, sans-serif;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  color: #000000;
  cursor: default;
}

.win-btn:active {
  border-style: inset;
}

.win-btn-close {
  font-weight: bold;
}

/* ---- Menu bar ---- */
.menubar {
  display: flex;
  gap: 14px;
  background: var(--face);
  border-bottom: 1px solid var(--face-dark);
  padding: 2px 6px;
}

.menubar span {
  cursor: default;
}

.menubar span:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ---- Toolbar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: var(--face);
  border-bottom: 1px solid var(--face-dark);
  flex-wrap: wrap;
}

.btn {
  background: var(--face);
  color: #000000;
  border: 2px outset var(--face);
  padding: 4px 10px;
  cursor: default;
  font-family: inherit;
  font-size: 11px;
}

.btn:active {
  border-style: inset;
  padding: 5px 9px 3px 11px;
}

.btn.small {
  padding: 2px 6px;
  font-size: 11px;
  width: 100%;
  margin-bottom: 4px;
}

.btn.small:active {
  padding: 3px 5px 1px 7px;
}

/* ---- Workspace layout ---- */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---- Toolbox (left, Paint-style tool grid) ---- */
.toolbox {
  width: 54px;
  flex-shrink: 0;
  background: var(--face);
  border-right: 1px solid var(--face-dark);
  padding: 3px;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.tool-btn {
  width: 24px;
  height: 22px;
  background: var(--face);
  border: 1px outset var(--face);
}

.tool-btn:active {
  border-style: inset;
}

/* ---- Canvas area ---- */
.canvas-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--face-dark);
  overflow: auto;
  padding: 20px;
}

#glcanvas, .overlay-canvas {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #000000;
  box-shadow: 1px 1px 0 #ffffff;
}

.overlay-canvas {
  position: absolute;
  z-index: 5;
}

.overlay-canvas.hidden {
  display: none;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #e0e0e0;
  pointer-events: none;
}
.drop-hint p { margin: 4px 0; }
.drop-hint .small { font-size: 11px; }
.drop-hint.hidden { display: none; }

/* ---- Right panel ---- */
.panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--face);
  border-left: 1px solid var(--face-dark);
  overflow-y: auto;
  padding: 8px;
}

.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
}
.preset-btn {
  background: var(--face);
  border: 2px outset var(--face);
  color: #000000;
  padding: 5px 4px;
  cursor: default;
  font-family: inherit;
  font-size: 11px;
}
.preset-btn:active {
  border-style: inset;
}

.fx-group {
  border-style: groove;
  border-width: 2px;
  border-color: var(--face);
  margin-bottom: 8px;
  background: var(--face);
}

.fx-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: bold;
  border-bottom: 1px solid var(--face-dark);
}

.fx-controls {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
}

.fx-controls label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fx-controls input[type=range] {
  width: 100%;
}

.fx-controls input[type=color] {
  width: 100%;
  height: 20px;
  border: 1px inset var(--face);
  padding: 0;
}

.checkline {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
}

.panel-divider {
  margin: 12px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--face-dark);
  font-size: 11px;
  font-weight: bold;
}

.fx-controls select {
  background: var(--field-bg);
  color: #000000;
  border: 1px inset var(--face);
  padding: 3px;
  font-family: inherit;
  font-size: 11px;
}

.ghost-file {
  display: block;
  text-align: center;
}

.audio-transport {
  display: flex;
  gap: 4px;
}
.audio-transport .btn { flex: 1; }

.hint {
  font-size: 10px;
  line-height: 1.4;
  margin: 0;
}

/* ---- Classic checkbox switch ---- */
.switch {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: default;
}
.switch span {
  position: absolute;
  inset: 0;
  background: var(--field-bg);
  border: 1px inset var(--face);
}
.switch span::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 8px;
  border-bottom: 2px solid #000000;
  border-right: 2px solid #000000;
  transform: rotate(40deg);
}
.switch input:checked + span::after {
  display: block;
}

/* ---- Status bar ---- */
.statusbar {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  background: var(--face);
  border-top: 1px solid var(--highlight);
  font-size: 11px;
}

#statusText {
  border: 1px inset var(--face);
  padding: 2px 6px;
  flex: 1;
}

.status-link {
  border: 1px inset var(--face);
  padding: 2px 6px;
  margin-left: 4px;
  color: #000000;
  text-decoration: none;
  white-space: nowrap;
}

.status-link:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .workspace { flex-direction: column; }
  .panel { width: 100%; border-left: none; border-top: 1px solid var(--face-dark); }
  .toolbox { display: none; }
}
