/* Graph View Layout */
.graph {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

.graph__canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

.graph__canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* -------------------------------------------------------------------
   Idle overlay — centered play button over the graph
   ------------------------------------------------------------------- */

.graph__idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  background: rgba(13, 13, 13, 0.55);
  z-index: 2;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.graph__idle[hidden] {
  display: none;
}

.graph__play-btn {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  border: none;
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-base);
  box-shadow:
    0 0 0 0 rgba(78, 205, 196, 0.3),
    0 4px 24px rgba(0, 0, 0, 0.4);
  animation: graph-pulse 2.5s ease-in-out infinite;
}

.graph__play-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 0 8px rgba(78, 205, 196, 0.15),
    0 4px 32px rgba(0, 0, 0, 0.5);
}

.graph__play-btn:active {
  transform: scale(0.95);
  animation: none;
}

.graph__play-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

@keyframes graph-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.3), 0 4px 24px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(78, 205, 196, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4); }
}

.graph__idle-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

/* -------------------------------------------------------------------
   Controls bar at bottom
   ------------------------------------------------------------------- */

.graph__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.graph__controls-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Control buttons */
.graph__btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
  padding: 0 var(--space-sm);
}

.graph__btn:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-muted);
}

.graph__btn:active {
  transform: scale(0.95);
}

.graph__btn--stop {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
}

.graph__btn--stop:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.graph__btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Scale selector */
.graph__select {
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  font-size: var(--font-size-xs);
  font-family: var(--font-family);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.graph__select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* -------------------------------------------------------------------
   View switcher tab bar
   ------------------------------------------------------------------- */

.view-switcher {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-elevated);
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border-subtle);
  padding-bottom: env(safe-area-inset-bottom);
}

.view-switcher__tab {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-dim);
  font-size: var(--font-size-xs);
  transition: color var(--transition-fast);
}

.view-switcher__tab svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.view-switcher__tab.active {
  color: var(--color-accent);
  position: relative;
}

.view-switcher__tab.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--color-accent);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.view-switcher__tab:hover {
  color: var(--color-text-muted);
}

/* Adjust views for tab bar height */
.view {
  bottom: calc(48px + env(safe-area-inset-bottom));
}

/* -------------------------------------------------------------------
   Current note display in controls
   ------------------------------------------------------------------- */

.graph__current-note {
  font-size: var(--font-size-lg);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text-dim);
  min-width: 56px;
  text-align: center;
  transition: color var(--transition-fast);
}

.graph__current-note.detected {
  color: var(--color-in-tune);
}

.graph__current-note .octave {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-muted);
}
