/* Mahjong Solitaire Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #007f6a;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Start Screen Overlay */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 80, 70, 0.98) 0%, rgba(0, 40, 35, 0.98) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

.start-screen.hidden {
    display: none !important;
    pointer-events: none !important;
}

.petals-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.start-content {
    text-align: center;
    animation: slideUp 0.5s ease;
    position: relative;
    z-index: 1;
}

.start-logo {
    width: 400px;
    height: auto;
    margin-bottom: 30px;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.7));
    animation: logoFloat 3s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-logo:hover {
    filter: drop-shadow(0 15px 40px rgba(255, 215, 0, 0.6)) brightness(1.15);
    transform: translateY(-5px) scale(1.05);
    animation: none;
}

.start-logo:active {
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.7));
    transform: translateY(0px) scale(0.98);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.start-hint {
    color: #FFD700;
    font-size: 1.2em;
    margin-top: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: 1px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Rotation Notification for Mobile Portrait */
.rotation-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.rotation-notification.show {
    display: flex;
}

.rotation-content {
    text-align: center;
    padding: 40px;
    background: rgba(0, 127, 106, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease;
}

.rotation-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: rotateDevice 2s ease-in-out infinite;
}

.rotation-content p {
    font-size: 1.3em;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
}

@keyframes rotateDevice {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(90deg);
    }
}

.start-content h1 {
    font-size: 3em;
    color: #FFD700;
    margin-bottom: 30px;
    text-shadow:
        3px 3px 6px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
}

.start-button-sprite {
    height: 100px;
    width: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.5));
}

.start-button-sprite:hover {
    transform: scale(1.08) translateY(-3px);
    filter: drop-shadow(0 8px 20px rgba(255, 215, 0, 0.4)) brightness(1.1);
}

.start-button-sprite:active {
    transform: scale(0.98) translateY(1px);
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border-radius: 10px;
    padding: 5px 15px;
    margin-bottom: 5px;
}

.stats-bar {
    display: flex;
    gap: 15px;
    align-items: center;
}

.top-buttons {
    display: flex;
    gap: 5px;
}

.game-area {
    flex: 1;
    display: flex;
    min-height: 800px;
}

.canvas-container {
    flex: 1;
    background: transparent;
    border-radius: 10px;
    padding: 20px;
    position: relative;
    overflow: visible;
    min-height: 800px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    background: transparent;
    max-width: 100%;
    height: auto;
}

.sidebar {
    display: none;
}

.panel {
    display: none;
}

.stats-grid {
    display: none;
}

.stat-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #FFD700;
}

.controls {
    display: none;
}

