/**
 * timed-practice-app styles.
 *
 * The reference panel reuses trace.css classes (.trace-ref-panel etc.).
 * This file covers:
 *   .tp-setup-screen    — fullscreen setup overlay
 *   .tp-top-bar         — countdown bar during draw phase
 *   #tpRefPanel         — position overrides for the ref panel
 *   .tp-thresh-row      — threshold slider inside the ref panel
 *   .tp-results-screen  — fullscreen results overlay
 */

/* ===== SHARED FULLSCREEN OVERLAY ===== */

.tp-setup-screen,
.tp-results-screen {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(6px);
    overflow-y: auto;
}

/* ===== SETUP SCREEN ===== */

.tp-setup-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 56px 32px 48px;
    width: 100%;
    max-width: 640px;
    text-align: center;
}

.tp-setup-title {
    font-size: 30px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 0.01em;
}

.tp-setup-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: -14px;
}

/* Image slots */
.tp-slots-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.tp-slot {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
    padding: 0;
    font-family: inherit;
}

.tp-slot:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.tp-slot-plus {
    font-size: 32px;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1;
    pointer-events: none;
}

.tp-slot-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    pointer-events: none;
}

.tp-slot-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0;
    font-family: inherit;
    line-height: 1;
    transition: background 0.15s;
}

.tp-slot-remove:hover { background: rgba(180, 40, 40, 0.85); }

/* Timer picker */
.tp-timer-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tp-timer-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tp-timer-opts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.tp-timer-opt {
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.tp-timer-opt:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.tp-timer-opt-active {
    border-color: #f97316 !important;
    background: rgba(249, 115, 22, 0.18) !important;
    color: #fff !important;
}

/* Action buttons (Start, Draw Again, New Session) */
.tp-action-btn {
    padding: 12px 40px;
    font-size: 15px;
    font-weight: bold;
    font-family: inherit;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.tp-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== TOP BAR (draw phase) ===== */

.tp-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    z-index: 11;
    width: max-content;
    max-width: calc(100vw - 24px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 0 0 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
}

.tp-top-bar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tp-progress-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}

.tp-timer-display {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s;
}

.tp-timer-urgent { color: #f97316; }

/* ===== REF PANEL OVERRIDES ===== */

/* Position below the top bar and add threshold row space */
#tpRefPanel {
    top: 52px;
}

/* Threshold row inside ref panel */
.tp-thresh-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-thresh-row input[type="range"] {
    flex: 1;
    min-width: 0;
}

.tp-thresh-val {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    min-width: 24px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== RESULTS SCREEN ===== */

.tp-results-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 56px 32px 48px;
    width: 100%;
    max-width: 860px;
    text-align: center;
}

.tp-avg-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tp-avg-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tp-avg-score {
    font-size: 72px;
    font-weight: bold;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
}

.tp-results-list {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.tp-result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
    flex: 1 1 160px;
    max-width: 200px;
    min-width: 140px;
}

.tp-result-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tp-result-ref {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tp-result-score {
    font-size: 34px;
    font-weight: bold;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}

.tp-result-diff {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.tp-results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
