:root {
    --bg-color: #030f08;
    --primary-color: #2fe36f;
    --accent-color: #5efcbf;
    --paw-color: rgba(3, 60, 30, 0.9);
    --text-color: #d8ffe6;
    --menu-shadow: rgba(55, 224, 146, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Open Sans', Arial, sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(47, 227, 111, 0.25), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(94, 252, 191, 0.2), transparent 35%),
        var(--bg-color);
    color: var(--text-color);
}

button {
    font-family: inherit;
}

.app {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.app.is-active {
    opacity: 1;
    pointer-events: auto;
}

.app__header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 1.5rem 0.5rem;
}

.control-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.btn-round {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #2fe36f, #1eba53);
    color: #011d0c;
    box-shadow: 0 8px 20px rgba(46, 227, 111, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-round--small {
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.btn-round[aria-pressed="true"] {
    background: #2ecc71;
}

.btn-round:active {
    transform: translateY(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status-indicators {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-dot {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: #bbb;
    color: #fff;
}

.status-dot--online { background: #4caf50; }
.status-dot--offline { background: #d9534f; }

.app-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(420px, 1fr) minmax(220px, 260px);
    gap: 1.5rem;
    padding: 0 1.5rem 2rem;
    align-items: stretch;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.side-panel--right {
    align-items: stretch;
}

.cat-stage {
    min-height: 560px;
    border-radius: 32px;
    background: radial-gradient(circle at 30% 20%, rgba(94, 252, 191, 0.25), transparent 45%),
        radial-gradient(circle at 80% 40%, rgba(47, 227, 111, 0.25), transparent 55%),
        linear-gradient(135deg, #050f07, #05160c);
    position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.35);
    overflow: hidden;
    padding-top: 2rem;
}

.cat-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -54%);
    width: 420px;
    height: 460px;
    perspective: 800px;
}

.speech-bubble {
    position: fixed;
    bottom: 100px;
    left: 50%;
    width: min(320px, 80vw);
    min-height: 90px;
    padding: 1.25rem;
    background: rgba(1, 29, 12, 0.8);
    border: 3px solid rgba(47, 227, 111, 0.7);
    border-radius: 65% 65% 40% 40%;
    box-shadow: 0 18px 30px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translate3d(-50%, -120px, 0);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.4, 0.8, 0.3, 1.2);
    z-index: 500;
}

.speech-bubble::before,
.speech-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: inherit;
    border: 3px solid #b27c3f;
    border-bottom: none;
    border-radius: 70% 70% 25% 25%;
}

.speech-bubble::before {
    top: -38px;
    width: 170px;
    height: 70px;
}

.speech-bubble::after {
    top: -70px;
    width: 120px;
    height: 55px;
}

.speech-bubble.is-visible {
    opacity: 1;
    transform: translate3d(-50%, 5px, 0);
}

.log-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 260px;
    max-width: calc(100vw - 32px);
    background: rgba(1, 23, 12, 0.9);
    border-radius: 18px;
    border: 1px solid rgba(47, 227, 111, 0.35);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    padding: 0.75rem;
    color: #d8ffe6;
    font-size: 0.75rem;
    line-height: 1.4;
    pointer-events: none;
    z-index: 600;
}

.log-bubble.is-highlight {
    background: rgba(34, 34, 34, 0.95);
    border-color: #6ef0b8;
}

.log-bubble__title {
    font-weight: 600;
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
}

.log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.log-list li {
    display: block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0.75;
}

.log-bubble button {
    pointer-events: auto;
    width: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 12px;
    margin-top: 0.5rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
}

.hierarchy-panel {
    background: rgba(4, 22, 12, 0.92);
    border: 1px solid rgba(47, 227, 111, 0.2);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 280px;
}

.paw-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.state-panel {
    background: rgba(4, 22, 12, 0.92);
    border: 1px solid rgba(47, 227, 111, 0.2);
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.35);
    height: 100%;
}

.state-panel__buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.state-btn {
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    background: rgba(8, 35, 18, 0.9);
    color: #d8ffe6;
    box-shadow: 0 8px 18px rgba(0,0,0,0.3);
    border: 1px solid rgba(47, 227, 111, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.state-btn:active {
    transform: translateY(2px);
}

.state-panel__actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

@media (max-width: 960px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .side-panel {
        flex-direction: column;
    }

    .cat-stage {
        order: -1;
    }

    .cat-wrapper {
        transform: translate(-50%, -50%);
    }

    .speech-bubble {
        position: static;
        margin: 1rem auto 0;
        display: block;
        transform: none;
    }
}