/* Button sprite styling */
.button-sprite {
    height: 80px;
    width: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.button-sprite:hover:not(.disabled) {
    transform: scale(1.05) translateY(-2px);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.button-sprite:active:not(.disabled) {
    transform: scale(0.95) translateY(1px);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.button-sprite.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.hint-button {
    position: absolute;
    bottom: 250px;
    right: 10px;
    height: 85px;
    z-index: 100;
}

/* Button sprites - no additional styling needed, handled by .button-sprite class */

.message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px 50px;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
}

.message.success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #1e3c28;
}

.message.error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.message.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.rules {
    display: none;
}

/* Responsive design */
@media (max-width: 1024px) {
    .top-bar {
        flex-direction: column;
        gap: 15px;
    }

    .stats-bar {
        gap: 20px;
    }

    .top-buttons {
        width: 100%;
        justify-content: center;
    }

    .start-logo {
        width: 280px;
    }

    .start-hint {
        font-size: 1.1em;
    }
}

@media (max-width: 768px) {
    .stats-bar {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .stat-item {
        width: 100%;
        justify-content: space-between;
    }

    .top-buttons {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .top-buttons .button-sprite {
        height: 60px;
        width: auto;
    }

    .canvas-container {
        padding: 10px;
        min-height: auto;
    }

    .game-area {
        min-height: auto;
    }

    .hint-button {
        bottom: 10px;
        right: 10px;
        height: 70px;
    }

    .start-logo {
        width: 220px;
    }

    .start-hint {
        font-size: 1em;
    }

    .start-content h1 {
        font-size: 2.2em;
    }
}

@media (max-width: 480px) {
    .top-buttons .button-sprite {
        height: 50px;
    }

    .hint-button {
        height: 60px;
    }

    .stat-label {
        font-size: 0.75em;
    }

    .stat-value {
        font-size: 1.1em;
    }
}

/* Shake animation for error feedback */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

/* How To Modal */
.howto-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    overflow: auto;
}

.howto-content {
    background: linear-gradient(135deg, #007f6a 0%, #005f50 100%);
    border: 3px solid #FFD700;
    border-radius: 15px;
    padding: 30px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    margin: 20px;
}

.howto-close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 35px;
    font-weight: bold;
    color: #FFD700;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
}

.howto-close:hover {
    color: #FFF;
    transform: scale(1.2);
}

.howto-content h2 {
    color: #FFD700;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.howto-content h3 {
    color: #FFD700;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3em;
    border-bottom: 2px solid #FFD700;
    padding-bottom: 5px;
}

.howto-body {
    color: #FFF;
    line-height: 1.6;
}

.howto-body p {
    margin-bottom: 15px;
}

.howto-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.howto-body li {
    margin-bottom: 8px;
}

.howto-body strong {
    color: #FFD700;
}

.howto-tip {
    background: rgba(255, 215, 0, 0.1);
    border-left: 4px solid #FFD700;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
}

/* Scrollbar styling for modal */
.howto-content::-webkit-scrollbar {
    width: 8px;
}

.howto-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.howto-content::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 10px;
}

.howto-content::-webkit-scrollbar-thumb:hover {
    background: #FFF;
}

/* Tile Sets Display */
.tile-sets {
    margin: 20px 0;
}

.tile-set {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.tile-set-name {
    color: #FFD700;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.tile-examples {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.tile-examples img {
    width: 60px;
    height: auto;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    background: #FFFEF0;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.tile-examples img:hover {
    transform: scale(1.1);
    border-color: #FFD700;
}

.tile-note {
    text-align: center;
    font-size: 0.85em;
    color: #FFA500;
    font-style: italic;
    margin-top: 8px;
}

/* Responsive adjustments for tile sets */
@media (max-width: 768px) {
    .tile-examples img {
        width: 50px;
    }

    .howto-content {
        max-width: 95vw;
        padding: 20px;
    }

    .tile-set {
        padding: 10px;
    }
}

/* SEO Content Section */
.seo-content {
    background: linear-gradient(135deg, #006b5a 0%, #004d40 100%);
    color: #ffffff;
    padding: 60px 20px;
    margin-top: 40px;
}

.seo-container {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.seo-content h2 {
    color: #FFD700;
    font-size: 2.2em;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.seo-content h3 {
    color: #FFA500;
    font-size: 1.6em;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 8px;
}

.seo-content p {
    margin-bottom: 15px;
    font-size: 1.05em;
}

.seo-content strong {
    color: #FFD700;
    font-weight: 600;
}

.seo-content ul, .seo-content ol {
    margin: 15px 0 15px 30px;
}

.seo-content li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.tile-list {
    list-style: none;
    margin-left: 0 !important;
}

.tile-list li {
    padding: 15px;
    background: rgba(255, 215, 0, 0.08);
    border-left: 4px solid #FFD700;
    margin-bottom: 15px;
    border-radius: 4px;
}

.tile-category {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tile-info {
    flex: 1;
}

.tile-images {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.tile-images img {
    width: 50px;
    height: auto;
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 4px;
    background: #FFFEF0;
    padding: 3px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.tile-images img:hover {
    transform: scale(1.15);
    border-color: #FFD700;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

.cta-text {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 165, 0, 0.15);
    border: 2px solid #FFA500;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
}

/* Read More Button in Modal */
.read-more-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin: 20px auto;
    display: block;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
    transition: all 0.3s ease;
}

.read-more-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.5);
}

.read-more-btn:active {
    transform: scale(0.98);
}

/* Expanded Guide Content */
.expanded-guide {
    display: none;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.expanded-guide.show {
    display: block;
    animation: fadeInDown 0.4s ease;
}

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

.guide-section {
    margin-bottom: 25px;
}

.guide-section h4 {
    color: #FFD700;
    font-size: 1.2em;
    margin-bottom: 10px;
    margin-top: 20px;
}

.guide-section ul {
    margin-left: 20px;
}

.guide-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Responsive SEO Content */
@media (max-width: 768px) {
    .seo-content {
        padding: 40px 15px;
    }

    .seo-content h2 {
        font-size: 1.8em;
    }

    .seo-content h3 {
        font-size: 1.3em;
    }

    .seo-content p, .seo-content li {
        font-size: 1em;
    }

    .tile-images img {
        width: 42px;
    }

    .tile-list li {
        padding: 12px;
    }
}

/* Navigation Links */
.nav-link-home:hover,
.nav-link-games:hover {
    background: rgba(45, 80, 22, 1) !important;
    border-color: rgba(139, 195, 74, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .nav-link-home,
    .nav-link-games {
        padding: 10px 16px !important;
        font-size: 12px !important;
        bottom: 15px !important;
    }

    .nav-link-home {
        left: 10px !important;
    }

    .nav-link-games {
        right: 10px !important;
    }
}
