/* Fling Lab: gesture physics playground. Shared tokens from site.css; everything here is prefixed fl-. */
.fl { --fl: #0A9CC2; --fl-ink: #07789A; --fl-2: #8B5CF6; padding-bottom: 72px; }
@media (prefers-color-scheme: dark) { .fl { --fl: #4CC9EC; --fl-ink: #7DD9F2; --fl-2: #A78BFA; } }
.fl-head-chips { margin-top: 18px; }
.fl-noscript { padding: 14px 18px; border-radius: var(--r-m); background: var(--raised); }

.fl-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: start; }
.fl-side { display: grid; gap: 20px; min-width: 0; }
@media (max-width: 960px) {
  .fl-workspace { grid-template-columns: minmax(0, 1fr); }
}

.fl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow-1); min-width: 0; }
.fl-card-title { font-size: 1.05rem; letter-spacing: -0.01em; margin: 0; }
.fl-card-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.fl-label { display: block; font: 650 .8rem/1.2 var(--sans); color: var(--muted); margin: 0; }
.fl-fine { font-size: .84rem; line-height: 1.45; color: var(--muted); margin: 0; }
.fl-btn-sm { min-height: 38px; padding: 6px 14px; font-size: .92rem; }
.fl-btn-sm svg { width: 18px; height: 18px; }
.fl-mini { display: inline-grid; place-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 .84rem/1 var(--sans); cursor: pointer; }
.fl-mini:hover { background: var(--raised); }

/* segmented buttons */
.fl-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--raised); }
.fl-seg button { min-height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 .9rem/1.1 var(--sans);
  cursor: pointer; padding: 6px 10px; transition: background .15s, color .15s, box-shadow .15s; }
.fl-seg button:hover { color: var(--ink); }
.fl-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.fl-seg button.fl-on { color: var(--fl-ink); }
.fl-scenes { max-width: 420px; }
.fl-scene-note { margin: 10px 0 14px; min-height: 2.9em; }
.fl-langs { min-width: 220px; }

/* the stage */
.fl-stage { position: relative; height: clamp(380px, 60vh, 540px); border-radius: var(--r-m); overflow: hidden; touch-action: pan-y;
  background: var(--bg); border: 1px solid var(--line); isolation: isolate; user-select: none; -webkit-user-select: none; }
