/* Local Font Declarations */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/inter-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/inter-medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/inter-semibold.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/inter-bold.woff2') format('woff2');
}

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: white;
    --game-bg: #FAA6A4;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #333;
    --hover-bg: rgba(0, 0, 0, 0.05);
    --button-bg: #f0f0f0;
    --button-hover: #e8e8e8;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --dot-fill: #fff;
    --dot-selected: #333;
    --line-color: #FAA6A4;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --game-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b8b8b8;
    --border-color: #2F3246;
    --hover-bg: rgba(255, 255, 255, 0.08);
    --button-bg: #383838;
    --button-hover: #454545;
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --dot-fill: #2d2d2d;
    --dot-selected: #ffffff;
    --line-color: #ff8c94;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.game-header {
    width: 100%;
    padding: 12px 0;
    background: var(--bg-secondary);
    position: relative;
    margin: 0;
    z-index: 10;
}

@media (max-width: 768px) {
    .game-header {
        margin: 0;
        padding-top: 12px;
        width: 100%;
    }
    
    body {
        margin-top: 0;
        padding-top: 0!important;
    }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dark-mode-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.dark-mode-btn:hover {
    background-color: var(--hover-bg);
}

.yesterday-link {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.yesterday-link:hover {
    background-color: var(--hover-bg);
}

.yesterday-link svg {
    width: 24px;
    height: 24px;
}

.help-btn {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.help-btn:hover {
    opacity: 0.7;
}

/* Mode Switcher Button */
.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--button-bg);
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.mode-btn:hover {
    background-color: var(--button-hover);
}

.mode-chevron {
    transition: transform 0.4s ease;
}

.mode-btn.active .mode-chevron {
    transform: rotate(180deg);
}

/* Mode Popup */
.mode-popup {
    display: none;
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 200px;
    overflow: hidden;
    margin-top: 5px;
}

.mode-popup.show {
    display: block;
}

.mode-popup-content {
    padding: 8px 0;
}

.mode-option {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 16px;
    color: var(--text-primary);
}

.mode-option:hover {
    background-color: var(--hover-bg);
}

.mode-option.selected {
    background-color: var(--button-bg);
    font-weight: 600;
}

.mode-title {
    font-weight: 500;
}

.mode-option.selected .mode-title {
    font-weight: 600;
}


body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    padding: 0;
    padding-top: 0;
    touch-action: manipulation;
    margin: 0;
    margin-top: 0;
    position: relative;
    transition: background-color 0.3s ease;
    overflow-x: hidden;
}

.game-container {
    background: var(--game-bg);
    border-radius: 0;
    padding: 40px;
    width: 100%;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.game-layout {
    display: flex;
    align-items: flex-start;
    gap: 150px;  /* Increased gap for more spacing */
    width: 100%;
    padding-top: 0;
    justify-content: center;
    flex: 1;
}

.word-section {
    width: 350px;  /* Fixed width instead of flex: 1 */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 300px;
    padding-top: 30px; /* Reduced from 50px */
    position: relative;
}

.canvas-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 400px;  /* Match canvas width for proper alignment */
    margin-left: 50px;  /* Additional margin to ensure spacing */
}

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

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: transparent;
    cursor: default;
    touch-action: pan-y;
    width: 400px !important;
    height: 400px !important;
    image-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.game-btn {
    padding: 14px 32px;
    font-size: 18px;
    font-weight: 500;
    border: 2px solid #333;
    border-radius: 25px;
    background: white;
    color: #333;
    cursor: pointer;
    outline: none;
    position: relative;
}

.game-btn:hover {
    background: #FAA6A4;
    color: #fff;
}

.game-btn:active {
    background: #FAA6A4;
    color: #fff;
}

.game-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

#restartBtn {
    border-color: #666;
}

#deleteBtn {
    border-color: #666;
}

#enterBtn {
    border-color: #333;
    background: #333;
    color: white;
}

#enterBtn:hover {
    background: #333;
    color: white;
}

#enterBtn:active {
    background: #333;
    color: white;
}

.word-display {
    text-align: center;
    font-size: 40px;  /* Slightly larger (was 36px) */
    font-weight: bold;
    color: var(--text-primary);
    letter-spacing: 0;  /* No letter spacing */
    min-height: 80px;
    padding: 20px 0 10px 0;
    margin-bottom: 20px;
    width: 580px; /* 450px + 20% on each side (90px * 2) */
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-display span {
    color: inherit;
}

.word-display::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 90px; /* 20% inset from left */
    right: 90px; /* 20% inset from right */
    height: 4px; /* Increased thickness */
    background: var(--border-color);
}

