/* ---------------------------------------------------------
   MOBILE-FIRST BASE
--------------------------------------------------------- */
body {
    background: #02030a;
    color: #b8ffe5;
    font-family: "Fira Code", monospace;
    margin: 0;
    padding: 10px;
    text-align: center;
}

/* Prevent accidental pinch-zoom */
html, body {
    touch-action: manipulation;
}

/* Title */
.title {
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: 0.08em;
    margin: 10px 0 20px 0;
    color: #9af0e7;
}

/* ---------------------------------------------------------
   MAIN LAYOUT
--------------------------------------------------------- */
#calibration-ui {
    margin-top: 10px;
}

/* ----------------------------------------
   ASCII LATTICE — MOBILE OPTIMIZED
----------------------------------------- */
#lattice-wrapper {
    display: block;
    margin: 0 auto;
    padding: 8px;
    background: #030512;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,255,200,0.15);
    max-width: 100vw;
    overflow-x: auto;  /* mobile scroll */
    overflow-y: hidden;
}

/* Default lattice size (desktop-ish) */
#lattice {
    white-space: pre;
    font-size: 14px;
    line-height: 14px;
    display: inline-block;
}

/* MOBILE — enlarge lattice for readability */
@media (max-width: 700px) {
    #lattice {
        font-size: 20px;        /* ← big & readable */
        line-height: 20px;
        letter-spacing: 0px;
    }
}

/* DESKTOP — keep it crisp */
@media (min-width: 1000px) {
    #lattice {
        font-size: 15px;
        line-height: 15px;
    }
}

/* ---------------------------------------------------------
   STATS + LOG
--------------------------------------------------------- */
#stats {
    margin-top: 10px;
    font-size: 1rem;
}

#log {
    margin-top: 10px;
    height: 90px;
    overflow-y: auto;
    font-size: 0.85rem;
    padding: 5px;
}

/* ---------------------------------------------------------
   STABILITY BAR
--------------------------------------------------------- */
#stability-container {
    width: 90%;
    margin: 12px auto 0 auto;
    background: #111;
    border-radius: 6px;
    height: 14px;
}

#stability-bar {
    height: 100%;
    background: linear-gradient(90deg, #0ff, #a0ffe0);
    border-radius: 6px;
    transition: width 0.25s ease;
}

/* ---------------------------------------------------------
   MOBILE DIRECTIONAL PAD
--------------------------------------------------------- */
/* Perfectly aligned responsive D-pad */
#mobile-controls.dpad {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(3, 70px);
    justify-content: center;
    gap: 10px;
}

/* Mobile buttons */
.mobile-btn {
    width: 70px;
    height: 70px;
    background: #04121a;
    border: 1px solid #1dfab2;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Fix SVG scaling */
.mobile-btn svg {
    width: 30px;
    height: 30px;
    display: block;
}

/* Active effect */
.mobile-btn:active {
    background: #0a2633;
}

@media (max-width: 400px) {
    #mobile-controls.dpad {
        grid-template-columns: repeat(3, 55px);
    }
    .mobile-btn {
        width: 55px;
        height: 55px;
    }
    .mobile-btn svg {
        width: 24px;
        height: 24px;
    }
}


/* ---------------------------------------------------------
   RESULT SCREEN
--------------------------------------------------------- */
#result-screen {
    margin-top: 20px;
    padding: 12px;
}

#sigil {
    font-size: 14px;
    line-height: 14px;
    white-space: pre;
}

/* Desktop sigil enlargement */
@media (min-width: 700px) {
    #sigil {
        font-size: 18px;
        line-height: 18px;
    }
}

/* ---------------------------------------------------------
   BUTTONS
--------------------------------------------------------- */
button {
    margin: 10px;
    background: #0c1921;
    color: #b8ffe5;
    border: 1px solid #1dfab2;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

button:hover {
    background: #113039;
}

button:active {
    background: #1e4d5d;
}

/* ---------------------------------------------------------
   EFFECTS
--------------------------------------------------------- */
#lattice-wrapper.glitch-hit {
    transform: translateX(4px) translateY(-2px);
    box-shadow: 0 0 30px rgba(255,40,40,0.7);
}

#lattice-wrapper.fragment-gain {
    background: radial-gradient(circle at center, #1dfab2 0%, #030512 70%);
}

/* ---------------------------------------------------------
   RECENT SIGNALS
--------------------------------------------------------- */
#recent-signals ul {
    list-style: none;
    padding: 0;
    margin: 10px;
    font-size: 0.9rem;
}

/* Utility */
.hidden {
    display: none !important;
}

