/* ================================
   Global Styles & Variables
   ================================ */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --green-main: #22c55e;
    --blue-main: #3b82f6;
    --red-main: #ef4444;
    --yellow-main: #eab308;
    --black-main: #1f2937;

    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: #1f2937;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ================================
   Screen Management
   ================================ */

.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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

/* ================================
   Start Screen
   ================================ */

#startScreen {
    position: relative;
    overflow: hidden;
}

.logo-container {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 2;
}

.game-title {
    font-family: var(--font-display);
    font-size: 7rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    margin-bottom: 1rem;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
}

.game-title .letter {
    display: inline-block;
    animation: bounce 1s ease-in-out infinite;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-title .letter:nth-child(1) { animation-delay: 0s; }
.game-title .letter:nth-child(2) { animation-delay: 0.1s; }
.game-title .letter:nth-child(3) { animation-delay: 0.2s; }
.game-title .letter:nth-child(4) { animation-delay: 0.3s; }
.game-title .letter:nth-child(5) { animation-delay: 0.4s; }
.game-title .letter:nth-child(6) { animation-delay: 0.5s; }
.game-title .letter:nth-child(7) { animation-delay: 0.6s; }

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

.tagline {
    font-size: 1.8rem;
    color: white;
    font-weight: 300;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.start-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

/* Animated particles background */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particles::before,
.particles::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite;
}

.particles::before {
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.particles::after {
    bottom: -100px;
    right: -100px;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, -100px) scale(1.2); }
    66% { transform: translate(-100px, 100px) scale(0.8); }
}

/* ================================
   Buttons
   ================================ */

.btn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--primary-color);
    border: 3px solid var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.5rem;
    min-width: 300px;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ================================
   Rules Screen
   ================================ */

.rules-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 3rem;
    max-width: 900px;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
}

.rules-container h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
}

.rules-content {
    margin-bottom: 2rem;
}

.rule-section {
    margin-bottom: 2rem;
}

.rule-section h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.rule-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.rule-section ul {
    list-style: none;
    padding-left: 0;
}

.rule-section li {
    font-size: 1.1rem;
    padding: 0.5rem 0;
    padding-left: 2rem;
    position: relative;
}

.rule-section li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.pawn-example {
    display: flex;
    gap: 2rem;
    justify-content: space-around;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pawn-item {
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.pawn-item .pawn,
.pawn-item .cube {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    display: block;
}

.pawn.green, .cube.green { color: var(--green-main); }
.pawn.blue, .cube.blue { color: var(--blue-main); }
.pawn.red, .cube.red { color: var(--red-main); }
.pawn.yellow, .cube.yellow { color: var(--yellow-main); }
.pawn.black, .cube.black { color: var(--black-main); }

.example-box {
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    padding: 1.5rem;
    border-radius: 15px;
    border-left: 5px solid var(--primary-color);
}

.example-box p {
    margin-bottom: 0.5rem;
}

/* ================================
   Player Setup
   ================================ */

.setup-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 3rem;
    max-width: 800px;
    box-shadow: var(--shadow-xl);
    width: 100%;
}

.setup-container h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
}

.player-input-section {
    margin-bottom: 2rem;
}

.player-input-section label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.player-input-section input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    border: 3px solid #e5e7eb;
    border-radius: 10px;
    font-family: var(--font-body);
    transition: border-color 0.3s;
}

.player-input-section input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.player-names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.player-name-input {
    position: relative;
}

.player-name-input input {
    width: 100%;
    padding: 1rem 1rem 1rem 3.5rem;
    font-size: 1.1rem;
    border: 3px solid #e5e7eb;
    border-radius: 10px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.player-name-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.player-avatar {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.difficulty-selector {
    margin: 2rem 0;
}

.difficulty-selector h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.difficulty-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.difficulty-btn {
    flex: 1;
    padding: 1.5rem;
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.difficulty-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
}

.diff-icon {
    font-size: 2rem;
}

/* ================================
   Game Screen
   ================================ */

#gameScreen.active {
    display: block;
    padding: 0;
}

.top-bar {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.game-info {
    display: flex;
    gap: 3rem;
    align-items: center;
}

.round-indicator,
.current-team {
    font-size: 1.2rem;
    font-weight: 600;
}

.round-indicator span,
.current-team span {
    color: #fbbf24;
    font-size: 1.3rem;
}

.actions {
    display: flex;
    gap: 1rem;
}

.game-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    padding: 2rem;
    min-height: calc(100vh - 100px);
}

/* ================================
   Left Panel (Card & Controls)
   ================================ */

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.concept-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--primary-color);
}

