/* Worst Captcha - Google reCAPTCHA Style Design */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Comment Form Section */
.comment-form-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.comment-form-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

#editor {
    height: 150px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.ql-toolbar {
    border-radius: 8px 8px 0 0 !important;
    border-color: #e0e0e0 !important;
}

.ql-container {
    border-radius: 0 0 8px 8px !important;
    border-color: #e0e0e0 !important;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Captcha Checkbox - Google reCAPTCHA Style */
.captcha-checkbox {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    padding: 12px 16px;
    display: inline-block;
    margin: 15px 0;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-input {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-custom {
    width: 28px;
    height: 28px;
    border: 2px solid #c1c1c1;
    border-radius: 2px;
    background: white;
    position: relative;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    display: none;
    left: 9px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid #4285f4;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.checkbox-input:checked + .checkbox-label .checkbox-custom {
    border-color: #4285f4;
}

/* Hide checkmark until captcha is completed */
.checkbox-input:checked + .checkbox-label .checkbox-custom::after {
    display: none;
}

/* Show checkmark only when captcha is completed */
.captcha-checkbox.completed .checkbox-input:checked + .checkbox-label .checkbox-custom::after {
    display: block;
}

/* Spinning wheel inside checkbox */
.checkbox-custom.spinning::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #4285f4;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.checkbox-custom.spinning::after {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.checkbox-text {
    font-size: 14px;
    color: #555;
}

.checkbox-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 12px;
    border-left: 1px solid #e0e0e0;
}

.logo-icon {
    font-size: 1.2rem;
}

.logo-text {
    font-size: 11px;
    color: #999;
}

/* Captcha Widget - Popup Style */
.captcha-widget {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.captcha-popup {
    background: white;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90vw;
    animation: slideIn 0.3s ease-out;
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.captcha-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 3px 3px 0 0;
}

.captcha-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.captcha-icon {
    font-size: 1rem;
}

.captcha-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.captcha-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.captcha-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.captcha-content {
    padding: 12px;
}

.captcha-instruction {
    background: #f8f9fa;
    padding: 12px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    border-radius: 4px;
    margin-bottom: 12px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.captcha-instruction.white-text {
    color: #f8f9fa !important;
}

.captcha-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    min-height: 300px;
}

/* Step 2 and 3 container should take full grid area */
.captcha-grid .step2-container {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    background: white;
    border-radius: 4px;
    padding: 20px;
}

.captcha-cell {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.captcha-cell:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.captcha-cell.clicked {
    animation: clickPulse 0.3s ease-out;
}

@keyframes clickPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Shapes */
.shape {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s;
}

.shape.square {
    width: 70%;
    height: 70%;
}

.shape.circle {
    width: 70%;
    height: 70%;
    border-radius: 50%;
}

.shape.triangle {
    width: 0;
    height: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    border-bottom: 60px solid;
}

.shape.optical {
    width: 70%;
    height: 70%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
    animation: opticalSpin 2s linear infinite;
}

@keyframes opticalSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Captcha Status */
.captcha-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.captcha-progress {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
}

/* Step 2: Note Singing UI */
.step2-container {
    padding: 20px;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.step2-container h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.step2-container p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.note-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.target-note, .user-note {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    min-width: 120px;
}

.target-note span, .user-note span {
    display: block;
    margin-bottom: 5px;
}

.target-note span:first-child, .user-note span:first-child {
    font-size: 0.85rem;
    color: #999;
}

.target-note span:last-child, .user-note span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.note-progress {
    margin-bottom: 20px;
    font-size: 1rem;
    color: #666;
}

#notes-matched {
    font-weight: 600;
    color: #4CAF50;
}

.mic-status {
    margin-top: 15px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 4px;
    color: #4CAF50;
    font-size: 0.9rem;
}

/* Step 3: Image Selection UI */
.step3-container {
    padding: 12px;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.step3-container h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.step3-container p {
    color: #666;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.age-verification {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
}

.age-verification p {
    margin-bottom: 15px;
    font-weight: 600;
}

.age-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.step3-instruction {
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    font-size: 1.125rem;
    text-align: center;
}

.category-highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: capitalize;
    display: inline-block;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 3px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

.image-cell {
    aspect-ratio: 1;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-cell:hover {
    border-color: #4285f4;
    transform: scale(1.02);
}

.image-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1px;
    display: block;
}

.image-cell .selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(66, 133, 244, 0.3);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.image-cell.selected {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.3);
}

.image-cell.selected .selection-overlay {
    opacity: 1;
}

.image-cell.correct {
    border-color: #4CAF50;
    animation: correctPulse 0.5s ease-out;
}

.image-cell.incorrect {
    border-color: #ff4444;
    animation: incorrectShake 0.5s ease-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.step3-controls {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.step3-progress {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: #666;
}

#step3-score {
    font-weight: 600;
    color: #4CAF50;
}

#step3-submit-btn {
    margin-top: 0;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#step3-submit-btn:hover {
    background: #3367d6;
}

/* Comments Section */
.comments-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.comments-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #667eea;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: 600;
    color: #333;
}

.comment-time {
    color: #999;
    font-size: 0.9rem;
}

.comment-content {
    color: #555;
    line-height: 1.6;
}

/* Bot Detection Overlay */
.bot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s;
}

.bot-message {
    text-align: center;
    color: #ff4444;
}

.bot-icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 20px;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.bot-text {
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 5px;
}

/* Screen Shake Overlay */
.shake-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.shake-overlay.active {
    animation: screenShake 0.5s;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-5px, 5px); }
    20%, 40%, 60%, 80% { transform: translate(5px, -5px); }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Cursor hiding */
.cursor-hidden {
    cursor: none !important;
}

/* Cursor invert */
.cursor-inverted {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="white" d="M12 2L2 22h20L12 2z"/></svg>') 12 12, auto !important;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .captcha-popup {
        width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .captcha-grid {
        gap: 4px;
        padding: 8px;
        min-height: 250px;
    }
    
    .captcha-instruction {
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .bot-text {
        font-size: 2rem;
    }
    
    /* Step 2 and 3 mobile improvements */
    .step2-container {
        padding: 15px;
        min-height: 250px;
    }
    
    .step2-container h3 {
        font-size: 1.1rem;
    }
    
    .step2-container p {
        font-size: 0.9rem;
    }
    
    .note-display {
        flex-direction: column;
        gap: 15px;
    }
    
    .target-note, .user-note {
        min-width: 100%;
    }
    
    .mic-status {
        font-size: 0.85rem;
        padding: 8px;
    }
    
    /* Step 3 mobile improvements */
    .image-grid {
        max-width: 100%;
        gap: 2px;
        padding: 4px;
    }
    
    .image-cell {
        min-height: auto;
    }
    
    .step3-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    #step3-submit-btn {
        width: 100%;
    }
}
