#content_sim #ldpc-tanner-lab,
#content_sim #ldpc-tanner-lab * {
    box-sizing: border-box;
    font-family: "Courier New", Courier, monospace;
}

#content_sim #ldpc-tanner-lab {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 12px;
    color: #e8f1ff;
    background: #05070b;
    border: 1px solid #263244;
}

#content_sim #ldpc-tanner-lab .tg-panel {
    border: 1px solid #243044;
    background: #0b1018;
    margin-bottom: 10px;
    padding: 10px;
}

#content_sim #ldpc-tanner-lab .tg-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
}

#content_sim #ldpc-tanner-lab .tg-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}

#content_sim #ldpc-tanner-lab label {
    min-width: 118px;
    color: #a9c3e8;
    font-size: 12px;
}

#content_sim #ldpc-tanner-lab select,
#content_sim #ldpc-tanner-lab input[type="range"],
#content_sim #ldpc-tanner-lab input[type="number"],
#content_sim #ldpc-tanner-lab button {
    font-family: "Courier New", Courier, monospace;
}

#content_sim #ldpc-tanner-lab select,
#content_sim #ldpc-tanner-lab input[type="number"] {
    flex: 1;
    min-width: 0;
    color: #eef7ff;
    background: #121a25;
    border: 1px solid #33465f;
    padding: 4px 6px;
}

#content_sim #ldpc-tanner-lab input[type="range"] {
    flex: 1;
    min-width: 80px;
}

#content_sim #ldpc-tanner-lab .tg-value {
    width: 46px;
    text-align: right;
    color: #ffd166;
    font-size: 12px;
}

#content_sim #ldpc-tanner-lab .tg-btn {
    border: 1px solid #3d5878;
    color: #f4fbff;
    background: #16243a;
    padding: 5px 8px;
    cursor: pointer;
    min-height: 28px;
}

#content_sim #ldpc-tanner-lab .tg-btn:hover,
#content_sim #ldpc-tanner-lab .tg-btn.active {
    background: #25527a;
    border-color: #5fa8d3;
}

#content_sim #ldpc-tanner-lab .tg-stage {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 10px;
    align-items: stretch;
}

#content_sim #ldpc-tanner-lab .tg-subtitle {
    color: #9fbee8;
    font-size: 13px;
    margin: 0 0 7px 0;
}

#content_sim #ldpc-tanner-lab .tg-matrix {
    display: grid;
    gap: 3px;
    width: max-content;
}

#content_sim #ldpc-tanner-lab #tgMatrix {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

#content_sim #ldpc-tanner-lab .tg-cell {
    width: 24px;
    height: 24px;
    border: 1px solid #28364b;
    background: #111923;
    color: #68788f;
    text-align: center;
    line-height: 22px;
    font-size: 12px;
    cursor: pointer;
}

#content_sim #ldpc-tanner-lab .tg-cell.one {
    background: #1b4d6b;
    color: #ffffff;
    border-color: #63c7ff;
}

#content_sim #ldpc-tanner-lab .tg-cell.header {
    background: #0b1018;
    color: #a9c3e8;
    cursor: default;
}

#content_sim #ldpc-tanner-lab .tg-cell.hot {
    outline: 2px solid #ffd166;
}

#content_sim #ldpc-tanner-lab .tg-svg-wrap {
    position: relative;
    min-height: 510px;
    height: 100%;
    border: 1px solid #263244;
    background: #05080d;
    overflow: hidden;
}

#content_sim #ldpc-tanner-lab svg {
    display: block;
    width: 100%;
    height: 510px;
}

#content_sim #ldpc-tanner-lab .tg-edge {
    stroke: #456079;
    stroke-width: 2;
    opacity: 0.75;
    cursor: pointer;
}

#content_sim #ldpc-tanner-lab .tg-edge.active {
    stroke: #ffd166;
    stroke-width: 4;
    opacity: 1;
}

#content_sim #ldpc-tanner-lab .tg-edge.bad {
    stroke: #ef476f;
}

#content_sim #ldpc-tanner-lab .tg-node {
    cursor: pointer;
}

#content_sim #ldpc-tanner-lab .tg-var circle {
    fill: #16324d;
    stroke: #6dd3ff;
    stroke-width: 2;
}