.difficulty-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.difficulty-badge.EASY {
    background: #d1fae5;
    color: #065f46;
}

.difficulty-badge.HARD {
    background: #fed7aa;
    color: #9a3412;
}

.difficulty-badge.CHALLENGING {
    background: #fecaca;
    color: #991b1b;
}

.secret-word {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-display);
    margin-bottom: 1.5rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pawn-selector {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.pawn-selector h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.tool-btn {
    padding: 1rem;
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1rem;
}

.tool-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.tool-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.tool-icon {
    font-size: 2rem;
}

.tool-icon.green { color: var(--green-main); }
.tool-icon.blue { color: var(--blue-main); }
.tool-icon.red { color: var(--red-main); }
.tool-icon.yellow { color: var(--yellow-main); }
.tool-icon.black { color: var(--black-main); }

.round-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ================================
   Right Panel (Icon Board)
   ================================ */

.icon-board {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.icon-item {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0.8rem;
}

.icon-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.icon-symbol {
    font-size: 2.5rem;
    margin-bottom: 0.3rem;
}

.icon-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #6b7280;
    line-height: 1.2;
}

.marker {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: none;
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.marker.green { color: var(--green-main); }
.marker.blue { color: var(--blue-main); }
.marker.red { color: var(--red-main); }
.marker.yellow { color: var(--yellow-main); }
.marker.black { color: var(--black-main); }

/* Position markers around the icon */
.marker:nth-of-type(1) { top: -10px; left: -10px; }
.marker:nth-of-type(2) { top: -10px; right: -10px; }
.marker:nth-of-type(3) { bottom: -10px; left: -10px; }
.marker:nth-of-type(4) { bottom: -10px; right: -10px; }
.marker:nth-of-type(5) { top: 50%; left: -15px; transform: translateY(-50%); }

/* ================================
   Modal (Scoreboard)
   ================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 30px;
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
}

.scoreboard-list {
    margin-bottom: 2rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 15px;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.score-item:hover {
    transform: translateX(10px);
    box-shadow: var(--shadow-lg);
}

.score-item.winner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 3px solid #f59e0b;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-rank {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.player-avatar-small {
    font-size: 1.5rem;
}

.player-score {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--success-color);
}

/* ================================
   Game Over Screen
   ================================ */

.game-over-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 3rem;
    max-width: 800px;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.winner-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s infinite;
}

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

.final-scores {
    margin-bottom: 2rem;
}

.game-over-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

/* ================================
   Responsive Design
   ================================ */

@media (max-width: 1200px) {
    .game-content {
        grid-template-columns: 1fr;
    }

    .icon-board {
        max-height: 600px;
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 4rem;
        letter-spacing: 0.3rem;
    }

    .tagline {
        font-size: 1.2rem;
    }

    .btn-large {
        min-width: 250px;
        font-size: 1.2rem;
    }

    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .icon-board {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

/* ================================
   Scrollbar Styling
   ================================ */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

/* ================================
   New Features - Enhanced Styles
   ================================ */

/* Language Selector */
.language-selector {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.language-btn {
    min-width: 120px;
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
}

.language-btn:hover {
    transform: translateY(-2px);
}

/* Board Controls */
.board-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

/* Search Container */
.search-container {
    width: 100%;
}

.search-container input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    border: 3px solid #e5e7eb;
    border-radius: 10px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Category Filter */
.category-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-family: var(--font-display);
    font-weight: 600;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--primary-color);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.zoom-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: 600;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.zoom-btn:hover {
    background: #f3f4f6;
}

.zoom-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* History Panel */
.history-panel {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--primary-color);
    margin: 0;
}

.history-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-tiny {
    padding: 0.4rem 0.8rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-tiny:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-tiny:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.history-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.history-item:hover {
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
}

.history-marker {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.history-icon {
    font-size: 1.5rem;
}

.history-label {
    flex: 1;
    font-weight: 500;
}

/* Timer Display */
.timer-display {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: #10b981;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    min-width: 80px;
    text-align: center;
}

.timer-display.timer-warning {
    color: #ef4444;
    animation: pulse-warning 1s infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        background: rgba(239, 68, 68, 0.2);
    }
    50% {
        background: rgba(239, 68, 68, 0.4);
    }
}

#timerBtn.active {
    background: var(--success-color);
    color: white;
}

/* Tutorial Overlay */
.tutorial-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.tutorial-overlay.active {
    display: flex;
}

.tutorial-content {
    background: white;
    border-radius: 30px;
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.tutorial-content h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.tutorial-content p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.tutorial-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.tutorial-highlight {
    position: relative;
    z-index: 1999;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 40px rgba(99, 102, 241, 0.8) !important;
    animation: highlight-pulse 2s infinite;
}

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

/* Enhanced Visual Feedback */
.icon-item {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0.8rem;
}

.icon-item:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
}

.icon-item:active {
    transform: translateY(-4px) scale(1.02);
}

.marker {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: all;
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s;
}

.marker:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

/* Marker pulse animation */
@keyframes marker-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.marker.pulse {
    animation: marker-pulse 0.6s ease-in-out infinite;
}

/* Button hover effects enhancement */
.btn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 600;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Tool button enhanced feedback */
.tool-btn {
    padding: 1rem;
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1rem;
}

.tool-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.tool-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    animation: tool-selected 0.4s ease;
}

@keyframes tool-selected {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive adjustments for new elements */
@media (max-width: 1200px) {
    .board-controls {
        padding: 1rem;
    }

    .category-filter {
        gap: 0.3rem;
    }

    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .history-panel {
        max-height: 200px;
    }
}

@media (max-width: 768px) {
    .language-selector {
        flex-direction: column;
        gap: 0.5rem;
    }

    .language-btn {
        min-width: 200px;
    }

    .board-controls {
        padding: 0.8rem;
    }

    .category-filter {
        flex-direction: column;
    }

    .category-btn {
        width: 100%;
    }

    .zoom-controls {
        flex-wrap: wrap;
    }

    .history-panel {
        max-height: 150px;
    }

    .timer-display {
        font-size: 1.2rem;
        min-width: 60px;
    }
}

/* Word Manager */
.word-manager-container {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 3rem;
    max-width: 900px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
}

.word-manager-container h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
}

.word-manager-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.difficulty-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.difficulty-tab {
    padding: 0.8rem 1.5rem;
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-weight: 600;
}

.difficulty-tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.difficulty-tab.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
}

