/* ========================================
   Stakco Light TV Dashboard Styles
   Updated: Info bar below puzzle, history thumbnails, lighter text
   ======================================== */

/* Base Styles */
body {
    background: var(--stakco-dark-velvet-night);
    color: #fff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ========================================
   App Bar
   ======================================== */

.app-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 30px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-bar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.app-bar-title {
    font-size: 1.5em;
    font-weight: bold;
    background: var(--stakco-light-golden-sunrise);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Database Status Indicator */
.db-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.8em;
}

.db-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.db-status.connected .db-indicator {
    background: #10b981;
}

.db-label {
    color: #b0b0b0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   Container
   ======================================== */

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

/* ========================================
   Status Bar (Consolidated Stats)
   ======================================== */

.status-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
    margin-bottom: 25px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b0b0b0;
}

.status-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #DFAC6D;
    font-family: monospace;
}

.status-value.awaiting {
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 8px;
}

.status-details {
    font-size: 0.7em;
    color: #9ca3af;
    opacity: 0.8;
}

.status-item.awaiting-signal.hidden {
    display: none;
}

/* Legacy stats-grid support (fallback) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #F9EA59;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    line-height: 1;
    background: var(--stakco-light-golden-sunrise);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Awaiting Signal Card */
.stat-card.awaiting-signal {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.3) 0%, rgba(107, 114, 128, 0.2) 100%);
    border: 1px solid rgba(156, 163, 175, 0.5);
}

.stat-card.awaiting-signal .stat-label {
    color: #9ca3af;
}

.stat-card.awaiting-signal .stat-value {
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2em;
}

.stat-card.awaiting-signal.hidden {
    display: none;
}

.awaiting-signal-details {
    font-size: 0.75em;
    color: #9ca3af;
    margin-top: 5px;
    opacity: 0.8;
}

/* ========================================
   Event Log Section (transparent container)
   ======================================== */

.event-log-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* Icon buttons for actions */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    color: #aaa;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.icon-btn.clear-log-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.icon-btn.refresh-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

.event-log {
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85em;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
}

.event-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Event item background styles */
.event-item.session_started {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    border-left: 3px solid #10b981;
}

.event-item.session_ended {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
    border-left: 3px solid #ef4444;
}

.event-item.user_active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.2) 100%);
    border-left: 3px solid #3b82f6;
}

.event-item.user_inactive {
    background: linear-gradient(135deg, rgba(249, 234, 89, 0.2) 0%, rgba(212, 152, 79, 0.2) 100%);
    border-left: 3px solid #F9EA59;
}

.event-item.puzzle_changed {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2) 0%, rgba(142, 68, 173, 0.2) 100%);
    border-left: 3px solid #9b59b6;
}

.event-item.app_backgrounded {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.2) 0%, rgba(107, 114, 128, 0.2) 100%);
    border-left: 3px solid #9ca3af;
}

.event-item.app_resumed {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.2) 100%);
    border-left: 3px solid #22c55e;
}

.event-item.game_event,
.event-item.puzzleSolved {
    background: linear-gradient(135deg, rgba(249, 234, 89, 0.3) 0%, rgba(16, 185, 129, 0.2) 100%);
    border-left: 3px solid #F9EA59;
}

.event-item.tracking_lost {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
    border-left: 3px solid #ef4444;
}

.event-item.tracking_regained {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
    border-left: 3px solid #10b981;
}

.event-time {
    color: #b0b0b0;
    min-width: 80px;
}

.event-type {
    font-weight: bold;
    min-width: 130px;
}

