/* =========================================================
   Cat Screen Toy — styles/misc-cat-toy.css
   Matches Jubaroo .ms-tool-page shell + modern-tools.css
   ========================================================= */

body.ms-cat-toy .cat-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 355px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-top: 0.5rem;
}

@media (max-width: 1020px) {
    body.ms-cat-toy .cat-workspace {
        grid-template-columns: 1fr;
    }
}

/* ── Control Deck ────────────────────────────────────────── */
body.ms-cat-toy .cat-controls {
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius);
    padding: 1.15rem;
    box-shadow: var(--ms-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

body.ms-cat-toy .cat-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ms-dim);
    margin: 0 0 0.55rem;
}

/* Prey Type Cards */
body.ms-cat-toy .prey-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

@media (max-width: 1020px) and (min-width: 640px) {
    body.ms-cat-toy .prey-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

body.ms-cat-toy .prey-card {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--ms-border);
    background: rgba(255, 255, 255, 0.025);
    color: var(--ms-text);
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.15s ease;
}

body.ms-cat-toy .prey-card:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.07);
}

body.ms-cat-toy .prey-card.is-active {
    border-color: var(--ms-blue);
    background: rgba(59, 130, 246, 0.14);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

body.ms-cat-toy .prey-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--ms-sky);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.ms-cat-toy .prey-card.is-active .prey-icon {
    background: var(--ms-blue);
    border-color: var(--ms-blue);
    color: #ffffff;
}

body.ms-cat-toy .prey-icon svg {
    width: 22px;
    height: 22px;
}

body.ms-cat-toy .prey-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

body.ms-cat-toy .prey-name {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--ms-text);
    line-height: 1.2;
}

body.ms-cat-toy .prey-desc {
    font-size: 0.78rem;
    color: var(--ms-muted);
    line-height: 1.3;
}

/* Sliders */
body.ms-cat-toy .cat-sliders {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

body.ms-cat-toy .slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
}

body.ms-cat-toy .slider-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--ms-text);
}

body.ms-cat-toy .slider-val {
    font-family: var(--ms-mono);
    font-size: 0.78rem;
    color: var(--ms-sky);
    background: rgba(59, 130, 246, 0.12);
    padding: 0.14rem 0.48rem;
    border-radius: 6px;
}

body.ms-cat-toy input[type="range"].cat-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    outline: none;
    cursor: pointer;
}

body.ms-cat-toy input[type="range"].cat-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ms-blue);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.14s ease;
}

body.ms-cat-toy input[type="range"].cat-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

body.ms-cat-toy input[type="range"].cat-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ms-blue);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

/* Surface Swatches & Tap Behavior */
body.ms-cat-toy .surface-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
}

body.ms-cat-toy .surface-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.46rem 0.55rem;
    border-radius: 9px;
    border: 1px solid var(--ms-border);
    background: rgba(255, 255, 255, 0.025);
    color: var(--ms-muted);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.16s, color 0.16s, background-color 0.16s;
}

body.ms-cat-toy .surface-btn:hover {
    color: var(--ms-text);
    border-color: rgba(59, 130, 246, 0.42);
}

body.ms-cat-toy .surface-btn.is-active {
    color: var(--ms-text);
    border-color: var(--ms-blue);
    background: rgba(59, 130, 246, 0.14);
}

body.ms-cat-toy .surface-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.45);
    flex-shrink: 0;
}

body.ms-cat-toy .segmented-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

body.ms-cat-toy .seg-btn {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.48rem 0.45rem;
    border-radius: 9px;
    border: 1px solid var(--ms-border);
    background: rgba(255, 255, 255, 0.025);
    color: var(--ms-muted);
    font-size: 0.77rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s, color 0.16s, background-color 0.16s;
}

body.ms-cat-toy .seg-btn:hover {
    color: var(--ms-text);
    border-color: rgba(59, 130, 246, 0.4);
}

body.ms-cat-toy .seg-btn.is-active {
    color: #ffffff;
    background: var(--ms-blue);
    border-color: var(--ms-blue);
}

/* Toggle Rows */
body.ms-cat-toy .toggle-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

body.ms-cat-toy .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.52rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--ms-border);
    cursor: pointer;
}

body.ms-cat-toy .toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

body.ms-cat-toy .toggle-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--ms-text);
}

body.ms-cat-toy .toggle-sub {
    font-size: 0.73rem;
    color: var(--ms-muted);
}

body.ms-cat-toy .cat-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

body.ms-cat-toy .cat-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

body.ms-cat-toy .cat-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
    transition: background-color 0.18s ease;
}

body.ms-cat-toy .cat-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.18s ease;
}

body.ms-cat-toy .cat-switch input:checked + .cat-switch-track {
    background: var(--ms-blue);
}

body.ms-cat-toy .cat-switch input:checked + .cat-switch-track::after {
    transform: translateX(18px);
}

/* Action Buttons */
body.ms-cat-toy .cat-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

body.ms-cat-toy .cat-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

