/**
 * WordMine - Main Stylesheet
 * Version 6.7.2 - Dedicated Add Bot Button
 * - Removed styles for interactive empty player slots.
 * - Added styles for a dedicated action button container in the waiting room.
 */


/* --- GLOBAL STYLES & VARIABLES --- */


/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Rye&family=Inter:wght@400;700&display=swap');


/* Define a color palette */
:root {
   --background-color: #4A3C31;
   --text-color: #FDF6E3;
   --canvas-bg: #4A3C31; 
   --canvas-shadow: rgba(0,0,0,0.5);
   --button-primary-bg: #2C1E12;
   --button-secondary-bg: #4A3C31;
   --button-border: #1F150C;
   --golden-highlight: #FFD700;
   --error-color: #c1351d;
   --red-value: #ef4444;
   --green-value: #22c55e;
   --tile-bg: #D2B48C;
   --tile-bg-selected: #ffe494;
   --tile-bg-highlight: #ffe494;
   --summary-mat-bg: #C3B091;
   --construction-area-bg: #EDE4D4;
}


/* Basic setup for a full-screen experience */
body, html {
   margin: 0;
   padding: 0;
   width: 100%;
   height: 100%;
   overflow: hidden;
   font-family: 'Inter', sans-serif;
   color: var(--text-color);
   background-color: var(--background-color);
}


/* --- LOADING OVERLAY --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--background-color);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    pointer-events: all;
}
.loading-overlay:not(.active) {
    opacity: 0;
}
.loading-logo {
    font-family: 'Rye', serif;
    font-size: clamp(4rem, 15vw, 7rem);
    line-height: 1;
    color: var(--text-color);
    text-shadow: 3px 3px 5px rgba(0,0,0,0.5);
    opacity: 0;
    animation: fadeInLogo 0.5s 0.1s forwards;
}
@keyframes fadeInLogo {
    to { opacity: 1; }
}

#app-container {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease-in;
    height: 100%;
}


/* Screen container logic */
.screen {
   display: none;
   width: 100%;
   height: 100%;
}
.screen.active {
   display: block;
}


/* General canvas styling */
.canvas {
   width: 100%;
   height: 100%;
   background: linear-gradient(rgba(74, 60, 49, 0.8), rgba(74, 60, 49, 0.8)), url(https://www.transparenttextures.com/patterns/rocky-wall.png);
   display: flex;
   justify-content: center;
   align-items: center;
   padding: 1rem;
   box-sizing: border-box;
   text-align: center;
   position: relative;
}


/* General button styling */
.btn {
   background-color: var(--button-primary-bg);
   border: 2px solid var(--button-border);
   border-radius: 8px;
   padding: 0.75rem 1.5rem;
   font-family: 'Rye', serif;
   font-size: 1.2rem;
   color: var(--text-color);
   cursor: pointer;
   text-decoration: none;
   box-shadow: 0 4px 0 var(--button-border);
   transition: transform 0.1s, box-shadow 0.1s, opacity 0.3s, background-color 0.3s;
   position: relative;
   overflow: hidden;
}
.btn:active {
   transform: translateY(2px);
   box-shadow: 0 2px 0 var(--button-border);
}
.btn:disabled {
   background-color: #555;
   color: #999;
   cursor: not-allowed;
   box-shadow: 0 4px 0 #333;
}
.btn.btn-secondary {
   background-color: var(--button-secondary-bg);
}

/* Updated to style both developer buttons */
#dev-reset-btn, #dev-round5-btn {
    background-color: var(--error-color);
    color: white;
    border: 1px solid black;
    padding: 5px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: none;
}


/* --- MAIN MENU SCREEN --- */


#screen-main-menu .menu-container {
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   gap: 0;
   padding: 20px;
}
#screen-main-menu #pickaxe-container {
   position: relative;
   display: flex;
   justify-content: center;
   align-items: center;
   height: 120px;
   width: 120px;
   margin-bottom: -0.5rem;
   cursor: pointer; /* Add cursor to indicate it's interactive */
   -webkit-tap-highlight-color: transparent;

}
#screen-main-menu #pickaxe {
   font-size: 5rem;
   transform-origin: 80% 80%;
   animation: swing-anim 2s ease-in-out infinite;
   animation-delay: -1s;
   z-index: 10;
}
/* Class for the easter egg fast swing */
#screen-main-menu #pickaxe.frenzy-swing {
    animation: frenzy-swing-anim 0.2s linear infinite;
}
#screen-main-menu #rocks {
   font-size: 4rem;
   position: absolute;
   bottom: 5px;
   left: 0px;
   z-index: 5;
   color: #615146;
   text-shadow: 1px 1px 2px black;
   transition: transform 0.1s ease;
}
@keyframes swing-anim {
   0%, 100% { transform: rotate(40deg); }
   50% { transform: rotate(-35deg); }
}
/* Keyframes for the fast swing */
@keyframes frenzy-swing-anim {
    0%, 100% { transform: rotate(45deg); }
    50% { transform: rotate(-45deg); }
}

#screen-main-menu .particle {
   position: absolute;
   font-family: 'Rye', serif;
   font-size: 1.7rem;
   opacity: 1;
   animation: fly-away 1.5s linear forwards;
   user-select: none;
   z-index: 20;
   bottom: 35px;
   left: 35px;
}
@keyframes fly-away {
   to {
       opacity: 0;
       transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(720deg) scale(0.5);
   }
}