/* Event type text colors */
.event-type.session_started { color: #10b981; }
.event-type.session_ended { color: #ef4444; }
.event-type.user_active { color: #3b82f6; }
.event-type.user_inactive { color: #F9EA59; }
.event-type.puzzle_changed { color: #9b59b6; }
.event-type.app_backgrounded { color: #9ca3af; }
.event-type.app_resumed { color: #22c55e; }
.event-type.game_event,
.event-type.puzzleSolved { color: #F9EA59; }
.event-type.tracking_lost { color: #ef4444; }
.event-type.tracking_regained { color: #10b981; }

.event-details {
    flex: 1;
    color: #ccc;
}

.event-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.badge-solved { background: #10b981; color: white; }
.badge-skipped { background: #f59e0b; color: white; }
.badge-timeout { background: #ef4444; color: white; }
.badge-abandoned { background: #6b7280; color: white; }
.badge-background_timeout { background: #9ca3af; color: white; }
.badge-session_start { background: #3b82f6; color: white; }
.badge-rotation_resumed { background: #8b5cf6; color: white; }
.badge-app_resumed { background: #22c55e; color: white; }
.badge-thinking { background: #F9EA59; color: #3C2F38; }
.badge-background { background: #9ca3af; color: white; }
.badge-session_ended { background: #ef4444; color: white; }
.badge-puzzleSolved { background: linear-gradient(135deg, #F9EA59 0%, #10b981 100%); color: #3C2F38; }
.badge-tracking_lost { 
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
    color: white; 
}
.badge-tracking_regained { 
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
    color: white; 
}

/* Legacy button styles (if any old buttons remain) */
.clear-log-btn:not(.icon-btn),
.refresh-btn:not(.icon-btn) {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: auto;
}

.clear-log-btn:not(.icon-btn):hover,
.refresh-btn:not(.icon-btn):hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Sessions Container (no wrapper, direct content)
   ======================================== */

#sessionsContainer {
    margin-bottom: 30px;
}

.session {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
}

/* Centered session content layout */
.session-content {
    display: flex;
    gap: 20px;
    align-items: start;
}

.session-content.centered {
    justify-content: center;
}

/* ========================================
   Puzzle Player (Container + Info Bar)
   ======================================== */

.puzzle-player {
    width: 450px;
    max-width: 100%;
}

/* ========================================
   Puzzle Container - Video Frame Style
   ======================================== */

.puzzle-container {
    position: relative;
    width: 100%;
    /* Remove aspect-ratio - let content determine height */
    background: #0a0a0a;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    box-shadow: 
        inset 0 0 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 0, 0, 0.3);
}

/* LIVE badge */
.live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 15;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.live-badge .live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% { 
        opacity: 0.6;
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
    }
}

.live-badge .live-text {
    color: #ef4444;
}

/* TV Noise - No Session State */
.puzzle-container.no-session {
    background: #1a1a1a;
    border-radius: 12px 12px 0 0;
    /* Maintain square shape for no-session state since content is absolute */
    aspect-ratio: 1 / 1;
}

.tv-noise {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-radial-gradient(
            circle at 50% 50%,
            rgba(255, 255, 255, 0.03) 0px,
            rgba(0, 0, 0, 0.03) 1px,
            transparent 2px
        );
    animation: tvNoise 0.15s steps(3) infinite;
    opacity: 0.8;
    z-index: 1;
}

@keyframes tvNoise {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-2px, -2px); }
    100% { transform: translate(2px, 2px); }
}

/* Scanlines effect */
.tv-noise::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
}

/* Static grain */
.tv-noise::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.4'/%3E%3C/svg%3E");
    animation: grainMove 0.5s steps(10) infinite;
    opacity: 0.3;
}

@keyframes grainMove {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}

.no-stream-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.no-stream-text .signal-icon {
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ========================================
   Puzzle Layers Area - Square container for layers
   ======================================== */

.puzzle-layers-area {
    position: relative;
    width: 100%;
    /* Create square using padding-bottom trick */
    padding-bottom: 100%;
    /* Small padding around edges */
    box-sizing: border-box;
}

/* Puzzle layers - fill the square layers area */
.puzzle-layer {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border-radius: 50%;
    transition: transform 0.1s linear;
    overflow: hidden;
}

.puzzle-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Layer z-index */
.puzzle-layer.layer1 {
    z-index: 1;
}

.puzzle-layer.layer2 {
    z-index: 2;
}

.puzzle-layer.layer3 {
    z-index: 3;
}

/* Puzzle overlay for background state */
.puzzle-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-weight: 600;
    z-index: 10;
    flex-direction: column;
    gap: 5px;
}

.puzzle-background-overlay .countdown {
    font-size: 0.8em;
    opacity: 0.8;
}

/* Puzzle loading state */
.puzzle-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #b0b0b0;
    z-index: 5;
}

/* ========================================
   Rotation Bar - Media Control Style (below puzzle layers)
   ======================================== */

.rotation-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 20;
    font-family: monospace;
}

.rotation-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rotation-label {
    font-size: 0.8em;
    color: #888;
    font-weight: 600;
}

.rotation-value {
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    min-width: 45px;
    text-align: right;
}

.quality-indicator {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    margin-left: 10px;
}

.quality-indicator.quality-excellent { 
    background: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.quality-indicator.quality-good { 
    background: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.quality-indicator.quality-poor { 
    background: rgba(249, 234, 89, 0.3);
    color: #F9EA59;
}

.quality-indicator.quality-lost { 
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.quality-indicator.quality-unknown { 
    background: rgba(156, 163, 175, 0.3);
    color: #9ca3af;
}

/* ========================================
   Session Info Bar (below puzzle)
   ======================================== */

.session-info-bar {
    background: rgba(0, 0, 0, 0.6);
    /* Match puzzle-container border width on sides */
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 0 12px 12px;
    padding: 10px 12px;
    /* Ensure same box-sizing */
    box-sizing: border-box;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.info-row:first-child {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-item {
    font-size: 0.85em;
    color: #b0b0b0;
}

.info-item.session-id-info {
    font-family: monospace;
    font-size: 0.75em;
    color: #888;
}

.info-item.puzzle-info {
    color: #ccc;
}

.info-item.puzzle-info strong {
    color: #DFAC6D;
}

.info-item .info-label {
    color: #888;
    margin-right: 4px;
}

.info-item .info-value {
    color: #DFAC6D;
    font-weight: 600;
    font-family: monospace;
}

/* Activity badge in info bar */
.activity-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
}

.activity-badge.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.activity-badge.inactive {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

/* ========================================
   History Section (transparent container)
   ======================================== */

.history-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Legacy support for old history-container class */
.history-container {
    margin-top: 30px;
    margin-bottom: 30px;
}

.history-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
}

/* History Card with Thumbnail */
.history-card {
    display: flex;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
    align-items: center;
}

.history-card:hover {
    border-color: rgba(223, 172, 109, 0.3);
    transform: translateY(-2px);
}

/* History Card Thumbnail - Square */
.history-card-thumbnail {
    width: 110px;
    min-width: 80px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-card-thumbnail.no-image {
    background: rgba(255, 255, 255, 0.1);
}

.history-card-thumbnail.no-image img {
    display: none;
}

.history-card-thumbnail .thumbnail-placeholder {
    color: #666;
    font-size: 1.5em;
}

/* History Card Content */
.history-card-content {
    flex: 1;
    min-width: 0;
}

.history-card-header {
    margin-bottom: 4px;
}

.history-puzzle-id {
    font-weight: bold;
    color: #DFAC6D;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.history-outcome {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65em;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}

.outcome-solved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.outcome-skipped {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.outcome-timeout {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.outcome-abandoned {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.outcome-background_timeout {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.history-card-stats {
    display: flex;
    gap: 12px;
    font-size: 0.8em;
    color: #bbb;
    margin-bottom: 4px;
}

.history-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-card-time {
    font-size: 0.7em;
    color: #999;
}

/* History Card Actions */
.history-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.history-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    transition: all 0.2s ease;
}

.history-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.history-action-btn.download-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

.history-action-btn.play-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    color: #10b981;
}

.history-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.history-action-btn .btn-icon {
    font-size: 1em;
}

/* Flags */
.history-flags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.flag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65em;
    font-weight: bold;
}

.flag-suspicious {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.flag-resumed {
    background: rgba(139, 92, 246, 0.3);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.history-loading,
.history-empty {
    text-align: center;
    padding: 30px;
    color: #b0b0b0;
}

.history-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    display: flex;
    align-items: center;
    color: #b0b0b0;
    font-size: 0.9em;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    text-align: center;
    margin-top: 30px;
    opacity: 0.7;
    font-size: 0.9em;
    color: #D4984F;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* No sessions placeholder */
.no-sessions {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
    font-size: 1.1em;
    color: #DFAC6D;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 968px) {
    .puzzle-player {
        width: 100%;
        max-width: 400px;
    }
    
    .status-bar {
        justify-content: center;
    }
    
    .status-divider {
        display: none;
    }
    
    .status-item {
        padding: 4px 8px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 6px;
    }
    
    .history-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-bar {
        padding: 12px 20px;
    }
    
    .app-bar-title {
        font-size: 1.2em;
    }
    
    .app-bar-logo {
        width: 32px;
        height: 32px;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    .event-item {
        flex-wrap: wrap;
    }
    
    .event-time {
        min-width: auto;
    }
    
    .status-bar {
        padding: 10px 15px;
        gap: 6px;
    }
    
    .status-label {
        font-size: 0.65em;
    }
    
    .status-value {
        font-size: 0.95em;
    }
    
    .rotation-bar {
        gap: 12px;
        padding: 10px;
    }
    
    .rotation-value {
        font-size: 0.9em;
        min-width: 40px;
    }
    
    .info-row {
        gap: 10px;
    }
    
    /* Keep same internal card layout on mobile, smaller square thumbnail */
    .history-card-thumbnail {
        width: 110px;
        min-width: 70px;
        /* aspect-ratio: 1/1 inherited from base style keeps it square */
    }
}