/* The player playground: the real LimePlayer player on the left (its corners, colors and controls are its own: the
   stage adds no frame or rounding that would hide them), a tabbed dock of its settings on the right
   (js/features/playground.js), and the embed code under both. */
@layer sections {
    .pg { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .62fr); gap: 24px; align-items: start; }
    .pg__stage { position: relative; min-width: 0; align-self: center; }
    .pg__stage::before { content: ''; position: absolute; inset: 8% 6% -8%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, var(--lime-a25), transparent); filter: blur(34px); pointer-events: none; }
    .pg__screen { position: relative; aspect-ratio: 16 / 9; }
    /* the player: the next one loads underneath and fades in when it says "ready" */
    .pg__frame { position: absolute; inset: 0; background: transparent; transition: opacity .2s ease; }
    .pg__frame.is-next { opacity: 0; pointer-events: none; }

    /* the dock: tabs, then one group of settings at a time */
    .pg__dock { display: grid; align-content: start; gap: 22px; padding: 22px 24px 26px; border: 0; }
    .pg__tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 999px; background: var(--white-a4); border: 1px solid var(--line); }
    .pg__tab { height: 36px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 14px; font-weight: 800; transition: background-color .2s, color .2s; }
    .pg__tab:hover { color: var(--text); }
    .pg__tab[aria-selected="true"] { background: var(--white-a12); color: var(--text); box-shadow: inset 0 1px 0 var(--white-a8); }
    .pg__tab:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
    .pg__panel { display: grid; gap: 20px; }
    .pg__panel[hidden] { display: none; }
    .pg__field { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
    .pg__field legend { margin-bottom: 10px; padding: 0; color: var(--text-3); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .pg__note { display: flex; gap: 10px; align-items: flex-start; color: var(--text-3); font-size: 13.5px; line-height: 1.5; }
    .pg__note .i { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--lime-300); }

    .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
    .swatch { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .25); cursor: pointer; transition: transform .2s var(--ease); }
    .swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
    .swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }
    .swatch:has(input:focus-visible) { outline: 2px solid var(--white); outline-offset: 5px; }
    .swatch:hover { transform: scale(1.08); }
    .swatches { position: relative; }
    .swatch--custom { padding: 0; border: 0; background: conic-gradient(#FF5A6E, #FFC857, #4ADE80, #C7FF2E, #9C8CFF, #FF5A6E); color: var(--white); }
    .swatch--custom .i { width: 16px; height: 16px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .7)); pointer-events: none; }
    .swatch--custom.is-on { background: var(--c); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }
    .swatch--custom[aria-expanded="true"] { transform: scale(1.08); }
    .swatch--custom:focus-visible { outline: 2px solid var(--white); outline-offset: 5px; }

    /* the built-in color picker (js/features/color-picker.js): plane, hue slider, hex field */
    .cpick { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 14px); display: grid; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface-raised); border: 1px solid var(--line-2); box-shadow: 0 24px 60px -12px var(--black-a80), inset 0 1px 0 var(--white-a6); animation: cpick-in .18s var(--ease); }
    .cpick[hidden] { display: none; }
    @keyframes cpick-in { from { opacity: 0; translate: 0 -4px; } }
    .cpick__plane, .cpick__hue { position: relative; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
    .cpick__plane { height: 140px; border-radius: 12px; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--hue)); box-shadow: inset 0 0 0 1px var(--line-2); cursor: crosshair; }
    .cpick__hue { height: 14px; border-radius: 999px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
    .cpick__dot { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--white); background: var(--pick); box-shadow: 0 0 0 1px rgb(0 0 0 / .3), 0 2px 6px rgb(0 0 0 / .4); translate: -50% -50%; pointer-events: none; }
    .cpick__hue .cpick__dot { background: var(--hue); }
    .cpick__plane:focus-visible, .cpick__hue:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
    .cpick__row { display: flex; align-items: center; gap: 10px; }
    .cpick__preview { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--pick); box-shadow: inset 0 0 0 1px var(--line-3); }
    .cpick__hex { flex: 1; min-width: 0; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-ink); color: var(--text); font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; outline: none; }
    .cpick__hex:focus { border-color: var(--lime-a45); }

    /* "+N more player options" under the dock's tabs */
    .pg__more { display: flex; align-items: center; gap: 12px; margin-top: 2px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; line-height: 1.45; }
    .pg__more strong { color: var(--text); font-weight: 700; }
    .pg__more-count { flex: none; display: grid; place-items: center; min-width: 46px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--lime-a10); color: var(--lime-200); box-shadow: inset 0 0 0 1px var(--lime-a30); font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }

    /* a segmented choice (controls style, play button, corners) */
    .seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--white-a3); border: 1px solid var(--line); }
    .seg__opt { position: relative; flex: 1; min-width: 0; }
    .seg__opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
    .seg__opt span { display: grid; place-items: center; height: 34px; padding: 0 6px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 700; white-space: nowrap; transition: background-color .2s, color .2s; }
    .seg__opt:hover span { color: var(--text); }
    .seg__opt input:checked + span { background: var(--lime-a10); color: var(--lime-200); box-shadow: inset 0 0 0 1px var(--lime-a45); }
    .seg__opt input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 1px; }

    .ccpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .ccpick__opt { position: relative; display: grid; gap: 6px; justify-items: center; padding: 10px 6px 8px; border-radius: 12px; background: var(--white-a3); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background-color .2s; }
    .ccpick__opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
    .ccpick__opt:has(input:checked) { background: var(--lime-a10); border-color: var(--lime-a45); }
    .ccpick__opt:has(input:focus-visible) { outline: 2px solid var(--white); outline-offset: 2px; }
    .ccpick__face { display: grid; place-items: center; width: 100%; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #2A3B44, #10181D); font-family: var(--font-caption); font-size: 15px; }
    .ccpick__opt small { color: var(--text-2); font-size: 12px; font-weight: 700; }

    .pg__switches { display: grid; gap: 16px; }
    .toggle { position: relative; display: flex; align-items: flex-start; gap: 12px; color: var(--text); font-size: 14.5px; font-weight: 700; cursor: pointer; }
    .toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
    .toggle__track { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--white-a12); transition: background-color .2s; }
    .toggle__track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 2px 4px var(--black-a40); transition: translate .25s var(--ease); }
    .toggle input:checked + .toggle__track { background: var(--lime-400); }
    .toggle input:checked + .toggle__track::after { translate: 16px 0; }
    .toggle input:focus-visible + .toggle__track { outline: 2px solid var(--white); outline-offset: 2px; }
    .toggle__text { display: grid; gap: 2px; padding-top: 2px; }
    .toggle__text small { color: var(--text-3); font-size: 12.5px; font-weight: 600; line-height: 1.45; }

    .pg__code { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-top: 24px; padding: 12px 12px 12px 20px; border-radius: var(--r-panel); background: var(--surface-ink); border: 1px solid var(--line-2); }
    .pg__code-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; font-weight: 700; white-space: nowrap; }
    .pg__code-label .i { width: 16px; height: 16px; color: var(--lime-300); }
    .pg__code code { overflow: hidden; color: var(--lime-200); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }

    @media (max-width: 1000px) { .pg { grid-template-columns: 1fr; } .ccpick { grid-template-columns: repeat(6, 1fr); } }
    @media (max-width: 620px) {
        .ccpick { grid-template-columns: repeat(3, 1fr); }
        .pg__dock { padding: 18px 16px 20px; }
        .pg__code { grid-template-columns: minmax(0, 1fr) auto; }
        .pg__code-label { display: none; }
    }
}
