.cat-page {
    min-height: 100vh;
    margin: 0;
    color: #2a2a2d;
    background: #f4efe4;
    font-family: "Segoe UI", sans-serif;
}

.cat-shell {
    width: min(100vw - 24px, 1180px);
    max-width: none;
    margin: 0 auto;
    padding: 18px 0 28px;
}

.cat-game {
    position: relative;
    overflow: hidden;
    border: 1px solid #d7cab7;
    border-radius: 8px;
    background: #9ed7ed;
    box-shadow: 0 14px 32px rgba(57, 44, 30, 0.18);
}

#cat-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    touch-action: none;
}

.cat-hud {
    position: absolute;
    inset: 10px 12px auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    pointer-events: none;
}

.hud-metric,
.hud-gauge {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 8px;
    background: rgba(255, 252, 238, 0.82);
    box-shadow: 0 6px 16px rgba(72, 48, 28, 0.14);
}

.hud-metric span,
.hud-gauge span {
    display: block;
    color: #6c5b4b;
    font-size: 0.78rem;
    line-height: 1.1;
}

.hud-metric strong {
    display: block;
    overflow: hidden;
    font-size: clamp(1rem, 2.2vw, 1.6rem);
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-gauge meter {
    width: 100%;
    height: 14px;
}

.cat-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(88%, 520px);
    transform: translate(-50%, -50%);
    border: 1px solid rgba(96, 70, 42, 0.24);
    border-radius: 8px;
    background: rgba(255, 250, 235, 0.92);
    box-shadow: 0 16px 40px rgba(41, 31, 22, 0.25);
    text-align: center;
}

.title-panel {
    padding: 28px 20px 24px;
}

.title-panel h1 {
    margin: 0;
    color: #242428;
    font-size: clamp(2.1rem, 7vw, 4.5rem);
    letter-spacing: 0;
}

.title-panel p,
.message-panel p {
    margin: 8px 0 20px;
    color: #5c4d3e;
}

.message-panel {
    padding: 22px 18px;
}

.title-actions,
.record-actions,
.cat-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.cat-controls {
    margin: 14px 0;
}

.cat-button {
    min-height: 38px;
    border: 1px solid #b8a58e;
    border-radius: 7px;
    padding: 8px 13px;
    color: #30261f;
    background: #fffaf0;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.cat-button:hover {
    background: #fff3d7;
}

.cat-button.primary {
    color: #fffaf0;
    background: #386641;
    border-color: #386641;
}

.cat-button.danger {
    color: #fffaf0;
    background: #9b3d2f;
    border-color: #9b3d2f;
}

.link-button,
.file-button {
    display: inline-flex;
    align-items: center;
}

.file-button input {
    display: none;
}

.cat-panels {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.cat-panel {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d7cab7;
    border-radius: 8px;
    background: #fffaf0;
}

.cat-panel h2 {
    margin: 0 0 10px;
    color: #403429;
    font-size: 1rem;
}

.cat-panel label {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
    color: #5c4d3e;
    font-size: 0.9rem;
}

.cat-panel select {
    min-height: 34px;
    border: 1px solid #cdbda7;
    border-radius: 6px;
    padding: 4px 8px;
    background: #fff;
}

.cat-panel ul,
.cat-panel dl {
    margin: 0;
    padding: 0;
}

.cat-panel li {
    margin-left: 1.2rem;
}

.cat-panel dt {
    color: #6c5b4b;
    font-size: 0.82rem;
}

.cat-panel dd {
    margin: 0 0 6px;
    font-weight: 700;
}

.save-status {
    min-height: 1.2em;
    margin: 8px 0 0;
    color: #6c5b4b;
    font-size: 0.88rem;
}

@media (max-width: 900px) {
    .cat-hud {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cat-panels {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .cat-shell {
        width: min(100vw - 12px, 1180px);
        padding-top: 8px;
    }

    .cat-hud {
        inset: 6px;
        gap: 5px;
    }

    .hud-metric,
    .hud-gauge {
        padding: 5px 7px;
    }

    .cat-panels {
        grid-template-columns: 1fr;
    }
}
