:root {
    --bit-size: 18px;
    --gap: 6px;
    --label-w: 46px
}

body {
    font-family: system-ui, Arial;
    margin: 18px
}

.container {
    max-width: 900px;
    margin: auto
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px
}

.controls input[type="text"] {
    min-width: 180px;
    padding: 6px
}

.controls select,
.controls input[type="range"],
.controls button {
    padding: 6px
}

.visual-root {
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 6px;
    background: #fafafa
}

.byte-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f2f2f2
}

.hex-label {
    width: var(--label-w);
    font-family: monospace;
    color: #111
}

.bit-cell {
    width: var(--bit-size);
    height: var(--bit-size);
    border-radius: 3px;
    border: 1px solid #d6e3f0;
    background: #e9f2ff;
    display: inline-block
}

.bit-cell.on {
    background: #2b6cb0
}

.byte-index {
    margin-left: 8px;
    color: #666;
    font-size: 13px
}

.timings {
    display: flex;
    gap: 12px
}

.timing {
    margin: 6px 0
}


/* === Navigation === */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #007bff;
    padding: 10px 20px;
    border-radius: 6px;
}

.nav-link {
    color: white;
    text-decoration: none;
    margin-right: 15px;
    font-weight: bold;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #ffeb3b;
}

.language-switcher .lang-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: 10px;
    transition: transform 0.2s;
}

.language-switcher .lang-btn:hover {
    transform: scale(1.2);
}


/* Container för visualisering */
.visual-root {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    min-height: 80px;
    font-family: monospace;
}

/* Varje rad (ett byte) */
.byte-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

/* Hex-värde till vänster */
.hex-label {
    width: 40px;
    text-align: right;
    margin-right: 8px;
    font-weight: bold;
    color: #333;
}

/* Bitceller */
.bit-cell {
    width: 16px;
    height: 16px;
    margin: 0 2px;
    border: 1px solid #ccc;
    background: #f0f0f0;
    border-radius: 2px;
    transition: background 0.2s;
}

.bit-cell.on {
    background: #4caf50;
    /* grön för '1' */
    border-color: #388e3c;
}

/* Index till höger */
.byte-index {
    margin-left: 8px;
    font-size: 0.85em;
    color: #666;
}

/* Felmeddelanden */
.visual-root em {
    color: #c62828;
    /* röd text */
    font-style: normal;
    font-weight: bold;
}

.byte-row {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.hex-label {
    font-family: monospace;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    margin-right: 6px;
    border-radius: 3px;
    min-width: 40px;
    text-align: center;
}

.bit-cell {
    width: 14px;
    height: 20px;
    border: 1px solid #ccc;
    margin: 0 1px;
    background: #f9f9f9;
}

.bit-cell.on {
    background: #4caf50;
}

.byte-index {
    margin-left: 8px;
    font-size: 0.8em;
    color: #666;
}


.byte-row {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.dec-label {
    font-family: monospace;
    background: #eee;
    color: #333;
    padding: 2px 6px;
    margin-right: 6px;
    border-radius: 3px;
    min-width: 40px;
    text-align: center;
}

.hex-label {
    font-family: monospace;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    margin-right: 6px;
    border-radius: 3px;
    min-width: 50px;
    text-align: center;
}

.bit-cell {
    width: 14px;
    height: 20px;
    border: 1px solid #ccc;
    margin: 0 1px;
    background: #f9f9f9;
}

.bit-cell.on {
    background: #4caf50;
}

.byte-index {
    margin-left: 8px;
    font-size: 0.8em;
    color: #666;
}

.visual-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 8px;
    text-align: left;
    color: #222;
    font-family: sans-serif;
}

.char-label {
    font-family: monospace;
    background: #ffd54f;
    color: #000;
    padding: 2px 6px;
    margin-right: 6px;
    border-radius: 3px;
    min-width: 20px;
    text-align: center;
}


.visual-desc {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 6px;
    font-family: sans-serif;
}

.header-row {
    display: flex;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px;
}

.header-row>div {
    margin-right: 6px;
    min-width: 40px;
    text-align: center;
}

.bit-header {
    flex: 1;
    text-align: center;
}