/* ==========================================
   JOCKOCLOCKO - TAMAGOTCHI x JOCKO AESTHETIC
   Black & White, Discipline, Pixel Perfect
   ========================================== */

:root {
    --black: #000000;
    --white: #FFFFFF;
    --gray-dark: #1a1a1a;
    --gray-medium: #333333;
    --gray-light: #666666;
    --screen-bg: #8a9a5b;
    --screen-dark: #5a6a3b;
    --pixel-border: 4px;
}

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

body {
    font-family: Impact, 'Franklin Gothic Bold', 'Arial Black', sans-serif;
    background: var(--black);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 500px;
    width: 100%;
}

/* ==========================================
   HEADER
   ========================================== */

.header {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

.title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    text-shadow:
        4px 4px 0 var(--gray-dark),
        2px 2px 0 rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.subtitle {
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--gray-light);
    font-weight: 400;
    text-transform: uppercase;
}

/* ==========================================
   TAMAGOTCHI SCREEN - Main Display
   ========================================== */

.tamagotchi-screen {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 8px solid var(--white);
    /* Create octagonal shape by clipping corners */
    clip-path: polygon(
        20px 0%, calc(100% - 20px) 0%,
        100% 20px, 100% calc(100% - 20px),
        calc(100% - 20px) 100%, 20px 100%,
        0% calc(100% - 20px), 0% 20px
    );
    padding: 25px;
    box-shadow:
        0 0 0 3px var(--black),
        0 0 0 6px var(--gray-medium),
        inset 0 4px 8px rgba(0, 0, 0, 0.6),
        0 12px 32px rgba(0, 0, 0, 0.9);
    margin-bottom: 30px;
    position: relative;
}

/* G-Shock style corner guards - make them more prominent */
.tamagotchi-screen::before,
.tamagotchi-screen::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    z-index: 1;
}

.tamagotchi-screen::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.tamagotchi-screen::after {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* G-Shock Style Watch Display */
.watch-display {
    background: var(--black);
    border: 2px solid var(--white);
    border-radius: 2px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(255, 255, 255, 0.1);
}

.watch-time {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', 'Consolas', monospace;
    letter-spacing: 6px;
    color: var(--white);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.watch-date {
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: var(--gray-light);
    font-weight: 400;
    font-family: 'Courier New', 'Consolas', monospace;
}

/* Circadian Rhythm Display */
.circadian-rhythm {
    margin-bottom: 20px;
}

.rhythm-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--white);
    text-align: center;
}

.rhythm-track {
    position: relative;
    height: 32px;
    background: var(--black);
    border: 2px solid var(--white);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Phase Segments */
.rhythm-phase {
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease;
}

.rhythm-phase:last-of-type {
    border-right: none;
}

/* Calculate flex basis from data-hours attribute via inline styles */
.rhythm-phase[data-hours="2"] { flex: 2; }
.rhythm-phase[data-hours="3"] { flex: 3; }
.rhythm-phase[data-hours="5"] { flex: 5; }

/* Phase Colors - Based on Circadian Science + Jocko's Schedule */
.wind-down {
    background: linear-gradient(90deg, #3A4A5A, #2A3A4A);
}

.light-sleep {
    background: linear-gradient(90deg, #2A3A4A, #1A2A3A);
}

.deep-sleep {
    background: linear-gradient(90deg, #1A2A3A, #0A1A2A);
    box-shadow: inset 0 0 20px rgba(0, 50, 100, 0.3);
}

.workout {
    background: linear-gradient(90deg, #8A2A2A, #AA3A3A);
    box-shadow: inset 0 0 15px rgba(255, 50, 50, 0.3);
    border-left: 2px solid rgba(255, 100, 100, 0.5);
}

.morning-peak {
    background: linear-gradient(90deg, #5A6A3A, #7A8A5A);
}

.max-alert {
    background: linear-gradient(90deg, #7A8A5A, #9AAA6A);
    box-shadow: inset 0 0 10px rgba(255, 255, 100, 0.1);
}

.afternoon-dip {
    background: linear-gradient(90deg, #6A6A4A, #5A5A3A);
}

.evening-peak {
    background: linear-gradient(90deg, #5A5A3A, #3A4A5A);
}

/* Current Time Slider */
.rhythm-slider {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 3px;
    z-index: 10;
    transition: left 1s linear;
}

.slider-marker {
    position: relative;
    width: 3px;
    height: 100%;
    background: var(--white);
    box-shadow:
        0 0 8px rgba(255, 255, 255, 0.8),
        0 0 12px rgba(255, 255, 255, 0.4);
}

.slider-marker::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--white);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.8));
}

.slider-marker::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 6px solid var(--white);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.8));
}

/* Phase Labels */
.rhythm-phases-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 4px;
}

.phase-time {
    font-size: 0.65rem;
    color: var(--gray-light);
    font-family: 'Courier New', monospace;
    font-weight: 400;
}

.phase-current {
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--white);
    padding: 4px 10px;
    background: var(--black);
    border: 2px solid var(--white);
    border-radius: 2px;
}

