/**
 * Funquizo Games - Perfect Timing Stylesheet
 */

:root {
    --pt-bg-dark: #0f172a;
    --pt-card-bg: rgba(30, 41, 59, 0.7);
    --pt-track-bg: #090d16;
    --pt-track-border: #334155;
    --pt-center-color: #10b981; /* emerald 500 */
    --pt-center-glow: rgba(16, 185, 129, 0.4);
    --pt-marker-color: #ffffff;
    --pt-marker-glow: rgba(59, 130, 246, 0.6);
    --pt-gold: #f59e0b;
    --pt-gold-glow: rgba(245, 158, 11, 0.5);
    --pt-danger: #ef4444;
}

#perfect-timing-app {
    max-width: 760px;
    margin: 0 auto;
    font-family: inherit;
    color: #f8fafc;
}

.pt-shell {
    width: 100%;
    margin: 0 auto 2rem;
}

/* Round & Speed Bar */
.pt-round-tracker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 10px 18px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.pt-round-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 800;
}

.pt-round-dots {
    display: flex;
    gap: 6px;
}

.pt-round-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #334155;
    border: 1px solid #475569;
    transition: all 0.2s ease;
}

.pt-round-dot.completed {
    background: #10b981;
    border-color: #059669;
}

.pt-round-dot.current {
    background: #f59e0b;
    border-color: #d97706;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
    transform: scale(1.15);
}

