:root {
    --bg: #0f2e40;
    --pcb-green: #1a3a3a;
    --gold: #ffd700;
    --dot-clr: #00ff88;
    --dash-clr: #ff4444;

    --accent: #235e6e;
    --sheet-border: 2px solid #000;
    --clr-chiaro: #84c1c6;
    --clr-medio: #235e6e;
    --clr-scuro: #0f2e40;
    --clr-scurissimo: rgb(10, 28, 39);
}

/* base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    touch-action: manipulation;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
    background: var(--bg);
    color: #eeeeee;
    padding: 8px;
    display: flex;
    justify-content: center;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
}

.app {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-touch-callout: none;
}



.audio-debug {
    margin-top: 12px;
    padding: 6px 10px;

    background: #000;
    color: #00ff88;

    font-family: monospace;
    font-size: 12px;

    border-radius: 6px;

    text-align: center;

    opacity: 0.8;
}



/* header */
.app__header {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.app__title {
    font-size: 1.3rem;
    margin: 0
}

.back-button {
    color: var(--clr-chiaro);
    text-decoration: none;
}

.status {
    color: var(--clr-chiaro);
    font-size: 0.95rem
}

.morse-svg {
    width: 100%;
    background: #050b10;
    border: 2px solid #1a262f;
    border-radius: 12px;
}

.node {
    fill: var(--pcb-green);
    stroke: #4a6a6a;
    stroke-width: 2;
    transition: 0.2s;
}

.link {
    stroke: #1a262f;
    stroke-width: 4;
    stroke-linecap: round;
}

.node-label {
    fill: #fff;
    font-size: 16px;
    font-weight: 900;
    text-shadow: 0 0 4px #000;
    pointer-events: none;
}

.active-dot {
    fill: var(--dot-clr) !important;
    filter: drop-shadow(0 0 8px var(--dot-clr));
    stroke: #fff;
}

.active-dash {
    fill: var(--dash-clr) !important;
    filter: drop-shadow(0 0 8px var(--dash-clr));
    stroke: #fff;
}

.morse-display {
    background: #000;
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    text-align: center;
    min-height: 41px;
}

#decodedText {
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 2px;
    font-weight: bold;
}

.speed-control {
    width: 100%;
    text-align: center;
    color: var(--clr-chiaro);
}

.slider-wrapper {
    padding: 0 25px;
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 18px;
    font-size: 12px;
    /* margin-top: 5px; */
}

#speedSlider {
    width: 100%;
    height: 24px;
    -webkit-appearance: none;
    background: transparent;
}

/* TRACK */
#speedSlider::-webkit-slider-runnable-track {
    height: 10px;
    background: #1a262f;
    border-radius: 10px;
}

/* THUMB */
#speedSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--clr-chiaro);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -1px;
}

/* FIREFOX */
#speedSlider::-moz-range-track {
    height: 10px;
    background: #1a262f;
    border-radius: 10px;
}

#speedSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--gold);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Stili bottoni */
.controls {
    display: flex;
    gap: 30px;
    align-items: center;
    padding: 6px;
    justify-content: space-between;
}

#morseSequence {
    height: 21px;
    text-align: center;
    color: var(--dot-clr);
    letter-spacing: 5px;
    /* border: 1px solid var(--clr-chiaro); */
    padding-left: 5px;
}

#audioToggle {
    height: 35px;
    width: 110px;
    background: transparent;
    border: 1px solid var(--clr-chiaro);
    padding: 8px 10px;
    border-radius: 8px;
}

.submit-button {
    width: 150px;
    height: 100px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 50px;
    text-align: center;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight: none;
    -webkit-tap-highlight-color: transparent;
}

.submit-button.active {
    transform: translateY(1px);
}

.restart-button {
    width: 110px;
    height: 35px;
    background: transparent;
    color: var(--clr-chiaro);
    border: 1px solid var(--clr-chiaro);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer
}

/* piccole regole per schermi stretti */
@media (max-width:490px) {
    .app__header {
        padding: 0 10px;
    }

    .restart-button {
        height: 50px;
    }

    #audioToggle {
        height: 50px;
    }
}