/* =========================================
   ISYARATKU - MODE PENGUJIAN
   Hanya dimuat bersama praktik.html?uji=1
   ========================================= */

/* Tabel 26 kolom tidak boleh melebarkan kolom kamera;
   tabel di-scroll di dalam panel. */
.test-mode .camera-section {
    min-width: 0;
}

.test-panel {
    min-width: 0;
    max-width: 100%;
    margin-top: 18px;
    padding: 20px;
    background: var(--color-surface);
    border: 2px solid var(--color-accent);
    border-radius: 18px;
    color: var(--color-navy);
    font-family: var(--font-sans);
}

.test-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.test-eyebrow {
    color: var(--color-warning);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.test-head h3 {
    margin: 2px 0 0;
    font-size: 16px;
}

.test-progress {
    padding: 4px 10px;
    background: var(--color-warning-bg);
    border-radius: 999px;
    color: var(--color-warning);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* Form */

.test-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.test-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 600;
}

.test-form select,
.test-form input {
    min-width: 0;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    background: white;
    color: var(--color-navy);
    font: inherit;
    font-size: 14px;
}

.test-form :disabled {
    background: var(--color-surface-muted);
}

.test-scenario-info {
    margin: 8px 0 14px;
    color: var(--color-muted);
    font-size: 12px;
}

/* Tahap percobaan */

.test-stage {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    transition: background 0.2s, border-color 0.2s;
}

.test-stage[data-phase="prep"] {
    background: var(--color-warning-bg);
    border-color: var(--color-pending);
}

.test-stage[data-phase="recording"] {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
}

.test-target {
    display: grid;
    place-items: center;
    flex: none;
    width: 64px;
    height: 64px;
    background: var(--color-navy);
    border-radius: 14px;
    color: white;
    font-size: 36px;
    font-weight: 800;
}

.test-stage-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.test-stage-copy strong {
    font-size: 15px;
}

.test-stage-copy span {
    color: var(--color-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.test-stage[data-phase="recording"] .test-stage-copy strong::before {
    content: "● ";
    color: var(--color-danger);
}

/* Mode otomatis */

.test-auto {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-top: 12px;
}

.test-auto .primary-button {
    min-height: 42px;
    min-width: 170px;
}

.test-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-navy);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.test-keys {
    color: var(--color-muted);
    font-size: 12px;
}

.test-keys kbd {
    padding: 1px 6px;
    border: 1px solid var(--color-border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: white;
    color: var(--color-navy);
    font: 600 11px var(--font-sans);
}

/* Hitung mundur besar di atas video kamera */

.test-overlay {
    position: absolute;
    top: 52px;
    left: 50%;
    z-index: 5;
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
        "label label"
        "letter count"
        "hint hint";
    align-items: center;
    column-gap: 18px;
    padding: 10px 22px 12px;
    transform: translateX(-50%);
    border: 3px solid transparent;
    border-radius: 20px;
    background: rgba(16, 36, 43, 0.82);
    color: white;
    font-family: var(--font-sans);
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

.test-overlay[hidden] {
    display: none;
}

.ov-label {
    grid-area: label;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ov-letter {
    grid-area: letter;
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
}

.ov-count {
    grid-area: count;
    min-width: 1ch;
    font-size: 72px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ov-count:empty {
    display: none;
}

.ov-hint {
    grid-area: hint;
    margin-top: 2px;
    color: #DCE9E6;
    font-size: 13px;
}

.ov-hint:empty {
    display: none;
}

.test-overlay[data-view="prep"] {
    border-color: var(--color-accent);
}

.test-overlay[data-view="prep"] .ov-count,
.test-overlay[data-view="prep"] .ov-label {
    color: var(--color-accent);
}

.test-overlay[data-view="recording"] {
    border-color: #F04438;
}

.test-overlay[data-view="recording"] .ov-label,
.test-overlay[data-view="recording"] .ov-count {
    color: #FF8A80;
}

.test-overlay[data-view="ok"] {
    border-color: #32D583;
    background: rgba(8, 60, 36, 0.86);
}

.test-overlay[data-view="bad"] {
    border-color: #F04438;
    background: rgba(90, 16, 12, 0.86);
}

.test-overlay[data-view="paused"] {
    border-color: #98A2B3;
}

@media (max-width: 700px) {
    .test-overlay {
        top: 44px;
        padding: 6px 14px 8px;
    }

    .ov-letter { font-size: 42px; }
    .ov-count { font-size: 48px; }
}

/* Tombol */

.test-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.test-actions button {
    min-height: 38px;
}

/* display dari .secondary-button mengalahkan atribut hidden */
.test-panel [hidden] {
    display: none !important;
}

.test-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.danger-button {
    min-height: 38px;
    padding: 0 18px;
    border: 1px solid var(--color-danger-border);
    border-radius: 25px;
    background: white;
    color: var(--color-danger);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.danger-button:hover {
    background: var(--color-danger-bg);
}

.test-notice {
    min-height: 1em;
    margin: 8px 0 0;
    color: var(--color-warning);
    font-size: 13px;
    font-weight: 600;
}

.test-notice:empty {
    display: none;
}

/* Hasil terakhir */

.test-last {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.test-last[data-result="ok"] {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.test-last[data-result="bad"] {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.test-last span {
    color: var(--color-navy);
    font-size: 12px;
}

/* Grid 26 x 3 */

.test-grid-wrap {
    margin-top: 14px;
    overflow-x: auto;
}

.test-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 11px;
    text-align: center;
}

.test-grid th {
    color: var(--color-muted);
    font-weight: 700;
}

.test-grid td {
    min-width: 20px;
    height: 24px;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
}

.test-grid .cell-empty {
    background: var(--color-surface-muted);
}

.test-grid .cell-ok {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.test-grid .cell-bad {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.test-grid .cell-current {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Ringkasan */

.test-summary {
    margin-top: 14px;
    overflow-x: auto;
}

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

.test-summary th,
.test-summary td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

.test-summary th {
    color: var(--color-muted);
}

.test-summary td:not(:first-child),
.test-summary th:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.test-summary .summary-total td {
    border-bottom: none;
    font-weight: 700;
}

.test-export {
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.test-footnote {
    margin: 12px 0 0;
    color: var(--color-muted);
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .test-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .test-head {
        flex-direction: column;
    }
}
