/* profile.css — profile-view styles, scoped under #view-profile (P3 SPA migration).
   Base reset / :root tokens / fonts / scanlines (+ the global html.scanlines-* opt-out) /
   scrollbar come from the shell; only profile-view-specific component rules live here.
   The view uses the shell's shared top-bar / footer chrome, so no .wrapper/.top-bar/
   .nav-strip rules. The theme picker + custom-override drive the GLOBAL html theme by
   design (that is the "live theme apply without reload" deliverable). */

/* ── Display-effects (scanlines) toggle UI ── */
#view-profile .scanlines-seg { display: flex; }
#view-profile .scanlines-seg button { background: transparent; border: 1px solid var(--green-dim); color: var(--green-dim); font-family: 'Share Tech Mono', monospace; font-size: 13px; padding: 7px 16px; cursor: pointer; letter-spacing: 2px; text-transform: uppercase; transition: all 0.15s; border-right: none; }
#view-profile .scanlines-seg button:last-child { border-right: 1px solid var(--green-dim); }
#view-profile .scanlines-seg button.active { background: var(--green-faint); color: var(--green); border-color: var(--green); }
#view-profile .scanlines-seg button:last-child.active { border-right-color: var(--green); }
#view-profile .scanlines-seg button:hover:not(.active) { background: var(--green-faint); color: var(--green-dim); }

#view-profile .terminal-box { border: 1px solid var(--green-dim); padding: 24px; margin: 16px 0; background: var(--green-faint); position: relative; animation: fadeIn 0.35s ease; }
#view-profile .terminal-box::before { content: attr(data-label); position: absolute; top: -10px; left: 16px; background: var(--bg); padding: 0 8px; font-size: 13px; color: var(--green-dim); letter-spacing: 2px; }
#view-profile .terminal-box h2 { font-family: 'VT323', monospace; font-size: 28px; margin-bottom: 14px; color: var(--green); }

#view-profile .profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 16px 0; align-items: stretch; }
#view-profile .profile-stat { border: 1px solid color-mix(in srgb, var(--green) 18%, transparent); padding: 14px; background: color-mix(in srgb, var(--green) 3%, transparent); min-width: 0; }
#view-profile .profile-stat-key { font-size: 11px; color: var(--green-dim); letter-spacing: 3px; margin-bottom: 6px; }
#view-profile .profile-stat-val { font-family: 'VT323', monospace; font-size: 24px; color: var(--green); letter-spacing: 1px; overflow-wrap: anywhere; }

#view-profile .alert { padding: 10px 14px; font-size: 14px; margin: 10px 0; display: none; letter-spacing: 1px; }
#view-profile .alert.err  { border: 1px solid var(--red);   color: var(--red);   background: rgba(255,51,51,0.06); }
#view-profile .alert.ok   { border: 1px solid var(--green); color: var(--green); background: var(--green-faint); }
#view-profile .alert.warn { border: 1px solid var(--amber); color: var(--amber); background: rgba(255,176,0,0.06); }
#view-profile .alert.show { display: block; }

#view-profile .check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--green-dim); line-height: 1.7; margin: 12px 0; cursor: pointer; }
/* Custom terminal checkbox — the default OS box clashes with the CRT aesthetic. */
#view-profile .check-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0;
  background: var(--green-dark);
  border: 1px solid var(--green-dim);
  cursor: pointer; position: relative;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
#view-profile .check-row input[type="checkbox"]:hover { border-color: var(--green); }
#view-profile .check-row input[type="checkbox"]:checked {
  background: var(--green-faint); border-color: var(--green);
  box-shadow: 0 0 8px color-mix(in srgb, var(--green) 30%, transparent);
}
#view-profile .check-row input[type="checkbox"]:checked::after {
  content: '\2713'; /* ✓ */
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; color: var(--green);
}
#view-profile .check-row input[type="checkbox"]:focus-visible { outline: 1px solid var(--green); outline-offset: 2px; }

#view-profile .btn { background: transparent; border: 1px solid var(--green); color: var(--green); font-family: 'Share Tech Mono', monospace; font-size: 15px; padding: 10px 24px; cursor: pointer; letter-spacing: 2px; text-transform: uppercase; transition: all 0.15s; white-space: nowrap; }
#view-profile .btn:hover { background: var(--green); color: var(--bg); box-shadow: 0 0 20px color-mix(in srgb, var(--green) 40%, transparent); }
#view-profile .btn:active { transform: scale(0.98); }
#view-profile .btn-amber { border-color: var(--amber); color: var(--amber); }
#view-profile .btn-amber:hover { background: var(--amber); color: var(--bg); box-shadow: 0 0 20px rgba(255,176,0,0.4); }

#view-profile .divider { border: none; border-top: 1px solid color-mix(in srgb, var(--green) 10%, transparent); margin: 18px 0; }

#view-profile .discovery-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--green) 8%, transparent); font-size: 13px; }
#view-profile .discovery-row:last-child { border-bottom: none; }

/* ── melody sequencer (editor — lives inside the profile-grid as one stat cell) ── */
#view-profile .melody-stat { position: relative; display: flex; flex-direction: column; gap: 6px; }
#view-profile .melody-stat .melody-stat-key { font-size: 11px; color: var(--green-dim); letter-spacing: 3px; }
#view-profile .melody-grid { display: grid; grid-template-columns: repeat(8, 1fr); grid-auto-rows: 9px; gap: 2px; user-select: none; margin-top: 2px; }
#view-profile .melody-cell { background: color-mix(in srgb, var(--green) 4%, transparent); border: 1px solid color-mix(in srgb, var(--green) 8%, transparent); cursor: pointer; transition: background 0.08s, border-color 0.08s, box-shadow 0.08s; }
#view-profile .melody-cell:hover { border-color: color-mix(in srgb, var(--green) 35%, transparent); }
#view-profile .melody-cell.on { background: color-mix(in srgb, var(--green) 55%, transparent); border-color: color-mix(in srgb, var(--green) 70%, transparent); box-shadow: 0 0 4px color-mix(in srgb, var(--green) 40%, transparent); }
#view-profile .melody-cell.on.playing-now { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 8px rgba(255,176,0,0.85); }

