/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #ff69b4; /* Hot pink background */
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* Window frame styling */
.window-frame {
    width: 800px;
    background-color: #c0c0c0; /* Classic window gray */
    border: 3px solid #808080;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
}

.title-bar {
    background: linear-gradient(to right, #000080, #0000ff); /* Classic blue title bar */
    color: white;
    display: flex;
    padding: 3px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #808080;
}

.menu-bar {
    display: flex;
    gap: 15px;
    margin-left: 5px;
}

.menu-item {
    cursor: pointer;
    padding: 2px 8px;
}

.menu-item:hover {
    background-color: #6666ff;
}

.window-title {
    font-weight: bold;
    flex-grow: 1;
    text-align: center;
}

.window-controls {
    margin-right: 5px;
}

.window-controls span {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
    border: 1px solid white;
    padding: 0 4px;
}

/* Game container */
.game-container {
    width: 800px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    background-color: #ff69b4;
    position: relative;
    perspective: 1200px;
}

/* Notebook pages group - contains all pages */
.notebook-pages {
    position: relative;
    width: 95%;
    margin: 0 auto 50px;
    height: 700px;
}

/* Stacked pages effect - properly aligned like a real notebook */
.stacked-pages {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Allow clicking through to elements below */
}

/* Make pages precisely stacked, only slightly offset from each other */
.stacked-page {
    position: absolute;
    background-color: white;
    width: 100%;
    height: 100%;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
    transform: rotateX(45deg) rotateZ(-30deg); /* Match notebook-content transform */
    transform-origin: center center;
    top: 0;
    left: 0;
    border: 2px solid #000; /* Add black frame */
}

.stacked-page:nth-child(1) {
    transform: translateZ(-5px) translateY(4px) rotateX(45deg) rotateZ(-30deg);
    filter: brightness(0.97);
    z-index: 4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.stacked-page:nth-child(2) {
    transform: translateZ(-10px) translateY(8px) rotateX(45deg) rotateZ(-30deg);
    filter: brightness(0.94);
    z-index: 3;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.stacked-page:nth-child(3) {
    transform: translateZ(-15px) translateY(12px) rotateX(45deg) rotateZ(-30deg);
    filter: brightness(0.91);
    z-index: 2;
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.3);
}

.stacked-page:nth-child(4) {
    transform: translateZ(-20px) translateY(16px) rotateX(45deg) rotateZ(-30deg);
    filter: brightness(0.88);
    z-index: 1;
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.3);
}

/* Add notebook lines to stacked pages */
.stacked-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(to bottom, transparent 24px, #add8e6 25px);
    background-size: 25px 25px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5; /* Lighter lines on background pages */
}

/* Add red margin line to stacked pages */
.stacked-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 80px;  /* Increased from 50px */
    bottom: 0;
    width: 1px;
    background-color: #f00;
    z-index: 1;
    opacity: 0.5; /* Lighter line for background pages */
}

/* New Game button - moved above letter bar */
.controls {
    margin-top: 30px;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Alphabet row */
.alphabet-row {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    padding: 5px;
    background-color: #ffccdd;
    border: 1px solid #000;
    z-index: 10;
    position: relative;
}

.letter-btn {
    background-color: #fff;
    color: #000;
    border: 1px solid #999;
    padding: 3px 2px;
    width: 30px;  /* 1.5x larger */
    height: 30px; /* 1.5x larger */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px; /* 1.5x larger */
    font-weight: bold;
    margin: 0 2px;
    font-family: 'Courier New', monospace; /* Match wrong letters font */
}

.letter-btn:hover {
    background-color: #ddd;
}

.letter-btn.used {
    opacity: 0.5;
    cursor: not-allowed;
}

.letter-btn.correct {
    background-color: #ddd;
}

.letter-btn.wrong {
    background-color: #ddd;
}

/* Notebook section */
.notebook-content {
    position: absolute;
    background-color: white;
    width: 100%;
    height: 100%;
    /* Combine rotateX (45deg) with rotateZ (-30deg) for correct notebook angle */
    transform: rotateX(45deg) rotateZ(-30deg);
    transform-origin: center center;
    box-shadow: 0 30px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 5; /* Ensure it's above stacked pages */
    border: 2px solid #000; /* Add black frame */
}

/* Notebook blue lines */
.notebook-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(to bottom, transparent 24px, #add8e6 25px);
    background-size: 25px 25px;
    z-index: 1;
    pointer-events: none;
}

/* Red margin line */
.notebook-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 80px;  /* Increased from 50px */
    bottom: 0;
    width: 1px;
    background-color: #f00;
    z-index: 1;
}

