:root {
    --bg: #f7e6c9;
    --ui: #2f71ff;
    --ink: #3b2a1d;
    --panel: #ffffffee;
    --shadow: #00000020;
}

/* Base */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD */
.hud {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    pointer-events: auto;
}

.hud-left {
    display: flex;
    gap: 12px;
}

.hud-right {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* Bottom-left controls */
#hud-bottom-left {
    position: absolute;
    bottom: 18px;
    left: 18px;
    display: flex;
    gap: 12px;
    z-index: 30;
}

#btn-talk.hidden {
    display: none;
}

/* anchor this cluster bottom-right */
#hud-bottom-right {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 30;
}

/* wrapper relative so slots can be placed over bar */
.inv-wrap {
    position: relative;
    display: inline-block;
}

/* make the bar image larger */
#inventoryBar {
    display: block;
    width: 400px;
    /* increase size here */
    height: auto;
    /* keeps aspect ratio */
}

/* slots row sits on top of the bar */
#slotContainer {
    position: absolute;
    top: 50%;
    /* adjust until centered vertically */
    left: 20px;
    /* adjust so it aligns with bar */
    display: flex;
    gap: 8px;
    transform: translateY(-50%);
    /* center vertically */
}

/* each slot image */
.slot {
    width: 256px;
    height: 48px;
    border: 2px solid var(--ink);
    border-radius: 6px;
    background: white;
    box-shadow: 0 2px 6px var(--shadow);
    opacity: 0.1;
}

/* bag overlaps on right side */
#bagButton {
    position: absolute;
    right: -20px;
    /* adjust overlap */
    bottom: -10px;
    width: 96px;
    /* make bag bigger */
    height: 96px;
    cursor: pointer;
}

/* HUD overlays the canvas inside #game-container */
#hud-top {
    position: absolute;
    inset: 0;
    /* fill the container */
    z-index: 20;
    pointer-events: none;
    /* let clicks pass through by default */
}

/* Top groups */
#hud-top .hud-topleft,
#hud-top .hud-topright {
    position: absolute;
    top: clamp(8px, 1.2vw, 16px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 14px);
    pointer-events: auto;
    /* these children can receive clicks later */
}

#hud-top .hud-topleft {
    left: clamp(10px, 1.2vw, 18px);
}

#hud-top .hud-topright {
    right: clamp(10px, 1.2vw, 18px);
}

.hud-home {
    height: clamp(36px, 3.4vw, 48px);
    width: clamp(36px, 3.4vw, 48px);
}

.arrow {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 16px;
    font-size: 28px;
    background: var(--panel);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 6px 18px var(--shadow), inset 0 -4px 0 #e6e6e6;
}

.arrow:active {
    transform: translateY(2px);
}

.pill {
    height: 48px;
    min-width: 120px;
    padding: 0 16px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: var(--ui);
    color: white;
    font-weight: 700;
    box-shadow: 0 6px 18px var(--shadow);
}

.pill.small {
    height: 36px;
    min-width: 80px;
    font-size: 14px;
}

/* Dialog */
.dialog {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 105px;
    width: min(820px, calc(100% - 32px));
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 10px 24px var(--shadow);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
}

.dialog.hidden {
    display: none;
}

.dialog-name {
    grid-column: 1 / -1;
    font-weight: 800;
    color: #8b5a2b;
    letter-spacing: .3px;
}

.dialog-text {
    min-height: 48px;
    white-space: pre-wrap;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .arrow {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .pill {
        height: 44px;
        min-width: 110px;
    }
}