/* =====================================================================
   apps.css — shared app UI + per-app styling
   ===================================================================== */
.app-loading { display: grid; place-items: center; height: 100%; color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* generic app frame */
.app { display: flex; flex-direction: column; height: 100%; }
.app__bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); flex: 0 0 auto; flex-wrap: wrap; }
.app__bar .grow { flex: 1; }
.app__stage { flex: 1; min-height: 0; position: relative; }
.app__pad { padding: 16px; overflow: auto; height: 100%; }

.tool {
  font-family: var(--mono); font-size: 11.5px; padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s var(--ease);
}
.tool:hover { border-color: var(--line-2); color: var(--text); }
.tool.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tool--sw { width: 26px; height: 26px; padding: 0; border-radius: 6px; }
.lbl { font-family: var(--mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
input[type="range"] { accent-color: var(--accent); }
select, input[type="text"], input[type="number"] {
  font-family: var(--mono); font-size: 12px; background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px;
}

/* ---------- FORGE ---------- */
.forge__canvas { width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; background: #02030a; }
.forge__els { display: flex; gap: 5px; flex-wrap: wrap; }
.forge__el { width: 30px; height: 30px; border-radius: 7px; border: 2px solid transparent; position: relative; }
.forge__el.on { border-color: #fff; box-shadow: 0 0 12px currentColor; }
.forge__el .tip { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 9px; font-family: var(--mono); color: var(--muted); opacity: 0; white-space: nowrap; }
.forge__el:hover .tip { opacity: 1; }

/* ---------- FLUX ---------- */
.flux__canvas { width: 100%; height: 100%; background: #000; }

/* ---------- PULSE ---------- */
.pulse__grid { display: grid; gap: 4px; padding: 12px; overflow: auto; height: 100%; }
.pulse__row { display: grid; grid-template-columns: 64px repeat(16, 1fr); gap: 4px; align-items: center; }
.pulse__name { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pulse__cell { aspect-ratio: 1; min-height: 18px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); transition: transform .08s var(--ease); }
.pulse__cell:hover { border-color: var(--line-2); }
.pulse__cell.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--glow); }
.pulse__cell.beat { outline: 2px solid var(--accent-3); outline-offset: -2px; }
.pulse__cell.playhead { transform: scale(1.12); }

/* ---------- TERMINAL ---------- */
.term { height: 100%; display: flex; flex-direction: column; background: #04060e; font-family: var(--mono); font-size: 13px; }
.term__out { flex: 1; overflow: auto; padding: 12px 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.term__out .c-acc { color: var(--accent); } .term__out .c-3 { color: var(--accent-3); } .term__out .c-mut { color: var(--muted); } .term__out .c-err { color: #ff6b6b; }
.term__line { display: flex; gap: 8px; padding: 6px 14px 12px; border-top: 1px solid var(--line); }
.term__prompt { color: var(--accent); }
.term__in { flex: 1; background: none; border: none; color: var(--text); font-family: var(--mono); font-size: 13px; outline: none; }

/* ---------- SETTINGS / ABOUT ---------- */
.set__section { margin-bottom: 22px; }
.set__section h3 { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 1.5px; color: var(--faint); margin-bottom: 10px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 42px; height: 42px; border-radius: 10px; border: 2px solid var(--line-2); position: relative; }
.swatch.on { border-color: #fff; }
.swatch.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 16px; text-shadow: 0 1px 4px #000; }
.about__hero { text-align: center; padding: 18px 0 8px; }
.about__title { font-size: 30px; font-weight: 700; letter-spacing: 3px; background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.about__sub { color: var(--muted); font-family: var(--mono); font-size: 12px; margin-top: 4px; }
.about__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.about__card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; }
.about__card b { color: var(--accent); }
.kbd { font-family: var(--mono); font-size: 11px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 2px 6px; }

/* CRT easter-egg mode */
body.crt .desktop::after {
  content: ""; position: absolute; inset: 0; z-index: 999; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,.22) 2px 3px);
}
body.crt { filter: saturate(1.2) contrast(1.05); }