/* Easter Egg Falling Particle */
.frenzy-particle-falling {
    position: absolute;
    top: 20%;
    font-family: 'Rye', serif;
    text-shadow: 2px 2px 3px rgba(0,0,0,0.5);
    animation: fall-off-screen 4s linear forwards;
    pointer-events: none;
    z-index: 5000;
}
@keyframes fall-off-screen {
    from {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
    to {
        transform: translateY(110vh) rotate(var(--rotation, 360deg));
        opacity: 1;
    }
}


#screen-main-menu .title {
   font-family: 'Rye', serif;
   font-size: clamp(4rem, 15vw, 7rem);
   line-height: 1;
   text-shadow: 3px 3px 5px rgba(0,0,0,0.5);
}
#screen-main-menu .button-container {
   margin-top: 1rem;
   display: flex;
   flex-direction: column;
   gap: 1rem;
   width: 100%;
   max-width: 300px;
}
#screen-main-menu .btn {
   font-size: clamp(1.2rem, 4vw, 1.5rem);
   text-shadow: 1px 1px 2px var(--button-border);
   transition: transform 0.2s ease-out;
}
#screen-main-menu .btn::after {
   content: '';
   position: absolute;
   top: 50%;
   left: 50%;
   width: 200%;
   height: 200%;
   border-radius: 50%;
   background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.2"/></svg>'),
                     radial-gradient(circle, rgba(255,215,0,0.2) 0%, rgba(255,215,0,0) 70%);
   transform: translate(-50%, -50%);
   opacity: 0;
   transition: opacity 0.4s ease;
   pointer-events: none;
}

@media (hover: hover) {
    #screen-main-menu .btn:hover::after {
        opacity: 1;
    }
    #screen-main-menu .btn:hover {
        transform: translateY(-2px);
    }
}

#screen-main-menu .btn:active::after {
    opacity: 1;
}


/* --- PLAYER CONFIGURATION SCREEN --- */


.config-mat {
   background-color: var(--canvas-bg);
   background-image: url(https://www.transparenttextures.com/patterns/concrete-wall-3.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #2C1E12;
   width: 100%;
   max-width: 500px;
   height: 100%;
   max-height: 800px;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   padding: 1.5rem;
   box-sizing: border-box;
   color: #FDF6E3;
}
.config-header {
   text-align: center;
   font-family: 'Rye', serif;
   font-size: 2.5rem;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
}
.config-content {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   gap: 1.5rem;
   min-height: 0;
}
.profile-preview {
   display: flex;
   align-items: center;
   gap: 1rem;
   background: var(--input-bg);
   padding: 0.5rem 1rem;
   border-radius: 8px;
}
.selected-emoji {
   font-size: 3rem;
   width: 60px;
   height: 60px;
   display: flex;
   justify-content: center;
   align-items: center;
   background: rgba(0,0,0,0.2);
   border-radius: 50%;
   transition: transform 0.2s;
}

.name-input {
   background: rgba(0,0,0,0.2);
   border: 2px solid #A39071;
   border-radius: 8px;
   padding: 0.5rem 1rem;
   font-family: 'Rye', serif;
   font-size: 2rem;
   color: var(--text-color);
   width: 100%;
   max-width: 220px;
   box-sizing: border-box;
   text-align: center;
}
.name-input:focus {
   outline: none;
   border-color: var(--golden-highlight);
}

.emoji-picker {
   width: 100%;
   max-width: 350px;
   height: 200px;
   overflow-y: auto;
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
   gap: 0.5rem;
   background: var(--input-bg);
   padding: 1rem;
   border-radius: 8px;
}
.emoji-option {
   font-size: 2rem;
   cursor: pointer;
   border-radius: 8px;
   transition: background-color 0.2s, transform 0.2s;
}
.emoji-option:hover {
   background-color: rgba(255,255,255,0.1);
}
.emoji-option.selected {
   background-color: var(--golden-highlight);
   transform: scale(1.2);
}
.config-footer {
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   text-align: center;
}


/* --- WAITING ROOM & INTER-ROUND WAITING --- */


.waiting-mat {
   background-color: var(--canvas-bg);
   background-image: url(https://www.transparenttextures.com/patterns/concrete-wall-3.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #2C1E12;
   width: 100%;
   max-width: 500px;
   height: 100%;
   max-height: 800px;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   padding: 1.5rem;
   box-sizing: border-box;
   color: #FDF6E3;
   transition: transform 1.5s ease-in, opacity 1s;
}
.waiting-header {
   text-align: center;
   font-family: 'Rye', serif;
   font-size: 2.5rem;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
}
.waiting-content {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   gap: 1rem;
}
.waiting-room-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}
.status-text {
   font-size: 1.2rem;
   text-align: center;
}
.invite-button-container {
   position: relative;
}
.copy-success-message {
   position: absolute;
   top: -30px;
   left: 50%;
   transform: translateX(-50%);
   background: var(--golden-highlight);
   color: #382E27;
   padding: 0.5rem 1rem;
   border-radius: 5px;
   font-family: 'Rye', serif;
   opacity: 0;
   transition: opacity 0.3s, top 0.3s;
}
.copy-success-message.visible {
   opacity: 1;
   top: -40px;
}
.player-list {
   width: 100%;
   max-width: 350px;
   display: flex;
   flex-direction: column;
   gap: 0.5rem;
}
.player-slot {
   display: flex;
   align-items: center;
   background: rgba(0,0,0,0.2);
   border-radius: 8px;
   padding: 0.5rem 1rem;
   font-size: 1.2rem;
   min-height: 48px; /* Standardized height */
   box-sizing: border-box;
}
.player-slot.empty {
   border: 2px dashed rgba(255,255,255,0.3);
   background: transparent;
   color: rgba(255,255,255,0.5);
   justify-content: center;
   font-style: italic;
}
.player-avatar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px; /* Sightly smaller avatar */
    height: 32px;
    margin-right: 0.75rem;
}
.player-avatar .emoji-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 1;
}
.player-avatar .emoji {
    position: relative;
    z-index: 2;
    font-size: 1.8rem;
}

