body { font-family: 'Quicksand', sans-serif; }

:root {
    --bob-bg: #f0f4f8;
    --bob-slate: #334155;
    --bob-green: #10b981;
    --bob-gold: #c5a059;
    --bob-violet: #8b5cf6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body.bob-body {
    margin: 0;
    padding: 0;
    background: var(--bob-bg);
    height: 100dvh;
    overflow: hidden;
    width: 100vw;
}
body.bob-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}
.game-nav {
    width: 100vw !important;
    max-width: 100vw !important;
    align-self: stretch !important;
    flex-shrink: 0;
}
/* the shared header pill for bug reports would cover the play area: menu-only reporter is used */
#beta-report-trigger { display: none !important; }

.bob-app {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: min(640px, 100vw);
    display: flex;
    flex-direction: column;
    padding: 6px 10px 8px;
    gap: 6px;
}

/* ---- HUD ---- */
.bob-hud {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 16px;
    padding: 6px 12px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}
.bob-hud-l { min-width: 0; }
.bob-score {
    font-size: 1.55rem; font-weight: 700; color: var(--bob-slate); line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.bob-best {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 1.2px; color: var(--bob-gold); text-transform: uppercase;
}
.bob-hud-c { text-align: center; }
.bob-wave { font-size: 0.8rem; font-weight: 700; letter-spacing: 2px; color: var(--bob-green); }
.bob-chip {
    display: inline-block; margin-top: 2px; padding: 1px 9px; border-radius: 999px;
    background: #fef3c7; color: #b45309; font-size: 0.66rem; font-weight: 700; letter-spacing: 1px;
}
.bob-tag {
    display: inline-block; margin-top: 2px; padding: 1px 9px; border-radius: 999px;
    background: #ede9fe; color: #6d28d9; font-size: 0.66rem; font-weight: 700; letter-spacing: 1px;
}
.bob-hud-r { display: flex; justify-content: flex-end; gap: 6px; }
.bob-ibtn {
    width: 38px; height: 38px; border-radius: 12px; border: none; cursor: pointer;
    background: #f1f5f9; color: var(--bob-slate); font-size: 1.05rem; font-weight: 700; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.1s;
}
.bob-ibtn:hover { background: #e2e8f0; }
.bob-ibtn:active { transform: scale(0.94); }
.bob-ibtn:focus-visible, .bob-btn:focus-visible, .bob-seg button:focus-visible, .bob-tog:focus-visible {
    outline: 3px solid var(--bob-violet); outline-offset: 2px;
}

/* ---- Stage ---- */
.bob-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bobCanvas {
    display: block;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
}

/* ---- Overlays (pause / options / fallback game over) ---- */
.bob-ov {
    position: absolute; inset: 0; z-index: 20;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    overflow-y: auto; padding: 10px;
    background: rgba(15, 23, 42, 0.62);
    border-radius: 20px;
    -webkit-overflow-scrolling: touch;
}
.bob-ov > :first-child { margin-top: auto; }
.bob-ov > :last-child { margin-bottom: auto; }
.bob-panel {
    width: min(360px, 100%);
    background: #fff; border-radius: 20px; padding: 16px 16px 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}
.bob-panel h2 { margin: 0 0 10px; font-size: 1.25rem; color: var(--bob-slate); text-align: center; }
.bob-panel .big { font-size: 2.4rem; font-weight: 700; text-align: center; color: var(--bob-slate); margin: 4px 0 2px; }
.bob-panel .sub { text-align: center; color: #64748b; font-size: 0.85rem; margin-bottom: 10px; }
.bob-btn {
    display: block; width: 100%; margin-top: 8px; padding: 11px 14px; border: none; border-radius: 14px;
    background: var(--bob-slate); color: #fff; font-family: inherit; font-weight: 700; font-size: 0.95rem;
    letter-spacing: 0.5px; cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.bob-btn:hover { background: #1e293b; }
.bob-btn:active { transform: scale(0.98); }
.bob-btn.primary { background: var(--bob-green); }
.bob-btn.primary:hover { background: #059669; }
.bob-btn.ghost { background: #f1f5f9; color: var(--bob-slate); }
.bob-btn.ghost:hover { background: #e2e8f0; }

.bob-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9; color: var(--bob-slate); font-weight: 700; font-size: 0.9rem;
}
.bob-row.dim { opacity: 0.45; }
.bob-row small { display: block; font-weight: 600; color: #94a3b8; font-size: 0.7rem; }
.bob-seg { display: inline-flex; background: #f1f5f9; border-radius: 12px; padding: 3px; flex-shrink: 0; }
.bob-seg button {
    border: none; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.8rem; color: #64748b;
}
.bob-seg button.on { background: var(--bob-slate); color: #fff; }
.bob-tog, .bob-mini {
    border: none; border-radius: 10px; padding: 6px 14px; min-width: 62px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.8rem; background: #e2e8f0; color: #64748b;
}
.bob-tog.on { background: var(--bob-green); color: #fff; }
.bob-mini { background: #ede9fe; color: #6d28d9; }
#trophy-list { max-height: 44vh; overflow-y: auto; margin-top: 4px; -webkit-overflow-scrolling: touch; }
#trophy-list:empty { display: none; }

/* ---- Toast ---- */
.bob-toast {
    position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: rgba(15, 23, 42, 0.9); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 700;
    font-size: 0.85rem; z-index: 30; transition: opacity 0.2s, transform 0.2s; white-space: nowrap;
}
.bob-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Compact layouts ---- */
@media (max-height: 640px) {
    .bob-app { padding: 4px 8px 6px; gap: 4px; }
    .bob-hud { padding: 4px 10px; }
    .bob-score { font-size: 1.25rem; }
    .bob-ibtn { width: 34px; height: 34px; }
}
@media (max-width: 360px) {
    .bob-ibtn { width: 32px; height: 32px; font-size: 0.95rem; }
    .bob-hud-r { gap: 4px; }
}
@media (max-height: 420px) and (orientation: landscape) {
    .bob-hud { padding: 3px 10px; }
    .bob-score { font-size: 1.1rem; }
    .bob-best { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .bob-toast, .bob-btn, .bob-ibtn { transition: none; }
}