/* Petri dish: the dish, the brush ring and the lab-notebook panel */
body {
    background: radial-gradient(ellipse at 40% 45%, #15141f 0%, #000 70%) fixed #000;
    overflow: hidden;
}

/* The 850x650 photo of the dish. app.js fits it to the window with a transform. */
.petridish_wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 850px;
    height: 650px;
    transform-origin: 0 0;
}
.petridish_wrapper.is-ready {
    transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.petridish {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: url(/images/petridish.png);
    pointer-events: none;
}
/* The canvas sits exactly under the inner ellipse of the dish */
#stage {
    position: absolute;
    left: 179px;
    top: 103px;
    width: 498px;
    height: 398px;
    z-index: 1;
    overflow: hidden;
    border-radius: 50%;
    touch-action: none;
    cursor: crosshair;
}
#stage.is-painting {
    cursor: none;
}
.petridish_canvas {
    display: block;
    width: 100%;
    height: 100%;
}

html.variant-big .petridish_wrapper {
    width: 800px;
    height: 600px;
}
html.variant-big .petridish {
    display: none;
}
html.variant-big #stage {
    left: 0;
    top: 0;
    width: 800px;
    height: 600px;
    border-radius: 0;
}

/* Brush ring: an ellipse, because the dish is seen at an angle */
.petridish_brush {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    box-sizing: border-box;
    border: 1.5px solid rgba(255, 255, 255, .85);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 14px var(--pd-glow, var(--lab-teal));
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s, border-color .15s, background-color .15s;
}
.petridish_brush.is-on {
    opacity: 1;
}
.petridish_brush.is-down {
    background: radial-gradient(closest-side, rgba(255, 255, 255, .18), transparent);
}
.petridish_brush.is-erasing {
    border-style: dashed;
    border-color: var(--lab-red);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 12px var(--lab-red);
}

/* The panel */
.pd-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    width: 256px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    box-sizing: border-box;
    border: 1px solid rgba(169, 172, 217, .16);
    border-radius: 14px;
    background: rgba(29, 27, 58, .78);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
    box-shadow: var(--lab-shadow);
    color: var(--lab-muted);
    font: 500 12px/1.4 var(--lab-font);
    scrollbar-width: thin;
}
.pd-panel kbd {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 .3em;
    border-radius: 4px;
    background: rgba(246, 241, 227, .08);
    color: var(--lab-dim);
    font: 600 10px/1.5 var(--lab-mono);
    text-align: center;
}
.pd-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 14px;
    background: inherit;
}
.pd-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    flex: 1;
    min-width: 0;
}
.pd-head b {
    color: var(--lab-ink);
    white-space: nowrap;
    font-size: 14px;
    font-weight: 800;
}
.pd-led {
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--pd-glow, var(--lab-teal));
    box-shadow: 0 0 10px var(--pd-glow, var(--lab-teal));
    animation: pd-pulse 2.4s ease-in-out infinite;
}
.is-paused .pd-led {
    background: var(--lab-dim);
    box-shadow: none;
    animation: none;
}
@keyframes pd-pulse {
    50% { transform: scale(.7); opacity: .6; }
}
.pd-stats {
    color: var(--lab-dim);
    font: 600 10px var(--lab-mono);
    white-space: nowrap;
}
.pd-fold {
    display: grid;
    place-items: center;
    width: 24px;
    min-width: 0;
    height: 24px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--lab-muted);
    cursor: pointer;
}
.pd-fold:hover {
    background: rgba(246, 241, 227, .08);
    color: var(--lab-ink);
}
.pd-fold svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: rotate(180deg);
    transition: transform .25s;
}
.is-folded .pd-fold svg {
    transform: none;
}
.is-folded {
    width: auto;
    cursor: pointer;
}
.is-folded .pd-body {
    display: none;
}

.pd-body {
    padding: 0 14px 14px;
}
.pd-body section {
    padding: 12px 0;
    border-top: 1px solid rgba(169, 172, 217, .12);
}
.pd-body h3 {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0 0 8px;
    color: var(--lab-ink);
    font: 800 11px/1.2 var(--lab-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.pd-fk {
    margin-left: auto;
    color: var(--lab-magenta);
    font: 600 10px var(--lab-mono);
    letter-spacing: 0;
    text-transform: none;
}
.is-sweeping .pd-fk {
    color: var(--lab-teal);
}

.pd-panel button {
    font-family: var(--lab-font);
}
.pd-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
.pd-chip,
.pd-actions button,
.pd-mode button {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(246, 241, 227, .05);
    color: var(--lab-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.pd-chip:hover,
.pd-actions button:hover,
.pd-mode button:hover {
    background: rgba(246, 241, 227, .1);
    color: var(--lab-ink);
}
.pd-chip[aria-pressed="true"],
.pd-mode button[aria-checked="true"] {
    border-color: var(--pd-glow, var(--lab-teal));
    background: rgba(246, 241, 227, .1);
    color: var(--lab-ink);
}
.pd-blurb {
    min-height: 2.8em;
    margin: 8px 0 0;
    color: var(--lab-muted);
    font-style: italic;
}

.pd-map {
    display: block;
    width: 100%;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.pd-check {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--lab-muted);
    cursor: pointer;
}
.pd-check kbd {
    margin-left: auto;
}

.pd-stains {
    display: flex;
    gap: 8px;
}
.pd-stain {
    width: 28px;
    min-width: 0;
    height: 28px;
    min-height: 0;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--g);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
    cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.pd-stain:hover {
    transform: scale(1.1);
}
.pd-stain[aria-pressed="true"] {
    border-color: var(--lab-ink);
}

.pd-slider {
    display: grid;
    grid-template-columns: 48px 1fr 36px;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--lab-muted);
}
.pd-slider input {
    width: 100%;
    accent-color: var(--pd-glow, var(--lab-teal));
}
.pd-slider output {
    color: var(--lab-ink);
    font: 600 10px var(--lab-mono);
    text-align: right;
}
.pd-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 8px;
}
.pd-mode button {
    justify-content: center;
}
.pd-mode kbd {
    margin-left: 2px;
}

.pd-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(169, 172, 217, .12);
}
.pd-actions button {
    justify-content: space-between;
}
.pd-keys {
    margin: 12px 0 0;
    color: var(--lab-dim);
    font-size: 11px;
}
.pd-keys kbd {
    min-width: 1em;
}

@media (prefers-reduced-motion: reduce) {
    .petridish_wrapper.is-ready,
    .pd-fold svg {
        transition: none;
    }
    .pd-led {
        animation: none;
    }
}