.player-name {
   flex-grow: 1;
   display: flex;
   align-items: center;
   gap: 0.5rem;
}
.player-status {
   display: flex;
   align-items: center;
   gap: 0.5rem;
}
/* Bot specific UI in waiting room */
.bot-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.difficulty-btn {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.difficulty-btn.selected {
    background: var(--golden-highlight);
    border-color: var(--golden-highlight);
    color: #382E27;
    font-weight: bold;
}
.remove-bot-btn {
    background: transparent;
    border: none;
    color: var(--error-color);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 0.5rem;
}
.status-icon {
   font-size: 1.5rem;
}
.status-timer {
   font-size: 0.9rem;
   color: #ccc;
}
.waiting-footer {
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   display: flex;
   align-items: center;
   justify-content: center; 
   gap: 1rem;
}
.waiting-footer .btn:first-child:not(:only-child) {
    margin-right: auto;
}
.waiting-footer .btn:last-child:not(:only-child) {
    margin-left: auto;
}
#inter-round-footer-content {
    flex-grow: 1;
    text-align: center;
}
.easter-egg-msg {
   position: absolute;
   font-family: 'Rye', serif;
   font-size: 2.5rem;
   text-align: center;
   opacity: 0;
   transition: opacity 0.3s;
}
.waiting-mat.tip-over {
   transform: translateX(-150vw) rotate(-30deg);
   opacity: 0;
}
.waiting-mat.slide-in {
   transform: translateY(-150vh);
   transition: none;
}

/* --- GENERIC STYLES FOR HEADLINES & SUB-TEXT --- */

.section-headline {
    font-family: 'Rye', serif;
    font-size: 1.8rem;
    margin-bottom: 2rem; /* Consistent spacing */
    color: #382E27;
    font-weight: normal;
}
.section-headline b.rye {
    font-family: 'Rye', serif;
    font-weight: normal;
    color: var(--golden-highlight);
    text-shadow: 0 0 4px var(--button-border);
}

.sub-text {
    font-family: 'Inter', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #382E27;
    opacity: 0.9;
}


/* --- HOW TO PLAY SCREEN (AND MODAL) --- */

#screen-how-to-play .canvas {
   flex-direction: column;
   justify-content: flex-start;
   overflow-y: auto;
}
/* Reusable slideshow container styles */
#screen-how-to-play .slideshow-container,
#how-to-play-modal .slideshow-container {
   width: 100%;
   display: flex;
   justify-content: center;
   align-items: center;
   flex-direction: column;
   transition: transform 1s ease-in-out;
}
#screen-how-to-play .slideshow-container {
    min-height: 80%;
}
#screen-how-to-play .slideshow-container.falling {
    transform: translateY(150vh) rotate(15deg);
}
#screen-how-to-play .slideshow-container .slide,
#how-to-play-modal .slideshow-container .slide {
   display: none;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   width: 90%;
   max-width: 600px;
   /* This is the key change for vertical centering */
   height: 100%;
   gap: 1.5rem;
   animation: fadeIn 0.5s ease-in-out;
   padding-bottom: 2rem;
   box-sizing: border-box;
}
#screen-how-to-play .slideshow-container .slide.active,
#how-to-play-modal .slideshow-container .slide.active {
   display: flex;
}
@keyframes fadeIn {
   from { opacity: 0; transform: translateY(20px); }
   to { opacity: 1; transform: translateY(0); }
}

/* Special override for How to Play main title */
#screen-how-to-play .section-headline {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-top: 0;
    color: var(--text-color); /* Override for this screen */
}

/* Generic slide content styles */
#screen-how-to-play .slideshow-container .slide p,
#how-to-play-modal .slideshow-container .slide p {
   font-size: clamp(1rem, 2.5vw, 1.25rem);
   line-height: 1.5;
   max-width: 500px;
   color: var(--text-color);
   margin: 0;
}

#screen-how-to-play .slideshow-container .slide p b, 
#screen-how-to-play .slideshow-container .slide p .rye,
#how-to-play-modal .slideshow-container .slide p b,
#how-to-play-modal .slideshow-container .slide p .rye {
   color: var(--golden-highlight);
   font-weight: normal;
   font-family: 'Rye', serif;
}
#screen-how-to-play .slideshow-container .slide p .red,
#how-to-play-modal .slideshow-container .slide p .red { color: var(--red-value); }

#screen-how-to-play .slideshow-container .slide p .green,
#how-to-play-modal .slideshow-container .slide p .green { color: var(--green-value); }

#screen-how-to-play .slideshow-container .letter-grid,
#how-to-play-modal .slideshow-container .letter-grid {
   display: grid;
   grid-template-columns: repeat(4, minmax(60px, 1fr));
   gap: 0.5rem;
   margin-top: 1rem;
   position: relative;
   justify-content: center;
   width: 100%;
   max-width: 300px;
}
#screen-how-to-play .slideshow-container .letter-tile,
#how-to-play-modal .slideshow-container .letter-tile {
   background-color: var(--tile-bg);
   color: #382E27;
   font-family: 'Rye', serif;
   box-shadow: 3px 3px 5px rgba(0,0,0,0.4);
   border-radius: 8px;
   width: 60px;
   height: 60px;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   position: relative;
   transition: transform 0.3s, box-shadow 0.3s, opacity 0.5s, background-color 0.3s;
}
#screen-how-to-play .slideshow-container .letter-tile.highlight,
#how-to-play-modal .slideshow-container .letter-tile.highlight {
    box-shadow: 0 0 15px 3px var(--golden-highlight);
    background-color: var(--tile-bg-highlight);
    transform: scale(1.1);
}
#screen-how-to-play .slideshow-container .letter-tile.glow,
#how-to-play-modal .slideshow-container .letter-tile.glow {
    box-shadow: 0 0 15px 3px var(--golden-highlight);
}
/* New styles for discard animation */
#screen-how-to-play .slideshow-container .letter-tile.is-discarding,
#how-to-play-modal .slideshow-container .letter-tile.is-discarding {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
    transition: opacity 0.5s, transform 0.5s;
}
#screen-how-to-play .slideshow-container .letter-tile.is-new,
#how-to-play-modal .slideshow-container .letter-tile.is-new {
    animation: new-tile-pop 0.5s forwards;
}
@keyframes new-tile-pop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#screen-how-to-play .slideshow-container .letter-char,
#how-to-play-modal .slideshow-container .letter-char { font-size: 2rem; line-height: 1; }