.blinking-cursor {
    display: inline-block;
    color: var(--text-primary);
    font-weight: 300; /* Thicker cursor */
    font-size: 36px;
    animation: blink 1s infinite;
    margin-left: 2px;
    transform: scaleX(1.8); /* Make cursor wider */
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.success-popup {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: black;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

.success-popup.show {
    opacity: 1;
    visibility: visible;
}

.message {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
}

.message.error {
    background: #333;
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
}

.message.success {
    color: #4caf50;
}

.message:empty {
    display: none;
}

/* Completion Modal */
.completion-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.completion-modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    position: relative;
    min-width: 400px;
    max-width: 90%;
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 36px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

#solutionCanvas {
    display: block;
    margin: 0 auto 30px;
    width: 200px !important;
    height: 200px !important;
    image-rendering: auto;
}

.modal-content h2 {
    font-size: 42px;
    margin: 0 0 30px 0;
    color: #333;
    font-weight: bold;
}

.play-again-btn {
    background: var(--text-primary);
    color: var(--bg-secondary);
    border: none;
    border-radius: 30px;
    padding: 18px 60px;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.play-again-btn:hover {
    background: #555;
}

/* Yesterday's Puzzle Modal */
.yesterday-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.yesterday-modal.show {
    display: flex;
}

.yesterday-modal-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.yesterday-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.yesterday-close:hover {
    color: #333;
}

.yesterday-modal-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--text-primary);
}

.yesterday-solution-text {
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-weight: 500;
}

#yesterdayCanvas {
    max-width: 100%;
    height: auto;
    width: 400px !important;
    height: 400px !important;
    image-rendering: auto;
}

@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
        gap: 10px; /* Reduced from 30px for less space between elements */
        padding: 10px 10px 0 10px; /* Add horizontal padding for content */
    }
    
    .word-section {
        width: 100%;
        align-items: center;
        padding-top: 0;
        display: flex;
        flex-direction: column;
    }
    
    /* On mobile, message goes below word display */
    .word-section .message {
        top: auto;
        bottom: 0px;
    }
    
    .word-display {
        text-align: center;
        font-size: 32px;  /* Slightly larger (was 28px) */
        letter-spacing: 0;  /* No letter spacing */
        padding: 15px 0 8px 0;
        width: 90vw; /* Use viewport width for proper centering */
        max-width: 490px; /* 350px + 20% on each side (70px * 2) */
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 auto;
    }
    
    .word-display::after {
        left: 70px; /* Adjust for mobile */
        right: 70px;
        height: 3px; /* Keep consistent thickness on mobile */
    }
    
    .blinking-cursor {
        font-size: 32px;  /* Match the word-display font size */
        font-weight: 300;
        transform: scaleX(1.6); /* Slightly less wide on mobile */
    }
    
    .canvas-section {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-left: 0;  /* Remove margin on mobile */
    }
    
    .game-container {
        padding: 10px;
        width: 100%;
    }
    
    .game-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .button-container {
        gap: 15px;
    }
    
    body {
        padding: 0;
    }
}

@media (hover: none) {
    .game-btn:hover {
        background: white;
        transform: none;
    }
    
    #enterBtn:hover {
        background: #333;
    }
}

/* Submitted Words Display */
.submitted-words {
    text-align: center;
    margin-top: 30px;
    color: var(--text-primary);
    min-height: 50px;
}

.word-count {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.word-list {
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 2px;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 100%;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .submitted-words {
        margin-top: 20px;
    }
    
    .word-count {
        font-size: 12px;
    }
    
    .word-list {
        font-size: 20px;
        letter-spacing: 1.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Landing Page Styles */
.landing-content {
    width: 100%;
    margin-top: 60px;
    background: white;
    color: #333;
}

[data-theme="dark"] .landing-content {
    background: #1a1a1a;
    color: #e0e0e0;
}

.landing-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.intro-section {
    margin-bottom: 50px;
    text-align: center;
}

.intro-section h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.intro-section p {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

[data-theme="dark"] .intro-section p {
    color: #b8b8b8;
}

.how-to-play {
    background: #F4F7FB;
    padding: 50px 20px;
    margin-bottom: 50px;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

[data-theme="dark"] .how-to-play {
    background: #1a1a1a;
}

.how-to-play h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
}

.step {
    max-width: 760px;
    margin: 0 auto 40px;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
}

[data-theme="dark"] .step {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.step-number {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.step-number svg {
    width: 100%;
    height: 100%;
}

.step-content {
    width: 100%;
}

.step-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
    text-align: center;
}

.step-content p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
    
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] .step-content p {
    color: #b8b8b8;
}

.example-grid {
    min-height: 200px;
    border-radius: 8px;
    max-width: 530px;
    margin: auto auto;
    margin-top: 15px;

}
.example-grid img {
    
    border-radius: 9px;
    background: #fff;
    padding: 7px;
    max-width: -webkit-fill-available;
    max-height: 100%;
}

[data-theme="dark"] .example-grid {
    background: #1a1a1a;
    border-color: #444;
}


.faq-section {
    margin-bottom: 50px;
}

.faq-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
}

.faq-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7f7f7;
    border-radius: 8px;
}

[data-theme="dark"] .faq-item {
    background: #2d2d2d;
}

.faq-item h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.faq-item h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 15px 0 10px;
    color: var(--text-primary);
}

.faq-item p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 10px;
}