#view-profile .melody-gear { position: absolute; top: 6px; right: 8px; width: 18px; height: 18px; background: transparent; border: 1px solid color-mix(in srgb, var(--green) 18%, transparent); color: var(--green-dim); font-family: inherit; font-size: 12px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: all 0.12s; }
#view-profile .melody-gear:hover { color: var(--green); border-color: var(--green); }
#view-profile .melody-gear[aria-expanded="true"] { color: var(--amber); border-color: var(--amber); }

#view-profile .melody-popover { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 210px; padding: 12px 14px; background: var(--bg); border: 1px solid color-mix(in srgb, var(--green) 45%, transparent); box-shadow: 0 8px 22px rgba(0,0,0,0.65); display: none; flex-direction: column; gap: 10px; font-size: 12px; color: var(--green-dim); letter-spacing: 1px; }
#view-profile .melody-popover.open { display: flex; }
#view-profile .melody-popover .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
#view-profile .melody-popover label { letter-spacing: 2px; }
#view-profile .melody-popover select,
#view-profile .melody-popover input { background: transparent; border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); color: var(--green-dim); font-family: inherit; font-size: 13px; padding: 3px 6px; }
#view-profile .melody-popover input[type="number"] { width: 60px; }
#view-profile .melody-play { background: transparent; border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); color: var(--green-dim); font-family: inherit; font-size: 14px; padding: 5px 12px; cursor: pointer; letter-spacing: 3px; transition: all 0.1s; }
#view-profile .melody-play:hover { border-color: var(--green); color: var(--green); }
#view-profile .melody-play.playing { color: var(--amber); border-color: var(--amber); }

/* ── Custom theme picker (replaces native <select>) ── */
#view-profile .theme-picker { position: relative; display: inline-block; min-width: 280px; }
#view-profile .theme-picker-trigger { width: 100%; background: var(--bg); border: 1px solid var(--green-dim); color: var(--green); font-family: inherit; font-size: 14px; letter-spacing: 1px; padding: 6px 32px 6px 12px; cursor: pointer; text-align: left; position: relative; transition: border-color 0.15s; }
#view-profile .theme-picker-trigger:hover { border-color: var(--green); }
#view-profile #theme-trigger-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-profile .theme-picker-trigger .caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--green-dim); transition: transform 0.15s; }
#view-profile .theme-picker.open .theme-picker-trigger .caret { transform: translateY(-50%) rotate(180deg); }
#view-profile .theme-picker-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg); border: 1px solid var(--green); list-style: none; margin: 0; padding: 4px 0; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,0.65); display: none; }
#view-profile .theme-picker.open .theme-picker-panel { display: block; }
#view-profile .theme-picker-panel li { padding: 8px 14px; font-size: 14px; color: var(--green); cursor: pointer; letter-spacing: 1px; transition: background 0.08s, color 0.08s; }
#view-profile .theme-picker-panel li:hover { background: var(--green-faint); color: var(--green); }
#view-profile .theme-picker-panel li.active { background: var(--green-faint); color: var(--green); box-shadow: inset 2px 0 0 var(--green); }
#view-profile .custom-var-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; cursor: default; }
#view-profile .custom-var-label { font-size: 12px; color: var(--green-dim); letter-spacing: 1px; min-width: 110px; flex-shrink: 0; }
#view-profile .custom-hex { background: var(--green-dark); border: 1px solid rgba(86,232,122,0.25); color: var(--green); font-family: 'Share Tech Mono', monospace; font-size: 13px; padding: 4px 8px; width: 100px; letter-spacing: 1px; outline: none; transition: border-color 0.1s; }
#view-profile .custom-hex:focus { border-color: var(--green); }
#view-profile .custom-hex.invalid { border-color: var(--red); color: var(--red); }
#view-profile #custom-theme-apply, #view-profile #custom-theme-reset { background: transparent; border: 1px solid rgba(86,232,122,0.35); color: var(--green-dim); font-family: 'Share Tech Mono', monospace; font-size: 12px; padding: 5px 14px; letter-spacing: 2px; cursor: pointer; transition: border-color 0.1s, color 0.1s; }
#view-profile #custom-theme-apply:hover { border-color: var(--green); color: var(--green); }
#view-profile #custom-theme-reset:hover { border-color: var(--red); color: var(--red); }
/* Custom-override is a collapsible section (collapsed by default) — the hex grid is
   advanced/rarely-used, so it stays tucked behind a toggle. */
#view-profile .custom-theme-toggle { background: none; border: none; padding: 0; cursor: pointer; font-family: 'Share Tech Mono', monospace; font-size: 12px; color: var(--green-dim); letter-spacing: 2px; display: inline-flex; align-items: center; gap: 6px; transition: color 0.12s; }
#view-profile .custom-theme-toggle:hover { color: var(--green); }
#view-profile .custom-theme-caret { display: inline-block; font-size: 10px; transition: transform 0.15s; }
#view-profile .custom-theme-toggle.open .custom-theme-caret { transform: rotate(90deg); }
#view-profile .custom-theme-body { margin-top: 10px; }

@media (max-width: 600px) {
  #view-profile .profile-grid { grid-template-columns: 1fr 1fr; }
}