#screen-how-to-play .slideshow-container .letter-value,
#how-to-play-modal .slideshow-container .letter-value { font-size: 0.8rem; font-family: 'Inter', sans-serif; font-weight: bold; transition: color 0.3s; }

#screen-how-to-play .slideshow-container .vowel-rule-value,
#how-to-play-modal .slideshow-container .vowel-rule-value {
    color: var(--golden-highlight) !important;
    text-shadow: 0px 0px 3px #000000a1;
}

#screen-how-to-play .slideshow-container .value-change,
#how-to-play-modal .slideshow-container .value-change { position: absolute; top: -5px; right: -5px; font-size: 1.2rem; font-weight: bold; opacity: 0; transform: scale(0.5); transition: all 0.5s ease-out; text-shadow: 0 0 3px black; }
#screen-how-to-play .slideshow-container .value-change.show,
#how-to-play-modal .slideshow-container .value-change.show { opacity: 1; transform: scale(1); }
#screen-how-to-play .slideshow-container .value-red,
#how-to-play-modal .slideshow-container .value-red { color: var(--red-value); text-shadow: 0 0 3px black; }
#screen-how-to-play .slideshow-container .value-green,
#how-to-play-modal .slideshow-container .value-green { color: var(--green-value); text-shadow: 0 0 3px black; }
#screen-how-to-play .slideshow-container #word-display,
#how-to-play-modal .slideshow-container #word-display { font-family: 'Rye', serif; font-size: 2.5rem; color: var(--golden-highlight); height: 3rem; }
#screen-how-to-play .slideshow-container #score-calculation,
#how-to-play-modal .slideshow-container #score-calculation { font-size: 1.2rem; height: 1.5rem; color: var(--text-color); }
#screen-how-to-play .slideshow-container #score-calculation .letter,
#how-to-play-modal .slideshow-container #score-calculation .letter { font-family: 'Rye', serif; color: var(--golden-highlight); }
#screen-how-to-play .slideshow-container #score-calculation .points,
#how-to-play-modal .slideshow-container #score-calculation .points { font-size: 0.8rem; vertical-align: super; color: #ccc; }
#screen-how-to-play .slideshow-container .discarded-letters-container,
#how-to-play-modal .slideshow-container .discarded-letters-container { display: flex; gap: 0.2rem; margin-top: 1rem; opacity: 0.7; min-height: 35px; align-items: center; color: var(--text-color);}
#screen-how-to-play .slideshow-container .discarded-tile,
#how-to-play-modal .slideshow-container .discarded-tile { transform: scale(0.5); }

#screen-how-to-play .slideshow-container #copy-container,
#how-to-play-modal .slideshow-container #copy-container {
    position: relative;
    margin-top: 1rem;
}
#screen-how-to-play .slideshow-container #copy-message,
#how-to-play-modal .slideshow-container #copy-message {
    background-color: #2C1E12;
    border: 2px dashed var(--button-secondary-bg);
    padding: 1rem;
    border-radius: 8px;
    font-style: italic;
    color: #ccc;
}
#screen-how-to-play .slideshow-container #copy-btn, 
#screen-how-to-play .slideshow-container #htp-play-now-btn,
#how-to-play-modal .slideshow-container #copy-btn,
#how-to-play-modal .slideshow-container #htp-play-now-btn {
    margin-top: 0.5rem;
}
#how-to-play-modal #htp-play-now-btn {
    display: none;
}

#screen-how-to-play .slideshow-container .trophy,
#how-to-play-modal .slideshow-container .trophy {
   font-size: 4rem;
   animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
   0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
   40% { transform: translateY(-20px); }
   60% { transform: translateY(-10px); }
}

#screen-how-to-play .navigation,
#how-to-play-modal .navigation {
   width: 90%;
   max-width: 600px;
   display: flex;
   flex-wrap: wrap;
   justify-content: center;
   align-items: center;
   gap: 1rem;
   transition: transform 1s ease-in-out 0.1s;
   margin-top: auto;
   padding-top: 1rem;
}
#screen-how-to-play .navigation {
   position: sticky; 
   bottom: 1rem;
}
#screen-how-to-play .navigation.falling {
    transform: translateY(150vh) rotate(-10deg);
}
#screen-how-to-play .navigation .dots-container,
#how-to-play-modal .navigation .dots-container {
    width: 100%;
    display: flex;
    justify-content: center;
    order: 1; /* Dots on top */
}
.nav-btn {
   background-color: var(--button-secondary-bg);
   border: 2px solid var(--button-border);
   border-radius: 8px;
   padding: 0.5rem 1rem;
   font-family: 'Rye', serif;
   font-size: 1.2rem;
   color: var(--text-color);
   cursor: pointer;
   user-select: none;
}
#screen-how-to-play .navigation .nav-btn,
#how-to-play-modal .navigation .nav-btn {
   visibility: visible;
   order: 2; /* Buttons below dots */
   flex-grow: 1; /* Make buttons grow to fill space */
   max-width: 150px;
}
#screen-how-to-play .navigation .nav-btn.hidden,
#how-to-play-modal .navigation .nav-btn.hidden {
   visibility: hidden;
   display: none;
}
#screen-how-to-play .navigation .dots-container,
#how-to-play-modal .navigation .dots-container {
   display: flex;
   gap: 0.5rem;
}
#screen-how-to-play .navigation .dot,
#how-to-play-modal .navigation .dot {
   width: 12px;
   height: 12px;
   border-radius: 50%;
   background-color: var(--button-secondary-bg);
   border: 2px solid var(--button-border);
   cursor: pointer;
   transition: background-color 0.3s;
}
#screen-how-to-play .navigation .dot.active,
#how-to-play-modal .navigation .dot.active {
   background-color: var(--golden-highlight);
}
/* This selector is now more specific to avoid conflicts */
#screen-how-to-play a.back-btn {
   position: absolute;
   top: 2rem;
   left: 2rem;
   background-color: transparent;
   box-shadow: none;
   border: none;
   transition: transform 1s ease-in-out 0.2s;
   z-index: 10;
}
#screen-how-to-play .back-btn.falling {
    transform: translateY(150vh) rotate(20deg);
}
.whoops-message {
   position: absolute;
   font-family: 'Rye', serif;
   font-size: 5rem;
   color: var(--golden-highlight);
   text-shadow: 0 0 10px black;
   opacity: 0;
   transition: opacity 0.3s ease-in-out;
   pointer-events: none;
}
.whoops-message.show {
   opacity: 1;
}

