/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #2c2c2c 0%, #3a3a3a 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.experiment-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.fullscreen-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.fullscreen-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #f5843f;
    cursor: pointer;
}

.id-hint {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Screen management */
.screen {
    display: block;
    min-height: 100vh;
}

.screen.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.screen.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background: #000000;
}

video::-webkit-media-controls {
    display: none !important;
}

/* Header */
.header {
    text-align: center;
    padding: 60px 0 40px;
    background: linear-gradient(135deg, #e55a2b 0%, #d4821a 100%);
    margin-bottom: 40px;
    border-radius: 0 0 20px 20px;
}

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

.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Experiment section */
.experiment-section {
    padding: 40px 0;
}

.experiment-section h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: #e55a2b;
}

/* Experiment list */
.experiment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* Container for all experiments sections */
#experiments-list {
    display: block;
}

.experiment-card {
    background: linear-gradient(145deg, #404040, #353535);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid #555;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.experiment-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #e55a2b, #d4821a);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.experiment-card:hover::before {
    transform: scaleX(1);
}

.experiment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(255, 107, 53, 0.2);
    border-color: #e55a2b;
}

.experiment-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ffffff;
}

.experiment-card p {
    color: #b0b0b0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.experiment-card .status {
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    margin-top: 15px;
}

.experiment-card .status.available {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.experiment-card .status.completed {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

/* Section titles */
.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #555;
}

/* No experiments message */
.no-experiments {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed #555;
    margin: 10px 0;
}

/* Experiment ID display */
.experiment-id {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: #b0b0b0;
    font-size: 0.7rem;
    font-family: 'Courier New', monospace;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #555;
    opacity: 0.8;
    transition: opacity 0.3s ease, color 0.2s ease;
    max-width: 200px;
    word-break: break-all;
    line-height: 1.2;
    white-space: normal;
    cursor: pointer;
    user-select: none;
}

.experiment-card:hover .experiment-id {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
}

.experiment-id.copied {
    color: #56d364;
    border-color: #56d364;
}


/* Different styles for available vs completed cards */
.experiment-card.available {
    border-left: 4px solid #4CAF50;
}

.experiment-card.completed {
    border-left: 4px solid #2196F3;
    opacity: 0.8;
    cursor: default;
}

.experiment-card.completed:hover {
    opacity: 0.8;
    transform: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-color: #555;
}

/* Arena experiments: distinct purple/teal tint so operators see them at a glance. */
.experiment-card.arena {
    background: linear-gradient(145deg, #2a3050, #1f2540);
    border-left: 4px solid #7c4dff;
}

.experiment-card.arena::before {
    background: linear-gradient(90deg, #7c4dff, #00bcd4);
}

.experiment-card.arena:hover {
    border-color: #7c4dff;
    box-shadow: 0 12px 40px rgba(124, 77, 255, 0.25);
}

.experiment-card.arena.completed {
    background: linear-gradient(145deg, #2a3050, #1f2540);
    border-left: 4px solid #5a6bbf;
}

.experiment-card .status.arena-badge {
    background: linear-gradient(135deg, #7c4dff, #00bcd4);
    color: white;
    margin-right: 8px;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.button:hover::before {
    left: 100%;
}

.button.primary {
    background: linear-gradient(135deg, #e55a2b, #d4821a);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.button.secondary {
    background: linear-gradient(135deg, #5a5a5a, #4a4a4a);
    color: white;
    border: 1px solid #777;
}

.button.secondary:hover {
    background: linear-gradient(135deg, #5a5a5a, #3a3a3a);
    transform: translateY(-2px);
}

/* Fullscreen video */

.fullscreen-overlay {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #000;
    overflow: hidden;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.video-header {
    position: absolute;
    top: clamp(16px, 3vh, 48px);
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, max-content) 1fr minmax(0, max-content);
    align-items: center;
    gap: clamp(12px, 2vw, 40px);
    padding: 0 clamp(12px, 3vw, 32px);
    color: #f4f4f4;
    z-index: 8;
    width: 100%;
    margin: 0;
    max-width: none;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}

.back-button {
    background: none;
    border: none;
    color: #f4f4f4;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    cursor: pointer;
    transition: color 0.2s ease;
    justify-self: start;
}

.back-button:hover {
    color: #f7b14f;
}

.video-title {
    font-size: clamp(1.2rem, 2.1vw, 1.9rem);
    font-weight: 600;
    color: #f4f4f4;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: center;
}

.video-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: clamp(160px, 18vw, 320px);
    max-width: clamp(220px, 24vw, 360px);
    text-align: right;
    justify-self: end;
}

.video-header.video-header--hidden {
    opacity: 0;
    pointer-events: none;
}

.video-container.cursor-hidden,
.video-container.cursor-hidden * {
    cursor: none !important;
}

.atom-progress-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
}

.atom-progress-sub {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.atom-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    overflow: hidden;
}

.atom-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5843f, #f7b14f);
    width: 0%;
    transition: width 0.3s ease;
}
.video-progress .atom-progress-bar { order: 1; }
.video-progress .atom-progress-label { order: 2; }
.video-progress .atom-progress-sub { order: 3; }

.video-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.playback-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.14);
    z-index: 5;
}

.playback-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e55a2b, #d4821a);
    width: 0%;
    transition: width 0.25s ease;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#main-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    z-index: 7;
    transition: opacity 0.3s ease;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.error-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.error-message {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #ffb4a2;
    text-align: center;
    max-width: 420px;
    white-space: pre-line;
}

.experiment-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 20px;
}

.experiment-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #b0b0b0;
}

.atom-number {
    font-size: 1rem;
    color: #b0b0b0;
    background: rgba(255, 255, 255, 0.12);
    padding: 6px 12px;
    border-radius: 18px;
}

.video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
}

.video-preview-text {
    font-size: 1.2rem;
    color: #e0e0e0;
    text-align: center;
    margin-bottom: 48px;
    transform: translateY(-16px);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #666;
}

.play-button {
    background: linear-gradient(135deg, #e55a2b, #d4821a);
    border: none;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.play-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(255, 107, 53, 0.6);
}

.play-button svg {
    color: white;
    margin-left: 4px;
}

.play-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: #b0b0b0;
    font-weight: 500;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    justify-content: center;
    z-index: 10;
}

/* Rating section */
.rating-section {
    padding: clamp(48px, 8vh, 72px) 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: clamp(24px, 5vh, 48px);
    align-items: center;
}

.rating-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.rating-header h2 {
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 700;
    margin: 0;
    color: #b0b0b0;
}

.rating-experiment-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 auto;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.rating-buttons .rating-btn {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px;
    min-height: 140px;
}

@media (max-width: 900px) {
    .rating-buttons {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

.rating-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: nowrap;
    align-items: stretch;
}

.skip-action {
    background: linear-gradient(135deg, #1f1f1f, #161616);
    border-color: rgba(255, 255, 255, 0.12);
}

.skip-action:hover {
    background: linear-gradient(135deg, #262626, #1c1c1c);
    border-color: rgba(255, 255, 255, 0.22);
}

.secondary-action {
    background: linear-gradient(135deg, #2d2d2d, #252525);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
    flex: 1 1 0;
}

.secondary-action:hover {
    background: linear-gradient(135deg, #3a3a3a, #2d2d2d);
    border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 960px) {
    .rating-actions {
        flex-wrap: wrap;
    }

    .secondary-action {
        flex: 1 1 100%;
        min-width: 0;
    }
}

.rating-buttons.horizontal .rating-btn {
    flex: 1 1 240px;
    min-width: 220px;
    padding: 28px 18px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.rating-btn {
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    border: 2px solid #666;
    border-radius: 20px;
    padding: 40px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
}

.rating-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #e55a2b, #d4821a);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rating-btn:hover::before {
    opacity: 0.1;
}

.rating-btn:hover {
    transform: translateY(-3px);
    border-color: #e55a2b;
    box-shadow: 0 8px 25px rgba(229, 90, 43, 0.3);
    background: linear-gradient(145deg, #5a5a5a, #4a4a4a);
}

.rating-btn.selected {
    background: linear-gradient(135deg, #e55a2b, #d4821a);
    border-color: #e55a2b;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

/* Color-coded rating buttons */
.rating-btn[data-mark="1"] {
    border-color: #ff6b6b;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="1"]:hover {
    border-color: #ff5252;
    background: linear-gradient(145deg, #5a4a4a, #4a3a3a);
    box-shadow: 0 8px 25px rgba(255, 107, 82, 0.3);
}

.rating-btn[data-mark="1"]:hover::before {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
}

.rating-btn[data-mark="2"] {
    border-color: #ffd93d;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="2"]:hover {
    border-color: #ffcc02;
    background: linear-gradient(145deg, #5a4a4a, #4a3a3a);
    box-shadow: 0 8px 25px rgba(255, 217, 61, 0.3);
}

.rating-btn[data-mark="2"]:hover::before {
    background: linear-gradient(135deg, #ffd93d, #ffcc02);
}

.rating-btn[data-mark="3"] {
    border-color: #51cf66;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="3"]:hover {
    border-color: #40c057;
    background: linear-gradient(145deg, #4a5a4a, #3a4a3a);
    box-shadow: 0 8px 25px rgba(81, 207, 102, 0.3);
}

.rating-btn[data-mark="3"]:hover::before {
    background: linear-gradient(135deg, #51cf66, #40c057);
}

.rating-btn[data-mark="4"] {
    border-color: #74c0fc;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="4"]:hover {
    border-color: #339af0;
    background: linear-gradient(145deg, #4a4a5a, #3a3a4a);
    box-shadow: 0 8px 25px rgba(116, 192, 252, 0.3);
}

.rating-btn[data-mark="4"]:hover::before {
    background: linear-gradient(135deg, #74c0fc, #339af0);
}

.rating-btn[data-mark="5"] {
    border-color: #ffd93d;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="5"]:hover {
    border-color: #ffcc02;
    background: linear-gradient(145deg, #5a4a4a, #4a3a3a);
    box-shadow: 0 8px 25px rgba(255, 217, 61, 0.3);
}

.rating-btn[data-mark="5"]:hover::before {
    background: linear-gradient(135deg, #ffd93d, #ffcc02);
}

.rating-btn[data-mark="6"] {
    border-color: #ff6b6b;
    background: linear-gradient(145deg, #4a4a4a, #3a3a3a);
}

.rating-btn[data-mark="6"]:hover {
    border-color: #ff5252;
    background: linear-gradient(145deg, #5a4a4a, #4a3a3a);
    box-shadow: 0 8px 25px rgba(255, 107, 82, 0.3);
}

.rating-btn[data-mark="6"]:hover::before {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
}

.rating-number {
    font-size: 3rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    color: #ffffff;
}

.rating-label {
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.4;
    color: #ffffff;
}

.rating-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Completion section */
.completion-section {
    text-align: center;
    padding: 80px 0;
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 30px;
}

.completion-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #e55a2b;
}

.completion-section p {
    font-size: 1.2rem;
    color: #b0b0b0;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 60px 0;
    color: #b0b0b0;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ff6b35;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error states */
.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
}

.error-block {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    justify-content: center;
    background: rgba(244, 67, 54, 0.12);
    border: 1px solid rgba(244, 67, 54, 0.4);
    color: #ffe2df;
    padding: 32px 24px;
    border-radius: 16px;
    max-width: 520px;
    margin: 40px auto;
    text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .experiment-list {
        grid-template-columns: 1fr;
    }
    
    .rating-buttons.horizontal {
        flex-direction: column;
        gap: 15px;
    }
    
    .rating-buttons.horizontal .rating-btn {
        height: 80px;
        padding: 15px 10px;
    }
    
    .rating-number {
        font-size: 2.5rem;
    }
    
    .rating-label {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 40px 0 30px;
    }
    
    .rating-buttons.horizontal {
        flex-direction: column;
        gap: 10px;
    }
    
    .rating-buttons.horizontal .rating-btn {
        height: 60px;
        padding: 10px 8px;
    }
    
    .rating-number {
        font-size: 2rem;
    }
    
    .rating-label {
        font-size: 0.9rem;
    }
    
    .play-button {
        width: 80px;
        height: 80px;
    }
    
    .play-button svg {
        width: 40px;
        height: 40px;
    }
}

/* TV-friendly styles */
@media (min-width: 1920px) {
    .rating-buttons.horizontal {
        max-width: 1600px;
        gap: 25px;
    }
    
    .rating-buttons.horizontal .rating-btn {
        height: 150px;
        padding: 30px 20px;
    }
    
    .rating-number {
        font-size: 4rem;
    }
    
    .rating-label {
        font-size: 1.3rem;
    }
}
