/* Word Games - Responsive No-Scroll Layout */

* {
    box-sizing: border-box;
}

/* Hide turnkey hosting credit */
#turnkey-credit {
    display: none !important;
}

/* Prevent iOS bounce/scroll issues */
html, body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Full viewport game container */
.word-game-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    /* Fallback for older browsers */
    height: 100vh;
    /* iOS Safari fix */
    height: -webkit-fill-available;
    /* Modern browsers - dynamic viewport height accounts for browser chrome */
    height: 100dvh;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    z-index: 9999;
    /* Ensure content doesn't go behind iOS home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Minimal header */
.game-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    height: 50px;
    position: relative;
    z-index: 1000;
}

.game-header__left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.game-header__back:hover {
    background: #f0f0f0;
    color: #333;
}

.game-header__back svg {
    width: 20px;
    height: 20px;
}

.game-header__title {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.game-header__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: -2px;
}

/* Account Button */
.account-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.account-btn .account-level {
    font-size: 0.65rem;
    font-weight: 700;
    color: #6366f1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    min-width: 32px;
    text-align: center;
}

.account-btn .account-level:empty {
    display: none;
}

.game-header__btn {
    background: none;
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    color: #666;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-header__btn:hover {
    background: #f0f0f0;
    color: #333;
}

.game-header__btn svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Main game area - fills remaining space */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 1rem;
    min-height: 0;
}

/* Game Hub / Archive Styles */
.game-hub-wrapper {
    min-height: 100vh;
    background: #fafafa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.game-hub-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 2rem 1rem;
    text-align: center;
}

.game-hub-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #111;
    margin: 0 0 0.5rem 0;
}

.game-hub-header p {
    color: #666;
    margin: 0;
    font-size: 1rem;
}

.game-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Game Card - Apple TV style 3D effect */
.game-card,
.game-card:link,
.game-card:visited,
.game-card:hover,
.game-card:active,
.game-card:focus {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none !important;
    color: #111 !important;
    display: block;
    border: 1px solid #e5e5e5;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    outline: none;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
                box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    will-change: transform, box-shadow;
    position: relative;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0,0,0,0.15),
        0 10px 20px rgba(0,0,0,0.1),
        0 0 0 1px rgba(0,0,0,0.05);
}

.game-card:active {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 10px 20px rgba(0,0,0,0.12),
        0 5px 10px rgba(0,0,0,0.08);
    transition-duration: 0.1s;
}

.game-card:focus {
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.5),
        0 20px 40px rgba(0,0,0,0.15);
}

/* Shine effect on hover */
.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(255,255,255,0.1) 50%,
        transparent 100%
    );
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.game-card:hover::before {
    left: 100%;
}

.game-card__image {
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: none;
}

.game-card:hover .game-card__image {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.game-card__icon {
    font-size: 3rem;
}

.game-card__content {
    padding: 1.25rem;
}

.game-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111;
    margin: 0 0 0.5rem 0;
}

.game-card__desc {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.game-card__play {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff !important;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.game-card__play svg {
    stroke: #fff;
}

/* Override Ohio theme link underline animation */
.game-hub-grid .game-card:hover,
.game-hub-grid .game-card.-dashed,
.links-underline .game-card:hover,
.links-underline .game-card.-dashed {
    background-image: none !important;
    animation: none !important;
}

.game-card:hover {
    background-image: none !important;
}

/* Modal/Overlay styles - z-index 50000 to ensure modals are above all game overlays */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.game-modal.active {
    opacity: 1;
    visibility: visible;
}

.game-modal__content {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.game-modal.active .game-modal__content {
    transform: scale(1);
}

.game-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

/* Toast notifications */
.game-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: calc(100% - 2rem);
    max-width: 400px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
    z-index: 10001;
    border: 2px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .game-header {
        padding: 0.5rem 0.75rem;
        height: 50px;
    }

    .game-header__title {
        font-size: 1rem;
    }

    .game-container {
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .game-hub-grid {
        padding: 1rem;
        gap: 1rem;
    }

    .game-hub-header {
        padding: 1.5rem 1rem;
    }

    .game-hub-header h1 {
        font-size: 1.5rem;
    }
}

/* Landscape phone optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .game-header {
        height: 44px;
        padding: 0.25rem 0.75rem;
    }

    .game-container {
        flex-direction: row;
        padding: 0.5rem;
    }
}

/* Dark mode - matches device theme */
@media (prefers-color-scheme: dark) {
    .word-game-wrapper {
        background: #0f0f0f;
    }

    .game-header {
        background: #1a1a2e;
        border-bottom-color: #2d2d44;
    }

    .game-header__title {
        color: #f0f0f0;
    }

    .game-header__back {
        color: #9ca3af;
    }

    .game-header__back:hover {
        background: #2d2d44;
        color: #f0f0f0;
    }

    .game-header__btn {
        color: #9ca3af;
    }

    .game-header__btn:hover {
        background: #2d2d44;
        color: #f0f0f0;
    }

    .account-btn .account-level {
        color: #a5b4fc;
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
        border-color: rgba(99, 102, 241, 0.4);
    }

    .game-modal {
        background: rgba(0, 0, 0, 0.7);
    }

    .game-toast {
        background: #2d2d44;
        color: #f0f0f0;
    }

    /* Game hub dark mode */
    .game-hub-wrapper {
        background: #0f0f0f;
    }

    .game-hub-header {
        background: #1a1a2e;
        border-bottom-color: #2d2d44;
    }

    .game-hub-header h1 {
        color: #f0f0f0;
    }

    .game-hub-header p {
        color: #9ca3af;
    }

    .game-card,
    .game-card:link,
    .game-card:visited,
    .game-card:hover,
    .game-card:active,
    .game-card:focus {
        background: #1a1a2e;
        border-color: #2d2d44;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        color: #f0f0f0 !important;
        text-decoration: none !important;
    }

    .game-card:hover {
        box-shadow:
            0 20px 40px rgba(0,0,0,0.4),
            0 10px 20px rgba(0,0,0,0.3),
            0 0 0 1px rgba(255,255,255,0.05);
    }

    .game-card:active {
        box-shadow:
            0 10px 20px rgba(0,0,0,0.35),
            0 5px 10px rgba(0,0,0,0.25);
    }

    .game-card:focus {
        box-shadow:
            0 0 0 3px rgba(59, 130, 246, 0.5),
            0 20px 40px rgba(0,0,0,0.4);
    }

    .game-card::before {
        background: linear-gradient(
            120deg,
            transparent 0%,
            rgba(255,255,255,0.05) 50%,
            transparent 100%
        );
    }

    .game-card__image {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    }

    .game-card__title {
        color: #f0f0f0;
    }

    .game-card__desc {
        color: #9ca3af;
    }

    .game-card__play {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    }
}