#content_sim #ldpc-tanner-lab .tg-var.decoded0 circle {
    fill: #0f3d2e;
    stroke: #6ee7a8;
}

#content_sim #ldpc-tanner-lab .tg-var.decoded1 circle {
    fill: #4a2631;
    stroke: #ff7a9b;
}

#content_sim #ldpc-tanner-lab .tg-check rect {
    fill: #22283a;
    stroke: #a8b2ff;
    stroke-width: 2;
}

#content_sim #ldpc-tanner-lab .tg-check.pass rect {
    fill: #173326;
    stroke: #6ee7a8;
}

#content_sim #ldpc-tanner-lab .tg-check.fail rect {
    fill: #44202b;
    stroke: #ef476f;
}

#content_sim #ldpc-tanner-lab .tg-node text,
#content_sim #ldpc-tanner-lab .tg-edge-label {
    fill: #edf6ff;
    font-size: 12px;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

#content_sim #ldpc-tanner-lab .tg-edge-label {
    fill: #ffd166;
    font-size: 11px;
}

#content_sim #ldpc-tanner-lab .tg-edge-label.active {
    fill: #05070b;
    font-size: 14px;
    font-weight: bold;
}

#content_sim #ldpc-tanner-lab .tg-edge-label-bg {
    fill: #ffd166;
    stroke: #ffffff;
    stroke-width: 1;
}

#content_sim #ldpc-tanner-lab .tg-status {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

#content_sim #ldpc-tanner-lab .tg-readout {
    border: 1px solid #263244;
    background: #070b10;
    padding: 8px;
    min-height: 62px;
}

#content_sim #ldpc-tanner-lab .tg-readout b {
    color: #ffd166;
}

#content_sim #ldpc-tanner-lab .tg-bit-row,
#content_sim #ldpc-tanner-lab .tg-step-strip {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

#content_sim #ldpc-tanner-lab .tg-bit-row {
    align-items: stretch;
}

#content_sim #ldpc-tanner-lab .tg-bit-entry {
    display: grid;
    grid-template-columns: 52px 1fr 54px;
    gap: 4px;
    align-items: center;
    width: 100%;
}

#content_sim #ldpc-tanner-lab .tg-bit {
    min-width: 52px;
    min-height: 28px;
    border: 1px solid #3d5878;
    background: #101827;
    color: #f4fbff;
    cursor: pointer;
}

#content_sim #ldpc-tanner-lab .tg-bit.one {
    background: #4a2631;
    border-color: #ff7a9b;
}

#content_sim #ldpc-tanner-lab .tg-llr-input {
    width: 54px;
    min-height: 28px;
    color: #ffd166;
    background: #0a111a;
    border: 1px solid #3d5878;
    padding: 3px 4px;
    font-size: 12px;
}

#content_sim #ldpc-tanner-lab .tg-llr-slider {
    width: 100%;
    min-width: 74px;
}

#content_sim #ldpc-tanner-lab .tg-step-pill {
    border: 1px solid #263244;
    color: #89a7cd;
    padding: 4px 6px;
    font-size: 12px;
}

#content_sim #ldpc-tanner-lab .tg-step-pill.active {
    color: #05070b;
    background: #ffd166;
    border-color: #ffd166;
}

#content_sim #ldpc-tanner-lab .tg-step-description {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #263244;
    background: #070b10;
    color: #c7d8ee;
    font-size: 12px;
    line-height: 1.45;
}

#content_sim #ldpc-tanner-lab .tg-step-description b {
    color: #ffd166;
}

#content_sim #ldpc-tanner-lab .tg-step-description code {
    color: #9ee6ff;
}

#content_sim #ldpc-tanner-lab .tg-log {
    max-height: 110px;
    overflow: auto;
    color: #bfcee1;
    font-size: 12px;
    line-height: 1.45;
}

#content_sim #ldpc-tanner-lab .tg-help {
    color: #b8c7dc;
    line-height: 1.45;
    font-size: 12px;
}

@media (max-width: 760px) {
    #content_sim #ldpc-tanner-lab .tg-controls,
    #content_sim #ldpc-tanner-lab .tg-stage,
    #content_sim #ldpc-tanner-lab .tg-status {
        grid-template-columns: 1fr;
    }
}
