/* Base Typography and Colors */
:root {
    --bg-primary: #1a1511;
    --bg-secondary: #2a201a;
    --text-primary: #e8dcc0;
    --text-secondary: #c4b896;
    --accent-blue: #4a9eff;
    --accent-blue-hover: #6bb3ff;
    --border-color: #3d2f23;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Crimson Text', Georgia, serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    background-attachment: fixed;
    line-height: 1.6;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.book-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 2px solid var(--border-color);
}

.title {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 3px;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    letter-spacing: 1px;
}

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent-blue-hover);
}

/* Setup Content */
.setup-content {
    max-width: 800px;
    margin: 0 auto;
}

.regular-box {
    background: rgba(42, 32, 26, 0.8);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.game-portal-card {
    background: rgb(42, 32, 26);
}

.regular-box h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

.hint {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 4px;
    border-left: 4px solid var(--accent-blue);
}

/* Language Selection */
.language-options {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.language-btn {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    min-width: 150px;
}

.language-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    transform: translateY(-2px);
}

.language-btn .flag {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Animal Selection */
.animals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.animals-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.8rem;
}

.animal-option {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.animal-option:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    transform: translateY(-2px);
}

.animal-option.selected {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.3);
}

.animal-emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.animal-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}
/* Stats Display */
.stats-display {
    background: rgba(42, 32, 26, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.stat-bars {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 0.25rem;
}

.stat-bar {
    width: 8px;
    height: 8px;
    background: var(--border-color);
    border-radius: 2px;
}

.stat-bar.filled {
    background: var(--accent-blue);
}

/* Faction Selection */
.faction-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faction-option {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.faction-option:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
}

.faction-option input[type="radio"] {
    display: none;
}

.faction-option input[type="radio"]:checked + .faction-name {
    color: var(--accent-blue);
}

.faction-option:has(input[type="radio"]:checked) {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.3);
}

.faction-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.faction-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Buttons */
.start-btn, .save-btn {
    background: linear-gradient(135deg, var(--accent-blue), #3d8bff);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 2rem;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.start-btn:hover, .save-btn:hover {
    background: linear-gradient(135deg, var(--accent-blue-hover), #5ba3ff);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.reset-btn {
    background: linear-gradient(135deg, #c44569, #b73e56);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.reset-btn:hover {
    background: linear-gradient(135deg, #d85d7a, #c44569);
    transform: translateY(-2px);
}

/* Game Layout */
.game-body {
    padding: 0;
    margin: 0;
}

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(26, 21, 17, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-icon {
    color: var(--text-primary);
    text-decoration: none;
}

.icon-circle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: opacity 0.3s ease;
}

.icon-circle:hover {
    opacity: 0.7;
}

.story-option {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}
.story-option:hover, .story-option:focus {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    transform: translateX(5px);
}
.story-option .option-number {
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}
.story-option .option-text {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#languageSwitch {
    background: rgba(61, 47, 35, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Main Game Content */
.game-main {
    margin-top: 80px;
    margin-bottom: 120px;
    padding: 2rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.story-section {
    background: rgba(42, 32, 26, 0.8);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.story-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    text-align: justify;
}

.translatable {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--accent-blue);
    transition: color 0.3s ease;
}

.translatable:hover {
    color: var(--accent-blue);
}

.translation-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.translatable:hover .translation-tooltip {
    opacity: 1;
}

/* Game Options */
.game-options {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.option-item {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.option-item:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    transform: translateX(5px);
}

.option-item.special {
    position: relative;
}

.option-item.special::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: rgba(74, 158, 255, 0.3);
    border-radius: 6px 0 0 6px;
}

.option-number {
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.option-text {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer and Inventory */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 21, 17, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}

.inventory-section {
    text-align: center;
    flex: 1;
}

.inventory-section h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.inventory-slots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.inventory-slot, .inventory-item {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(61, 47, 35, 0.8);
}

.inventory-slot.empty {
    background: rgba(61, 47, 35, 0.3);
}

.inventory-item {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.inventory-item:hover {
    background: rgba(74, 158, 255, 0.4);
    transform: scale(1.1);
}

/* Inventory item tooltip */
.inventory-item {
    position: relative;
}

.inventory-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 21, 17, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 5px;
}

.inventory-item:hover .inventory-tooltip {
    opacity: 1;
}

.tooltip-name {
    font-weight: 600;
    color: var(--accent-blue);
}

.tooltip-translation {
    color: var(--text-secondary);
    font-style: italic;
}

/* Drag and Drop */
.inventory-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.inventory-slot.drag-over {
    background: rgba(74, 158, 255, 0.3);
    border-color: var(--accent-blue);
}

.drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: rgba(196, 69, 105, 0.3);
    border: 2px dashed #c44569;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #c44569;
    z-index: 1001;
}

.drop-zone.active {
    display: flex;
}

/* Combat Interface */
.combat-interface {
    background: rgba(42, 32, 26, 0.9);
    border: 2px solid #c44569;
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
}

.combat-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.combatant {
    text-align: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(61, 47, 35, 0.8);
}

.combatant.enemy {
    border-color: #c44569;
}

.combatant-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.combatant-emoji {
    font-size: 3rem;
    display: block;
    margin: 1rem 0;
}

.health-bar {
    background: rgba(61, 47, 35, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.health-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    transition: width 0.5s ease;
}

.combat-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.combat-btn {
    background: linear-gradient(135deg, #c44569, #b73e56);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.combat-btn:hover {
    background: linear-gradient(135deg, #d85d7a, #c44569);
    transform: translateY(-2px);
}

.combat-btn:disabled {
    background: linear-gradient(135deg, #6B7280, #4B5563);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

/* Trading Interface */
.trading-interface {
    background: rgba(42, 32, 26, 0.9);
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
}

.gold-display {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #FFD700;
}

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

.shop-items .combat-btn {
    width: 100%;
    min-width: auto;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
}

.shop-item {
    background: rgba(61, 47, 35, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.shop-item.is-locked {
    cursor: default;
    transition: none;
}

.shop-item.is-locked:hover {
    border-color: var(--border-color);
    background: rgba(61, 47, 35, 0.8);
}

.shop-item:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.1);
}

.shop-item.expensive {
    opacity: 0.5;
}

.shop-item.expensive:hover {
    opacity: 0.7;
}

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

.trade-section h4 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent-blue);
    font-size: 1.2rem;
}

.sell-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.sell-items .combat-btn {
    width: 100%;
    min-width: auto;
    font-size: 0.8rem;
    padding: 0.6rem 0.8rem;
}

.sell-item {
    background: rgba(61, 47, 35, 0.6);
    border-color: #4CAF50;
}

.sell-item:hover {
    border-color: #66BB6A;
    background: rgba(76, 175, 80, 0.1);
}

.sell-btn {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sell-btn:hover {
    background: linear-gradient(135deg, #66BB6A, #4CAF50);
    transform: translateY(-2px);
}

/* Puzzle interface */
.puzzle-interface {
    text-align: center;
    padding: 2rem;
}

.puzzle-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.puzzle-buttons .combat-btn {
    width: auto;
    min-width: 100px;
    margin: 0;
}

.puzzle-option {
    background: linear-gradient(135deg, #4A9EFF, #3B82F6);
    border: 2px solid #2563EB;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
    margin: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.puzzle-option:hover {
    background: linear-gradient(135deg, #60A5FA, #4A9EFF);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

/* Dialogue interface styles */
.dialogue-interface {
    padding: 2rem;
    background: rgba(42, 32, 26, 0.9);
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    margin: 1rem 0;
}

.dialogue-title {
    text-align: center;
    color: var(--accent-blue);
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.dialogue-content {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(61, 47, 35, 0.8);
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
}

.dialogue-speaker {
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.dialogue-text {
    font-style: italic;
    line-height: 1.6;
}

.dialogue-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 2rem;
}

.dialogue-option {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dialogue-option:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
    transform: translateX(5px);
}

.puzzle-input {
    margin: 2rem 0;
}

.answer-input {
    width: 100%;
    max-width: 300px;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: rgba(26, 21, 17, 0.8);
    color: var(--text-color);
    font-size: 1rem;
    text-align: center;
}

.answer-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Dialogue interface */
.dialogue-interface {
    padding: 2rem;
}

.character-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.character-emoji {
    font-size: 3rem;
}

.dialogue-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Crafting interface */
.crafting-interface {
    padding: 2rem;
}

.recipes {
    display: grid;
    gap: 1rem;
    margin: 2rem 0;
}

.recipe {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    background: rgba(61, 47, 35, 0.6);
}

.recipe.missing-ingredients {
    opacity: 0.5;
    border-color: #666;
}

.recipe-name {
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.recipe-ingredients {
    margin: 0.5rem 0;
    font-family: monospace;
}

.recipe-description {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Minigame interface */
.minigame-interface {
    padding: 2rem;
}

.memory-game {
    margin: 2rem 0;
}

.memory-score {
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--accent-blue);
}

.memory-matching-game {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.memory-left-column,
.memory-right-column {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.memory-left-column h4,
.memory-right-column h4 {
    color: var(--accent-blue);
    margin-bottom: 1rem;
    text-align: center;
}

.memory-word-left,
.memory-word-right {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(61, 47, 35, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.memory-word-left:hover,
.memory-word-right:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.1);
}

.memory-word-left.selected,
.memory-word-right.selected {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.3);
    transform: scale(1.05);
}

.memory-word-left.matched,
.memory-word-right.matched {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .memory-matching-game {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.shop-item-emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.shop-item-price {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Keyboard key indicator */
.key-indicator {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    font-family: monospace;
}

/* Gold counter */
.gold-counter {
    text-align: center;
    font-size: 1.2rem;
    color: #FFD700;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Settings */
.settings-form {
    max-width: 600px;
    margin: 0 auto;
}

.setting-group {
    background: rgba(42, 32, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.setting-group h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.setting-select {
    width: 100%;
    background: rgba(61, 47, 35, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 1rem;
}

.current-animal {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--accent-blue);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.settings-actions .save-btn {
    width: auto;
    margin-top: 0;
    flex: 1;
    min-width: 200px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .language-options {
        flex-direction: column;
        align-items: center;
    }
    
    .language-btn {
        min-width: 200px;
    }
    
    .animals-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.8rem;
    }
    
    .faction-options {
        gap: 0.8rem;
    }
    
    .faction-option {
        padding: 1rem;
    }
    
    .game-main {
        padding: 1rem;
        margin-top: 70px;
        margin-bottom: 100px;
    }
    
    .story-section {
        padding: 1.5rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .top-nav {
        padding: 0.8rem;
    }
    
    .game-footer {
        padding: 0.8rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .inventory-slots {
        gap: 0.3rem;
    }
    
    .inventory-slot, .inventory-item {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions .save-btn {
        width: 100%;
    }
    
    .reset-btn {
        margin-left: 0;
        width: 100%;
    }
}

/* Item Collection Animation */
@keyframes itemCollected {
    0% {
        transform: scale(1);
        background: rgba(74, 158, 255, 0.2);
    }
    50% {
        transform: scale(1.2);
        background: rgba(74, 158, 255, 0.6);
    }
    100% {
        transform: scale(1);
        background: rgba(74, 158, 255, 0.2);
    }
}

.inventory-item.collected {
    animation: itemCollected 0.8s ease-in-out;
}

/* Game Messages */
.game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: var(--accent-blue);
    padding: 2rem 3rem;
    border-radius: 12px;
    font-size: 1.3rem;
    z-index: 10000;
    text-align: center;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 8px 24px var(--shadow-color);
    backdrop-filter: blur(10px);
    animation: messageAppear 0.5s ease-out;
}

.game-message.closable {
    padding-right: 2.5rem;
}

.game-message .message-close-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 1.2rem;
    cursor: pointer;
}

@keyframes messageAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Story transitions */
.story-text.fade-in {
    animation: fadeInStory 0.8s ease-in-out;
}

@keyframes fadeInStory {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Option hover effects */
.option-item.selected {
    background: rgba(74, 158, 255, 0.4) !important;
    transform: translateX(10px);
    border-color: var(--accent-blue-hover);
}

@media (max-width: 480px) {
    .title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
    
    .animals-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .animal-emoji {
        font-size: 1.5rem;
    }
    
    .animal-name {
        font-size: 0.8rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .story-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .option-item {
        padding: 0.8rem;
    }

    /* Hide feedback link to prevent overlap with inventory */
    #feedbackLink {
        display: none;
    }
    
    .option-text {
        font-size: 0.9rem;
    }
}

/* Word Quiz interface */
.word-quiz-interface {
    padding: 2rem;
    text-align: center;
}

.quiz-progress {
    width: 100%;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.quiz-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-word {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-option {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    background: rgba(61, 47, 35, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-weight: 500;
}

.quiz-option:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
}

/* Custom Action Input */
.custom-action {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    gap: 0.5rem;
}

.custom-action-input {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: rgba(26, 21, 17, 0.8);
    color: var(--text-color);
    font-size: 1rem;
}

.custom-action-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.custom-action-send {
    background: rgba(61, 47, 35, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.custom-action-send:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.2);
}

/* Auth layouts */
.auth-card {
    max-width: 640px;
    margin: 0 auto;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .auth-desc {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-row label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.auth-row input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(26, 21, 17, 0.85);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.auth-row input:focus,
.auth-row select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.auth-row select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(26, 21, 17, 0.85);
    color: var(--text-primary);
    transition: all 0.2s ease;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
        linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 3px),
        calc(100% - 15px) calc(50% - 3px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-actions .auth-button {
    flex: 1;
    min-width: 180px;
}

.auth-button {
    background: linear-gradient(135deg, var(--accent-blue), #3d8bff);
    border: none;
    color: #0b1726;
    padding: 0.9rem 1.4rem;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-button:hover {
    background: linear-gradient(135deg, var(--accent-blue-hover), #5ba3ff);
    transform: translateY(-1px);
}

.auth-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

.auth-links a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    color: var(--accent-blue-hover);
}

.status-message {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(74, 158, 255, 0.08);
    color: var(--text-primary);
}

.status-message.error {
    border-color: #c44569;
    background: rgba(196, 69, 105, 0.15);
}

.status-message.success {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
}
