/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
}

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

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 40px 0;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    font-size: 2.5em;
}

h2 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.8em;
}

h3 {
    color: #34495e;
    margin-bottom: 10px;
    font-size: 1.3em;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: #4a90e2;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #357abd;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn-accept {
    background-color: #27ae60;
    color: white;
    margin-right: 15px;
    min-width: 180px;
}

.btn-accept:hover {
    background-color: #229954;
    transform: translateY(-2px);
}

.btn-reject {
    background-color: #e74c3c;
    color: white;
    min-width: 180px;
}

.btn-reject:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Cards */
.study-info, .consent-section, .gamble-card, .comprehension-card,
.grid-container, .survey-container, .completion-info, .break-message {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Welcome Screen */
.study-info p {
    margin-bottom: 12px;
    font-size: 1.05em;
}

.consent-section ul {
    margin: 20px 0;
    padding-left: 25px;
}

.consent-section li {
    margin-bottom: 10px;
}

.consent-checkbox {
    display: flex;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.consent-checkbox input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.3);
    cursor: pointer;
}

/* Comprehension Check */
.comprehension-card {
    max-width: 700px;
    margin: 0 auto;
}

.comprehension-question {
    font-size: 1.15em;
    margin-bottom: 25px;
    line-height: 1.8;
}

/* Phase Headers */
.phase-header {
    text-align: center;
    margin-bottom: 30px;
}

