/*! supertwentyplus licence: (c) 2026 Supertwentyplus Pte. Ltd. All rights reserved. Proprietary, not open source.
   Use only as provided on supertwentyplus.com (free or by subscription, under its Terms). Copying, reuse or hosting elsewhere,
   in whole or in part, needs a written licence: supertwentyplus@gmail.com. See LICENSE.txt at the site root. */
/* 3D Pendulum Wave Simulation: a dark lab instrument inside the app panel */
.pw-app { padding: clamp(8px, 1.6vw, 14px); }
.pw {
  --pw-bg: #050811; --pw-glass: rgba(15, 23, 42, .82); --pw-card: rgba(15, 23, 42, .62); --pw-well: rgba(2, 6, 23, .9);
  --pw-line: rgba(255, 255, 255, .1); --pw-line-soft: rgba(255, 255, 255, .05);
  --pw-text: #f1f5f9; --pw-text-2: #cbd5e1; --pw-dim: #94a3b8;
  --pw-cyan: #67e8f9; --pw-cyan-bg: rgba(34, 211, 238, .18); --pw-cyan-line: rgba(34, 211, 238, .38);
  --pw-amber: #fcd34d; --pw-green: #6ee7b7; --pw-rose: #fda4af; --pw-pink: #f0abfc; --pw-violet: #c4b5fd;
  --pw-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  position: relative; display: flex; flex-direction: column; gap: 10px; container-type: inline-size;
  padding: 10px; border-radius: calc(var(--widget-radius, 18px) - 4px);
  background: radial-gradient(120% 80% at 50% 0%, #0b1530 0%, var(--pw-bg) 60%);
  color: var(--pw-text); font-size: 14px; line-height: 1.4;
}
.pw * { box-sizing: border-box; }
.pw svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.pw [hidden] { display: none !important; }
.pw-mono { font-family: var(--pw-mono); }
.pw-dim { color: var(--pw-dim); }
.pw-small { font-size: 12px !important; }
.pw-c-cyan { color: var(--pw-cyan); } .pw-c-green { color: var(--pw-green); } .pw-c-amber { color: var(--pw-amber); }
.pw-c-rose { color: var(--pw-rose); } .pw-c-violet { color: var(--pw-violet); }

/* Buttons */
.pw button { font: inherit; color: inherit; cursor: pointer; }
.pw button:focus-visible, .pw input:focus-visible, .pw select:focus-visible { outline: 2px solid var(--pw-cyan); outline-offset: 2px; }
.pw-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--pw-well); border: 1px solid var(--pw-line); border-radius: 12px; }
.pw-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--pw-dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pw-seg button:hover { color: var(--pw-text); }
.pw-seg button[aria-pressed="true"], .pw-seg button[aria-selected="true"] { background: var(--pw-cyan-bg); border-color: var(--pw-cyan-line); color: var(--pw-cyan); }
.pw-seg svg { width: 15px; height: 15px; }
.pw-shapes button { font-family: var(--pw-mono); font-size: 12px; padding: 0 10px; }
.pw-rand { color: var(--pw-amber) !important; }
.pw-rand[aria-pressed="true"] { background: rgba(245, 158, 11, .18) !important; border-color: rgba(251, 191, 36, .4) !important; }
.pw-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--pw-line); background: rgba(30, 41, 59, .85); color: var(--pw-text-2); }
.pw-icon-btn:hover { color: #fff; background: rgba(51, 65, 85, .9); }

.pw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pw-bar-end { display: flex; gap: 6px; margin-left: auto; }

/* Stage */
.pw-stage { position: relative; height: clamp(340px, 62vh, 600px); border-radius: 14px; overflow: hidden; background: var(--pw-bg); border: 1px solid var(--pw-line); }
.pw-canvas { position: absolute; inset: 0; }
.pw-canvas canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.pw-hud { position: absolute; top: 8px; left: 8px; right: 8px; max-width: 460px; padding: 8px 12px; border-radius: 12px; background: var(--pw-glass); border: 1px solid var(--pw-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; }
.pw-hud-top { display: flex; align-items: center; gap: 8px; }
.pw-dot { width: 8px; height: 8px; border-radius: 50%; background: #22d3ee; box-shadow: 0 0 8px #22d3ee; animation: pw-pulse 1.6s ease-in-out infinite; flex-shrink: 0; }
@keyframes pw-pulse { 50% { opacity: .35; } }
.pw-phase { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--pw-cyan); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-time { font-family: var(--pw-mono); font-size: 12px; color: var(--pw-text-2); white-space: nowrap; }
.pw-progress { height: 5px; margin: 6px 0 4px; border-radius: 99px; background: #1e293b; overflow: hidden; }
.pw-progress-bar { width: 0; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22d3ee, #34d399, #8b5cf6); }
.pw-hud-foot { display: flex; justify-content: space-between; gap: 10px; font-family: var(--pw-mono); font-size: 12px; }
.pw-readout { color: var(--pw-pink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-readout-2 { color: var(--pw-cyan); white-space: nowrap; }
.pw-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 14px; max-width: calc(100% - 24px); border-radius: 99px; background: rgba(15, 23, 42, .85); border: 1px solid var(--pw-cyan-line); color: #a5f3fc; font-size: 12px; pointer-events: none; transition: opacity .5s; text-align: center; }
.pw-hint svg { width: 14px; height: 14px; color: var(--pw-cyan); }
.pw-hint.is-gone { opacity: 0; }
.pw-nogl { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 24px; text-align: center; color: var(--pw-text-2); background: var(--pw-bg); }
.pw-nogl p { margin: 0; max-width: 42ch; }

/* Live stats */
.pw-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 7px 12px; border-radius: 12px; background: var(--pw-card); border: 1px solid var(--pw-line-soft); font-family: var(--pw-mono); font-size: 12px; }
.pw-stats div { display: flex; gap: 6px; }
.pw-stats dt { color: #64748b; }
.pw-stats dd { margin: 0; font-weight: 600; }

/* Transport row */
.pw-transport { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pw-play { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; min-width: 150px; padding: 0 18px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #22d3ee, #6366f1); color: #020617 !important; font-weight: 700 !important; box-shadow: 0 8px 22px rgba(34, 211, 238, .22); }
.pw-play:hover { filter: brightness(1.1); }
.pw-play svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.pw-btn { display: inline-flex; white-space: nowrap; align-items: center; gap: 7px; min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--pw-line); background: rgba(30, 41, 59, .9); color: var(--pw-text-2); font-size: 13px; font-weight: 600; }
.pw-btn:hover { background: rgba(51, 65, 85, .9); color: #fff; }
.pw-amber { background: rgba(245, 158, 11, .14); border-color: rgba(251, 191, 36, .32); color: var(--pw-amber); }
.pw-amber:hover { background: rgba(245, 158, 11, .25); color: var(--pw-amber); }
.pw-cyan { border-color: rgba(34, 211, 238, .3); color: var(--pw-cyan); }
.pw-cyan[aria-pressed="false"] { color: var(--pw-dim); border-color: var(--pw-line); }
.pw-chev { transition: transform .2s; }
.pw-toggle-shut .pw-chev { transform: rotate(180deg); }
.pw-cams button { min-height: 40px; }
#pw-toggle { margin-left: auto; }

/* Drawer */
.pw-drawer { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--pw-line); }
.pw-drawer-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pw-tabs button { min-height: 34px; font-size: 12.5px; }
.pw-pill { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 12px; background: var(--pw-card); border: 1px solid var(--pw-line); font-size: 12px; }
.pw-sep { color: #334155; }
.pw-chip { min-height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--pw-dim); font-family: var(--pw-mono); font-size: 12px; }
.pw-chip:hover { color: var(--pw-text); }
.pw-chip[aria-pressed="true"], .pw-chip-on { background: var(--pw-cyan-bg); border-color: var(--pw-cyan-line); color: var(--pw-cyan); }
.pw-chip-amber { background: rgba(245, 158, 11, .18); border-color: rgba(251, 191, 36, .32); color: var(--pw-amber); }
.pw-chip-amber2 { background: #1e293b; border-color: var(--pw-line); color: #fde68a; }
.pw-chip-pink[aria-pressed="true"] { background: rgba(217, 70, 239, .18); border-color: rgba(232, 121, 249, .35); color: var(--pw-pink); }
.pw-chip-pink[aria-pressed="false"] { background: transparent; border-color: transparent; color: var(--pw-dim); }
.pw-chip-green { background: rgba(16, 185, 129, .18); border-color: rgba(52, 211, 153, .35); color: var(--pw-green); }
.pw-chip-green[aria-pressed="true"] { background: rgba(245, 158, 11, .18); border-color: rgba(251, 191, 36, .35); color: var(--pw-amber); }

.pw-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@container (min-width: 520px) { .pw-grid { grid-template-columns: 1fr 1fr; } }
@container (min-width: 700px) { .pw-grid-3 { grid-template-columns: repeat(3, 1fr); } }
@container (min-width: 980px) { .pw-grid-4 { grid-template-columns: repeat(4, 1fr); } }
.pw-card { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--pw-card); border: 1px solid var(--pw-line-soft); min-width: 0; }
.pw-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pw-card-head label, .pw-lbl { font-size: 12px; font-weight: 600; color: var(--pw-text-2); }
.pw-card-head output { font-size: 12.5px; font-weight: 700; text-align: right; }
.pw-head-l { display: inline-flex; align-items: center; gap: 6px; }
.pw-card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; font-family: var(--pw-mono); font-size: 12px; color: var(--pw-dim); }
.pw-card-foot strong { color: var(--pw-text); font-weight: 600; }
.pw-inline { flex-wrap: nowrap; }
.pw-inline input { flex: 1; min-width: 60px; }
.pw-mini { min-height: 26px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--pw-line-soft); background: #1e293b; color: var(--pw-text-2); font-family: var(--pw-mono); font-size: 12px; }
.pw-mini:hover { background: #334155; }
#pw-unit { border-color: rgba(34, 211, 238, .3); color: var(--pw-cyan); }
.pw-cd[aria-pressed="true"] { background: rgba(244, 63, 94, .2); border-color: rgba(251, 113, 133, .35); color: var(--pw-rose); }
.pw-presets { display: inline-flex; gap: 3px; }
.pw-link { min-height: 26px; padding: 0; border: 0; background: none; color: var(--pw-amber); font-family: var(--pw-mono); font-size: 12px; }
.pw-link:hover { text-decoration: underline; }
.pw-polys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pw-polys button { min-height: 34px; border-radius: 8px; border: 1px solid var(--pw-line-soft); background: #1e293b; color: var(--pw-text-2); font-family: var(--pw-mono); font-size: 12px; font-weight: 600; }
.pw-polys button[aria-pressed="true"] { background: var(--pw-cyan-bg); border-color: var(--pw-cyan-line); color: var(--pw-cyan); }
.pw select { width: 100%; min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--pw-line); background: #1e293b; color: var(--pw-text); font: inherit; font-size: 13px; }

/* Sliders */
.pw input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer; }
.pw input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: rgba(51, 65, 85, .95); border: 1px solid rgba(255, 255, 255, .08); }
.pw input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #22d3ee; border: 2px solid #ecfeff; box-shadow: 0 0 12px rgba(34, 211, 238, .75); }
.pw input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: rgba(51, 65, 85, .95); border: 1px solid rgba(255, 255, 255, .08); }
.pw input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #22d3ee; border: 2px solid #ecfeff; box-shadow: 0 0 12px rgba(34, 211, 238, .75); }

/* Info dialog */
.pw-modal { width: min(560px, calc(100vw - 24px)); max-height: 88vh; padding: 20px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .15); background: #0f172a; color: var(--pw-text-2); box-shadow: 0 30px 70px rgba(0, 0, 0, .6); font-size: 14px; line-height: 1.55; }
.pw-modal::backdrop { background: rgba(2, 6, 23, .78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pw-modal-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--pw-line); }
.pw-modal-head { flex-wrap: wrap; }
.pw-modal-head h2 { flex: 1 1 200px; order: 2; margin: 0; font-size: 18px; line-height: 1.25; color: #fff; }
.pw-modal-head .pw-tag { flex: 0 0 100%; order: 1; width: max-content; max-width: max-content; }
.pw-modal-head .pw-icon-btn { order: 3; }
.pw-tag { padding: 2px 8px; border-radius: 6px; background: var(--pw-cyan-bg); color: var(--pw-cyan); font-family: var(--pw-mono); font-size: 12px; text-transform: uppercase; }
.pw-modal-body p { margin: 12px 0; }
.pw-modal-body strong { color: #fff; }
.pw-box { margin: 12px 0; padding: 4px 14px; border-radius: 14px; background: #020617; border: 1px solid rgba(34, 211, 238, .2); }
.pw-box h3 { margin: 10px 0 0; font-family: var(--pw-mono); font-size: 13px; color: var(--pw-cyan); }
.pw-box p { font-size: 13px; }
.pw-modal-ok { width: 100%; }

/* Full screen */
.pw:fullscreen { border-radius: 0; padding: 10px; overflow-y: auto; }
.pw:fullscreen .pw-stage, .pw.is-full .pw-stage { flex: 1 0 auto; height: auto; min-height: 55vh; }
.pw.is-full { position: fixed; inset: 0; z-index: 1000; border-radius: 0; overflow-y: auto; }
body.pw-lock { overflow: hidden; }

/* Phones */
@media (max-width: 640px) {
  .pw { padding: 6px; gap: 8px; }
  .pw-stage { height: clamp(320px, 58vh, 520px); border-radius: 12px; }
  .pw-modes { flex: 1; flex-wrap: nowrap; min-width: 0; }
  .pw-modes button { flex: 1; justify-content: center; padding: 0 6px; min-width: 0; font-size: 12.5px; }
  .pw-shapes { order: 3; width: 100%; justify-content: space-between; }
  .pw-shapes button { flex: 1; justify-content: center; padding: 0 4px; }
  .pw-hud { top: 6px; left: 6px; right: 6px; padding: 6px 10px; }
  .pw-readout-2 { display: none; }
  .pw-stats { font-size: 12px; gap: 2px 10px; padding: 6px 10px; }
  .pw-play { flex: 1 1 100%; }
  .pw-btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .pw-wide-only { display: none; }
  .pw-cams { flex: 1 1 auto; }
  .pw-cams button { flex: 1; justify-content: center; padding: 0 8px; }
  #pw-toggle { flex: 0 0 auto; margin-left: 0; }
  .pw-tabs { width: 100%; }
  .pw-tabs button { flex: 1; justify-content: center; white-space: normal; text-align: center; line-height: 1.2; padding: 4px 8px; }
  .pw-hint { font-size: 12px; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .pw-dot { animation: none; } .pw-chev, .pw-hint { transition: none; } }