/* --- GENERIC MODAL STYLES --- */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 5000;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.modal-overlay.visible {
    display: flex;
    opacity: 1;
}
.modal-content {
    background-color: var(--background-color);
    background-image: url(https://www.transparenttextures.com/patterns/concrete-wall-3.png);
    border: 2px solid #2C1E12;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--canvas-shadow);
    width: 90%;
    max-width: 600px;
    height: 90%;
    max-height: 800px;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-sizing: border-box;
}
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--text-color);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}
#how-to-play-modal .modal-content {
    color: var(--text-color); /* Override default mat color */
}
#how-to-play-modal .slideshow-container {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}
#how-to-play-modal .navigation {
    flex-shrink: 0;
}
#how-to-play-modal .section-headline {
    color: var(--text-color);
}


/* --- MAIN GAME BOARD SCREEN --- */

#screen-game-board .canvas {
    align-items: initial;
}

#screen-game-board .game-container {
   position: relative;
   width: 100%;
   max-width: 500px;
   height: 100%;
   perspective: 1500px;
   display: flex;
   flex-direction: column;
}

#screen-game-board .player-chin {
   background-color: var(--button-secondary-bg);
   color: var(--text-color);
   padding: 0.5rem 1.5rem;
   border-radius: 0 0 10px 10px;
   font-family: 'Rye', serif;
   font-size: 1.2rem;
   box-shadow: 0 4px 6px rgba(0,0,0,0.3);
   z-index: 10;
   margin: 0 auto;
   flex-shrink: 0;
}

#screen-game-board .game-mat {
   flex-grow: 1;
   min-height: 0;
   position: relative;
   margin-top: -25px;
}

.flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}
.flipper.flipped {
    transform: rotateY(180deg);
}

#screen-game-board .game-mat-face {
   position: absolute;
   width: 100%;
   height: 100%;
   backface-visibility: hidden;
   background-color: var(--summary-mat-bg);
   background-image: url(https://www.transparenttextures.com/patterns/fabric-of-squares.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #A39071;
   display: flex;
   flex-direction: column;
   padding: 1.5rem;
   box-sizing: border-box;
}

#screen-game-board .game-mat-front.warning::before {
   content: '';
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   background-color: var(--error-color);
   border-radius: 15px;
   opacity: 0;
   pointer-events: none;
   z-index: 100;
}
#screen-game-board .game-mat-front.warning::before {
   animation: mat-warning-pulse 1s infinite;
}
@keyframes mat-warning-pulse {
   50% { opacity: 0.2; }
}

#screen-game-board .game-mat-back {
   transform: rotateY(180deg);
   color: #382E27;
   align-items: center;
   justify-content: center;
   gap: 2rem;
}

#screen-game-board .game-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   color: #382E27;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
}

#screen-game-board .info-tag {
   font-family: 'Rye', serif;
   font-size: 1rem;
   text-align: center;
   flex: 1;
}

#screen-game-board .info-tag .value {
   font-size: 1.5rem;
   display: block;
   color: #1F150C;
   min-width: 4ch;
}

#screen-game-board #game-timer .value {
   color: var(--golden-highlight);
   text-shadow: 0 0 5px black;
   transition: color 0.3s, transform 0.3s;
}

#screen-game-board #game-timer.warning .value {
   color: var(--error-color);
   animation: timer-warning-pulse 1s infinite;
}
@keyframes timer-warning-pulse {
   50% { transform: scale(1.1); }
}

#screen-game-board .game-area {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   gap: 1rem;
   position: relative;
   min-height: 0;
}

#screen-game-board .word-construction-area {
   background: rgba(0,0,0,0.1);
   border-radius: 10px;
   height: 135px;
   padding: 0.5rem;
   display: flex;
   justify-content: center;
   align-items: center;
   flex-wrap: wrap;
   gap: 0.5rem;
   overflow-y: auto;
   position: relative;
}
#screen-game-board .word-construction-area.crowded .letter-tile {
   width: 45px;
   height: 45px;
}
#screen-game-board .word-construction-area.crowded .letter-char {
   font-size: 1.5rem;
}
#screen-game-board .word-construction-area.crowded .letter-value {
   font-size: 0.7rem;
}
.nope-easter-egg {
   font-family: 'Rye', serif;
   font-size: 4rem;
   color: var(--error-color);
   text-shadow: 0 0 5px black;
   animation: nope-fade 0.3s forwards;
}
@keyframes nope-fade {
   0% { opacity: 1; transform: scale(1); }
   100% { opacity: 0; transform: scale(1.2); }
}

#screen-game-board .feedback-container {
   display: flex;
   justify-content: space-between;
   align-items: center;
   min-height: 30px;
}