/* Interactive Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.action-btn {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 3px solid var(--white);
    border-radius: 2px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.action-btn:hover {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    transform: translateY(-1px);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.action-btn:active {
    transform: translateY(1px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.6),
        inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.btn-icon {
    font-size: 1.2rem;
    filter: grayscale(100%) brightness(1.2);
}

.btn-label {
    font-size: 0.65rem;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--white);
    text-transform: uppercase;
}

/* Jocko Sprite Container */
.jocko-container {
    background: var(--screen-bg);
    border: 3px solid var(--screen-dark);
    border-radius: 4px;
    padding: 40px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    box-shadow:
        inset 0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 -2px 6px rgba(0, 0, 0, 0.2);
    position: relative;
}

.jocko-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
        );
    pointer-events: none;
    border-radius: 8px;
}

.jocko-sprite {
    max-width: 128px;
    max-height: 128px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.3));
}

/* Status Bar */
.status-bar {
    background: var(--black);
    border: 2px solid var(--white);
    border-radius: 2px;
    padding: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.status-item {
    margin-bottom: 0;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.status-label {
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-weight: 600;
}

.status-percentage {
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--white);
}

.status-meter {
    background: var(--gray-dark);
    border: 2px solid var(--gray-medium);
    height: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.status-fill {
    background: var(--white);
    height: 100%;
    transition: width 0.3s ease;
}

/* ==========================================
   TWEET SECTION
   ========================================== */

.tweet-section {
    background: var(--gray-dark);
    border: 3px solid var(--white);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow:
        0 0 0 2px var(--black),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

.tweet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-medium);
}

.tweet-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.tweet-title {
    font-size: 0.85rem;
    letter-spacing: 2px;
    font-weight: bold;
}

.tweet-container {
    background: var(--black);
    border: 2px solid var(--gray-medium);
    border-radius: 2px;
    padding: 15px;
    min-height: 80px;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.tweet-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--white);
}

.tweet-loading {
    color: var(--gray-light);
    font-style: italic;
    text-align: center;
}

.tweet-error {
    color: var(--gray-light);
    font-size: 0.85rem;
    text-align: center;
}

.tweet-timestamp {
    font-size: 0.75rem;
    color: var(--gray-light);
    text-align: right;
    letter-spacing: 1px;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-light);
    letter-spacing: 1px;
}

.footer a {
    color: var(--white);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-light);
    transition: border-color 0.3s ease;
}

.footer a:hover {
    border-bottom-color: var(--white);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 600px) {
    .title {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .watch-time {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .tamagotchi-screen {
        border-width: 6px;
        padding: 15px;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

.jocko-sprite {
    animation: fadeIn 0.5s ease;
}

/* Pulse animation for state changes */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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