/* ── Recorder family: #modes, #rec, #file, #grid, #trash ────────────────────── */

/* ── #modes: the hand-written list in the top-left corner ─────────────────── */
#modes .modes-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 0.3cqw;
}
#modes .mode {
  position: relative;
  font-family: var(--font-marker);
  font-size: clamp(9px, 1.1cqw, 18px);
  line-height: 1.2;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0 0.3em;
  cursor: pointer;
  transform: rotate(-1deg);
}
#modes .mode:nth-child(2) { transform: rotate(0.5deg) translateX(0.4cqw); }
#modes .mode:nth-child(3) { transform: rotate(-0.5deg); }
#modes .mode:nth-child(4) { transform: rotate(1deg) translateX(0.5cqw); }
#modes .mode-dash { margin-right: 0.3em; }
#modes .mode-creator { --fam: var(--creator); }
#modes .mode-recorder { --fam: var(--recorder); }
#modes .mode-processor { --fam: var(--processor); }
#modes .mode-text {
  position: relative;
  padding: 0 0.15em;
  border-radius: 3px 8px 2px 6px;
  transition: background-size 0.25s ease-out;
  /* highlighter swipe, revealed when active */
  background: linear-gradient(transparent 40%, color-mix(in srgb, var(--fam, transparent) 55%, transparent) 40% 88%, transparent 88%) no-repeat left / 0% 100%;
}
#modes .mode:hover .mode-text {
  text-decoration: underline wavy var(--fam, var(--ink-soft));
  text-underline-offset: 0.2em;
}
#modes .mode[aria-pressed='true'] .mode-text { background-size: 100% 100%; }

#modes .mode-nope .mode-text { color: var(--ink-soft); }
#modes .mode-scribble {
  position: absolute;
  inset: 5% -4%;
  width: 108%;
  height: 90%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
#modes .mode-quip {
  position: absolute;
  left: 100%;
  top: -0.2em;
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: 1.1em;
  color: var(--danger);
  opacity: 0;
  pointer-events: none;
}
#modes .mode-nope.is-noping { animation: modes-nope 0.5s ease-in-out; }
#modes .mode-nope.is-noping .mode-quip { animation: modes-quip 1.6s ease-out; }
@keyframes modes-nope {
  20% { transform: rotate(-5deg) translateX(0.4cqw); }
  40% { transform: rotate(4deg) translateX(0.4cqw); }
  60% { transform: rotate(-3deg) translateX(0.4cqw); }
  80% { transform: rotate(2deg) translateX(0.4cqw); }
}
@keyframes modes-quip {
  0% { opacity: 0; transform: translateY(0.3em) rotate(-4deg); }
  15%, 75% { opacity: 1; transform: translateY(0) rotate(-4deg); }
  100% { opacity: 0; transform: translateY(-0.4em) rotate(-4deg); }
}

/* ── #rec: the circled R ──────────────────────────────────────────────────── */
#rec {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#rec .rec-btn {
  width: 4.4cqw;
  min-width: 40px;
  aspect-ratio: 1;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s;
}
#rec .rec-btn:hover { transform: rotate(-6deg) scale(1.05); }
#rec .rec-btn:active { transform: scale(0.94); }
#rec .rec-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#rec .rec-art { width: 100%; height: 100%; overflow: visible; }
#rec .rec-ring { fill: none; stroke: var(--line); stroke-width: 2.4; stroke-linecap: round; }
#rec .rec-ring-2 { stroke-width: 1.6; opacity: 0.7; }
#rec .rec-fill { fill: var(--danger); opacity: 0; transform-box: fill-box; transform-origin: center; }
#rec .rec-letter { font-family: var(--font-marker); font-size: 26px; fill: var(--ink); }
#rec .rec-time {
  font-family: var(--font-hand);
  font-size: clamp(10px, 1.1cqw, 18px);
  line-height: 1;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
#rec .rec-status {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: clamp(10px, 1cqw, 16px);
  color: var(--ink-soft);
}
#rec[data-state='armed'] .rec-letter { fill: var(--danger); animation: rec-blink 0.6s steps(2) infinite; }
#rec[data-state='armed'] .rec-ring { stroke: var(--danger); stroke-dasharray: 6 4; }
#rec:is([data-state='recording'], [data-state='stopping'], [data-state='saving']) .rec-fill {
  opacity: 0.9;
  animation: rec-pulse 1s ease-in-out infinite;
}
#rec:is([data-state='recording'], [data-state='stopping'], [data-state='saving']) .rec-letter { fill: var(--paper); }
#rec:is([data-state='recording'], [data-state='stopping']) .rec-time { color: var(--danger); }
#rec[data-state='stopping'] .rec-fill { animation-duration: 0.4s; }
@keyframes rec-blink { 50% { opacity: 0.2; } }
@keyframes rec-pulse { 50% { transform: scale(0.86); opacity: 0.65; } }

