/* Play tab: layout, chain pieces, controls pieces, meters, scenes, level, looper. */

#view-play {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ground-text);
}

.play-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-header .preset-center {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}

.icon-btn {
  appearance: none;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:active {
  transform: translateY(1px);
}

#preset-name {
  font-family: var(--font-heading), system-ui, sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  color: var(--ground-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-name {
  font-size: 12px;
  color: var(--ground-muted);
}

.play-actions {
  display: flex;
  gap: 8px;
}

/* Hero */
.play-hero {
  position: relative;
  height: 150px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 0%, var(--raised) 0%, var(--panel) 70%) var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-hero-cab {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 11px;
  color: var(--muted);
}

.play-hero-match {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}

/* Meters */
.meters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.meters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.meter-label {
  flex: none;
  width: 26px;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 11px;
  color: var(--muted);
}

.meter-bar {
  flex: 1 1 auto;
  min-width: 0;
  height: 6px;
  border-radius: 3px;
  background: var(--raised);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
}

.meter-text {
  flex: none;
  width: 56px;
  text-align: right;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  color: var(--text);
}

#clip {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 6px;
  padding: 2px 7px;
}

#load {
  flex: none;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  color: var(--muted);
}

#wave {
  display: block;
  width: 100%;
  height: 36px;
  border-radius: 8px;
  background: var(--raised);
}

/* Scenes */
#scenes {
  display: flex;
  gap: 8px;
}

#scenes button {
  flex: 1 1 0;
  min-width: 0;
}

#scenes button {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-body), system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

#scenes button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

/* Chain: tiles */
.chain-tiles {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chain-tiles .tile {
  flex: none;
  width: 68px;
  min-height: 84px;
  border: 0;
  background: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  cursor: pointer;
}

.chain-tiles .tile-box {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--raised);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chain-tiles .tile.is-selected .tile-box {
  border-color: var(--k);
}

.chain-tiles .tile.is-off .tile-box {
  opacity: 0.5;
}

.chain-tiles .tile-dot {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.chain-tiles .tile-name {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
}

.chain-tiles .tile.is-selected .tile-name {
  color: var(--text);
  font-weight: 600;
}

/* Chain: pedals */
.chain-pedals {
  display: block;
}

.pedal-board {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 12px 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.chain-pedals .pedal {
  flex: none;
  width: 60px;
  height: 96px;
  border: 0;
  border-radius: 12px;
  background: var(--k);
  color: #15110e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  cursor: pointer;
}

.chain-pedals .pedal.is-off {
  opacity: 0.45;
}

.chain-pedals .pedal.is-selected {
  box-shadow: 0 0 0 3px var(--ground), 0 0 0 6px var(--accent);
}

.chain-pedals .pedal-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--raised);
}

.chain-pedals .pedal-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  word-break: break-word;
}

.chain-pedals .pedal-foot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cfcac2;
  border: 3px solid #8f8a82;
}

/* Chain: list */
.chain-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.chain-list .row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.chain-list .row:last-child {
  border-bottom: 0;
}

.chain-list .row.is-selected {
  background: var(--raised);
}

.chain-list .row.is-off {
  opacity: 0.6;
}

.row-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.row-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-state {
  flex: none;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  color: var(--muted);
}

/* Block card */
.block-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px 8px;
}

.block-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.block-color {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.block-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-heading), system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#block-power {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#block-power[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

/* Controls: ring */
.controls-ring {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.controls-ring .knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
}

.controls-ring .knob-dial {
  position: relative;
  width: 64px;
  height: 64px;
}

.knob-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: ns-resize;
  touch-action: none;
}

.controls-ring .knob-name {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Controls: chicken */
.controls-chicken {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.controls-chicken .chicken {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
}

.controls-chicken .chicken-dial {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--knob-face, #efe3c8);
  box-shadow: 0 0 0 3px var(--panel), 0 2px 0 var(--line);
}

.chicken-head {
  position: absolute;
  inset: 0;
}

.chicken-pointer {
  position: absolute;
  left: 50%;
  top: 5px;
  width: 3px;
  height: 15px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--knob-pointer, #15110e);
}

.chicken-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: ns-resize;
  touch-action: none;
}

.controls-chicken .chicken-value {
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.controls-chicken .chicken-name {
  font-size: 11px;
  color: var(--muted);
}

/* Controls: slider */
.controls-slider {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.slider-label {
  flex: none;
  width: 92px;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slider-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  accent-color: var(--k, var(--accent));
  cursor: pointer;
}

.slider-value {
  flex: none;
  width: 62px;
  text-align: right;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

/* Level row */
.level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
}

#level-status {
  flex: 1 1 100%;
  font-size: 13px;
  color: var(--text);
}

.level-trim-value {
  min-width: 62px;
  text-align: center;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
}

#match-level {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Looper */
#looper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
}

.looper-state {
  flex: 1 1 100%;
  font-size: 13px;
  color: var(--muted);
}

.looper-bar {
  flex: 1 1 100%;
  height: 8px;
  border-radius: 3px;
  background: var(--raised);
  overflow: hidden;
}

.looper-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
}

.looper-time {
  flex: 1 1 auto;
  font-family: var(--font-numbers), system-ui, sans-serif;
  font-size: 12px;
  color: var(--text);
}

#looper button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.looper-confirm {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.looper-confirm button {
  flex: 1 1 0;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.looper-confirm .confirm-yes {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.play-hero-match::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--accent);
  vertical-align: middle;
}