.fl-backdrop { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.fl-overlay { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.fl-slots { position: absolute; inset: 0; z-index: 1; }
.fl-slot { position: absolute; border: 2px dashed color-mix(in srgb, var(--fl) 40%, var(--line)); border-radius: 14px; cursor: pointer;
  transition: border-color .2s, background .2s; }
.fl-slot:hover { border-color: var(--fl); }
.fl-slot.fl-on { border-color: var(--fl); border-style: solid; background: color-mix(in srgb, var(--fl) 9%, transparent); }
.fl-tick { position: absolute; right: 10px; display: flex; align-items: center; gap: 6px; transform: translateY(-50%); font: 700 .68rem/1 var(--sans);
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint); cursor: pointer; }
.fl-tick::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.fl-tick.fl-on { color: var(--fl-ink); }

.fl-thing { position: absolute; left: 0; top: 0; z-index: 3; touch-action: none; cursor: grab; will-change: transform; }
.fl-thing:active { cursor: grabbing; }
.fl-thing:focus-visible { outline: 3px solid var(--fl); outline-offset: 4px; }
.fl-held .fl-thing > * { box-shadow: 0 22px 44px rgb(10 30 60 / 30%), 0 4px 10px rgb(10 30 60 / 18%); }

/* corners: a floating video card over an app screen */
.fl-stage[data-scene="corners"] .fl-backdrop { padding: 22px; display: grid; align-content: start; gap: 12px; }
.fl-stage[data-scene="corners"] .fl-backdrop i { display: block; height: 54px; border-radius: 12px; background: var(--raised); }
.fl-stage[data-scene="corners"] .fl-backdrop i:first-child { height: 20px; width: 40%; background: var(--line); }
.fl-stage[data-scene="corners"] .fl-backdrop i:nth-child(3) { width: 82%; }
.fl-video { position: relative; width: 100%; height: 100%; border-radius: 14px; overflow: hidden; color: #fff;
  background: radial-gradient(70% 90% at 80% 20%, rgb(255 255 255 / 22%), transparent 60%), linear-gradient(135deg, #0A9CC2 0%, #6D5CF6 70%, #A84BD8 100%);
  box-shadow: 0 12px 28px rgb(10 30 60 / 22%), 0 2px 6px rgb(10 30 60 / 14%); transition: box-shadow .2s; }
.fl-video::before { content: ""; position: absolute; left: 50%; top: 46%; width: 0; height: 0; transform: translate(-35%, -50%);
  border-left: 18px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; opacity: .95; }
.fl-video b { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 4px; background: rgb(255 255 255 / 30%); }
.fl-video b::after { content: ""; position: absolute; inset: 0 62% 0 0; border-radius: 4px; background: #fff; }
.fl-video span { position: absolute; left: 10px; top: 8px; font: 700 .7rem/1 var(--mono); opacity: .9; }

/* sheet: a bottom sheet over a map-like backdrop */
.fl-stage[data-scene="sheet"] .fl-backdrop {
  background: radial-gradient(circle at 30% 40%, color-mix(in srgb, var(--leaf) 22%, transparent) 0 70px, transparent 71px),
    radial-gradient(circle at 78% 22%, color-mix(in srgb, var(--sky) 20%, transparent) 0 54px, transparent 55px),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 34px 34px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 34px 34px; opacity: .8; }
.fl-stage[data-scene="sheet"] .fl-backdrop i { display: none; }
.fl-stage[data-scene="sheet"] .fl-thing { cursor: ns-resize; }
.fl-sheet { width: 100%; height: 100%; border-radius: 22px 22px 0 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  box-shadow: 0 -10px 30px rgb(10 30 60 / 14%); padding: 10px 18px 0; display: grid; align-content: start; gap: 12px; }
.fl-sheet::before { content: ""; justify-self: center; width: 40px; height: 5px; border-radius: 5px; background: var(--line); }
.fl-sheet strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.fl-sheet span { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; }
.fl-sheet span::before { content: ""; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--fl), var(--fl-2)); opacity: .85; }
.fl-sheet span::after { content: ""; height: 12px; border-radius: 6px; background: var(--raised); width: var(--w, 80%); }

/* glide: a tile on a dotted plane */
.fl-stage[data-scene="glide"] .fl-backdrop { background: radial-gradient(circle, var(--line) 1.4px, transparent 1.6px) 0 0 / 22px 22px; }
.fl-stage[data-scene="glide"] .fl-backdrop i { display: none; }
.fl-tile { width: 100%; height: 100%; border-radius: 22px; display: grid; place-items: center;
  background: radial-gradient(70% 70% at 30% 25%, rgb(255 255 255 / 35%), transparent 60%), linear-gradient(140deg, #FFB547 0%, #FF6F9A 55%, #8B5CF6 100%);
  box-shadow: 0 12px 28px rgb(60 20 60 / 22%), 0 2px 6px rgb(60 20 60 / 14%); }
.fl-tile::before { content: ""; width: 34%; height: 34%; border-radius: 50%; border: 4px solid rgb(255 255 255 / 90%); }

.fl-under-stage { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.fl-send { display: grid; gap: 8px; margin-top: 14px; }
.fl-send[hidden] { display: none; }

/* readouts */
.fl-readouts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.fl-readouts div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.fl-readouts dt { font: 650 .72rem/1.2 var(--sans); color: var(--muted); }
.fl-readouts dd { margin: 4px 0 0; font: 650 .95rem/1.2 var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .fl-readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* graph */
.fl-graph { display: block; width: 100%; height: 170px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.fl-graph-help { margin-top: 10px; }
.fl-graph-help b { color: var(--ink); font-weight: 650; }

/* switches and sliders */
.fl-switches { display: grid; gap: 4px; margin-bottom: 14px; }
.fl-switch { position: relative; display: flex; align-items: center; gap: 10px; min-height: 38px; font: 600 .92rem/1.2 var(--sans); color: var(--ink); cursor: pointer; }
.fl-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fl-switch input:disabled { cursor: default; }
.fl-switch:has(input:disabled) { opacity: .45; }
.fl-switch-ui { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); transition: background .2s; }
.fl-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform .2s var(--ease-out); }
.fl-switch input:checked + .fl-switch-ui { background: var(--fl); }
.fl-switch input:checked + .fl-switch-ui::after { transform: translateX(16px); }
.fl-switch input:focus-visible + .fl-switch-ui { outline: 3px solid var(--fl); outline-offset: 2px; }
.fl-range-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.fl-range-row output { font: 600 .84rem/1 var(--mono); color: var(--muted); }
.fl-range { width: 100%; accent-color: var(--fl); margin: 8px 0 0; }
.fl-sliders .fl-fine { margin-top: 12px; }

/* code */
.fl-code-card { margin-top: 20px; }
.fl-code pre { margin: 0 0 12px; max-height: 560px; overflow: auto; }

/* notes */
.fl-notes { margin-top: 56px; }
.fl-notes h2 { font-size: 1.6rem; }
.fl-notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.fl-note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px; }
.fl-note h3 { font-size: 1.05rem; }
.fl-note p { font-size: .94rem; color: var(--muted); margin: 0; }
.fl-note code { font-size: .84em; background: var(--raised); padding: .1em .35em; border-radius: 5px; }

@media (max-width: 480px) {
  .fl-card { padding: 16px; border-radius: var(--r-m); }
  .fl-stage { height: clamp(360px, 62vh, 480px); }
  .fl-langs { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .fl-seg button, .fl-switch-ui, .fl-switch-ui::after, .fl-slot, .fl-video { transition: none; }
}