/* ── #file: FILE / CATALOGUE / O O O O ────────────────────────────────────── */
#file .file-box {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--paper);
  border: var(--stroke) solid var(--line);
  border-radius: 6px 14px 5px 12px / 12px 5px 14px 6px;
  transform: rotate(0.6deg);
  overflow: hidden;
}
#file button {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
#file .file-head {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4em;
  padding: 0.2cqw 0;
  border-bottom: var(--stroke) solid var(--line);
}
#file .file-title {
  font-family: var(--font-marker);
  font-size: clamp(12px, 1.7cqw, 28px);
  letter-spacing: 0.2em;
  line-height: 1.1;
}
#file .file-hint {
  font-family: var(--font-hand);
  font-size: clamp(9px, 0.95cqw, 15px);
  color: var(--ink-soft);
  transition: color 0.15s;
}
#file .file-head:hover .file-title { color: var(--recorder); }
#file .file-head:hover .file-hint { color: var(--recorder); }
#file .file-cat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  padding: 0.1cqw 0;
  border-bottom: var(--stroke) solid var(--line);
  font-family: var(--font-marker);
  font-size: clamp(8px, 0.85cqw, 14px);
  letter-spacing: 0.08em;
}
#file .file-cat-label { white-space: nowrap; }
#file .file-page { font-family: var(--font-marker); font-size: 1.3em; line-height: 1; padding: 0 0.3em; }
#file .file-page[hidden] { display: none; }
#file .file-page:disabled { opacity: 0.25; cursor: default; }
#file .file-slots {
  list-style: none;
  margin: 0;
  padding: 0 0.3cqw;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
#file .slot {
  display: block;
  width: 2.6cqw;
  min-width: 24px;
  aspect-ratio: 1;
  border-radius: 50%;
  transition: transform 0.12s;
}
#file .slot:hover { transform: scale(1.12) rotate(-4deg); }
#file .slot svg { width: 100%; height: 100%; overflow: visible; display: block; }
#file .slot-ring {
  fill: transparent;
  stroke: var(--line);
  stroke-width: 2.6;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
}
#file .slot:not(.has-clip) .slot-ring { stroke: var(--ink-soft); stroke-dasharray: 4 3; }
#file .slot.has-clip .slot-ring { fill: color-mix(in srgb, var(--clip) 45%, var(--paper)); }
#file .slot-wave { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
#file .slot[aria-pressed='true'] .slot-ring { stroke: var(--recorder); stroke-width: 4; }
#file .slot.is-playing .slot-ring { animation: file-spin 1.4s linear infinite; }
#file .slot.is-new { animation: file-pop 0.6s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes file-spin { to { transform: rotate(360deg); } }
@keyframes file-pop { 0% { transform: scale(0.2) rotate(-40deg); } 100% { transform: none; } }
#file .file-foot {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.15cqw 0.4cqw;
  border-top: 1.5px dashed var(--ink-soft);
  min-height: 1.6cqw;
}
#file .file-export {
  font-family: var(--font-marker);
  font-size: clamp(8px, 0.8cqw, 13px);
  padding: 0 0.4em;
  border: 1.5px solid var(--line);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  white-space: nowrap;
}
#file .file-export:hover:not(:disabled) { background: var(--recorder); color: var(--paper); }
#file .file-export:disabled { opacity: 0.3; cursor: default; }
#file .file-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: clamp(9px, 0.9cqw, 15px);
  color: var(--ink-soft);
}