body.ms-cat-toy .cat-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--ms-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ms-text);
    transition: background-color 0.16s, border-color 0.16s, transform 0.12s;
}

body.ms-cat-toy .cat-btn:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.45);
}

body.ms-cat-toy .cat-btn:active {
    transform: translateY(1px);
}

body.ms-cat-toy .cat-btn.is-primary {
    background: var(--ms-blue);
    border-color: var(--ms-blue);
    color: #ffffff;
}

body.ms-cat-toy .cat-btn.is-primary:hover {
    background: var(--ms-blue-deep);
    border-color: var(--ms-blue-deep);
}

body.ms-cat-toy .cat-btn svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* ── Stage Container & Canvas ────────────────────────────── */
body.ms-cat-toy .cat-stage-col {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

body.ms-cat-toy .cat-stage-wrap {
    position: relative;
    width: 100%;
    height: clamp(420px, 64vh, 690px);
    border-radius: var(--ms-radius);
    border: 1px solid var(--ms-border);
    overflow: hidden;
    box-shadow: var(--ms-shadow);
    background: #faf6ee;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body.ms-cat-toy .cat-stage-wrap:fullscreen,
body.ms-cat-toy .cat-stage-wrap:-webkit-full-screen,
body.ms-cat-toy .cat-stage-wrap.is-pseudo-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 99999 !important;
}

body.ms-cat-toy #cat-stage-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Stage Floating HUD */
body.ms-cat-toy .stage-hud-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    pointer-events: none;
    z-index: 4;
}

body.ms-cat-toy .stage-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.74);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    pointer-events: auto;
}

body.ms-cat-toy .stage-stats .stat-sep {
    opacity: 0.35;
}

body.ms-cat-toy .stage-stats .stat-num {
    font-family: var(--ms-mono);
    color: #93c5fd;
}

body.ms-cat-toy .stage-hud-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    pointer-events: auto;
}

body.ms-cat-toy .hud-pill-btn {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.42rem 0.78rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.16s, border-color 0.16s;
}

body.ms-cat-toy .hud-pill-btn:hover {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(147, 197, 253, 0.55);
}

body.ms-cat-toy .hud-pill-btn svg {
    width: 15px;
    height: 15px;
    position: relative;
    z-index: 2;
}

body.ms-cat-toy .hud-pill-btn span {
    position: relative;
    z-index: 2;
}

body.ms-cat-toy .hud-hold-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: rgba(239, 68, 68, 0.72);
    z-index: 1;
    pointer-events: none;
}

/* Quick Fullscreen Hint Banner */
body.ms-cat-toy .fs-toast {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    padding: 0.48rem 0.95rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.79rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 4;
    white-space: nowrap;
}

body.ms-cat-toy .fs-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tips Strip Below Stage */
body.ms-cat-toy .cat-tips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 720px) {
    body.ms-cat-toy .cat-tips {
        grid-template-columns: 1fr;
    }
}

body.ms-cat-toy .cat-tip-card {
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: 12px;
    padding: 0.8rem 0.95rem;
}

body.ms-cat-toy .cat-tip-card h3 {
    margin: 0 0 0.25rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--ms-text);
}

body.ms-cat-toy .cat-tip-card p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--ms-muted);
    line-height: 1.45;
}

/* ── Light Theme Adjustments ─────────────────────────────── */
[data-theme="light"] body.ms-cat-toy .cat-controls,
[data-theme="light"] body.ms-cat-toy .cat-tip-card {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(37, 99, 235, 0.18);
}

[data-theme="light"] body.ms-cat-toy .prey-card,
[data-theme="light"] body.ms-cat-toy .surface-btn,
[data-theme="light"] body.ms-cat-toy .seg-btn,
[data-theme="light"] body.ms-cat-toy .toggle-row,
[data-theme="light"] body.ms-cat-toy .cat-btn:not(.is-primary) {
    background: #f8fafc;
    border-color: rgba(37, 99, 235, 0.18);
    color: #0f172a;
}

[data-theme="light"] body.ms-cat-toy .prey-card.is-active {
    background: rgba(37, 99, 235, 0.1);
    border-color: #2563eb;
}

[data-theme="light"] body.ms-cat-toy .seg-btn.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

[data-theme="light"] body.ms-cat-toy .prey-name,
[data-theme="light"] body.ms-cat-toy .slider-head,
[data-theme="light"] body.ms-cat-toy .toggle-title,
[data-theme="light"] body.ms-cat-toy .cat-tip-card h3 {
    color: #0f172a;
}

[data-theme="light"] body.ms-cat-toy .prey-desc,
[data-theme="light"] body.ms-cat-toy .toggle-sub,
[data-theme="light"] body.ms-cat-toy .surface-btn,
[data-theme="light"] body.ms-cat-toy .seg-btn,
[data-theme="light"] body.ms-cat-toy .cat-tip-card p {
    color: #475569;
}

[data-theme="light"] body.ms-cat-toy .surface-btn.is-active {
    color: #0f172a;
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
}
