@font-face {
  font-family: 'HeadFont'; /* The name you'll use in your CSS */
  src: url('/fonts/head3.otf') format('woff2');
  font-weight: 400; /* Normal weight */
  font-style: normal;
  font-display: swap; /* Essential for performance */
}

:root {
    --bg-color: #1a1a1a;
    --paper-bg: #f4e4bc;
    --accent: #d4af37;
    --text-primary: #e0e0e0;
    --text-dark: #2c2c2c;
    --font-head: 'Playfair Display', serif;
    --font-body: 'Lora', serif;
}


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


body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* Header Removed */


.subtitle {
    font-style: italic;
    color: #888;
}

/* Main Image Area */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    background-color: #000;
}

.newspaper-wrapper {
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-in;
    overflow: hidden;
}

.newspaper-wrapper.zoomed {
    cursor: zoom-out;
}

.loading-spinner {
    position: absolute;
    color: var(--accent);
    font-family: var(--font-head);
    z-index: 0;
}

/* Zoom Target Container */
.zoom-target {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    width: 100%;
    max-height: 100%;
    max-width: 100%;
    transition: transform 0.3s ease;
    transform-origin: center center;
}

#paperImage {
    grid-area: 1 / 1;
    /* Ensure the whole newspaper fits without truncation */
    object-fit: contain;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    /* Critical: Allow grid item to shrink below natural size */
    min-width: 0;
    min-height: 0;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transition: opacity 0.3s ease;
    z-index: 1;
}

.newspaper-wrapper.zoomed .zoom-target {
    transform: scale(2.5);
}

.date-mask {
    grid-area: 1 / 1;
    position: absolute;
    top: 5.8%;
    width: 60%;
    height: 3%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.zoom-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.6);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s;
}

.newspaper-wrapper.zoomed .zoom-hint {
    opacity: 0;
}


/* Controls Footer */
.controls {
    background: #222;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-top: 1px solid #333;
    z-index: 10;
    transition: all 0.3s ease;
    position: relative;
}

.controls.collapsed {
    padding: 0.5rem;
    gap: 0;
}

.controls.collapsed .slider-container,
.controls.collapsed .guess-btn {
    display: none;
}

.toggle-btn {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 12px 12px 0 0;
    padding: 8px 50px;
    font-size: 1.2rem;
    font-family: var(--font-body);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.5);
    transition: all 0.2s;
    outline: none;
    z-index: 20;
    line-height: 1;
}

.controls.collapsed .toggle-btn {
    border-color: var(--accent);
    color: #000;
    padding-bottom: 8px;
}

.toggle-btn:hover {
    background: #e5bd3c;
    color: #000;
    padding-bottom: 12px; /* Lift effect */
}

.slider-container {
    width: 100%;
    padding: 0 2rem;
}

.year-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.year-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.year-value {
    font-family: var(--font-head);
    font-size: 3rem;
    color: var(--accent);
    font-weight: 700;
}

.slider-container {
    width: 100%;
    padding: 0 2rem;
}