.word-count {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
    min-width: 30px;
    text-align: center;
}

.word-manager-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.add-word-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.add-word-section input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.add-word-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.word-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 15px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s;
}

.word-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.word-text {
    font-size: 1.1rem;
    font-weight: 500;
    flex: 1;
}

.word-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.2rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon.btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.word-manager-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Modals */
.alert-modal-content,
.confirm-modal-content,
.prompt-modal-content {
    text-align: center;
    animation: alertSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes alertSlideIn {
    from {
        transform: translateY(-100px) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.alert-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: alertIconPulse 0.6s ease-in-out;
}

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

.alert-modal-content h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.alert-modal-content p {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #374151;
}

.alert-modal-content .btn {
    min-width: 150px;
}

/* Confirm Modal */
.confirm-modal-content {
    max-width: 500px;
}

.confirm-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: alertIconPulse 0.6s ease-in-out;
}

.confirm-modal-content h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.confirm-modal-content p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #374151;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-buttons .btn {
    min-width: 120px;
}

/* Prompt Modal */
.prompt-modal-content {
    max-width: 500px;
}

.prompt-modal-content h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.prompt-modal-content input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    font-family: var(--font-body);
    transition: all 0.3s;
    margin-bottom: 2rem;
}

.prompt-modal-content input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.prompt-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.prompt-buttons .btn {
    min-width: 120px;
}

/* Accessibility improvements */
.btn:focus,
.tool-btn:focus,
.category-btn:focus,
.zoom-btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading state for async operations */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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