#screen-game-board .word-feedback-area {
   flex-grow: 1;
   font-family: 'Rye', serif;
   font-size: 1rem;
   color: #382E27;
   text-align: center;
   opacity: 0;
   transition: opacity 0.3s;
}
#screen-game-board .word-feedback-area.visible {
   opacity: 1;
}
#screen-game-board .word-feedback-area.error {
   color: var(--error-color);
   animation: shake-error 0.5s;
}
@keyframes shake-error {
   0%, 100% { transform: translateX(0); }
   10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
   20%, 40%, 60%, 80% { transform: translateX(5px); }
}

#screen-game-board .letter-pool {
   display: grid;
   grid-template-columns: repeat(4, 1fr);
   gap: 0.5rem;
   justify-items: center;
   max-width: 300px;
   margin: 0 auto;
}

#screen-game-board .letter-tile {
   background-color: var(--tile-bg);
   color: #382E27;
   font-family: 'Rye', serif;
   box-shadow: 3px 3px 5px rgba(0,0,0,0.2);
   border-radius: 8px;
   width: 60px;
   height: 60px;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s, width 0.3s, height 0.3s;
}
#screen-game-board .letter-tile.selected {
   opacity: 0.4;
   transform: scale(0.9);
   cursor: not-allowed;
}

/* --- Tile Animations --- */
.anim-pop { animation: pop-anim 0.2s ease-out; }
@keyframes pop-anim { 50% { transform: scale(1.2) rotate(-5deg); } }

/* Animation for a tile being selected from the pool */
.flash-on-press {
    animation: tile-press-flash 0.4s ease-out;
}

@keyframes tile-press-flash {
    50% {
        box-shadow: 0 0 15px 3px var(--golden-highlight);
        background-color: var(--tile-bg-highlight);
        transform: scale(1.1);
    }
}

.shuffle-jump-out { animation: jump-out-anim 0.3s forwards ease-out; }
@keyframes jump-out-anim { to { transform: var(--transform-end); opacity: 0; } }

.shuffle-jump-in { animation: jump-in-anim 0.3s backwards ease-in; }
@keyframes jump-in-anim { from { transform: var(--transform-start); opacity: 0; } }

.clear-fly-back { animation: fly-back-anim 0.5s forwards ease-in-out; }
@keyframes fly-back-anim {
   to {
       transform: translate(var(--tx, 0), var(--ty, 0)) scale(1) rotate(var(--r, 0));
       opacity: 0.5;
   }
}

#screen-game-board .letter-char { font-size: 2rem; transition: font-size 0.3s; }
#screen-game-board .letter-value { font-size: 0.8rem; font-family: 'Inter', sans-serif; font-weight: bold; transition: font-size 0.3s; }

#screen-game-board .game-footer {
   display: flex;
   justify-content: center;
   align-items: center;
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   position: relative;
   transition: background-color 0.3s, border-top-color 0.3s;
}
/* Stronger visual cue for the confirmation step */
#screen-game-board .game-footer.footer-confirm-active {
    background-color: rgba(0,0,0,0.25);
    border-top: 2px dashed var(--golden-highlight);
}

#screen-game-board .btn {
   background-color: var(--button-secondary-bg);
   font-size: 1rem;
}
#screen-game-board .btn-small {
   padding: 0.5rem 1rem;
   font-size: 0.8rem;
   box-shadow: 0 3px 0 var(--button-border);
}
#screen-game-board .btn-main {
   background-color: var(--button-primary-bg);
   font-size: 1.2rem;
}
#screen-game-board .confirmation-buttons {
   display: flex;
   justify-content: center;
   gap: 1rem;
}

