/* Frosted glass modern theme */
:root {
    /* Panel */
    --panel-bg: rgba(15, 15, 25, 0.88);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-border-inner: rgba(255, 255, 255, 0.05);

    /* Text */
    --text-primary: #e8e0d4;
    --text-secondary: #a89b8c;
    --text-title: #e8a23a;
    --text-dim: #6b6058;

    /* Buttons */
    --btn-bg: rgba(255, 255, 255, 0.06);
    --btn-hover: rgba(255, 255, 255, 0.12);
    --btn-active: rgba(232, 162, 58, 0.25);
    --btn-disabled: rgba(255, 255, 255, 0.03);
    --btn-text: #e8e0d4;
    --btn-text-disabled: #5a5248;

    /* Bars */
    --bar-bg: rgba(0, 0, 0, 0.5);
    --bar-hp: #e04040;
    --bar-hunger: #c97030;
    --bar-stamina: #e8a23a;
    --bar-progress: #e8a23a;
    --bar-progress-bg: rgba(0, 0, 0, 0.6);

    /* Slots */
    --slot-bg: rgba(255, 255, 255, 0.04);
    --slot-border: rgba(255, 255, 255, 0.08);
    --slot-hover: rgba(232, 162, 58, 0.15);

    /* Layout */
    --panel-w: 680px;
    --panel-gap: 16px;
    --panel-margin: 16px;
    --panel-radius: 12px;
    --hud-height: 48px;
    --slot-size: 72px;
    --font-main: system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Z layers */
    --z-hud: 100;
    --z-panel: 200;
    --z-backdrop: 150;
    --z-overlay: 50;
}

/* Responsive: tablet */
@media (min-width: 601px) and (max-width: 1024px) {
    :root {
        --panel-w: min(680px, 90vw);
        --slot-size: 68px;
    }
}

/* Responsive: mobile */
@media (max-width: 600px) {
    :root {
        --panel-w: 100vw;
        --panel-radius: 16px 16px 0 0;
        --hud-height: 48px;
        --slot-size: 60px;
    }
}

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

body {
    overflow: hidden;
    background: #1a1a2e;
    font-family: var(--font-main);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

#game-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    cursor: pointer;
    touch-action: manipulation;
}

/* Shared panel styling */
.panel {
    position: fixed;
    width: var(--panel-w);
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: var(--z-panel);
    display: none;
    flex-direction: column;
}

.panel.visible {
    display: flex;
}

.panel-title {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-title);
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--panel-border-inner);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.panel-body::-webkit-scrollbar {
    width: 6px;
}

.panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Buttons */
.btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--btn-hover);
}

.btn:active:not(:disabled) {
    background: var(--btn-active);
    transform: scale(0.97);
}

.btn:disabled {
    background: var(--btn-disabled);
    color: var(--btn-text-disabled);
    cursor: default;
}

/* Primary action button (Craft, Place, Build, Add) */
.btn-primary {
    background: rgba(232, 162, 58, 0.2);
    border-color: rgba(232, 162, 58, 0.4);
    color: var(--text-title);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(232, 162, 58, 0.35);
}

.btn-primary:disabled {
    background: rgba(232, 162, 58, 0.06);
    border-color: rgba(232, 162, 58, 0.1);
    color: var(--btn-text-disabled);
}

/* Progress bar */
.progress-bar {
    position: relative;
    height: 22px;
    background: var(--bar-progress-bg);
    border: 1px solid var(--panel-border);
    border-radius: 11px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%), var(--bar-progress);
    transition: width 0.1s linear;
    border-radius: 11px;
}

.progress-bar .label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Panel backdrop overlay (mobile bottom sheets) */
.panel-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--z-backdrop);
}

.panel-backdrop.visible {
    display: block;
}

/* Bottom sheet styles (mobile) */
@media (max-width: 600px) {
    .panel.bottom-sheet {
        position: fixed;
        bottom: var(--hud-height);
        left: 0;
        right: 0;
        top: auto;
        width: 100vw;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
    }

    .panel.bottom-sheet.visible {
        display: flex;
        transform: translateY(0);
    }

    .panel.bottom-sheet.dragging {
        transition: none;
    }

    .drag-handle {
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        margin: 8px auto 0;
        flex-shrink: 0;
    }

    .btn {
        padding: 10px 16px;
        min-height: 44px;
    }
}

@media (min-width: 601px) {
    .drag-handle {
        display: none;
    }
}