.pt-speed-badge {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pt-score-pills {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pt-score-pill {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.88rem;
    font-weight: 800;
}

.pt-score-pill--p1 {
    border-color: #3b82f6;
    color: #60a5fa;
}

.pt-score-pill--p2 {
    border-color: #ec4899;
    color: #f472b6;
}

/* MAIN PLAY ARENA (THE WHOLE AREA IS CLICKABLE) */
.pt-play-arena {
    position: relative;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
    border-radius: 20px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pt-play-arena:hover {
    border-color: #475569;
}

.pt-play-arena:active {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}

.pt-arena-instruction {
    font-size: 1.15rem;
    font-weight: 800;
    color: #cbd5e1;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

/* THE TRACK */
.pt-track-container {
    position: relative;
    max-width: 680px;
    margin: 40px auto;
    width: 100%;
}

.pt-track-box {
    position: relative;
    height: 80px;
    background: var(--pt-track-bg);
    border: 2px solid var(--pt-track-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Rulers & Ticks */
.pt-ruler-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.pt-ruler-guide {
    stroke: rgba(148, 163, 184, 0.12);
    stroke-width: 1px;
    stroke-dasharray: 2 3;
}

.pt-ruler-p1 {
    stroke: rgba(148, 163, 184, 0.28);
    stroke-width: 1px;
}

.pt-ruler-p5 {
    stroke: rgba(148, 163, 184, 0.55);
    stroke-width: 1.5px;
}

.pt-ruler-p10 {
    stroke: rgba(203, 213, 225, 0.85);
    stroke-width: 2px;
}

.pt-ruler-labels {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 1;
}

.pt-ruler-num {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: -0.02em;
    user-select: none;
}

@media (max-width: 480px) {
    .pt-ruler-num {
        font-size: 0.62rem;
    }
}

/* Center Target Crosshair */
.pt-center-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: translateX(-50%);
    background: var(--pt-center-color);
    box-shadow: 0 0 12px var(--pt-center-glow), 0 0 24px var(--pt-center-glow);
    z-index: 2;
}

.pt-target-notch-top {
    position: absolute;
    left: 50%;
    top: -2px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 14px solid var(--pt-center-color);
    z-index: 3;
    filter: drop-shadow(0 0 4px var(--pt-center-color));
}

.pt-target-notch-bottom {
    position: absolute;
    left: 50%;
    bottom: -2px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 14px solid var(--pt-center-color);
    z-index: 3;
    filter: drop-shadow(0 0 4px var(--pt-center-color));
}

.pt-center-label {
    position: absolute;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--pt-center-color);
    text-shadow: 0 0 8px var(--pt-center-glow);
    letter-spacing: 0.05em;
}

/* MOVING NEEDLE / MARKER */
.pt-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    margin-left: -3px;
    background: #ffffff;
    box-shadow: 0 0 10px #ffffff, 0 0 20px rgba(59, 130, 246, 0.8);
    border-radius: 3px;
    z-index: 4;
    transition: none; /* Managed by JS animation frame */
}

.pt-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 20px #3b82f6;
    border: 3px solid #3b82f6;
}

.pt-marker.frozen-perfect {
    background: #f59e0b;
    box-shadow: 0 0 16px #f59e0b, 0 0 30px #f59e0b;
}

.pt-marker.frozen-perfect::before {
    background: #f59e0b;
    border-color: #ffffff;
    box-shadow: 0 0 16px #f59e0b, 0 0 28px #f59e0b;
    transform: translate(-50%, -50%) scale(1.3);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* FEEDBACK & MM READOUT */
.pt-feedback-box {
    margin-top: 20px;
    min-height: 85px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pt-readout-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 1.35rem;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    animation: ptPopIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.pt-badge--perfect {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

.pt-badge--awesome {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.5);
}

.pt-badge--good {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.pt-badge--ok {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #ffffff;
}

.pt-readout-sub {
    font-size: 0.95rem;
    font-weight: 700;
    color: #cbd5e1;
}

/* Versus Round Comparison Bar (for 1v1 and Bot) */
.pt-versus-box {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 14px;
    font-size: 1.05rem;
    font-weight: 800;
}

.pt-versus-player {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pt-versus-player.winner {
    color: #10b981;
}

/* Full Match End Overlay */
.pt-match-end-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    border-radius: 18px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    z-index: 20;
    animation: ptFadeIn 0.3s ease forwards;
}

.pt-match-end-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 8px;
    color: #ffffff;
}

.pt-match-end-sub {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    color: #cbd5e1;
    margin-bottom: 24px;
}

.pt-match-end-score-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pt-match-end-score-row strong {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 900;
}

.pt-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 440px;
    margin-bottom: 28px;
}

.pt-stat-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.pt-stat-val {
    font-size: 1.6rem;
    font-weight: 900;
    color: #f8fafc;
}

.pt-stat-lbl {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pt-rematch-btn {
    background: #10b981;
    color: #ffffff;
    border: none;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 14px 36px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    transition: all 0.15s ease;
}

.pt-rematch-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

@keyframes ptPopIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes ptFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Timeout Badge & Strikes */
.pt-timeout-badge {
    background: #1e293b;
    border: 1.5px solid #38bdf8;
    color: #38bdf8;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.88rem;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.pt-timeout-badge--warning {
    border-color: #f59e0b;
    color: #f59e0b;
}

.pt-timeout-badge--danger {
    border-color: #ef4444;
    color: #ef4444;
    animation: ptPulseDanger 0.8s infinite;
}

@keyframes ptPulseDanger {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
    50% { transform: scale(1.08); box-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }
}

.pt-strikes-badge {
    background: #450a0a;
    border: 1px solid #ef4444;
    color: #fca5a5;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

/* Feedback Pills for Timeout / Elimination */
.pt-feedback-pill--timeout {
    background: #451a03 !important;
    border-color: #f59e0b !important;
    color: #fef3c7 !important;
}

.pt-feedback-pill--eliminated {
    background: #450a0a !important;
    border-color: #ef4444 !important;
    color: #fee2e2 !important;
    animation: ptPulseDanger 1s infinite;
}

/* Group Finish Overlay & Leaderboard */
.pt-group-finish-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 20px;
    border-radius: 18px;
    z-index: 10;
    overflow-y: auto;
    text-align: center;
    animation: ptFadeIn 0.3s ease;
}

.pt-group-header-banner {
    margin-bottom: 16px;
    width: 100%;
}

.pt-winner-badge {
    font-size: 1.8rem;
    font-weight: 900;
    color: #10b981;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    letter-spacing: -0.01em;
}

.pt-winner-sub {
    font-size: 1.05rem;
    color: #cbd5e1;
    margin-top: 4px;
}

.pt-my-final-rank {
    display: inline-block;
    margin-left: 6px;
    color: #38bdf8;
    font-weight: 800;
}

.pt-waiting-badge {
    font-size: 1.6rem;
    font-weight: 900;
    color: #f59e0b;
    letter-spacing: -0.01em;
}

.pt-waiting-sub {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-top: 4px;
}

.pt-group-standings-card {
    width: 100%;
    max-width: 520px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    text-align: left;
}

.pt-group-standings-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.pt-group-standings-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #f8fafc;
}

.pt-standings-status {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}

.pt-waiting-info {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #fde68a;
    line-height: 1.4;
}

.pt-waiting-info strong {
    color: #ffffff;
}

.pt-standings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pt-standings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    font-size: 0.9rem;
    color: #cbd5e1;
    transition: all 0.2s ease;
}

.pt-standings-row.is-me {
    background: rgba(79, 70, 229, 0.2);
    border-color: #6366f1;
    color: #ffffff;
    font-weight: 800;
}

.pt-standings-row.is-winner {
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.pt-standings-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pt-rank-medal {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

.pt-player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pt-you-tag {
    color: #818cf8;
    font-size: 0.78rem;
    margin-left: 4px;
}

.pt-standings-right {
    flex-shrink: 0;
}

.pt-score-val {
    color: #10b981;
    font-family: ui-monospace, monospace;
    font-weight: 800;
}

.pt-status-tag {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.pt-status-tag--playing {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.pt-status-tag--eliminated {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.pt-group-actions {
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .pt-play-arena {
        padding: 24px 14px;
        min-height: 340px;
    }
    .pt-track-box {
        height: 64px;
    }
    .pt-arena-instruction {
        font-size: 1rem;
    }
    .pt-readout-badge {
        font-size: 1.15rem;
        padding: 6px 16px;
    }
    .pt-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .pt-winner-badge {
        font-size: 1.4rem;
    }
    .pt-group-finish-overlay {
        padding: 16px 12px;
    }
}