/* Back of card styling */
.post-round-summary {
   color: #382E27;
   text-align: center;
}
.post-round-summary h2 {
   font-family: 'Rye', serif;
   font-size: 3rem;
   margin: 0;
}
.post-round-summary .word {
   color: var(--golden-highlight);
   text-shadow: 0 0 5px black;
}
.post-round-summary .score-display {
   font-size: 2rem;
   font-weight: bold;
}
.score-anim-container {
   position: relative;
   height: 60px;
   width: 150px;
   margin: 1rem auto;
}
.score-anim-container .pickaxe {
   font-size: 3rem;
   position: absolute;
   left: 0;
   top: 0;
   transform-origin: bottom right;
   animation: score-swing 0.5s ease-in-out forwards;
}
@keyframes score-swing {
   0% { transform: rotate(40deg); }
   100% { transform: rotate(-30deg); }
}
.score-anim-container .rock {
   font-size: 3rem;
   position: absolute;
   right: 0;
   bottom: 0;
}
.score-anim-container .points {
   font-family: 'Rye', serif;
   font-size: 3rem;
   color: var(--golden-highlight);
   text-shadow: 0 0 5px black;
   position: absolute;
   left: 50%;
   top: 50%;
   transform: translate(-50%, -50%);
   opacity: 0;
   animation: score-reveal 0.3s 0.5s forwards;
}
@keyframes score-reveal {
   from { transform: translate(-50%, -50%) scale(0); }
   to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.times-up-emoji {
   font-size: 5rem;
   animation: emoji-pop-fade 1.5s forwards;
}
@keyframes emoji-pop-fade {
   0% { transform: scale(0); opacity: 0; }
   50% { transform: scale(1.1); opacity: 1; }
   100% { transform: scale(1); opacity: 1; }
}

.countdown-number {
   font-family: 'Rye', serif;
   font-size: 5rem;
   color: #382E27;
}
.countdown-pop { animation: countdown-pop-anim 1s forwards; }
@keyframes countdown-pop-anim {
   0% { transform: scale(0.5); opacity: 0; }
   50% { transform: scale(1.1); opacity: 1; }
   100% { transform: scale(1); opacity: 1; }
}
.countdown-swoop { animation: countdown-swoop-anim 1s forwards; }
@keyframes countdown-swoop-anim {
   0% { transform: translateY(50px) rotate(-15deg); opacity: 0; }
   100% { transform: translateY(0) rotate(0); opacity: 1; }
}
.countdown-shake { animation: countdown-shake-anim 1s forwards; }
@keyframes countdown-shake-anim {
   0% { opacity: 0; }
   25% { transform: rotate(10deg); }
   50% { transform: rotate(-10deg); }
   75% { transform: rotate(5deg); }
   100% { transform: rotate(0); opacity: 1; }
}


/* --- ROUND SUMMARY SCREEN --- */


.summary-mat {
   background-color: var(--summary-mat-bg);
   background-image: url(https://www.transparenttextures.com/patterns/fabric-of-squares.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #A39071;
   width: 100%;
   max-width: 500px;
   height: 100%;
   max-height: 800px;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   padding: 1.5rem;
   box-sizing: border-box;
   color: #382E27;
}
.summary-header {
   text-align: center;
   font-family: 'Rye', serif;
   font-size: 2rem;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
}
.summary-content {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   gap: 1rem;
   min-height: 0;
   position: relative;
}
.summary-stage {
   display: none;
   flex-direction: column;
   align-items: center;
   width: 100%;
   animation: fadeIn 0.5s;
}
.summary-stage.active {
   display: flex;
}

.usage-list {
   display: flex;
   gap: 1rem;
   justify-content: center;
   width: 100%;
}
.usage-item {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 0.5rem;
   perspective: 800px;
}
.usage-tile {
   width: 90px;
   height: 90px;
   position: relative;
   transform-style: preserve-3d;
   transition: transform 0.8s;
}
.usage-tile.flipped {
   transform: rotateY(180deg);
}
.usage-tile-face {
   position: absolute;
   width: 100%;
   height: 100%;
   backface-visibility: hidden;
   background-color: var(--tile-bg);
   border-radius: 8px;
   box-shadow: 3px 3px 5px rgba(0,0,0,0.2);
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   gap: 0.5rem;
}
.usage-tile-back {
   transform: rotateY(180deg);
}
.usage-tile .emoji { font-size: 3rem; }
.usage-tile .name { font-size: 0.8rem; }
.usage-tile .count { font-family: 'Rye', serif; font-size: 2rem; }
.usage-tile .count-label { font-size: 0.7rem; margin-top: -0.5rem; white-space: nowrap; }
.player-info {
   opacity: 0;
   transform: translateY(-10px);
   transition: opacity 0.5s, transform 0.5s;
}
.player-info.revealed {
   opacity: 1;
   transform: translateY(0);
}

.market-explanations {
    margin-top: 1rem;
    height: 4.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0; /* Changed from 0.75rem */
    width: 100%;
    max-width: 350px;
}
.market-explanations .sub-text {
    opacity: 0; /* Start invisible */
    transition: opacity 0.5s ease-in-out; /* Add fade effect */
    min-height: 1.5rem; /* Reserve space to prevent layout shift */
}
.market-explanations .sub-text.visible {
    opacity: 1;
}

/* Standardized leaderboard/status board styles */
.leaderboard {
   width: 100%;
   max-width: 350px;
   position: relative;
}
.leaderboard .player-row {
   display: flex;
   align-items: center;
   background: rgba(0,0,0,0.1);
   border-radius: 8px;
   padding: 0.5rem 1rem;
   font-size: 1.2rem;
   width: 100%;
   box-sizing: border-box;
   position: absolute;
   transition: top 0.5s ease-in-out, background-color 0.3s, margin-bottom 0.5s ease-in-out;
}
.leaderboard .player-rank { 
    font-family: 'Rye', serif; 
    width: 30px; 
    text-align: left;
}
.leaderboard .player-name { 
    flex-grow: 1; 
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.leaderboard .player-score { 
    font-family: 'Rye', serif; 
    font-size: 1.5rem; 
}

#screen-round-summary .letter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

#screen-round-summary .letter-tile {
   background-color: var(--tile-bg);
   color: #382E27;
   font-family: 'Rye', serif;
   box-shadow: 3px 3px 5px rgba(0,0,0,0.2);
   border-radius: 8px;
   width: 60px;
   height: 60px;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   position: relative;
}
#screen-round-summary .letter-char { 
    font-size: 2rem; 
    line-height: 1; 
}
#screen-round-summary .letter-value { 
    font-size: 0.8rem; 
    font-family: 'Inter', sans-serif; 
    font-weight: bold; 
}

#screen-round-summary .value-change { 
    position: absolute; 
    top: -5px; 
    right: -5px; 
    font-size: 1.2rem; 
    font-weight: bold; 
    text-shadow: 0 0 3px black; 
    opacity: 0; 
    transform: scale(0.5); 
    transition: all 0.5s ease-out; 
}
#screen-round-summary .value-change.show { 
    opacity: 1; 
    transform: scale(1); 
}
#screen-round-summary .value-red { color: var(--red-value); }
#screen-round-summary .value-green { color: var(--green-value); }


.swap-container {
   display: flex;
   gap: 1rem;
   perspective: 800px;
}
.swap-tile {
   width: 60px;
   height: 60px;
   position: relative;
   transform-style: preserve-3d;
   transition: transform 0.8s;
}
.swap-tile.flipped {
   transform: rotateY(180deg);
}
.swap-tile-face {
   position: absolute;
   width: 100%;
   height: 100%;
   backface-visibility: hidden;
   background-color: var(--tile-bg);
   border-radius: 8px;
   box-shadow: 3px 3px 5px rgba(0,0,0,0.2);
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
}
.swap-tile-back {
   transform: rotateY(180deg);
}
.swap-tile-face .letter-tile {
    width: 100%;
    height: 100%;
    box-shadow: none;
}
.summary-footer {
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   display: flex;
   justify-content: center;
   align-items: center;
}


/* --- FINAL TALLY SCREEN --- */


