/* BSV Highway — 3D night-city transaction visualizer */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #05070d;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    color: #c9d6ee;
    -webkit-font-smoothing: antialiased;
}

#gl {
    position: fixed;
    inset: 0;
    display: block;
    touch-action: none;
    cursor: grab;
}
#gl.dragging { cursor: grabbing; }
#gl.veh-hover { cursor: pointer; }

/* ---------- HUD panels ---------- */

.panel {
    background: rgba(7, 11, 22, 0.82);
    border: 1px solid rgba(120, 160, 255, 0.22);
    border-radius: 6px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.hud {
    position: fixed;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    z-index: 10;
    user-select: none;
}

#hud-stats { top: 16px; left: 16px; min-width: 230px; }
#hud-legend { top: 16px; right: 16px; }
#hud-feed { bottom: 16px; left: 16px; width: 270px; }
#hud-hint {
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-title {
    color: #9feaf9;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(80, 200, 255, 0.45);
}
.hud-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.hud-subtitle {
    color: #8fa7d9;
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.badge {
    font-size: 10px;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 3px;
    background: #1b2b1e;
    color: #57e88d;
    border: 1px solid #2c5436;
}
.badge.offline { background: #2b1b1b; color: #e85757; border-color: #543030; }
.badge.demo    { background: #2b261b; color: #e8c557; border-color: #544a30; }
.badge.paused  { background: #26262b; color: #b0b6d9; border-color: #3e3e54; }

.stat-table { border-collapse: collapse; width: 100%; }
.stat-table td { padding: 0 0 1px 0; white-space: nowrap; }
.stat-table td:first-child { color: #7d90bb; padding-right: 18px; }
.stat-table td:last-child { text-align: right; color: #dde8ff; }

.hud-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: #7d90bb;
    text-decoration: none;
}
.hud-link:hover { color: #9feaf9; }

/* ---------- legend ---------- */

.legend-table { border-collapse: collapse; }
.legend-table td { padding: 0 0 1px 0; white-space: nowrap; font-size: 12px; }
.legend-table td.lg-veh { color: #dde8ff; padding-right: 16px; }
.legend-table td.lg-what { color: #7d90bb; text-align: left; }
.lg-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: baseline;
}

/* ---------- feed ---------- */

#feed { max-height: 196px; overflow: hidden; }
.feed-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 1px 2px;
    cursor: pointer;
    border-radius: 3px;
    white-space: nowrap;
}
.feed-row:hover { background: rgba(120, 160, 255, 0.10); }
.feed-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.feed-cat { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.feed-size { color: #7d90bb; flex: 0 0 auto; }
.feed-row.feed-block { color: #ffd97a; }

/* ---------- hint / pause ---------- */

.hint-text { color: #7d90bb; font-size: 12px; }
#pause-btn, #frog-btn {
    font-family: inherit;
    font-size: 12px;
    color: #c9d6ee;
    background: rgba(120, 160, 255, 0.12);
    border: 1px solid rgba(120, 160, 255, 0.3);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
}
#pause-btn:hover, #frog-btn:hover { background: rgba(120, 160, 255, 0.22); }
#frog-btn.on {
    background: rgba(126, 231, 135, 0.22);
    border-color: rgba(126, 231, 135, 0.6);
    color: #d8ffd8;
}

/* ---------- frog mode ---------- */

#hud-frog {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 16px;
}
#hud-frog.on { display: flex; }
.frog-title {
    color: #7ee787;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(110, 230, 130, 0.5);
}
.frog-stat { color: #7d90bb; font-size: 12px; }
.frog-stat b { color: #dde8ff; font-weight: normal; }

#frog-banner {
    position: fixed;
    display: none;
    left: 50%;
    top: 36%;
    transform: translate(-50%, -50%);
    z-index: 30;
    font-size: clamp(22px, 4vw, 38px);
    font-weight: bold;
    letter-spacing: 2px;
    color: #ffd97a;
    text-shadow: 0 0 18px rgba(255, 200, 80, 0.7), 0 2px 6px #000;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

/* touch d-pad: shown only in frog mode on touch devices */
#frog-dpad {
    position: fixed;
    right: 18px;
    bottom: 86px;
    z-index: 15;
    display: none;
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(3, 58px);
    gap: 6px;
}
#frog-dpad.on { display: grid; }
.dpad-btn {
    font-family: inherit;
    font-size: 20px;
    color: #c9d6ee;
    background: rgba(7, 11, 22, 0.72);
    border: 1px solid rgba(120, 160, 255, 0.35);
    border-radius: 10px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
.dpad-btn:active {
    background: rgba(126, 231, 135, 0.3);
    border-color: #7ee787;
    color: #d8ffd8;
}
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* ---------- tooltip + detail ---------- */

#tooltip {
    position: fixed;
    display: none;
    z-index: 20;
    padding: 8px 11px;
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
    max-width: 320px;
}

#detail {
    position: fixed;
    display: none;
    z-index: 25;
    left: 50%;
    bottom: 70px;
    transform: translateX(-50%);
    width: min(440px, calc(100vw - 32px));
    padding: 13px 15px;
    font-size: 12.5px;
    line-height: 1.55;
}
#detail-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: #7d90bb;
    font-size: 14px;
    cursor: pointer;
}
#detail-close:hover { color: #fff; }

.d-cat { font-weight: bold; font-size: 13px; }
.d-class { color: #7d90bb; }
.d-row { color: #a9b8d9; }
.d-row b { color: #dde8ff; font-weight: normal; }
.d-preview {
    margin-top: 5px;
    color: #cfe0c9;
    word-break: break-word;
    max-height: 72px;
    overflow: hidden;
}
.d-links { margin-top: 6px; }
.d-links a { color: #9feaf9; text-decoration: none; margin-right: 14px; }
.d-links a:hover { text-decoration: underline; }
#detail img.d-media {
    display: block;
    margin-top: 8px;
    max-width: 100%;
    max-height: 160px;
    border-radius: 4px;
}

/* ---------- fatal ---------- */

#fatal {
    position: fixed;
    display: none;
    z-index: 50;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    padding: 20px 26px;
    font-size: 14px;
    color: #e8c557;
    text-align: center;
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
    #hud-legend, #hud-feed { display: none; }
    #hud-stats { min-width: 0; padding: 9px 11px; font-size: 12px; }
    #hud-hint { padding: 8px 10px; }
    .hint-text { display: none; }
    #detail { bottom: 60px; }
    /* legend is hidden, so the frog score moves to the free top-right; the
       stats panel makes way while the game is on */
    #hud-frog { left: auto; right: 16px; transform: none; padding: 8px 11px; gap: 10px; font-size: 12px; }
    body.frog-on #hud-stats { display: none; }
}
