/**
 * RUIN Game - Game-Specific Styles (Unified Mode)
 * Styles for unified move/cut game mechanics
 */

/* ==========================================
   GAME INSTRUCTIONS
   ========================================== */

/* Container for game controls (instructions + toolbar) */
.game-controls-container {
    width: 100%;
    margin-bottom: 16px;
}

.game-instructions {
    font-size: 16px;
    color: var(--color-text, #333);
    font-style: italic;
    margin: 16px 8px 8px auto;
    padding: 12px 24px 12px 24px;
    padding-right: 52px;
    background: #E8E8D1;
    border: none;
    border-radius: 48px 8px 48px 48px; 
    text-align: right;
    max-width: fit-content;
    box-shadow: none;
    transition: all 0.3s ease;
    position: relative;
    display: block;
}

/* Add cursor pointer icon on the right - updated for dark text */
.game-instructions::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z'/%3E%3Cpath d='M13 13l6 6'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.6;
}

/* ==========================================
   EDITING TOOLBAR
   ========================================== */

.editing-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
    padding: 0;
    background: transparent;
    border: none;
    justify-content: center;
    clear: both; /* Ensure toolbar clears any floats */
}

.edit-btn {
    background: var(--color-secondary, #B65F2E);
    color: #fff;
    border: 4px solid #000 !important;
    padding: 10px 20px;
    font-family: 'PT Serif', Georgia, serif;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none !important;
    box-shadow: none;
}

.edit-btn:hover:not(:disabled) {
    background: var(--color-secondary-hover, #9F5428);
    border-color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 0 #000;
}

.edit-btn:focus,
.edit-btn:focus-visible {
    background: var(--color-secondary, #B65F2E);
    border-color: #000 !important;
    outline: none !important;
    box-shadow: none !important;
}

.edit-btn:active:not(:disabled),
.edit-btn:focus:active:not(:disabled) {
    background: var(--color-secondary-hover, #9F5428);
    border-color: #000 !important;
    transform: translateY(0);
    box-shadow: none !important;
    outline: none !important;
}

.edit-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

/* Additional disabled state styling */
.edit-btn.disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
    pointer-events: none;
}

/* Cut button - active state when in cut mode */
.edit-btn.cut-mode-active {
    background: var(--color-background-cutting, #762E2F);
    border-color: #000 !important;
}

.edit-btn.cut-mode-active:hover {
    background: #5a2223;
    border-color: #000 !important;
}

/* Variants button - pill shaped, dark red */
.edit-btn-variants {
    background: var(--color-background-cutting, #762E2F);
    border: 4px solid #000 !important;
    border-radius: 50px;
    padding: 10px 24px;
}

.edit-btn-variants:hover:not(:disabled) {
    background: #5a2223;
    border-color: #000 !important;
}

.edit-btn-variants:focus,
.edit-btn-variants:focus-visible {
    background: var(--color-background-cutting, #762E2F);
    border-color: #000 !important;
    outline: none !important;
    box-shadow: none !important;
}

.edit-btn-variants:active:not(:disabled),
.edit-btn-variants:focus:active:not(:disabled) {
    background: #5a2223;
    border-color: #000 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ==========================================
   WORD CARDS
   ========================================== */

.word-bank-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Selected word card - GREEN/TEAL */
.word-selected {
    background: var(--color-primary, #2E7674) !important;
    border: 4px solid #000 !important;
    box-shadow: 4px 4px 0 0 #000;
    transform: translateY(-2px);
}

/* Word cards container - remove default border */
#word-cards {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
}

/* Locked word cards - when another word is selected */
.word-locked {
    background: var(--color-background-inverse, #202020) !important;
    color: var(--color-text-inverse, #F0F0E0) !important;
    border: 6px solid var(--color-border-strong, #202020) !important;
    cursor: pointer;
    /* NO OPACITY - cards stay full opacity per spec */
}

.word-locked:hover {
    box-shadow: 2px 2px 0 0 #000;
    transform: translateY(-1px);
}

/* Fully locked - after game completed, not clickable */
.word-locked-final {
    background: var(--color-background-inverse, #202020) !important;
    color: var(--color-text-inverse, #F0F0E0) !important;
    border: 6px solid var(--color-border-strong, #202020) !important;
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.loading-text {
    color: #999;
    font-style: italic;
}

/* ==========================================
   PASSAGE WORD STATES
   ========================================== */

/* Placed word - the user's selected word in the phrase */
.word-placed {
    background: #1D7062;
    color: #fff;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: bold;
    box-shadow: 2px 2px 0 0 rgba(0,0,0,0.3);
    display: inline-block;
    transition: all 0.15s ease;
}

/* Cuttable word - original passage word in cut mode */
.word-cuttable {
    cursor: pointer;
    padding: 2px 4px;
    margin: 0 -2px;
    border-radius: 2px;
    transition: all 0.15s ease;
    border-bottom: 2px dashed transparent;
}

.word-cuttable:hover {
    background: #fff;
    color: #A51919;
    text-decoration:line-through;
}

/* Animation for word movement */
@keyframes wordSlide {
    0% {
        transform: translateX(-10px);
        opacity: 0.7;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.word-placed.animate__animated {
    animation-duration: 0.2s !important;
}

/* ==========================================
   DONE BUTTON
   ========================================== */

#done-btn {
    width: 100%;
    display: block;
    margin-top: 16px;
}

#done-btn.word-locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: #666 !important;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-notification {
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-family: 'PT Serif', Georgia, serif;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* ==========================================
   VARIANTS MODAL
   ========================================== */

.variant-label {
    font-size: 16px;
    margin-bottom: 16px;
}

#modal-word-example {
    background: #1D7062;
    color: #fff;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: bold;
}

.word-alt-variants {
    text-transform: uppercase;
    color: #ddd;
    background-color: #333;
    min-width: 29%;
    display: inline-block;
    margin: 4px;
    cursor: pointer;
    border: 2px solid #000;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.word-alt-variants:hover {
    background-color: #B65F2E;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 0 #000;
}

/* ==========================================
   ALREADY PLAYED STATE
   ========================================== */

.already-played {
    text-align: center;
}

.already-played .result-text {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
}

.already-played hr {
    border-top: 2px dashed #ccc;
    margin: 20px 0;
}

/* ==========================================
   COMPLETION SCREEN STYLES
   ========================================== */

.completion-card {
    background: #fff;
    border: 3px solid #333;
    box-shadow: 6px 6px 0 0 #000;
    padding: 30px;
    margin: 20px 0;
}

.completion-result {
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.completion-original {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
}

.completion-source {
    font-size: 14px;
    color: #999;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.share-btn {
    background: #1D7062;
    color: #fff;
    border: 2px solid #000;
    padding: 10px 20px;
    font-family: 'PT Serif', Georgia, serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: #15584d;
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 0 #000;
}

.share-btn.secondary {
    background: #333;
}

.share-btn.secondary:hover {
    background: #222;
}

/* Stats display */
.stats-display {
    background: #f5f5f0;
    border: 2px solid #333;
    padding: 16px;
    margin: 20px 0;
}

.stats-display h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 12px;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-item {
    padding: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #B65F2E;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

/* Countdown timer */
.countdown-box {
    background: #222;
    color: #fff;
    padding: 16px;
    text-align: center;
    margin: 20px 0;
}

.countdown-label {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.countdown-time {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
}

.countdown-time span {
    background: #583019;
    padding: 4px 8px;
    margin: 0 2px;
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

/* Ensure proper spacing on tall screens */
.container-fluid {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container-fluid .row {
    flex: 1;
}

/* Push footer to bottom on tall screens */
#shop-section,
[include-html="_footer.html"] {
    margin-top: auto;
}

@media (max-width: 767px) {
    .editing-toolbar {
        justify-content: center;
    }
    
    .edit-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .game-instructions {
        font-size: 14px;
        margin: 12px auto;
        padding: 10px 20px;
    }
    
    .completion-result {
        font-size: 22px;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        text-align: center;
    }
    
    .stats-row {
        flex-wrap: wrap;
    }
    
    .stat-item {
        flex: 1 1 33%;
        min-width: 80px;
    }
    
    /* Make phrase more readable on mobile */
    #phrase {
        font-size: 18px;
        line-height: 1.6;
    }
    
    .word-placed {
        padding: 3px 7px;
    }
}

/* ==========================================
   PHASE INDICATORS
   ========================================== */

.phase-indicator {
    background: #f5f5f0;
    border: 2px solid #333;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.phase-icon {
    font-size: 24px;
}

.phase-text {
    flex: 1;
}

.phase-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 2px;
}

.phase-subtitle {
    font-size: 14px;
    color: #666;
}

/* ==========================================
   LEADERBOARD PREVIEW
   ========================================== */

.leaderboard-preview {
    margin: 20px 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #333;
    margin-bottom: 8px;
    background: #fff;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    transform: translateX(4px);
    box-shadow: 4px 4px 0 0 rgba(0,0,0,0.2);
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: bold;
    min-width: 40px;
    color: #B65F2E;
}

.leaderboard-content {
    flex: 1;
    margin: 0 12px;
}

.leaderboard-text {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.leaderboard-author {
    font-size: 14px;
    color: #666;
}

.leaderboard-votes {
    font-size: 18px;
    font-weight: bold;
    color: #1D7062;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

/* Fade animations for Animate.css integration */
.animate__fadeInUp {
    animation-name: fadeInUp;
    animation-duration: 0.3s;
}

.animate__fadeOutDown {
    animation-name: fadeOutDown;
    animation-duration: 0.3s;
}

.animate__pulse {
    animation-name: pulse;
}

.animate__faster {
    animation-duration: 0.2s !important;
}

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

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Delay classes for staggered animations - faster 50ms increments */
.word-card-delay-0 { animation-delay: 0ms; }
.word-card-delay-1 { animation-delay: 50ms; }
.word-card-delay-2 { animation-delay: 100ms; }
.word-card-delay-3 { animation-delay: 150ms; }
.word-card-delay-4 { animation-delay: 200ms; }
.word-card-delay-5 { animation-delay: 250ms; }
.word-card-delay-6 { animation-delay: 300ms; }

/* Make fadeInUp animation faster */
.animate__fadeInUp {
    animation-name: fadeInUp;
    animation-duration: 0.3s;
    animation-timing-function: ease-out;
}