.year-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(to bottom, #333, #444, #555);
    outline: none;
    border-radius: 3px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.year-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 40px;
    background: linear-gradient(135deg, #f0c040 0%, var(--accent) 50%, #b8941f 100%);
    cursor: grab;
    border-radius: 4px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(212, 175, 55, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(0, 0, 0, 0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.year-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #f5d060 0%, #e5bd3c 50%, #c9a52f 100%);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(212, 175, 55, 0.6);
    transform: translateY(-2px) scale(1.05);
}

.year-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: translateY(0) scale(0.98);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(212, 175, 55, 0.3);
}

/* Firefox */
.year-slider::-moz-range-thumb {
    width: 24px;
    height: 40px;
    background: linear-gradient(135deg, #f0c040 0%, var(--accent) 50%, #b8941f 100%);
    cursor: grab;
    border-radius: 4px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(212, 175, 55, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.4);
    border-bottom-color: rgba(0, 0, 0, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.year-slider::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #f5d060 0%, #e5bd3c 50%, #c9a52f 100%);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(212, 175, 55, 0.6);
    transform: translateY(-2px) scale(1.05);
}

.year-slider::-moz-range-thumb:active {
    cursor: grabbing;
    transform: translateY(0) scale(0.98);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(212, 175, 55, 0.3);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    color: #fff; /* Increased contrast */
    font-size: 0.9rem;
    font-family: var(--font-head);
    font-weight: bold;
}

.guess-btn {
    align-self: center;
    background: var(--accent);
    color: #000;
    border: none;
    padding: 1rem 3rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.guess-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    background: #e5bd3c;
}

/* Overlays (Intro, Result, GameOver) */
.intro-overlay,
.result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.intro-overlay.active,
.result-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.intro-content,
.result-content {
    background: #000;
    color: #fff;
    border: 2px solid var(--accent);
    padding: 3rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.15);
}

.intro-logo {
    display: block;
    margin: 0 auto 1rem auto;
    max-width: 250px;
    height: auto;
}

.main-title {
    font-family: 'HeadFont', serif;
    font-size: 5rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: var(--accent);
}

.tagline {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: #ccc;
    margin-bottom: 2rem;
    border-bottom: none;
    padding-bottom: 0;
    display: block;
}

.rules {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.rules p {
    font-family: var(--font-head);
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 400;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

/* Results Specifics */
.round-display {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--accent);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

#resultTitle {
    font-family: var(--font-head);
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.result-date {
    font-family: var(--font-body);
    font-style: italic;
    color: #bbb;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.score-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.score-display .label {
    color: #888;
}

.score-display .value {
    font-family: var(--font-head);
    font-size: 1.5rem;
    color: var(--accent);
}

.score-final {
    margin: 2rem 0;
    font-size: 1.2rem;
    color: #fff;
}

.final-score-value {
    font-family: var(--font-head);
    font-size: 5rem;
    color: var(--accent);
    margin: 1rem 0;
}

.final-message {
    font-size: 1.5rem;
    font-style: italic;
    margin-bottom: 2rem;
    color: #fff;
}

.primary-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.8rem 2rem;
    font-family: var(--font-head);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn.large-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    background: rgba(212, 175, 55, 0.1);
}

.primary-btn:hover {
    background: var(--accent);
    color: #000;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Header adjustments */
    h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* Intro overlay */
    .intro-content {
        padding: 2rem 1.5rem;
        width: 95%;
    }

    .intro-content h1 {
        font-size: 2.5rem;
        margin-bottom: 0.8rem;
    }

    .intro-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .rules {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .rules p {
        font-size: 1rem;
    }

    /* Result overlays */
    .result-content {
        padding: 2rem 1.5rem;
        width: 95%;
    }

    #resultTitle {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .score-display .value {
        font-size: 1.3rem;
    }

    .score-final {
        font-size: 1rem;
        margin: 1.5rem 0;
    }

    .final-score-value {
        font-size: 3.5rem;
    }

    .final-message {
        font-size: 1.2rem;
    }

    /* Controls footer */
    .controls {
        padding: 1rem;
        gap: 1rem;
    }

    .slider-container {
        padding: 0 0.5rem;
    }

    .year-display {
        margin-bottom: 1.5rem;
    }

    .year-label {
        font-size: 0.8rem;
    }

    .year-value {
        font-size: 2.5rem;
    }

    /* Slider thumb - larger for touch, rectangular shape */
    .year-slider::-webkit-slider-thumb {
        width: 32px;
        height: 48px;
    }

    .year-slider::-moz-range-thumb {
        width: 32px;
        height: 48px;
    }

    .slider-ticks {
        font-size: 0.7rem;
    }

    /* Guess button - larger touch target */
    .guess-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
    }

    /* Primary buttons */
    .primary-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .primary-btn.large-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    /* Zoom hint */
    .zoom-hint {
        bottom: 10px;
        right: 10px;
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    /* Date mask - adjust for mobile */
    .date-mask {
        top: 5.8%;
        width: 70%;
        height: 3%;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    h1 {
        font-size: 1.5rem;
    }

    .intro-content h1 {
        font-size: 2rem;
    }

    .intro-content p {
        font-size: 0.9rem;
    }

    #resultTitle {
        font-size: 1.6rem;
    }

    .year-value {
        font-size: 2rem;
    }

    .final-score-value {
        font-size: 3rem;
    }

    .guess-btn {
        font-size: 0.9rem;
        padding: 0.9rem 1.5rem;
    }

    .slider-ticks span:nth-child(2),
    .slider-ticks span:nth-child(4) {
        display: none; /* Hide middle ticks on very small screens */
    }
}

/* Landscape mobile optimization */
@media (max-height: 600px) and (orientation: landscape) {
    header {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .controls {
        padding: 0.8rem;
    }

    .year-display {
        margin-bottom: 0.8rem;
    }

    .year-value {
        font-size: 2rem;
    }

    .guess-btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    .intro-content,
    .result-content {
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .intro-content h1 {
        font-size: 2rem;
    }

    .final-score-value {
        font-size: 2.5rem;
        margin: 0.5rem 0;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .guess-btn:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    }

    .primary-btn:hover {
        background: transparent;
        color: var(--accent);
    }

    /* Active states for touch feedback */
    .guess-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .primary-btn:active {
        background: var(--accent);
        color: #000;
    }

    /* Larger touch targets */
    button {
        min-height: 44px;
        min-width: 44px;
    }
}

