/* Create By Asking: the online theremin on projects/online-theremin.html.
   Loaded after style.css, tools.css and advanced.css; reuses .adv-shell, .chip-dark, .icon-btn and .adv-* helpers.
   --tm-c is the glow colour of the chosen sound, set by assets/theremin.js. */

.tm { --tm-c: #FF4F9A; gap: 14px; }
.tm-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; }
.tm-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-mode { display: inline-flex; align-items: center; gap: 9px; border: 0; cursor: pointer; border-radius: 999px; padding: 11px 18px 11px 14px; background: rgba(255, 255, 255, 0.08); color: #E4DBFF; font: 700 0.98rem/1.1 var(--body); text-align: left; }
.tm-mode svg { width: 20px; height: 20px; flex: none; }
.tm-mode small { display: block; font: 500 0.72rem/1.2 var(--body); color: #A597CC; }
.tm-mode:hover { background: rgba(255, 255, 255, 0.14); }
.tm-mode:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tm-mode[aria-pressed="true"] { background: #FFC93C; color: #1C0F3F; }
.tm-mode[aria-pressed="true"] small { color: #4A3F66; }
.tm-mode-cam[aria-pressed="false"] { background: linear-gradient(135deg, rgba(255, 46, 126, 0.35), rgba(61, 245, 208, 0.22)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); color: #fff; }
.tm-quick { display: flex; align-items: center; gap: 8px; }
.tm-quick .adv-range input { width: 110px; }
.tm-quick .icon-btn { display: grid; place-items: center; }
.tm-quick .icon-btn svg, .tm-tools .icon-btn svg { width: 18px; height: 18px; }
.tm-mute .off { display: none; }
.tm-mute.is-muted { background: #FF2E7E; }
.tm-mute.is-muted .on { display: none; }
.tm-mute.is-muted .off { display: block; }
.tm-presets .chip-dark[aria-pressed="true"] { background: var(--tm-c); color: #1C0F3F; box-shadow: 0 0 16px -2px var(--tm-c); }

/* ---------- the play area ---------- */
.tm-stage { position: relative; aspect-ratio: 16 / 8.4; min-height: 300px; max-height: 74vh; width: 100%; border-radius: 14px; overflow: hidden; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 90% at 50% 115%, color-mix(in srgb, var(--tm-c) 34%, transparent), transparent 62%), radial-gradient(80% 60% at 50% -20%, rgba(124, 92, 255, 0.22), transparent 70%), #0A0519;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 -40px 80px -40px color-mix(in srgb, var(--tm-c) 40%, transparent); }
.tm-stage:focus-visible { outline: 3px solid #FFC93C; outline-offset: 2px; }
.tm-stage:fullscreen { aspect-ratio: auto; max-height: none; border-radius: 0; }
.tm-stage canvas, .tm-stage video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.tm-stage video { object-fit: cover; transform: scaleX(-1); opacity: 0.5; filter: saturate(0.55) contrast(1.05); }
.tm-read { position: absolute; left: 14px; top: 12px; display: grid; gap: 4px; pointer-events: none; }
.tm-read strong { font: 800 clamp(2rem, 1.4rem + 2.6vw, 3.1rem)/0.95 var(--display); color: #fff; text-shadow: 0 0 18px var(--tm-c), 0 0 2px rgba(0, 0, 0, 0.6); font-variant-numeric: tabular-nums; min-width: 2.4em; opacity: 0.55; transition: opacity 0.2s; }
.tm.is-playing .tm-read strong { opacity: 1; }
.tm-read span { font: 600 0.78rem/1 var(--mono); color: #CBBFE8; }
.tm-tuner { position: relative; width: 96px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); margin-top: 3px; }
.tm-tuner::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.45); border-radius: 2px; }
.tm-tuner i { position: absolute; top: -2px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--tm-c); box-shadow: 0 0 10px var(--tm-c); transition: left 0.08s linear; }
.tm-tuner.in i { background: #5BD48F; box-shadow: 0 0 10px #5BD48F; }
.tm[data-mode="camera"] .tm-read { left: 50%; transform: translateX(-50%); justify-items: center; text-align: center; }
.tm-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.tm-tools .icon-btn { display: grid; place-items: center; background: rgba(10, 5, 25, 0.6); }
.tm-ax { position: absolute; pointer-events: none; font: 600 0.68rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(203, 191, 232, 0.55); }
.tm-ax-y { left: 14px; bottom: 34px; writing-mode: vertical-rl; transform: rotate(180deg); }
.tm-ax-x { right: 14px; bottom: 30px; }
.tm[data-mode="camera"] .tm-ax { display: none; }
.tm-hint { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100% - 28px); text-align: center; font: 600 0.92rem/1.35 var(--body); color: #fff; background: rgba(10, 5, 25, 0.66); padding: 10px 16px; border-radius: 16px; pointer-events: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.tm-cal { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 20px; background: rgba(10, 5, 25, 0.5); pointer-events: none; }
.tm-cal strong { font: 800 clamp(2.4rem, 1.6rem + 4vw, 4.4rem)/1 var(--display); color: #fff; text-shadow: 0 0 24px var(--tm-c); }
.tm-cal span { max-width: 30em; font: 600 1rem/1.4 var(--body); color: #F2ECFF; background: rgba(10, 5, 25, 0.6); padding: 8px 14px; border-radius: 12px; }

/* ---------- camera panel ---------- */
.tm-cammsg { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 201, 60, 0.12); color: #FFE29A; font-size: var(--step--1); }
.tm-campanel { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 12px 14px; }
.tm-campanel .btn { padding: 8px 14px; }
.tm-stat { font: 600 0.75rem/1.3 var(--mono); color: #CBBFE8; }
.tm-stat b { color: #5BD48F; font-weight: 600; }
.tm-private { flex-basis: 100%; margin: 0; font-size: var(--step--1); color: #CBBFE8; display: flex; gap: 8px; align-items: flex-start; }
.tm-private svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: #5BD48F; }

/* ---------- sound and scale controls ---------- */
.tm-controls { display: grid; gap: 12px; }
.tm-key { background: rgba(255, 255, 255, 0.08); color: #fff; border: 0; border-radius: 999px; padding: 7px 10px; font: 600 var(--step--1)/1 var(--body); }
.tm-key:disabled { opacity: 0.4; }
.tm-key option { background: #1C0F3F; }
.tm-knobs { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.tm-knobs .adv-range input { width: 104px; accent-color: var(--tm-c); }

/* ---------- tune and record panels (shared look with the piano) ---------- */
.tm-panels { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; }
.tm-panel { background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.tm-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tm-select { background: rgba(255, 255, 255, 0.08); color: #fff; border: 0; border-radius: 999px; padding: 8px 12px; font: 600 var(--step--1)/1 var(--body); max-width: 100%; min-width: 0; flex: 1 1 180px; }
.tm-select option { background: #1C0F3F; }
.tm-panel .btn { padding: 8px 16px; }
.tm-panel .btn[aria-pressed="true"] { background: #FF2E7E; color: #fff; }
.tm-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.tm-track span { display: block; height: 100%; width: 0; background: #5BD48F; border-radius: 99px; transition: width 0.2s; }
.tm-strip { display: flex; gap: 4px; overflow: hidden; font: 700 0.85rem/1 var(--mono); color: #A597CC; min-height: 28px; align-items: center; }
.tm-strip span { flex: none; min-width: 28px; padding: 6px 4px; text-align: center; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.tm-strip span.done { color: #5BD48F; background: none; }
.tm-strip span.now { background: var(--tm-c); color: #1C0F3F; }
.tm-out { margin: 0; font-size: var(--step--1); color: #CBBFE8; min-height: 1.4em; }
.tm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #FF2E7E; margin-right: 7px; vertical-align: -1px; }
.tm-rec[aria-pressed="true"] .tm-dot { background: #fff; animation: pn-blink 1s steps(2) infinite; }
@keyframes pn-blink { 50% { opacity: 0.2; } }
.tm-time { font: 600 0.78rem/1.4 var(--mono); color: #A597CC; margin: 0; }
.tm-time:empty, .tm .adv-msg:empty { display: none; }
.tm .adv-note kbd { font: 600 0.72rem/1 var(--mono); background: rgba(255, 255, 255, 0.1); border-radius: 5px; padding: 2px 5px; color: #fff; }
.tm .adv-note b { color: #F2ECFF; }

@media (max-width: 760px) { .tm-panels { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .tm-stage { aspect-ratio: 4 / 4.6; max-height: 68vh; }
  .tm-top { gap: 10px; }
  .tm-modes { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .tm-mode { padding: 10px 12px; font-size: 0.9rem; }
  .tm-quick { width: 100%; }
  .tm-quick .adv-range { flex: 1; }
  .tm-quick .adv-range input { width: 100%; min-width: 0; }
  .tm-knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .tm-knobs .adv-range { display: grid; gap: 6px; }
  .tm-knobs .adv-range input { width: 100%; }
  .tm-hint { bottom: 64px; font-size: 0.85rem; max-width: calc(100% - 80px); }
  .tm-panel { padding: 12px; }
  .tm-recrow { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .tm-recrow .btn { justify-content: center; padding: 8px 6px; }
}
@media (hover: none) { .tm [data-hover] { display: none; } }
