/* The Cat Workshop: the cat's attributes on the left, the stage in the middle, direction on the right.
   Markup: Components/Pages/Workshops/CatStudio.razor (heading and notes) and wwwroot/js/cat/studio.js (the rest). */

.cs-page {
    --cs-purple: #3b2a6b;
    --cs-blue: #1d5fd1;
    --cs-gold: #ffd23f;
    --cs-line: #d6dde8;
}

.cs-head {
    display: flex;
    align-items: baseline;
    gap: .4rem 1rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}

.cs-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.cs-head p { margin: 0; color: #5b6472; }

.cs-app {
    display: grid;
    grid-template-columns: 20.5rem minmax(0, 1fr) 18.5rem;
    gap: .8rem;
    height: calc(100dvh - 3.25rem - 2rem - 2.8rem);
    min-height: 30rem;
}

.cs-app-wait { display: grid; place-items: center; font-weight: 700; color: var(--cs-purple); }

.cs-panel {
    min-height: 0;
    overflow-y: auto;
    padding: .7rem .8rem .9rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(20, 40, 80, .12);
    font-size: .92rem;
}

.cs-panel h3 {
    margin: .9rem 0 .35rem;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--cs-blue);
}

/* ---------- controls shared by both panels ---------- */
.cs-btn,
.cs-toggle,
.cs-motions button,
.cs-views button,
.cs-tabs button {
    border: 2px solid var(--cs-blue);
    border-radius: 999px;
    background: #fff;
    color: var(--cs-blue);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.cs-btn { padding: .28rem .8rem; }
.cs-btn[hidden] { display: none; }
.cs-btn:hover,
.cs-btn:focus-visible { background: var(--cs-blue); color: #fff; }
.cs-quiet { border-color: transparent; color: #5b6472; text-decoration: underline; font-weight: 600; }
.cs-quiet:hover,
.cs-quiet:focus-visible { background: #eef2f8; color: #2a3442; }

.cs-panel select,
.cs-panel input[type="text"],
.cs-recipe {
    width: 100%;
    padding: .35rem .6rem;
    border: 2px solid var(--cs-line);
    border-radius: 9px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.cs-panel select:focus,
.cs-panel input[type="text"]:focus,
.cs-recipe:focus { border-color: var(--cs-blue); outline: none; box-shadow: 0 0 0 3px rgba(29, 95, 209, .2); }

.cs-panel input[type="range"] { width: 100%; margin: 0; accent-color: var(--cs-blue); }

/* ---------- left: the cat ---------- */
.cs-who { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; margin-bottom: .6rem; }
.cs-who .cs-name { grid-column: 1 / -1; font-size: 1.15rem; font-weight: 800; color: var(--cs-purple); }

.cs-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .6rem; }
.cs-tabs button { flex: 1 1 auto; padding: .2rem .5rem; border-color: var(--cs-line); color: #2a3442; font-size: .88rem; }
.cs-tabs button:hover { border-color: var(--cs-blue); }
.cs-tabs button.on { border-color: var(--cs-purple); background: var(--cs-purple); color: #fff; }

.cs-page-tab[hidden] { display: none; }

.cs-field { margin-bottom: .55rem; }
.cs-field[hidden] { display: none; }
.cs-field > label:first-child { display: block; margin-bottom: .1rem; font-weight: 700; }

.cs-ends { display: flex; justify-content: space-between; font-size: .72rem; color: #7a8492; line-height: 1.1; }

.cs-field-colour { display: flex; align-items: center; gap: .6rem; }
.cs-field-colour > label:first-child { flex: 0 0 6.2rem; margin: 0; }
.cs-field-colour input[type="color"] { width: 3.2rem; height: 1.9rem; padding: 1px; border: 2px solid var(--cs-line); border-radius: 8px; background: #fff; cursor: pointer; }
.cs-optional { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: #5b6472; cursor: pointer; }

.cs-keep { margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--cs-line); }
.cs-keep summary { font-weight: 800; color: var(--cs-purple); cursor: pointer; }
.cs-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.cs-hint { margin: .5rem 0 .3rem; font-size: .8rem; color: #6a7480; }
.cs-recipe { margin-bottom: .4rem; font: .78rem/1.3 ui-monospace, Consolas, monospace; resize: vertical; }

.cs-saved { display: grid; gap: .2rem; margin: 0 0 .3rem; padding: 0; list-style: none; }
.cs-saved li { display: flex; align-items: center; gap: .4rem; }
.cs-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .3); }
.cs-saved-name { flex: 1; padding: .1rem .4rem; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.cs-saved-name:hover,
.cs-saved-name:focus-visible { background: #eaf1fb; }
.cs-saved-del { border: 0; background: none; color: #9aa3b0; font: inherit; cursor: pointer; }
.cs-saved-del:hover,
.cs-saved-del:focus-visible { color: #c8102e; }

/* ---------- middle: the stage ---------- */
.cs-stage {
    position: relative;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #e9eef6;
    box-shadow: 0 6px 24px rgba(20, 40, 80, .18);
}

.cs-canvas { position: absolute; inset: 0; }
.cs-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cs-canvas canvas:active { cursor: grabbing; }

.cs-loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; font-weight: 700; color: var(--cs-purple); }
.cs-loading[hidden] { display: none; }

.cs-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .85);
    color: #2a3442;
    font-size: .82rem;
    font-weight: 700;
    pointer-events: none;
}

.cs-views {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    max-width: calc(100% - 20px);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(20, 40, 80, .2);
}

.cs-views button { padding: .25rem .7rem; border-radius: 0; background: rgba(255, 255, 255, .92); font-size: .82rem; white-space: nowrap; }
.cs-views button + button { border-left: 0; }
.cs-views button:first-child { border-radius: 999px 0 0 999px; }
.cs-views button:last-child { border-radius: 0 999px 999px 0; }
.cs-views button:hover,
.cs-views button:focus-visible { background: var(--cs-blue); color: #fff; }

.cs-note {
    position: absolute;
    right: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
    padding: 5px 12px;
    border-radius: 10px;
    background: rgba(30, 40, 70, .88);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}

.cs-note[hidden] { display: none; }

/* ---------- right: direction ---------- */
.cs-transport { display: flex; gap: .4rem; margin-bottom: .5rem; }
.cs-transport > * { flex: 1; }

.cs-slider { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.2em; align-items: center; gap: .5rem; font-weight: 700; }
.cs-slider output { font-variant-numeric: tabular-nums; text-align: right; color: #5b6472; }

.cs-motions,
.cs-toggles { display: flex; flex-wrap: wrap; gap: .3rem; }

.cs-motions button,
.cs-toggle { padding: .18rem .6rem; border-color: var(--cs-line); color: #2a3442; font-size: .86rem; }

.cs-motions button:hover,
.cs-toggle:hover { border-color: var(--cs-blue); }

.cs-motions button.on { border-color: var(--cs-blue); background: var(--cs-blue); color: #fff; }
.cs-motions button.cs-loop::after { content: " ↻"; opacity: .55; }
.cs-moods button.on { border-color: var(--cs-purple); background: var(--cs-purple); }

.cs-toggle { padding-left: 1.6rem; position: relative; }
.cs-toggle::before { content: ""; position: absolute; left: .5rem; top: 50%; width: .7rem; height: .7rem; margin-top: -.35rem; border: 2px solid #9aa3b0; border-radius: 3px; background: #fff; }
.cs-toggle.on { border-color: var(--cs-purple); color: var(--cs-purple); }
.cs-toggle.on::before { border-color: var(--cs-purple); background: var(--cs-purple); box-shadow: inset 0 0 0 2px #fff; }

.cs-anim > select { margin-top: .5rem; }
.cs-rec { width: 100%; margin-top: .5rem; border-color: #d62f4b; color: #b0213a; font-variant-numeric: tabular-nums; }
.cs-rec:hover,
.cs-rec:focus-visible,
.cs-rec.on { background: #d62f4b; color: #fff; }

/* ---------- the notes under the workshop ---------- */
.cs-notes { max-width: 60rem; margin: 1.2rem auto 0; }
.cs-notes summary { font-size: 1.1rem; font-weight: 800; color: var(--cs-purple); cursor: pointer; }
.cs-notes h2 { margin: 1rem 0 .3rem; font-size: 1.05rem; font-weight: 800; }
.cs-notes code { padding: 0 .3em; border-radius: 4px; background: #efe9dc; font-size: .92em; }

@media (max-width: 1150px) {
    .cs-app { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; }
    .cs-stage { grid-column: 1 / -1; grid-row: 1; height: 62dvh; min-height: 22rem; }
    .cs-panel { max-height: 32rem; }
}

@media (max-width: 700px) {
    .cs-app { grid-template-columns: minmax(0, 1fr); }
    .cs-stage { height: 56dvh; }
    .cs-panel { max-height: none; }
    .cs-views button { padding: .25rem .45rem; font-size: .74rem; }
}
