#polar-enc-lab {
    width: 800px;
    max-width: 800px;
    box-sizing: border-box;
    background: #05090f;
    color: #d7ebff;
    font-family: "Courier New", monospace;
    border: 1px solid #26364d;
    padding: 10px;
}

#polar-enc-lab * {
    box-sizing: border-box;
    font-family: "Courier New", monospace;
}

.pec-example-note {
    width: 800px;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #26364d;
    background: #f7fbff;
    padding: 8px 10px;
    margin: 8px 0;
}

.pec-example-note p {
    margin: 4px 0;
}

#polar-enc-lab button,
#polar-enc-lab select,
#polar-enc-lab input {
    background: #101a28;
    color: #ffffff;
    border: 1px solid #36506f;
    padding: 4px 8px;
    font-weight: bold;
}

#polar-enc-lab button {
    cursor: pointer;
}

#polar-enc-lab button:hover,
#polar-enc-lab select:hover,
#polar-enc-lab input:hover {
    border-color: #ffd166;
}

.pec-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    border: 1px solid #26364d;
    padding: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.pec-control-row {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr) 54px;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.pec-control-row.pec-wide {
    grid-column: 1 / span 2;
    grid-template-columns: 105px minmax(0, 1fr) 54px;
}

.pec-control-row.pec-animation {
    grid-column: 1 / span 2;
    grid-template-columns: 105px 110px 110px 90px 90px;
    justify-content: start;
}

.pec-value {
    color: #ffd166;
    white-space: nowrap;
}

.pec-tabs {
    display: flex;
    gap: 6px;
    margin: 8px 0 10px;
}

.pec-tab {
    border: 1px solid #26364d;
    padding: 7px 10px;
    color: #8fc7ff;
    background: #09111d;
}

.pec-tab.active {
    background: #ffd166;
    color: #000000;
    border-color: #ffd166;
}

.pec-note,
.pec-panel {
    border: 1px solid #26364d;
    background: #07101a;
    padding: 10px;
    margin-bottom: 10px;
}

.pec-panel h3 {
    margin: 0 0 8px;
    color: #9bd3ff;
    font-size: 14px;
}

.pec-formula {
    border: 1px solid #36506f;
    background: #02060b;
    padding: 9px;
    line-height: 1.55;
    font-size: 12px;
}

.pec-highlight {
    color: #ffd166;
}

.pec-ok {
    color: #66f2a5;
}

.pec-warn {
    color: #ff8aa0;
}

.pec-vector {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 4px;
}

.pec-cell {
    min-height: 34px;
    border: 1px solid #36506f;
    background: #101a28;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}

.pec-cell .idx {
    color: #8fc7ff;
    font-size: 9px;
}

.pec-cell .val {
    font-size: 14px;
    font-weight: bold;
}

.pec-cell.info {
    border-color: #66f2a5;
    background: #06351f;
}

.pec-cell.pc {
    border-color: #ffd166;
    background: #4b3b05;
}

.pec-cell.frozen {
    border-color: #415268;
    background: #0b121d;
    color: #a9c7e8;
}

.pec-cell.active {
    outline: 2px solid #ff6b8a;
    outline-offset: 1px;
}

.pec-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    color: #a9c7e8;
}

.pec-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid #36506f;
    vertical-align: -2px;
    margin-right: 4px;
}

.pec-swatch.info { background: #06351f; border-color: #66f2a5; }
.pec-swatch.pc { background: #4b3b05; border-color: #ffd166; }
.pec-swatch.frozen { background: #0b121d; border-color: #415268; }

.pec-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 1px solid #26364d;
    background: #02060b;
    scrollbar-color: #6f88a8 #07101a;
    scrollbar-width: thin;
}

.pec-master-wrap {
    max-height: 360px;
}

.pec-table-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.pec-table-wrap::-webkit-scrollbar-track {
    background: #07101a;
    border-left: 1px solid #26364d;
}

.pec-table-wrap::-webkit-scrollbar-thumb {
    background: #36506f;
    border: 2px solid #07101a;
}

.pec-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #ffd166;
}

.pec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.pec-table th,
.pec-table td {
    border: 1px solid #26364d;
    padding: 4px 5px;
    text-align: right;
    color: #d7ebff;
}

.pec-table th {
    position: sticky;
    top: 0;
    background: #101a28;
    color: #9bd3ff;
    z-index: 1;
}

.pec-table tr.active td {
    background: #4b3b05;
}

.pec-table td.info {
    color: #66f2a5;
    font-weight: bold;
}

.pec-table td.pc {
    color: #ffd166;
    font-weight: bold;
}

.pec-table td.frozen {
    color: #8da5bf;
}

.pec-table td.master-use {
    color: #66f2a5;
    font-weight: bold;
}

.pec-table td.master-skip {
    color: #8da5bf;
}

.pec-table td.master-active {
    background: #4b1425;
    color: #ffffff;
}

.pec-master-table th:nth-child(3n+1),
.pec-master-table td:nth-child(3n+1) {
    background: rgba(143, 199, 255, 0.06);
}

.pec-master-table th {
    position: static;
}

#pecCanvas {
    display: block;
    width: 100%;
    height: 240px;
    border: 1px solid #26364d;
    background: #02060b;
}

.pec-summary {
    display: grid;
    gap: 6px;
}

.pec-summary div {
    border: 1px solid #26364d;
    background: #02060b;
    padding: 7px;
    line-height: 1.45;
}