/* Gallows and canvas - moved to cover almost 50% of the page */
.gallows {
    position: absolute;
    right: 80px;
    bottom: 80px;  /* Increased bottom margin */
    width: 400px;   /* Increased width */
    height: 400px;  /* Increased height */
    z-index: 2;
}

#hangman-canvas,
#temp-canvas,
#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Wrong letters area */
.wrong-letters {
    position: absolute;
    top: 20px;
    left: 90px;  /* Increased from 60px to be slightly after the margin line */
    font-size: 24px;
    font-family: 'Courier New', monospace;
    letter-spacing: 5px;
    z-index: 2;
}

/* Pencil styling */
.pencil {
    display: none; /* Hide the pencil */
/*
    position: absolute;
    width: 200px;
    height: 60px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 30"><rect x="20" y="5" width="80" height="20" fill="%23FFD700"/><polygon points="100,5 120,15 100,25" fill="%23FFA500"/><rect x="10" y="5" width="10" height="20" fill="%23000"/><rect x="0" y="7" width="10" height="16" fill="%23FFB6C1"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    transform: rotate(45deg);
    transform-origin: 10% 50%;
    pointer-events: none;
    z-index: 100;
    left: 150px;
    top: 180px;
    opacity: 1;
    transition: all 0.3s ease-out;
*/
}

/* Game status message moved to bottom of notebook */
#game-status {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #000;
    z-index: 5;
    min-height: 1.2em;
}

/* Controls area */
.controls {
    margin-top: 30px;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .game-container {
        margin: 10px;
    }
    
    .key {
        width: 32px;
        height: 32px;
        font-size: 1em;
    }
    
    #word-display {
        font-size: 1.5em;
    }
}

/* Animation for drawing */
@keyframes draw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Thicker lines for gallows */
.thicker-lines {
    stroke-width: 3px !important; /* Make gallows lines thicker */
}

/* Spiral binding with proper perspective - updated to match page perspective */
.spiral-binding {
    position: absolute;
    left: 25px;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;

    transform-origin: center center;
}

/* Ensure consistent spiral ring styling - updated to look like metal rings */
.spiral-ring {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #f0f0f0, #999, #555); /* Metal gradient */
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0px 1px 2px rgba(255,255,255,0.5), inset 0px -1px 2px rgba(0,0,0,0.7);
    border: 1px solid #333;
    margin: 2px 0;
    overflow: hidden;
}

.spiral-ring::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    top: 5px;
    left: 5px;
    border-radius: 50%;
    background-color: transparent; /* Make it a hole */
    box-shadow: inset 0px 0px 4px rgba(0,0,0,0.9);
    border: 1px solid #777;
}

/* Stacked page binding styling */
.stacked-page-binding {
    position: absolute;
    left: -25px; /* Match main spiral binding position */
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    /* Apply same perspective as the parent stacked page */
    transform-origin: left center;
}

/* Notebook holes (binder punches) - make consistent across pages */
.notebook-holes::before,
.notebook-holes::after,
.notebook-holes .hole-top,
.notebook-holes .hole-bottom {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: transparent;
    border-radius: 50%;
    border: 1px solid #999;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
    z-index: 5;
    left: 25px; /* Consistent with margin line (which is at 50px) */
}

.notebook-holes::before {
    top: 120px;
}

.notebook-holes::after {
    top: 580px;
}

.notebook-holes .hole-top {
    top: 250px;
}

.notebook-holes .hole-bottom {
    top: 450px;
}

/* Add notebook binding holes to stacked pages at same positions */
.stacked-page-holes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
}

