/* App typography is self-hosted NeverMind only. */

:root {
    --mot-purple: #6435c9;
    --mot-pink: #e03997;
    --mot-cyan: #00b5ad;
    --mot-gold: #fbbd08;
    --mot-dark: #1b1c1d;
}

#game-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--mot-dark);
    font-family: var(--fh, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    color: #fff;
    user-select: none;
    touch-action: none;
    z-index: 999999;
    box-sizing: border-box;
}

#game-wrapper *, #game-wrapper *::before, #game-wrapper *::after { box-sizing: border-box; }

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2d1b4d 0%, #1b1c1d 100%);
    overflow: hidden;
}

/* Top HUD */
.bh-top-bar {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 110;
    pointer-events: none;
}
.bh-info-card {
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    pointer-events: auto;
    color: #fff;
}
.bh-info-card--right { text-align: right; }
.bh-score-row { display: flex; align-items: baseline; gap: 0.5rem; }
.bh-label {
    color: #e2e8f0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
}
.bh-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mot-cyan);
}
.bh-multiplier-tag {
    font-size: 8px;
    background: var(--mot-gold);
    color: #0f172a;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-weight: 700;
    margin-top: 0.125rem;
    display: inline-block;
    animation: bh-pulse 1.5s infinite;
}
.bh-multiplier-tag.hidden { display: none !important; }

@keyframes bh-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.bh-health-container {
    width: 6rem;
    height: 0.5rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    margin-top: 0.25rem;
}
.bh-health-bar {
    height: 100%;
    background: var(--mot-pink);
    width: 100%;
    transition: width 0.3s, background-color 0.3s;
}
.bh-health-bar.is-ok { background: var(--mot-cyan); }
.bh-health-bar.is-warn { background: var(--mot-gold); }
.bh-health-bar.is-crit { background: var(--mot-pink); }

/* Screens */
#start-screen,
#game-over-screen,
#insights-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
#start-screen { z-index: 120; background: rgba(27, 28, 29, 0.95); backdrop-filter: blur(4px); }
#game-over-screen { z-index: 130; background: rgba(0, 0, 0, 0.95); backdrop-filter: blur(8px); }
#insights-modal { z-index: 140; background: rgba(27, 28, 29, 0.98); backdrop-filter: blur(12px); overflow-y: auto; padding: 2rem 1rem; }
#start-screen.hidden,
#game-over-screen.hidden,
#insights-modal.hidden { display: none !important; }

/* Back to Playground link (screens cover the global nav, so games need their own).
   In-flow inside the card so it never overflows the viewport on mobile/WP embeds. */
.bh-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    max-width: 100%;
    margin: 0.85rem auto 0;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}
.bh-home-btn:hover {
    background: rgba(15, 23, 42, 0.75);
    border-color: var(--mot-cyan);
    color: #fff;
}

.bh-card {
    max-width: 28rem;
    width: 100%;
    background: #2d1b4d;
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: #fff;
}
.bh-card--wide { max-width: 36rem; }
.bh-card--insights { border-color: rgba(0, 181, 173, 0.5); animation: bh-slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes bh-slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.bh-icon-frame {
    display: inline-block;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1rem;
}
.bh-icon-frame img {
    width: 5rem;
    height: 5rem;
    object-fit: contain;
    display: block;
}

.bh-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem;
    line-height: 1.1;
}
.bh-title--small { font-size: 1.875rem; margin-bottom: 0.5rem; }

.bh-byline {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}
.bh-byline-kicker {
    color: #e2e8f0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.bh-byline-name {
    color: #fff;
    font-weight: 800;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.titbits-link {
    color: var(--mot-gold);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: all 0.3s ease;
}
.titbits-link:hover {
    color: var(--mot-cyan);
    text-shadow: 0 0 8px rgba(0, 181, 173, 0.6);
}
.titbits-link--cyan { color: var(--mot-cyan); font-size: 0.75rem; }

.bh-rules-box {
    margin-bottom: 2rem;
    text-align: left;
    background: rgba(0, 0, 0, 0.4);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.bh-rule-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}
.bh-rule-row + .bh-rule-row { margin-top: 1rem; }
.bh-rule-row img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    flex-shrink: 0;
}

