/* Moonwind Mk II — Classic Mac OS Style */

:root {
  --bg: #6688aa;
  --win-bg: #e8e8e8;
  --win-border: #888;
  --win-title-bg: linear-gradient(180deg, #b0b0b0 0%, #d8d8d8 45%, #c0c0c0 55%, #a8a8a8 100%);
  --win-title-text: #222;
  --win-body-bg: #f4f4f4;
  --field-bg: #fff;
  --field-border: #999;
  --text: #222;
  --text-dim: #666;
  --menu-bg: #e8e8e8;
  --menu-hover: #3366cc;
  --menu-hover-text: #fff;
  --fl: #336699;
  --fr: #cc5533;
  --fx: #7744aa;
  --lfo: #338844;
  --env: #aa7722;
  --route: #556677;
  --accent-l: #4488cc;
  --accent-r: #dd6644;
  --danger: #cc3333;
  --bidi: #339944;
}

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

body {
  font-family: 'Lucida Grande', 'Geneva', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  min-height: 100vh;
}

/* ================================================================== */
/* MENU BAR                                                            */
/* ================================================================== */

.menubar {
  display: flex;
  align-items: center;
  height: 26px;
  background: linear-gradient(180deg, #f0f0f0 0%, #d4d4d4 100%);
  border-bottom: 1px solid #999;
  padding: 0 8px;
  gap: 0;
  position: relative;
  z-index: 100;
  overflow: visible;
}

.menu {
  position: relative;
}

.menu-title {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 12px;
  border: none;
  background: none;
  color: #222;
  cursor: default;
  font-family: inherit;
  border-radius: 3px;
}
.menu-title:hover, .menu:hover .menu-title {
  background: var(--menu-hover);
  color: var(--menu-hover-text);
}

.menu-drop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #f4f4f4;
  border: 1px solid #888;
  border-radius: 0 0 5px 5px;
  box-shadow: 2px 4px 12px rgba(0,0,0,.25);
  padding: 4px 0;
  z-index: 200;
}
.menu-drop-wide { min-width: 280px; }
.menu:hover .menu-drop { display: block; }

.menu-drop button {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 4px 16px;
  border: none;
  background: none;
  color: #222;
  cursor: default;
  font-family: inherit;
}
.menu-drop button:hover {
  background: var(--menu-hover);
  color: var(--menu-hover-text);
}

.menu-drop hr {
  border: none;
  border-top: 1px solid #c0c0c0;
  margin: 3px 8px;
}

.menu-label {
  display: block;
  font-size: 11px;
  color: #666;
  padding: 4px 16px 2px;
  font-weight: 600;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 12px 4px;
}

.menu-select {
  flex: 1;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-family: inherit;
}

.menu-select-sm {
  width: 50px;
  font-size: 12px;
  padding: 3px 4px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-family: inherit;
}

.menu-num {
  width: 50px;
  font-size: 12px;
  padding: 3px 4px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #222;
  text-align: center;
  font-family: inherit;
}

.menu-text {
  flex: 1;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-family: inherit;
}

.menu-btn {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: linear-gradient(180deg, #fafafa, #ddd);
  color: #222;
  cursor: default;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
}
.menu-btn:hover { border-color: #666; }
.menu-btn:active { background: linear-gradient(180deg, #ccc, #eee); }

.menu-item-btn {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 4px 16px;
  border: none;
  background: none;
  color: #222;
  cursor: default;
  font-family: inherit;
}
.menu-item-btn:hover {
  background: var(--menu-hover);
  color: var(--menu-hover-text);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ccc;
  border: 1px solid #999;
  flex-shrink: 0;
}
.status-dot.connected {
  background: #4a4;
  border-color: #282;
}

.snap-list {
  max-height: 140px;
  overflow-y: auto;
  margin: 2px 8px 4px;
}
.snap-empty {
  font-size: 11px;
  color: #999;
  text-align: center;
  padding: 6px;
}
.snap-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 3px;
}
.snap-item:hover { background: #dde4ee; }
.snap-name {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snap-btn {
  font-size: 10px;
  padding: 1px 6px;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: linear-gradient(180deg, #fafafa, #ddd);
  color: #444;
  cursor: default;
  font-family: inherit;
}
.snap-btn:hover { border-color: #888; }
.snap-btn.del:hover { color: var(--danger); border-color: var(--danger); }

.menubar-spacer { flex: 1; }
.menubar-title {
  font-size: 13px;
  font-weight: 700;
  color: #444;
  letter-spacing: .5px;
}
.tool-status {
  font-size: 11px;
  color: #336699;
  margin-left: 12px;
  white-space: nowrap;
}

/* ================================================================== */
/* MAIN LAYOUT                                                         */
/* ================================================================== */

main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  max-width: 576px;
  margin: 0 auto;
}

/* Top row: Input + Routing side by side */
.top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Middle: L/R columns */
.lr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Bottom: FX full width */
.bottom-row {
  width: 100%;
}

/* FX horizontal layout */
.fx-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.fx-body > .field {
  min-width: 160px;
}
.fx-sliders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================================================================== */
/* WINDOW PANELS                                                       */
/* ================================================================== */

.win {
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 1px 2px 6px rgba(0,0,0,.15);
}

.win-title {
  background: var(--win-title-bg);
  border-bottom: 1px solid #999;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--win-title-text);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.win-badge {
  font-size: 10px;
  font-weight: 400;
  color: #777;
}

.win-left .win-title {
  background: linear-gradient(180deg, #a0bcd8 0%, #c8daea 45%, #b4cce0 55%, #98b4d0 100%);
  color: #1a3355;
}
.win-right .win-title {
  background: linear-gradient(180deg, #d8b0a0 0%, #eaccc0 45%, #e0b8ac 55%, #d0a898 100%);
  color: #552a1a;
}

.win-body {
  background: var(--win-body-bg);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================================================================== */
/* FIELDS                                                              */
/* ================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.field label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
}

/* Dropdowns */
.cc-sel {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font-family: inherit;
  width: 100%;
}
.cc-sel:focus { border-color: #4488cc; outline: none; }

/* Sliders */
.sl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.val {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c0c0c0, #e0e0e0);
  border: 1px solid #aaa;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fafafa 0%, #ccc 100%);
  border: 1px solid #888;
  cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fafafa 0%, #ccc 100%);
  border: 1px solid #888;
  cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* Colored thumb accents */
.win-left input[type="range"]::-webkit-slider-thumb { border-color: var(--accent-l); }
.win-left input[type="range"]::-moz-range-thumb { border-color: var(--accent-l); }
.win-right input[type="range"]::-webkit-slider-thumb { border-color: var(--accent-r); }
.win-right input[type="range"]::-moz-range-thumb { border-color: var(--accent-r); }

/* SVG Visualizations */
.viz {
  width: 100%;
  height: 56px;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 3px;
  display: block;
}

/* Routing SVG */
.route-svg {
  width: 100%;
  max-width: 200px;
  height: 44px;
  margin: 4px auto 0;
  display: block;
}
.rd-box { fill: none; stroke-width: 1.4; }
.rd-l { stroke: var(--accent-l); }
.rd-r { stroke: var(--accent-r); }
.rd-label { font-size: 8px; fill: #555; text-anchor: middle; font-family: inherit; font-weight: 600; }
.rd-mode { font-size: 7px; fill: #888; text-anchor: middle; font-family: inherit; font-weight: 600; }
.rd-line { stroke: #999; stroke-width: 1; }
.rd-cross { stroke: var(--route); stroke-width: 1; stroke-dasharray: 2 2; }
.rd-mix { fill: #999; }

/* Noise toggle */
.tog {
  font-size: 13px;
  padding: 4px 16px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: linear-gradient(180deg, #fafafa, #ddd);
  color: #555;
  cursor: default;
  font-family: inherit;
  font-weight: 600;
  text-align: center;
}
.tog.active {
  background: linear-gradient(180deg, #ee6644, #cc4422);
  border-color: #993322;
  color: #fff;
}

/* ================================================================== */
/* RESPONSIVE                                                          */
/* ================================================================== */

@media (max-width: 700px) {
  .top-row, .lr-row { grid-template-columns: 1fr; }
  .fx-body { flex-direction: column; }
  main { max-width: 420px; }
}
