:root {
    --bg-color: #eef2f7;
    --main-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --primary-text: #333;
    --secondary-text: #777;
    --accent-color: #007bff;
    --glow-color: #ffc107;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-color);
    color: var(--primary-text);
    margin: 0;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-text);
}

.app-container {
    max-width: 1000px;
    margin: auto;
    background: var(--main-color);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    padding: 2rem;
}

/* Made the decoder smaller */
.visual-decoder-container {
    position: relative;
    width: 100%;
    height: 350px; /* Reduced height */
    margin-bottom: 2.5rem;
    border-radius: 15px;
    background: #f8f9fa;
    box-shadow: inset 0 2px 4px var(--shadow-color);
    display: flex;
    justify-content: center;
}

/* Interactive Start Node */
#start-node-container {
    position: absolute;
    top: 20px;
    width: 60px;
    height: 60px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

#start-node-container:hover {
    transform: scale(1.05);
}

.play-icon, .stop-icon {
    width: 24px;
    height: 24px;
    fill: white;
}

.stop-icon { display: none; } /* Hidden by default */

.node {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--main-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: all 0.2s ease-in-out;
    z-index: 2;
}

.line {
    position: absolute;
    background-color: #ccc;
    z-index: 1;
    transition: background-color 0.2s ease;
}

.node.active, #start-node-container.active {
    background: var(--glow-color);
    color: black;
    box-shadow: 0 0 25px var(--glow-color);
}

.line.active {
    background-color: var(--glow-color);
}

.io-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .io-section { grid-template-columns: 1fr 1fr; }
}

.io-group h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-text);
}

textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 120px;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    font-family: monospace;
    font-size: 1rem;
    transition: box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.3);
}

.output-box {
    width: 100%;
    box-sizing: border-box;
    min-height: 120px;
    padding: 15px;
    margin-top: 1rem;
    border-radius: 10px;
    background: #f8f9fa;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-text);
    word-wrap: break-word;
    border: 1px solid #ddd;
}