/*
 * LineThru site — HTML replica of the app window.
 * Every rule is scoped under .app-replica. Colors/base tokens come from
 * css/base.css (var(--bg), var(--panel), var(--hairline), var(--text),
 * var(--text-dim), var(--dot-off), var(--accent), var(--knob-face),
 * var(--knob-rim)) — do not redefine them here.
 */

/* .is-live on .app-replica is a JS state hook with no visual effect of its own (live state shows via #status-live.live and the transport button text) */

/* ---------------------------------------------------------------------- */
/* Root card                                                               */
/* ---------------------------------------------------------------------- */

.app-replica {
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px 22px 22px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.app-replica .replica-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.app-replica .replica-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.app-replica .replica-logotype {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.app-replica .replica-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.app-replica #status-live.live {
  color: var(--accent);
}

.app-replica .hw-button {
  flex: 0 0 auto;
  width: 84px;
  padding: 8px 0;
  background: var(--accent);
  color: var(--text);
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
}

.app-replica .hw-button:active {
  filter: brightness(0.9);
}

/* ---------------------------------------------------------------------- */
/* Panel sections (ROUTE / METERS / LEVELS)                                */
/* ---------------------------------------------------------------------- */

.app-replica .panel-section {
  display: block;
}

.app-replica .panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.app-replica .panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.app-replica .refresh-glyph {
  font-size: 10px;
  color: var(--text-dim);
}

.app-replica .meter-readout {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.app-replica .readout-value {
  color: var(--text);
  display: inline-block;
  min-width: 5ch;
  text-align: right;
  white-space: pre;
}

.app-replica .panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 6px;
}

/* ---------------------------------------------------------------------- */
/* ROUTE panel                                                             */
/* ---------------------------------------------------------------------- */

.app-replica .device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.app-replica .device-prefix {
  flex: 0 0 auto;
  width: 32px;
  font-size: 10px;
  color: var(--text-dim);
}

.app-replica .device-name {
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-replica .device-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
  flex: 0 0 auto;
}

.app-replica .device-caret {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- */
/* METERS panel                                                            */
/* ---------------------------------------------------------------------- */

.app-replica .meters-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
}

.app-replica .dot-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-replica .meter-label {
  flex: 0 0 auto;
  width: 36px;
  font-size: 9px;
  color: var(--text-dim);
}

.app-replica .meter-track {
  flex: 1;
  height: 7px;
  position: relative;
  background: radial-gradient(circle at center, var(--dot-off) 0 3.5px, transparent 3.5px) left center / 10px 7px repeat-x;
}

.app-replica .meter-track.has-dots {
  background: none;
}

.app-replica .meter-track .dot {
  position: absolute;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-off);
}

.app-replica .meter-track .dot.lit {
  background: var(--text);
}

.app-replica .meter-track .dot.lit-hot {
  background: var(--accent);
  box-shadow: 0 0 3px rgba(215, 25, 33, 0.8);
}

.app-replica .meter-track .dot.clip-marker {
  background: transparent;
  border: 1px solid var(--accent);
}

/* ---------------------------------------------------------------------- */
/* LEVELS panel — knobs                                                    */
/* ---------------------------------------------------------------------- */

.app-replica .knob-row {
  display: flex;
  justify-content: space-around;
  padding: 16px 0;
}

.app-replica .knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: ns-resize;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.app-replica .knob:focus {
  outline: none;
}

.app-replica .knob:focus-visible {
  outline: 1px solid var(--hairline);
  outline-offset: 4px;
}

.app-replica .knob-face {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--knob-face);
  border: 1px solid var(--knob-rim);
  background-image: linear-gradient(rgba(255, 255, 255, 0.07), transparent 50%);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5);
  transform: rotate(var(--angle, 0deg));
}

.app-replica .knob-indicator {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: -1.5px;
  width: 3px;
  height: 16px;
  border-radius: 1.5px;
  background: var(--accent);
}

.app-replica .knob-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.app-replica .knob-value {
  font-size: 11px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------- */
/* LEVELS panel — monitor row / pill toggle                                */
/* ---------------------------------------------------------------------- */

.app-replica .monitor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.app-replica .monitor-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text);
}

.app-replica.is-muted .monitor-label {
  color: var(--text-dim);
}

.app-replica .hw-pill {
  position: relative;
  width: 38px;
  height: 20px;
  padding: 0;
  background: var(--dot-off);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  cursor: pointer;
}

.app-replica .hw-pill .pill-thumb {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: left 0.15s ease-out, background 0.15s ease-out;
}

.app-replica #monitor-pill.is-on {
  background: var(--accent);
  border-color: transparent;
}

.app-replica #monitor-pill.is-on .pill-thumb {
  left: 21px;
  background: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  .app-replica .hw-pill .pill-thumb {
    transition: none;
  }
}