.stacked-page-holes::before,
.stacked-page-holes::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: transparent;
    border-radius: 50%;
    border: 1px solid #999;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
    opacity: 0.7;
    left: 25px;
}

.stacked-page-holes::before {
    top: 120px;
}

.stacked-page-holes::after {
    top: 580px;
}

.stacked-page-holes .hole-top,
.stacked-page-holes .hole-bottom {
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: transparent;
    border-radius: 50%;
    border: 1px solid #999;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
    opacity: 0.7;
    left: 25px;
}

.stacked-page-holes .hole-top {
    top: 250px;
}

.stacked-page-holes .hole-bottom {
    top: 450px;
}

/* Word display */
#word-spaces {
    font-size: 46px;
    letter-spacing: 18px;
    margin: 125px 0 20px;
    text-align: center;
    z-index: 2;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    position: relative;
    line-height: 1.5;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.word-line {
    min-height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-line .hyphen {
    display: inline-block;
    margin-left: 5px;
    color: #000;
    font-weight: bold;
}

#word-spaces span {
    position: relative;
    display: inline-block;
    width: 40px;
    text-align: center;
    padding-bottom: 10px;
}

#word-spaces span.space {
    width: 20px;
    background: none;
}

#word-spaces span:empty::after {
    content: '_';
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
}

/* Keyboard styling */
#keyboard {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 5;
}

.keyboard-row {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.key {
    width: 35px;
    height: 35px;
    font-size: 18px;
    background-color: #fff;
    border: 1px solid #999;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

.key:hover {
    background-color: #f0f0f0;
}

.key.used {
    opacity: 0.5;
    cursor: not-allowed;
}

.key.correct {
    background-color: #c8e6c9;
}

.key.wrong {
    background-color: #ffcdd2;
}

/* Word container */
#word-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 3;
}

/* Game controls */
.game-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;  /* Reset margin */
    z-index: 20;
    position: absolute;  /* Position absolutely */
    right: 10px;  /* Add some right padding */
    top: -30px;
}

.difficulty-dropdown,
.category-dropdown {
    background-color: #fff;
    color: #000;
    border: 1px solid #999;
    padding: 5px 10px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    height: 34px;
    line-height: 20px;
    vertical-align: middle;
}

.difficulty-dropdown:hover,
.category-dropdown:hover {
    background-color: #ddd;
}

#new-game,
#reveal-letter {
    background-color: #fff;
    color: #000;
    border: 1px solid #999;
    padding: 5px 15px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    height: 34px;
    line-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;  /* Reset any margins */
}

#new-game:hover,
#reveal-letter:hover {
    background-color: #ddd;
}

#new-game:disabled,
#reveal-letter:disabled {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

#new-game:disabled:hover,
#reveal-letter:disabled:hover {
    background-color: #f0f0f0;
}

#message-display {
    font-size: 18px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #333;
    height: 25px;
    text-align: center;
}

/* Game content */
.game-content {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.word-stats {
    text-align: center;
    font-family: 'Courier New', monospace;
    color: #666;
    font-size: 0.8em;
    padding: 5px;
    border-top: 1px dashed #ccc;
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.45);
    z-index: 100;
    width: 1000px;  /* Match the notebook width */
    max-width: 95%;  /* Ensure responsiveness */
    margin: 0 auto;
}

.word-stats p {
    margin: 5px 0;
    line-height: 1.4;
}

.word-stats a {
    color: #444;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid #ccc;
    font-weight: bold;
    display: inline-block;
    margin-left: 5px;
}

.word-stats a:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: #000;
    border-color: #666;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.word-stats a:active {
    transform: translateY(0);
    box-shadow: none;
}

.word-hint {
    position: absolute;
    top: 60px; /* Position it below the wrong letters which is at top: 20px */
    left: 90px; /* Match the wrong-letters left position */
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    color: #666;
    padding: 10px;
    text-align: left;
    font-style: italic;
    display: none; /* Hidden by default */
    z-index: 2; /* Same z-index as wrong-letters */
}

/* Streak counter styling */
.streak-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 5px;
    border: 2px solid #000;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.streak-counter span {
    color: #ff0000;
    font-weight: bold;
} 