.bh-btn {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.2s;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    font-family: inherit;
}
.bh-btn:active { transform: scale(0.97); }
.bh-btn--primary {
    background: var(--mot-gold);
    color: #1b1c1d;
    box-shadow: 0 10px 15px -3px rgba(251, 189, 8, 0.25);
}
.bh-btn--primary:hover { filter: brightness(1.1); transform: scale(1.02); }
.bh-btn--white { background: #fff; color: #0f172a; }
.bh-btn--white:hover { background: #f1f5f9; }
.bh-btn--purple {
    background: var(--mot-purple);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
}
.bh-btn--purple:hover { background: #7b4ce0; }

.bh-version, .bh-card-footnote {
    font-size: 10px;
    color: #e2e8f0;
    font-style: italic;
    font-weight: 500;
    opacity: 0.9;
    margin: 1.5rem 0 0;
}
.bh-card-footnote--bold { font-weight: 700; font-style: italic; margin: 0; }

.bh-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.bh-game-over-kicker {
    color: #f9a8d4;
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 10px;
}
.bh-final-score {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2rem;
}

/* Insights modal */
.bh-insights-header { text-align: center; margin-bottom: 2rem; }
.bh-insights-divider {
    height: 0.25rem;
    width: 5rem;
    background: var(--mot-cyan);
    margin: 0 auto;
    border-radius: 999px;
}

.bh-insights-body {
    color: #e2e8f0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.bh-retro-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.bh-retro-title {
    color: var(--mot-cyan);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.15em;
    margin: 0 0 0.75rem;
}
.bh-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.bh-stat-cell {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.bh-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}
.bh-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #f1f5f9;
    font-weight: 700;
}
/* Visual insight tiles */
.bh-vi {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem;
}
.bh-vi-visual {
    flex-shrink: 0;
    width: 7.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bh-vi-text { flex: 1; min-width: 0; }
.bh-vi-text h5 {
    color: #fff;
    font-weight: 700;
    font-style: italic;
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}
.bh-vi-text p {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #cbd5e1;
    margin: 0;
}
.bh-vi-text b { color: #fff; }
.bh-vi-text i { color: var(--mot-cyan); font-style: italic; }

/* Insight 1 — coverage dot grid */
.bh-dotgrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    width: 100%;
}
.bh-dot {
    aspect-ratio: 1;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
}
.bh-dot.is-found {
    background: var(--mot-cyan);
    box-shadow: 0 0 8px rgba(0, 181, 173, 0.7);
}
.bh-dot--inf {
    background: transparent !important;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mot-gold);
    font-weight: 700;
    font-size: 0.85rem;
}

/* Insight 2 — depth trade-off meter */
.bh-tradeoff {
    display: flex;
    width: 100%;
    height: 2.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bh-trade-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
    line-height: 1.1;
}
.bh-trade-seg img { width: 1rem; height: 1rem; object-fit: contain; }
.bh-trade-seg--deep {
    flex: 0 0 38%;
    background: rgba(251, 189, 8, 0.25);
    color: var(--mot-gold);
    flex-direction: column;
    border-right: 2px dashed rgba(255, 255, 255, 0.25);
}
.bh-trade-seg--wide {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

/* Insight 3 — bug vs feature verdict */
.bh-verdict { display: flex; gap: 0.5rem; width: 100%; }
.bh-verdict-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 0.25rem;
    border-radius: 0.6rem;
    border: 1px solid transparent;
}
.bh-verdict-chip img { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.bh-verdict-chip.is-bug {
    background: rgba(224, 57, 151, 0.12);
    border-color: rgba(224, 57, 151, 0.4);
}
.bh-verdict-chip.is-feature {
    background: rgba(0, 181, 173, 0.12);
    border-color: rgba(0, 181, 173, 0.4);
}
.bh-verdict-tag {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #94a3b8;
}
.bh-verdict-mark {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.bh-verdict-mark--yes { color: var(--mot-pink); }
.bh-verdict-mark--no { color: var(--mot-cyan); }

@media (max-width: 420px) {
    .bh-vi { flex-direction: column; text-align: center; }
    .bh-vi-visual { width: 100%; max-width: 12rem; }
}

.bh-modal-footer {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.bh-modal-back {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: color 0.15s;
}
.bh-modal-back:hover {
    color: var(--mot-cyan);
    text-decoration: underline;
}
.bh-modal-credit {
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

/* Entities */
.entity {
    position: absolute;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 10px;
}
.entity img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(0,0,0,0.6));
}
.entity.emoji-fallback {
    font-size: 2.5rem;
    line-height: 1;
    min-width: 56px;
    min-height: 56px;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}
.entity:active { transform: scale(0.8); }

#production-line {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80px;
    background: rgba(224, 57, 151, 0.15);
    border-top: 4px dashed var(--mot-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mot-pink);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    pointer-events: none;
}

.particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}
.floating { animation: float 3s ease-in-out infinite; }

#scan-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 181, 173, 0.1);
    pointer-events: none;
    opacity: 0;
    z-index: 150;
    border: 0px solid var(--mot-cyan);
    transition: all 0.3s;
}
.scanning #scan-overlay {
    opacity: 1;
    border-width: 4px;
    animation: pulse-border 0.5s infinite;
}
.scanning-gold #scan-overlay { background: rgba(251, 189, 8, 0.1); border-color: var(--mot-gold); }
.scanning-red #scan-overlay { background: rgba(224, 57, 151, 0.2); border-color: var(--mot-pink); }
.scanning-blue #scan-overlay { background: rgba(0, 181, 173, 0.1); border-color: var(--mot-cyan); }

@keyframes pulse-border {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.bh-float-msg {
    position: absolute;
    pointer-events: none;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 200;
}
.bh-msg-cyan { color: var(--mot-cyan); }
.bh-msg-pink { color: var(--mot-pink); }
.bh-msg-gold { color: var(--mot-gold); }