[data-theme="dark"] .faq-item p {
    color: #b8b8b8;
}

.faq-item ul {
    margin: 10px 0;
    padding-left: 20px;
}

.faq-item li {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 5px;
}

[data-theme="dark"] .faq-item li {
    color: #b8b8b8;
}

.link {
    color: #faa6a4;
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .link {
    color: #ff8c94;
}

.about-section {
    text-align: center;
}

.about-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.about-section p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
}

[data-theme="dark"] .about-section p {
    color: #b8b8b8;
}

/* Rating Section */
.rating-section {
    text-align: center;
    padding: 50px 20px;
    margin-top: 50px;
}

.rating-section .rate-text {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.rating-container {
    max-width: 400px;
    margin: 0 auto;
}

.star-rating {
    font-size: 40px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.star {
    cursor: pointer;
    display: inline-block;
    width: 40px;
    height: 40px;
    transition: transform 0.2s;
    user-select: none;
}

.star:hover {
    transform: scale(1.1);
}

.star svg {
    width: 100%;
    height: 100%;
}

.star .star-fill {
    transition: fill 0.2s;
    fill: #ddd;
}

.star.filled .star-fill {
    fill: #fa1228;
}

[data-theme="dark"] .star .star-fill {
    fill: #444;
}

[data-theme="dark"] .star.filled .star-fill {
    fill: #ff5555;
}

.rating-score {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.rating-votes {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Footer */
.site-footer {
    background: #f8f8f8;
    padding: 30px 20px;
    margin-top: 0;
    border-top: 1px solid #e0e0e0;
}

[data-theme="dark"] .site-footer {
    background: #1a1a1a;
    border-top: 1px solid #333;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.footer-logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.footer-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

[data-theme="dark"] .footer-title {
    color: #fff;
}

.footer-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.footer-text {
    color: #333;
}

[data-theme="dark"] .footer-text {
    color: #b8b8b8;
}

.footer-link {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.2s;
}

.footer-link:hover {
    opacity: 0.7;
}

[data-theme="dark"] .footer-link {
    color: #b8b8b8;
}

.footer-separator {
    color: #333;
    font-size: 14px;
}

[data-theme="dark"] .footer-separator {
    color: #b8b8b8;
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-wrap: wrap;
        text-align: center;
    }
    
    .rating-section {
        padding: 40px 15px;
    }
    
    .star-rating {
        font-size: 36px;
    }
    
    .rating-score {
        font-size: 24px;
    }
}

/* Mobile responsive for landing page */
@media (max-width: 768px) {
    .landing-content {
        margin-top: 40px;
        margin-left: 0;
        margin-right: 0;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
    }
    
    .landing-container {
        padding: 20px 0;
    }
    
    .intro-section h1 {
        font-size: 24px;
    }
    
    .how-to-play h2,
    .faq-section h2,
    .about-section h2 {
        font-size: 20px;
    }
    
    .how-to-play {
        width: calc(100% + 30px);
        padding: 40px 15px;
        margin: 0 -15px 40px -15px;
        position: static;
        left: auto;
        right: auto;
    }
    
    .step {
        padding: 20px;
        margin: 0 auto 30px;
        max-width: 100%;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        margin: 0 auto 15px;
    }
    
    .step-content h3 {
        font-size: 16px;
    }
    
    .faq-item {
        padding: 15px;
        margin-left: 15px;
        margin-right: 15px;
    }
    
    .intro-section,
    .how-to-play,
    .faq-section,
    .about-section {
        padding: 0 15px;
    }
}