body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 1.25rem;
    background: #f0f0f0;
    color: #333;
}

.container {
    max-width: 50rem;
    margin: 0 auto;
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
}

header {
    margin: 0 0 1.5rem 0;
    border-bottom: 1px solid #eee;
}

h1 {
    margin: 0 0 1rem 0;
}

section {
    margin: 0 0 1.5rem 0;
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
}

h2 {
    margin: 0 0 1rem 0;
}

.controls, .settings {
    margin: 0 0 1rem 0;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

input[type="text"], button {
    font: inherit;
}

input[type="text"] {
    flex-grow: 1;
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
}

button {
    padding: 0.5em 1em;
    cursor: pointer;
    background: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 0.25rem;
}

button:hover {
    background: #0056b3;
    border-color: #0056b3;
}

button:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* Chapter 1 Specific: Transmitter */
#transmitter-display {
    width: 100%;
    height: 10rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 0.25rem;
    margin: 1rem 0 0 0;
}

.display-off {
    background-color: black;
    color: white;
}

.display-on {
    background-color: white;
    color: black;
}

/* Chapter 1 Specific: Receiver */
.video-container {
    position: relative;
    width: 100%;
    max-width: 30rem;
    background: #000;
    margin: 0 0 0.75rem 0;
    overflow: hidden;
    border-radius: 0.25rem;
}

video {
    width: 100%;
    display: block;
}

#processing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.overlay-info {
    position: absolute;
    top: 0.625rem;
    left: 0.625rem;
    color: #0f0;
    background: rgba(0,0,0,0.5);
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    border-radius: 0.25rem;
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.625rem;
    box-sizing: border-box;
    color: white;
    pointer-events: none;
}

#decoded-text {
    font-family: monospace;
    font-weight: bold;
    min-height: 1.2em;
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.2;
    text-shadow: 0 0 0.3rem black;
}

#debug-signal {
    font-family: monospace;
    color: #ccc;
    margin: 0.25rem 0 0 0;
    min-height: 1.2em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.graph-container {
    width: 100%;
    height: 6rem;
    background: #222;
    border: 1px solid #555;
    border-radius: 0.25rem;
}

#signal-graph {
    width: 100%;
    height: 100%;
}