/* ── #grid: the lopsided 3×3 pad grid ─────────────────────────────────────── */
#grid .grid-pads {
  height: 100%;
  display: grid;
  /* the sketch's uneven columns and tall top row */
  grid-template-columns: 0.75fr 1.25fr 1fr;
  grid-template-rows: 1.45fr 1fr 1fr;
  gap: var(--stroke);
  background: var(--line);
  border: calc(var(--stroke) * 1.4) solid var(--line);
  border-radius: 3px 9px 4px 11px;
  transform: rotate(-0.5deg);
}
#grid .pad-cell {
  position: relative;
  background: var(--paper);
  --flash: var(--recorder);
  transition: background 0.2s;
}
#grid .pad-cell.has-clip {
  background: color-mix(in srgb, var(--clip) 30%, var(--paper));
  --flash: var(--clip);
}
#grid .pad {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0.35cqw 0.45cqw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
#grid .pad:focus-visible { outline-offset: -5px; }
#grid .pad-cell:not(.has-clip) .pad { cursor: pointer; }
#grid .pad-num {
  font-family: var(--font-marker);
  font-size: clamp(9px, 1cqw, 16px);
  line-height: 1;
}
#grid .pad-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: clamp(10px, 1.05cqw, 17px);
  line-height: 1;
  color: var(--ink-soft);
}
#grid .pad-wave {
  position: absolute;
  inset: 30% 8% 28%;
  width: 84%;
  height: 42%;
  pointer-events: none;
}
#grid .pad-wave-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.75;
}
#grid .pad-loop {
  position: absolute;
  top: 0.3cqw;
  right: 0.3cqw;
  z-index: 1;
  width: 1.7cqw;
  min-width: 18px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: var(--font-marker);
  font-size: clamp(9px, 0.95cqw, 15px);
  line-height: 1;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1.5px solid var(--ink-soft);
  border-radius: 50% 45% 55% 48%;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
#grid .pad-cell:hover .pad-loop,
#grid .pad-loop:focus-visible { opacity: 1; }
#grid .pad-loop[aria-pressed='true'] {
  opacity: 1;
  color: var(--paper);
  background: var(--recorder);
  border-color: var(--line);
  animation: grid-spin 2.4s linear infinite;
}
#grid .pad-cell.is-looping .pad-num { color: var(--recorder); }
#grid .pad-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--flash);
  opacity: 0;
  pointer-events: none;
}
#grid .pad-cell.is-hit::after { animation: grid-flash 0.24s ease-out; }
#grid .pad-cell.is-hit .pad { animation: grid-thump 0.16s ease-out; }
#grid .pad-cell.drop-hover { outline-offset: -5px; border-radius: 0; }
@keyframes grid-flash { 0% { opacity: 0.75; } 100% { opacity: 0; } }
@keyframes grid-thump { 40% { transform: scale(0.95); } }
@keyframes grid-spin { to { transform: rotate(360deg); } }

/* ── #trash: TRASHROOM, a bin wearing a hat ───────────────────────────────── */
#trash {
  display: flex;
  align-items: flex-end;
  gap: 0.3cqw;
}
#trash .trash-can { height: 100%; width: auto; overflow: visible; }
#trash .trash-fill { fill: var(--paper); stroke: var(--line); stroke-width: 2.2; stroke-linejoin: round; }
#trash .trash-ink { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
#trash .trash-hat { fill: var(--processor); stroke: var(--line); stroke-width: 2; stroke-linejoin: round; }
#trash .trash-pom { fill: var(--creator); stroke: var(--line); stroke-width: 1.6; }
#trash .trash-eye { fill: var(--ink); opacity: 0; transition: opacity 0.15s; }
#trash .trash-lid {
  transform-box: view-box;
  transform-origin: 54px 35px; /* hinge on the right */
  transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
}
#trash .trash-body { transform-box: view-box; transform-origin: 30px 70px; }
#trash:hover .trash-lid { transform: rotate(10deg); }
#trash.drop-hover .trash-lid { transform: rotate(38deg); }
#trash:is(:hover, .drop-hover, .is-munching) .trash-eye { opacity: 1; }
#trash.is-munching .trash-lid { animation: trash-munch 0.7s ease-in-out; }
#trash.is-munching .trash-body { animation: trash-chew 0.7s ease-in-out; }
#trash .trash-label {
  margin-bottom: 0.6cqw;
  font-family: var(--font-marker);
  font-size: clamp(9px, 1.05cqw, 17px);
  letter-spacing: 0.06em;
  transform: rotate(-3deg);
}
#trash .trash-quip {
  position: absolute;
  left: 1.5cqw;
  top: -1.8cqw;
  font-family: var(--font-hand);
  font-size: clamp(11px, 1.3cqw, 20px);
  color: var(--danger);
  opacity: 0;
  pointer-events: none;
}
#trash.is-munching .trash-quip { animation: trash-quip 0.9s ease-out; }
#trash .trash-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@keyframes trash-munch {
  0%, 100% { transform: none; }
  20% { transform: rotate(40deg); }
  40% { transform: rotate(0deg); }
  60% { transform: rotate(28deg); }
  80% { transform: rotate(0deg); }
}
@keyframes trash-chew {
  40%, 80% { transform: scale(1.06, 0.92); }
}
@keyframes trash-quip {
  0% { opacity: 0; transform: translateY(0.4cqw) rotate(-8deg); }
  25% { opacity: 1; transform: translateY(0) rotate(-8deg); }
  100% { opacity: 0; transform: translateY(-1cqw) rotate(-8deg); }
}