.phase-description {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 15px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    margin: 20px 0 10px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress {
    height: 100%;
    background-color: #4a90e2;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Loss Aversion Phase */
.gamble-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.gamble-card {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.gamble-description {
    margin: 30px 0;
}

.choice-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.choice-option {
    border: 3px solid #ddd;
    border-radius: 12px;
    padding: 25px;
    background-color: #f8f9fa;
    min-width: 250px;
}

.outcomes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.outcome {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.outcome.positive {
    background-color: #d5f4e6;
    border: 2px solid #27ae60;
}

.outcome.negative {
    background-color: #fadbd8;
    border: 2px solid #e74c3c;
}

.outcome.neutral {
    background-color: #fef9e7;
    border: 2px solid #f39c12;
}

.probability {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
    color: #555;
}

.amount {
    display: block;
    font-size: 1.4em;
    font-weight: bold;
}

.decision-buttons {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Tutorial */
.tutorial-steps {
    max-width: 700px;
    margin: 0 auto;
}

.tutorial-step {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.tutorial-step.hidden {
    display: none;
}

.tutorial-step ul {
    margin: 15px 0 15px 25px;
}

.tutorial-step li {
    margin-bottom: 10px;
}

.tutorial-instruction {
    text-align: center;
    font-style: italic;
    color: #666;
    margin-top: 15px;
}

.positive-text {
    color: #27ae60;
    font-weight: 600;
}

.negative-text {
    color: #e74c3c;
    font-weight: 600;
}

/* Grid Styles */
.grid-instructions {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #e3f2fd;
    border-radius: 8px;
    font-weight: 600;
    color: #1976d2;
}

.grid {
    display: grid;
    gap: 12px;
    margin: 20px auto;
    max-width: 700px;
}

.grid.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-option {
    aspect-ratio: 1;
    border: 2px solid #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background-color: #ffffff;
    padding: 10px;
    min-height: 140px;
}

.grid-option:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Hover colors based on option type */
.grid-option.gain-dominant:hover {
    border-color: #27ae60;
    background-color: #d5f4e6;
}

.grid-option.loss-dominant:hover {
    border-color: #e74c3c;
    background-color: #fadbd8;
}

.grid-option.neutral:hover {
    border-color: #f39c12;
    background-color: #fef9e7;
}

/* Selected state (stays highlighted until another is clicked) */
.grid-option.selected {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.grid-option.selected.gain-dominant {
    border-color: #27ae60;
    background-color: #d5f4e6;
    border-width: 3px;
}

.grid-option.selected.loss-dominant {
    border-color: #e74c3c;
    background-color: #fadbd8;
    border-width: 3px;
}

.grid-option.selected.neutral {
    border-color: #f39c12;
    background-color: #fef9e7;
    border-width: 3px;
}

/* Prospect Display in Grid */
.prospect-summary {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.certain-option {
    text-align: center;
}

.prospect-amount {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.prospect-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

.prospect-outcomes-full {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.outcome-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    border-left: 3px solid #ddd;
}

/* Colors only appear on hover */
.grid-option:hover .outcome-row.positive,
.grid-option.selected .outcome-row.positive {
    background-color: #c8e6c9;
    border-left-color: #27ae60;
}

.grid-option:hover .outcome-row.negative,
.grid-option.selected .outcome-row.negative {
    background-color: #ffcdd2;
    border-left-color: #e74c3c;
}

.outcome-row .probability {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 0.85em;
}

.outcome-row .amount {
    font-weight: bold;
    font-size: 1em;
}

/* Confidence Rating */
.confidence-rating {
    margin-top: 30px;
    padding: 25px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.confidence-rating.hidden {
    display: none;
}

.confidence-rating h3 {
    text-align: center;
    margin-bottom: 20px;
}

.rating-scale {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    gap: 10px;
}

.rating-scale label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    flex: 1;
    text-align: center;
}

.rating-scale label:hover {
    background-color: #e3f2fd;
}

.rating-scale input[type="radio"] {
    margin-bottom: 8px;
    transform: scale(1.3);
    cursor: pointer;
}

.rating-scale span {
    font-size: 0.85em;
    font-weight: 600;
}

/* Strategy Question */
.strategy-question {
    margin-top: 30px;
}

.strategy-question h3 {
    margin-bottom: 15px;
}

/* Overload Question */
.overload-question {
    margin-top: 30px;
}

.overload-question h3 {
    margin-bottom: 15px;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 15px 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    border: 2px solid transparent;
}

.radio-group label:hover {
    background-color: #f8f9fa;
    border-color: #667eea;
}

.radio-group input[type="radio"] {
    margin-right: 12px;
    width: auto;
    transform: scale(1.2);
    cursor: pointer;
}

/* Break Screen */
.break-message {
    text-align: center;
    padding: 50px;
    max-width: 600px;
    margin: 50px auto;
}

.break-message h1 {
    color: #667eea;
    margin-bottom: 25px;
}

.break-message p {
    font-size: 1.15em;
    margin-bottom: 15px;
}

/* Survey Styles */
.survey-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #ecf0f1;
}

.survey-section:last-child {
    border-bottom: none;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.likert-scale {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.likert-scale label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1;
}

.likert-scale label:hover {
    background-color: #f0f0f0;
}

.likert-scale input[type="radio"] {
    margin-bottom: 5px;
    transform: scale(1.2);
    cursor: pointer;
}

/* Completion Screen */
.completion-info {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.study-summary {
    margin: 30px 0;
    padding: 25px;
    background-color: #f8f9fa;
    border-radius: 10px;
    text-align: left;
}

.study-summary h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
}

.study-summary ul {
    list-style: none;
    padding: 0;
}

.study-summary li {
    margin-bottom: 12px;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
}

.debrief {
    margin-top: 30px;
    padding: 25px;
    background-color: #e3f2fd;
    border-radius: 10px;
    text-align: left;
}

.debrief h3 {
    color: #1976d2;
    margin-bottom: 15px;
}

.debrief p {
    line-height: 1.8;
}

/* Feedback Messages */
.feedback-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.feedback-message.success {
    background-color: #d5f4e6;
    color: #27ae60;
    border: 2px solid #27ae60;
}

.feedback-message.error {
    background-color: #fadbd8;
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    .gamble-card {
        padding: 20px;
    }
    
    .choice-options {
        flex-direction: column;
        align-items: center;
    }
    
    .choice-option {
        min-width: 100%;
    }
    
    .grid {
        gap: 8px;
    }
    
    .grid-option {
        min-height: 120px;
        font-size: 0.85em;
    }
    
    .rating-scale {
        flex-wrap: wrap;
    }
    
    .rating-scale label {
        min-width: 60px;
    }
    
    .likert-scale {
        flex-wrap: wrap;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-accept, .btn-reject {
        margin-right: 0;
    }
    
    .decision-buttons {
        flex-direction: column;
    }
}

/* Print Styles */
@media print {
    .btn {
        display: none;
    }
    
    .screen {
        page-break-after: always;
    }
}

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

.loading {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background-color: #2c3e50;
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 250px;
}

.tooltip.show {
    opacity: 1;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* Accessibility */
:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid #000;
    }
    
    .grid-option {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
