* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    background: #14100e;
    color: #f3ece1;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    gap: 10px;
}

.topbar {
    width: min(960px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #cbbba6;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #f5dfb8;
    letter-spacing: 0.4px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-btn {
    background: #2b221d;
    color: #f3ece1;
    border: 1px solid #4d3b31;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.pill-btn:hover {
    background: #3d3029;
    border-color: #7c5e4d;
}

.stage-wrap {
    position: relative;
    width: min(960px, 100%, calc((100vh - 110px) * 16 / 9));
    aspect-ratio: 16 / 9;
    background: #181412;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65), 0 0 0 2px #36271f;
}

canvas#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
}

.touch-controls {
    width: min(960px, 100%);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px;
}

.touch-controls.visible {
    display: flex;
}

.touch-group {
    display: flex;
    gap: 10px;
}

.touch-btn {
    min-width: 64px;
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    border: 2px solid #594134;
    background: #2b211c;
    color: #f7ebda;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    touch-action: none;
}

.touch-btn:active,
.touch-btn.active {
    background: #c92a2a;
    border-color: #ff8787;
}

.footer-hint {
    font-size: 12px;
    color: #9e8e7b;
    text-align: center;
}

@media (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
    .footer-hint {
        display: none;
    }
}
