/* Daylight: the page is the sky, so the chrome sits on top of it in glass
   rather than in a panel of its own. */
:root {
    --sky: #8ec5e8;
    --ink: #f4f7fb;
    --muted: #cbd8e6;
    --line: rgba(255, 255, 255, 0.28);
    --panel: #1b2431;
    --gold: #ffcf6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    background: var(--sky); color: var(--ink);
    font-family: 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', system-ui, sans-serif;
    user-select: none; -webkit-user-select: none;
}

.shell { position: relative; height: 100%; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 5;
    display: flex; align-items: center; gap: 8px;
    padding: calc(env(safe-area-inset-top) + 8px) 10px 0;
}
.spacer { flex: 1; }
.icon-btn {
    min-width: 40px; height: 36px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 11px; background: rgba(20, 30, 44, 0.5);
    backdrop-filter: blur(4px);
    color: var(--ink); font-size: 16px; text-decoration: none; cursor: pointer;
    font-family: inherit;
}
.icon-btn-text { font-size: 12.5px; font-weight: 700; }
.icon-btn:active { background: rgba(20, 30, 44, 0.75); }

/* The crosshair. Difference blending so it reads on grass and on stone alike. */
.cross {
    position: absolute; left: 50%; top: 50%; width: 20px; height: 20px;
    margin: -10px 0 0 -10px; pointer-events: none; z-index: 4;
    mix-blend-mode: difference;
}
.cross::before, .cross::after {
    content: ''; position: absolute; background: #fff;
}
.cross::before { left: 9px; top: 2px; width: 2px; height: 16px; }
.cross::after { top: 9px; left: 2px; height: 2px; width: 16px; }

.stick {
    position: absolute; left: 18px; bottom: calc(env(safe-area-inset-bottom) + 86px);
    width: 108px; height: 108px; border-radius: 50%; z-index: 5;
    border: 1px solid var(--line); background: rgba(20, 30, 44, 0.28);
    backdrop-filter: blur(3px); touch-action: none;
}
.stick i {
    position: absolute; left: 50%; top: 50%; width: 46px; height: 46px;
    margin: -23px 0 0 -23px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.5); border: 1px solid var(--line);
}

.pad {
    position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 82px);
    z-index: 5; display: grid; gap: 9px;
    grid-template-columns: 62px 62px; grid-template-areas: '. place' 'dig jump';
}
.pad-btn {
    width: 62px; height: 62px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: rgba(20, 30, 44, 0.42);
    backdrop-filter: blur(3px); color: var(--ink); font: inherit; cursor: pointer;
}
.pad-btn i { font-size: 25px; font-style: normal; }
.pad-btn:active { background: rgba(255, 255, 255, 0.32); }
#placeBtn { grid-area: place; }
#jumpBtn { grid-area: jump; }
#digBtn { grid-area: dig; background: rgba(120, 40, 30, 0.42); }

.bar {
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 5;
    display: flex; gap: 4px; padding: 5px;
    border-radius: 12px; background: rgba(20, 30, 44, 0.45); backdrop-filter: blur(4px);
    max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none;
}
.bar::-webkit-scrollbar { display: none; }
.slot {
    flex: 0 0 auto; width: 40px; height: 40px; padding: 0;
    border: 2px solid transparent; border-radius: 8px; cursor: pointer;
    background: rgba(0, 0, 0, 0.2); overflow: hidden;
}
.slot canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.slot.is-on { border-color: var(--gold); background: rgba(255, 207, 107, 0.2); }

.overlay {
    position: fixed; inset: 0; display: none; z-index: 20;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(10, 18, 28, 0.86); backdrop-filter: blur(6px);
}
.overlay.is-open { display: flex; }
.panel {
    width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto;
    padding: 24px 22px; border-radius: 20px; text-align: center;
    background: radial-gradient(120% 80% at 50% 0%, rgba(142, 197, 232, 0.24), transparent 62%), var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.kicker { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.3em; color: var(--sky); }
.title {
    margin: 0 0 10px; font-size: 36px; font-weight: 900; letter-spacing: 0.12em;
    background: linear-gradient(180deg, #ffffff, var(--sky));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.subtitle { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.legend { text-align: left; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 14px; margin-top: 16px; }
.legend h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 0.14em; }
.legend-row { display: flex; gap: 12px; margin-bottom: 9px; font-size: 13px; line-height: 1.55; }
.legend-row b { flex: 0 0 22px; color: var(--sky); font-size: 15px; text-align: center; }
.legend-row span { color: var(--muted); }
.btn {
    display: block; width: 100%; margin-top: 9px; padding: 14px;
    border: 0; border-radius: 13px; font: inherit; font-size: 15px; font-weight: 700;
    letter-spacing: 0.08em; cursor: pointer;
}
.btn-primary { background: linear-gradient(180deg, #9fd2f2, #4a9ccc); color: #06222f; }
.btn-ghost { background: rgba(255, 255, 255, 0.1); color: var(--ink); }

@media (min-width: 820px) {
    .stick, .pad { display: none; }
}