.tally-mat {
   background-color: var(--canvas-bg);
   background-image: url(https://www.transparenttextures.com/patterns/concrete-wall-3.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #2C1E12;
   width: 100%;
   max-width: 500px;
   height: 100%;
   max-height: 800px;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   padding: 1.5rem;
   box-sizing: border-box;
   color: #FDF6E3;
   position: relative;
   overflow: hidden;
}
.tally-header {
   text-align: center;
   font-family: 'Rye', serif;
   font-size: 2.5rem;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
   flex-shrink: 0;
}
.tally-content {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   position: relative;
   min-height: 0;
}
#final-tally-leaderboard .player-row.is-tallying {
    background: rgba(255,255,255,0.15);
    margin-bottom: 180px; /* Create space for the shorter receipt */
}
#final-tally-leaderboard .player-row.is-winner {
    background: linear-gradient(45deg, var(--golden-highlight), #a18012);
    color: #382E27;
    font-weight: bold;
}
.tally-receipt {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 320px;
    height: auto; /* Make height dynamic */
    background: #e4d7c3;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    color: #382E27;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.tally-receipt.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    animation: fadeInRow 0.5s forwards;
}
@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.receipt-row .word {
    font-family: 'Rye', serif;
}
.receipt-row .score {
    font-weight: bold;
}

#screen-final-tally .leaderboard .player-score {
   min-width: 60px;
   text-align: right;
}

.winner-headline {
    font-family: 'Rye', serif;
    font-size: 2.2rem;
    color: var(--golden-highlight);
    text-shadow: 0 0 10px black;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s, transform 0.5s;
}
.winner-headline.visible {
    opacity: 1;
    transform: scale(1);
}
.confetti {
   position: absolute;
   width: 10px;
   height: 10px;
   background-color: var(--color);
   opacity: 0;
   animation: fall var(--duration) linear forwards;
}
@keyframes fall {
   to {
       transform: translateY(100vh) rotate(360deg);
       opacity: 1;
   }
}
.tally-footer {
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   text-align: center;
   min-height: 60px;
   display: flex;
   justify-content: center;
   gap: 0.5rem;
   flex-shrink: 0;
   align-items: center;
}
.btn-confetti {
    background: var(--button-secondary-bg);
    border: 2px solid var(--button-border);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
    cursor: pointer;
    animation: pop-in 0.5s 1s backwards, wiggle 3s 1.5s infinite ease-in-out;
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 var(--button-border);
    margin: 1rem 0;
}
.btn-confetti:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 2px 0 var(--button-border);
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(8deg); }
    50% { transform: rotate(-8deg); }
    75% { transform: rotate(5deg); }
}

#view-word-list-btn {
    align-self: center;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.word-reveal-overlay {
   position: fixed;
   top: 0; left: 0; right: 0; bottom: 0;
   background: rgba(0,0,0,0.7);
   z-index: 100;
   display: flex;
   justify-content: center;
   align-items: center;
   opacity: 0;
   visibility: hidden;
   transition: opacity 0.3s, visibility 0.3s;
}
.word-reveal-overlay.visible {
   opacity: 1;
   visibility: visible;
}
.word-reveal-box {
   background-color: var(--summary-mat-bg);
   color: #382E27;
   padding: 1.5rem;
   border-radius: 10px;
   font-family: 'Inter', sans-serif;
   border: 2px solid #A39071;
   position: relative;
   width: 90%;
   max-width: 400px;
   max-height: 80%;
   overflow-y: auto;
   box-shadow: 0 10px 30px var(--canvas-shadow);
}
.word-reveal-box h3 { 
    margin: 0 0 0.5rem 0; 
    font-size: 1.2rem;
    font-family: 'Rye', serif;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #A39071;
}
.word-reveal-box h3:not(:first-child) {
    margin-top: 1.5rem;
}
.word-reveal-box ul { list-style: none; padding: 0; margin: 0; }
.word-reveal-box li { 
    display: flex; 
    justify-content: space-between; 
    gap: 1rem; 
    font-size: 1rem; 
    padding: 0.2rem 0; 
}
.word-reveal-box li span:first-child b { 
    font-weight: bold;
    color: #5c4b3c;
}
.word-reveal-box .btn { 
    margin-top: 1.5rem; 
    background-color: var(--button-secondary-bg);
}

/* --- ABOUT SCREEN --- */


.about-mat {
   background-color: var(--canvas-bg);
   background-image: url(https://www.transparenttextures.com/patterns/concrete-wall-3.png);
   border-radius: 15px;
   box-shadow: 0 10px 30px var(--canvas-shadow);
   border: 2px solid #2C1E12;
   width: 100%;
   max-width: 500px;
   height: 100%;
   max-height: 800px;
   display: flex;
   flex-direction: column;
   justify-content: space-between;
   padding: 1.5rem;
   box-sizing: border-box;
   color: #FDF6E3;
}
.about-header {
   text-align: center;
   font-family: 'Rye', serif;
   font-size: 2.5rem;
   padding-bottom: 1rem;
   border-bottom: 2px dashed #A39071;
}
.about-content {
   flex-grow: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   gap: 1rem;
   text-align: center;
   font-size: 1.1rem;
   line-height: 1.6;
   padding: 1rem 0;
}
.about-content p {
   margin: 0;
}
.about-content p b {
   font-family: 'Rye', serif;
   color: var(--golden-highlight);
   font-weight: normal;
}
.about-footer {
   padding-top: 1rem;
   border-top: 2px dashed #A39071;
   text-align: center;
   display: flex;
   justify-content: space-around;
   align-items: center;
}

/* --- ORIENTATION LOCK --- */
#orientation-lock {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 20000;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-color);
}

.lock-message {
    font-family: 'Rye', serif;
}

.lock-message span {
    display: inline-block;
    font-size: 4rem;
    margin-top: 1rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (orientation: landscape) {
    #orientation-lock {
        display: flex;
    }
}