/**
 * DigitZag - Number Puzzle Game
 * Copyright (c) 2025 Kevin Rossen. All rights reserved.
 */

:root {
    --bg-color: #121213;
    --primary-bg: #1a1a1b;
    --bg-secondary: #1a1a1b;
    --bg-tertiary: #2a2a2b;
    --border-color: #3a3a3c;
    --text-primary: #ffffff;
    --text-secondary: #818384;
    --correct: #538d4e;
    --present: #b59f3b;
    --absent: #3a3a3c;
    --key-bg: #818384;
    --accent: #538d4e;
    --primary-color: #538d4e;
    
    /* Tile sizing variables for different difficulties */
    --tile-size-easy: 70px;
    --tile-font-easy: 36px;
    --tile-size-normal: 62px;
    --tile-font-normal: 32px;
    --tile-size-advanced: 56px;
    --tile-font-advanced: 28px;
    
    /* Modal shared properties */
    --modal-bg: var(--primary-bg);
    --modal-border: 2px solid var(--border-color);
    --modal-border-radius: 8px;
    --modal-padding: 40px;
}

/* Global utility classes */
.hidden {
    display: none !important;
}

/* Skip Links for accessibility */
.skip-links {
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    z-index: 10000;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: top 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.skip-link:focus {
    top: 8px;
    outline: 2px solid white;
    outline-offset: 2px;
}

.skip-link:hover {
    background: var(--accent);
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus improvements */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Specific focus styles for game elements */
.tile:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 1px;
    box-shadow: 0 0 0 1px var(--bg-color);
}

.tile.active {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

.diff-btn:focus,
.mode-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.icon-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    *:focus-visible {
        outline: 3px solid;
        outline-offset: 2px;
    }
    
    .tile:focus {
        outline: 4px solid;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .skip-link {
        transition: none;
    }
    
    .tile {
        transition: none;
    }
    
    .modal {
        transition: none;
    }
}

/* Light theme */
body.light-theme {
    --bg-color: #ffffff;
    --primary-bg: #f6f7f8;
    --bg-secondary: #f6f7f8;
    --bg-tertiary: #e4e6eb;
    --border-color: #d6d6d7;
    --text-primary: #121213;
    --text-secondary: #787c7e;
    --correct: #6aaa64;
    --present: #c9b458;
    --absent: #d3d6da;
    --key-bg: #787c7e;
    --accent: #6aaa64;
    --primary-color: #6aaa64;
}

/* Light theme specific adjustments */
body.light-theme .modal {
    background: rgba(0, 0, 0, 0.3);
}

body.light-theme .modal-content {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body.light-theme .scratchpad-overlay {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .scratchpad-panel {
    background: #ffffff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

/* Font size variations */
body.font-large {
    font-size: 115%;
}

body.font-large .clue-item {
    font-size: 24px;
}

body.font-large .tile {
    font-size: calc(var(--tile-font-normal) * 1.15);
}

body.font-large h1 {
    font-size: 42px;
}

body.font-large .scrambled-display {
    font-size: 55px;
}

body.font-extra-large {
    font-size: 130%;
}

body.font-extra-large .clue-item {
    font-size: 30px;
}

body.font-extra-large .tile {
    font-size: calc(var(--tile-font-normal) * 1.3);
}

body.font-extra-large h1 {
    font-size: 48px;
}

body.font-extra-large .scrambled-display {
    font-size: 62px;
}

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

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Ensure focus-visible works for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    margin: 0;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 500px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.container {
    max-width: 500px;
    width: 100%;
}

header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.header-top {
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.title-section {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    text-align: center;
}

.streak-badge {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-bg);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 8px 12px;
    font-weight: bold;
    color: var(--accent);
    font-size: 16px;
    animation: pulse 2s infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.streak-badge:hover {
    background: var(--accent);
    color: var(--bg-color);
}

.streak-icon {
    font-size: 18px;
    filter: drop-shadow(0 0 4px var(--accent));
}

.streak-count {
    font-size: 18px;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.icon-buttons {
    display: flex;
    gap: 8px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* User Authentication Styles */
.user-auth {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

#signInArea, #userButtonArea {
    display: flex;
    align-items: center;
}

#userButtonArea {
    display: none;
}

/* Sign in button styling */
#sign-in-btn {
    font-size: 18px;
}

/* Style the Clerk user button to match the theme */
.cl-userButtonTrigger {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 8px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.cl-userButtonTrigger:hover {
    background: var(--bg-tertiary) !important;
    border-color: var(--accent) !important;
}

h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 5px;
    font-size: 14px;
}

.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    max-width: 500px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
}

.mode-btn {
    flex: 1;
    max-width: calc(50% - 5px);
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.difficulty-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    max-width: 500px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
}

.diff-btn {
    flex-basis: 28.3%;
    max-width: 28.3%;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

#toggleScratchpad {
    flex-basis: 15%;
    max-width: 15%;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diff-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.diff-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 12px rgba(83, 141, 78, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
    position: relative;
}

.diff-btn.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 6px;
    background: linear-gradient(45deg, var(--accent), #4a7c49);
    z-index: -1;
    opacity: 0.3;
    animation: difficulty-pulse 2s ease-in-out infinite alternate;
}

.diff-btn.active:hover {
    background: #4a7c49;
    border-color: #4a7c49;
    box-shadow: 0 0 16px rgba(83, 141, 78, 0.5), 0 3px 12px rgba(0, 0, 0, 0.3);
}

@keyframes difficulty-pulse {
    0% {
        opacity: 0.3;
    }
    100% {
        opacity: 0.5;
    }
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    contain: layout style;
}

.total-score-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--primary-bg);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.total-score-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.total-score-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 0.05em;
    min-width: 80px;
    text-align: center;
}

.reset-score-btn {
    padding: 6px 8px;
    font-size: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-score-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: scale(1.1);
}

.scrambled-number {
    text-align: center;
    padding: 20px;
    background: var(--primary-bg);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.scrambled-display {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.hint-section {
    text-align: center;
    padding: 15px;
    background: var(--primary-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.clues-section {
    background: var(--primary-bg);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.clues-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue-item {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.scoring-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--primary-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.scoring-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.scoring-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.score-item {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.score-item:first-child {
    color: var(--accent);
    font-weight: bold;
}

.guess-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
    contain: layout style;
}

.guess-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.tile {
    width: var(--tile-size-normal);
    height: var(--tile-size-normal);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--tile-font-normal);
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
    cursor: pointer;
    outline: none;
    position: relative;
    will-change: transform, box-shadow;
}

.tile.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(83, 141, 78, 0.3);
    transform: scale(1.02);
    animation: pulse-glow 1.5s ease-in-out infinite alternate;
}

.tile:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -1px;
}

.tile:hover:not(.filled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tile.selecting {
    animation: tile-select 0.3s ease-out;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(83, 141, 78, 0.3);
    }
    100% {
        box-shadow: 0 0 0 2px var(--accent), 0 0 20px rgba(83, 141, 78, 0.5);
    }
}

@keyframes tile-select {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1.02);
    }
}

/* Adjust tile sizes for different difficulties */
.game-container[data-difficulty="easy"] .tile {
    width: var(--tile-size-easy);
    height: var(--tile-size-easy);
    font-size: var(--tile-font-easy);
}

.game-container[data-difficulty="advanced"] .tile {
    width: var(--tile-size-advanced);
    height: var(--tile-size-advanced);
    font-size: var(--tile-font-advanced);
}

.tile.filled {
    animation: pop 0.1s ease-in-out;
}

.tile.correct {
    background-color: var(--correct);
    border-color: var(--correct);
    animation: flip 0.5s ease;
}

.tile.present {
    background-color: var(--present);
    border-color: var(--present);
    animation: flip 0.5s ease;
}

.tile.absent {
    background-color: var(--absent);
    border-color: var(--absent);
    animation: flip 0.5s ease;
}

.tile.locked {
    background: var(--bg-tertiary);
    border-color: var(--correct);
    border-width: 3px;
    opacity: 0.9;
    cursor: not-allowed;
}

.tile.locked::after {
    content: '🔒';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Enhanced animations for UI/UX improvements */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

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

@keyframes tileReveal {
    0% {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1) rotate(90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes clueAppear {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Loading state for game generation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.loading-text {
    color: var(--text-primary);
    font-size: 18px;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

/* Game container transition for difficulty changes */
.game-container {
    position: relative;
    transition: opacity 0.3s ease;
}

.game-container.transitioning {
    opacity: 0.3;
}

/* Enhanced clue animations */
.clue-item {
    animation: clueAppear 0.3s ease-out backwards;
}

.clue-item:nth-child(1) { animation-delay: 0.1s; }
.clue-item:nth-child(2) { animation-delay: 0.2s; }
.clue-item:nth-child(3) { animation-delay: 0.3s; }
.clue-item:nth-child(4) { animation-delay: 0.4s; }
.clue-item:nth-child(5) { animation-delay: 0.5s; }
.clue-item:nth-child(6) { animation-delay: 0.6s; }

/* Tile reveal animation for clues */
.tile.clue-reveal {
    animation: tileReveal 0.5s ease-out;
}

/* Clue digit animation */
.clue-digit {
    display: inline-block;
    animation: tileReveal 0.4s ease-out backwards;
    color: var(--accent);
    font-weight: bold;
}

.input-section {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#guessInput {
    flex: 1;
    max-width: 200px;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    letter-spacing: 0.1em;
}

#guessInput:focus {
    outline: none;
    border-color: var(--accent);
}

.submit-btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.submit-btn:hover {
    background: #4a7c49;
}

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

.attempts-remaining {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.message {
    text-align: center;
    font-size: 14px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.message.error {
    color: #ff5555;
}

.message.success {
    color: var(--correct);
}


/* Simple-Keyboard Customization for DigitZag */
.simple-keyboard {
    background: var(--bg-color) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15) !important;
    padding: 15px !important;
    z-index: 10003 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s ease !important;
}

.simple-keyboard.visible {
    transform: translateY(0) !important;
}

.simple-keyboard .hg-button {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    font-family: 'Helvetica Neue', Arial, sans-serif !important;
    min-height: 50px !important;
    margin: 3px !important;
    transition: all 0.2s ease !important;
}

.simple-keyboard .hg-button:hover {
    background: var(--bg-tertiary) !important;
    transform: translateY(-1px) !important;
}

.simple-keyboard .hg-button:active {
    transform: scale(0.95) !important;
    background: var(--accent) !important;
    color: var(--bg-color) !important;
}

.simple-keyboard .hg-button.hg-functionBtn {
    background: var(--danger) !important;
    color: white !important;
}

.simple-keyboard .hg-button.hg-functionBtn:hover {
    background: #d32f2f !important;
}

.simple-keyboard .hg-button.hg-functionBtn:active {
    background: #b71c1c !important;
}

/* Body adjustments when virtual keyboard is visible */
body.keypad-visible {
    padding-bottom: 200px;
    transition: padding-bottom 0.3s ease;
}

/* Mobile submit button */
.mobile-submit {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.mobile-submit.hidden {
    display: none;
}

.mobile-submit-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-submit-btn:hover {
    background: var(--primary-light);
}

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

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal:not(.hidden) .modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

.modal-content {
    background: var(--modal-bg);
    padding: var(--modal-padding);
    border-radius: var(--modal-border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: var(--modal-border);
    position: relative;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    margin: 20px 0;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 28px;
}

#modalMessage {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.modal-stats {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.modal-stats .stats-header h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: var(--accent);
}

.modal-stats .current-game-stats {
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

.modal-stats .overall-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-stats .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.modal-stats .stat-label {
    color: var(--text-secondary);
}

.modal-stats .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.modal-stats .difficulty-stat {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.modal-stats .difficulty-stat .stat-label {
    color: var(--accent);
    font-weight: 600;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Menu Modal Styles */
.menu-content {
    max-width: 350px;
    padding: 30px;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 16px;
    min-height: 48px;
}

.menu-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.menu-icon {
    font-size: 18px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-text {
    flex: 1;
    font-weight: 500;
}

.auth-item {
    border: none;
    background: transparent;
    padding: 0;
    cursor: default;
}

.auth-item:hover {
    background: transparent;
    transform: none;
}

.menu-auth-area {
    width: 100%;
}

.menu-auth-area .menu-item {
    width: 100%;
}

.menu-user-button-container {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.menu-user-button-container > div {
    opacity: 0;
}

.solution {
    text-align: left;
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.solution h3 {
    margin: 0 0 16px 0;
    color: var(--accent);
    font-size: 18px;
    text-align: center;
}

.solution-numbers {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    justify-content: center;
}

.solution-number {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    min-width: 100px;
}

.solution-number.original {
    border-color: var(--correct);
}

.solution-number.zagged {
    border-color: var(--present);
}

.solution-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.solution-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    font-family: inherit;
}

.solution-number.original .solution-value {
    color: var(--correct);
}

.solution-number.zagged .solution-value {
    color: var(--present);
}

.mapping-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.mapping-item {
    padding: 10px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
    flex: 0 0 auto;
    min-width: 60px;
}

.mapping-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .solution-numbers {
        flex-direction: column;
        gap: 12px;
    }
    
    .solution-number {
        min-width: auto;
        width: 100%;
    }
    
    .mapping-grid {
        max-width: 300px;
    }
    
    .mapping-item {
        min-width: 80px;
    }
}

.new-game-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.new-game-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Modal Actions Container */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Share Button */
.share-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: var(--bg-tertiary);
    border: 2px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

.share-btn.copied {
    background: var(--correct);
    border-color: var(--correct);
    color: white;
}

.share-btn.copied:hover {
    background: var(--correct);
    border-color: var(--correct);
    color: white;
}

/* Post Game Actions */
.post-game-actions {
    margin-top: 20px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}

.post-game-actions.hidden {
    display: none;
}

.post-game-actions .new-game-btn {
    margin: 0 auto;
}

/* Help Modal Styles */
.help-content {
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

/* Stats Modal Styles */
.stats-content {
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    margin-bottom: 15px;
    color: var(--accent);
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-stats {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.diff-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.diff-stat-row:last-child {
    border-bottom: none;
}

.diff-label {
    font-weight: bold;
    color: var(--text-primary);
}

.diff-data {
    color: var(--text-secondary);
}

/* Personal Bests Styles */
.personal-bests {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.best-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.best-stat-row:last-child {
    border-bottom: none;
}

.best-label {
    font-weight: bold;
    color: var(--text-primary);
}

.best-data {
    color: var(--text-secondary);
    text-align: right;
}

.best-data.has-best {
    color: var(--accent);
    font-weight: bold;
}

/* Wiki Link Button */
.wiki-link-btn {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.wiki-link-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

/* Menu Link Styling */
.menu-link {
    text-decoration: none;
    color: inherit;
}

.menu-link:hover {
    text-decoration: none;
    color: inherit;
}

.stats-notice {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 20px;
}

/* Leaderboard Modal Styles */
.leaderboard-content {
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

.leaderboard-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
}

.leaderboard-section {
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 80px;
    gap: 10px;
    background: var(--bg-secondary);
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-entries {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 80px;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    align-items: center;
}

.leaderboard-entry:hover {
    background: var(--bg-secondary);
}

.leaderboard-entry.current-user {
    background: var(--primary-bg);
    border-left: 4px solid var(--accent);
}

.rank-col {
    text-align: center;
    font-weight: bold;
    color: var(--accent);
}


.player-col {
    font-weight: 500;
    color: var(--text-primary);
}

.score-col {
    text-align: center;
    font-weight: bold;
    color: var(--accent);
}

.attempts-col,
.time-col {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-message,
.empty-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
}

.coming-soon-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-primary);
}

.coming-soon-icon {
    font-size: 48px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 8px var(--accent));
}

.coming-soon-text h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 20px;
}

.coming-soon-text p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.leaderboard-notice {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 20px;
}

/* Analytics Display Styles */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.analytics-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.analytics-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.analytics-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
}

.recent-activity h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.recent-games {
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
}

.recent-game {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    font-size: 14px;
}

.recent-game:last-child {
    border-bottom: none;
}

.game-date {
    color: var(--text-secondary);
}

.game-difficulty {
    color: var(--text-primary);
    text-transform: capitalize;
    font-weight: 500;
}

.game-result {
    text-align: center;
    font-weight: bold;
}

.game-result.win {
    color: var(--success);
}

.game-result.loss {
    color: var(--error);
}

.no-activity {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 20px;
}

.help-content h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--accent);
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.help-section p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 10px;
}

.help-section li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.4;
}

.help-section li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Enhanced Help Modal Styles */
.help-example {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.help-example h4 {
    margin: 0 0 10px 0;
    color: var(--accent);
    font-size: 16px;
}

.example-number {
    font-family: 'Courier New', monospace;
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: var(--primary-color);
}

.help-steps {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.help-steps li {
    counter-increment: step-counter;
    margin-bottom: 15px;
    padding-left: 35px;
    position: relative;
}

.help-steps li::before {
    content: counter(step-counter);
    background: var(--accent);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
    font-size: 14px;
}

.help-tips {
    list-style: none;
    padding-left: 0;
}

.help-tips li {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--accent);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
}

.help-tips li::before {
    content: "💡";
    margin-right: 8px;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.difficulty-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.difficulty-item h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.difficulty-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Settings Panel Styles */
.settings-content {
    width: 400px;
}

.settings-content h2 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Profile Modal Styles */
.profile-content {
    width: 450px;
    max-width: 90vw;
}

.profile-content h2 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.profile-section {
    margin-bottom: 20px;
}

.profile-info {
    margin-bottom: 25px;
}

.profile-picture-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.profile-avatar-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.profile-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    user-select: none;
}

.profile-info.premium .profile-avatar,
.profile-info.premium .profile-avatar-initials {
    border-color: #ffd700;
}

.profile-info.moderator .profile-avatar,
.profile-info.moderator .profile-avatar-initials {
    border-color: #40e0d0;
}

.profile-info.admin .profile-avatar,
.profile-info.admin .profile-avatar-initials {
    border-color: #ff4500;
}

.profile-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.profile-detail label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 120px;
}

.profile-value {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
    overflow: hidden;
}


/* Display Name Section - Three Line Layout */
.display-name-section {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.profile-label-line {
    display: flex;
    align-items: center;
}

.profile-label-line label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 120px;
}

.profile-content-line {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    position: relative;
}

.display-name-input {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.display-name-input[readonly] {
    background: var(--bg-color);
    color: var(--text-primary);
    border-color: var(--border-color);
    cursor: pointer;
}

.display-name-input[readonly]:hover {
    border-color: var(--accent);
}

.display-name-input:not([readonly]) {
    cursor: text;
    border-color: var(--accent);
}

.display-name-input:not([readonly]):focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.profile-actions-line {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    #displayNameEdit {
        min-width: 200px;
    }
    
    .profile-detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .profile-value {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Responsive profile picture */
    .profile-avatar-container {
        width: 60px;
        height: 60px;
    }
    
    .profile-avatar-initials {
        font-size: 24px;
    }
    
    /* Responsive leaderboard */
    .leaderboard-header {
        grid-template-columns: 40px 1fr 60px 60px 60px;
        padding: 10px;
        font-size: 12px;
    }
    
    .leaderboard-entry {
        grid-template-columns: 40px 1fr 60px 60px 60px;
        padding: 10px;
    }
}

.profile-value span {
    color: var(--text-primary);
    font-weight: 500;
}

.profile-role {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-role.player {
    background: rgba(129, 131, 132, 0.2);
    color: var(--text-secondary);
}

.profile-role.premium {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.profile-role.moderator {
    background: rgba(64, 224, 208, 0.2);
    color: #40e0d0;
    border: 1px solid rgba(64, 224, 208, 0.3);
}

.profile-role.admin {
    background: rgba(255, 69, 0, 0.2);
    color: #ff4500;
    border: 1px solid rgba(255, 69, 0, 0.3);
}

.profile-edit-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.profile-edit-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
}

.profile-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.profile-btn.primary:hover {
    background: #4a7c49;
    border-color: #4a7c49;
    transform: translateY(-1px);
}

.profile-btn.secondary {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.profile-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.profile-btn.danger {
    background: var(--bg-color);
    border-color: var(--border-color);
    color: #ff5555;
}

.profile-btn.danger:hover {
    background: rgba(255, 85, 85, 0.1);
    border-color: var(--border-color);
    color: #ff3333;
    transform: translateY(-1px);
}

.profile-icon {
    font-size: 18px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-privacy {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.profile-privacy a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.profile-privacy a:hover {
    text-decoration: underline;
}

.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.profile-input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

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

.profile-input.error {
    border-color: #ff5555;
}


.profile-save-btn, .profile-cancel-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 36px;
}

.profile-save-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.profile-cancel-btn:hover {
    background: #ff5555;
    color: white;
    border-color: #ff5555;
}

.profile-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.profile-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.profile-feedback.success {
    background: rgba(83, 141, 78, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.profile-feedback.error {
    background: rgba(255, 85, 85, 0.1);
    border: 1px solid #ff5555;
    color: #ff5555;
}

.profile-feedback.loading {
    background: rgba(129, 131, 132, 0.1);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
}

.profile-loading {
    opacity: 0.6;
    pointer-events: none;
}

.profile-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--text-secondary);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.theme-selector, .font-size-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.theme-btn, .font-size-btn {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.theme-btn:hover, .font-size-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.theme-btn.active, .font-size-btn.active {
    background: var(--primary-bg);
    border-color: var(--accent);
    color: var(--text-primary);
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Icon Button */
.icon-btn {
    padding: 8px 12px;
    font-size: 20px;
    background: var(--primary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.icon-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: scale(1.05);
}

/* Scratchpad Panel */
.scratchpad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: 998;
    display: none;
}

.scratchpad-overlay.hidden {
    display: none;
}

.scratchpad-overlay:not(.hidden) {
    display: block;
}

.scratchpad-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--primary-bg);
    border-left: 2px solid var(--border-color);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

.scratchpad-panel.hidden {
    display: none;
}

.scratchpad-panel:not(.hidden) {
    display: block;
}

.scratchpad-panel.open {
    transform: translateX(0);
}

/* Scratchpad header */
.scratchpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Pin button styles */
.pin-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
    opacity: 0.6;
}

.pin-btn:hover {
    background: var(--hover-bg);
    opacity: 1;
}

.pin-btn.pinned {
    color: var(--accent-color);
    opacity: 1;
    transform: rotate(45deg);
}

/* Pinned scratchpad state - no overlay, different z-index */
.scratchpad-panel.pinned {
    z-index: 500; /* Lower than modals but higher than game */
}

.scratchpad-panel.pinned ~ .scratchpad-overlay {
    display: none !important;
}

/* Scratchpad close button uses shared .close-btn styles with minor adjustments */
.scratchpad-panel .close-btn {
    font-size: 24px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scratchpad-panel h3 {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    margin-top: 30px;
    color: var(--text-primary);
    text-align: center;
}

.mapping-grid {
    margin: 0 auto;
}

.mapping-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
}

.zagged-digit {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
}

.mapping-arrow {
    text-align: center;
    color: var(--text-secondary);
}

.original-digit {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    padding: 8px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    user-select: none;
}

.original-digit:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.original-digit.mapped {
    color: var(--text-primary);
    background: var(--primary-bg);
    border-color: var(--accent);
}

.clear-btn {
    margin-top: 15px;
    padding: 8px 16px;
    font-size: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.clear-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.mapping-controls {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.select-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
}

.mapping-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 30px 8px 12px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    width: 80px;
}

.mapping-select:hover {
    border-color: var(--accent);
}

.mapping-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(83, 141, 78, 0.2);
}

/* Custom dropdown arrow */
.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    font-size: 12px;
}

.control-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.control-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: scale(1.1);
}

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

.plus-btn:hover {
    background: rgba(83, 141, 78, 0.1);
}

.minus-btn:hover {
    background: rgba(255, 85, 85, 0.1);
}

@media (max-width: 480px) {
    .streak-badge {
        padding: 3px 6px;
        font-size: 11px;
        border-radius: 14px;
        transform: translateY(-50%) scale(0.7);
        transform-origin: left center;
    }
    
    .streak-icon {
        font-size: 13px;
    }
    
    .scratchpad-panel {
        width: 280px;
    }
    
    .icon-btn {
        font-size: 18px;
        padding: 6px 10px;
    }
    
    .icon-buttons {
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        gap: 5px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .tile {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .game-container[data-difficulty="easy"] .tile {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
    
    .game-container[data-difficulty="advanced"] .tile {
        width: 45px;
        height: 45px;
        font-size: 22px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .scrambled-display {
        font-size: 36px;
    }
    
    .diff-btn {
        padding: 6px 16px;
        font-size: 12px;
    }
}

/* Version number */
.version {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.3;
    font-family: 'Courier New', monospace;
    pointer-events: none;
    z-index: 1;
}

/* Cookie Consent Banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-secondary);
    border-top: 2px solid var(--primary-color);
    padding: 20px;
    z-index: 10000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    box-sizing: border-box;
}

.cookie-consent.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cookie-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-content p {
    margin: 0;
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 10001;
    min-width: 80px;
    white-space: nowrap;
}

.cookie-btn.accept {
    background: var(--primary-color);
    color: white;
}

.cookie-btn.accept:hover {
    background: #45a049;
}

.cookie-btn.reject {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

.cookie-btn.reject:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .modal {
        padding-top: 20px;
        padding-bottom: 20px;
        align-items: center;
    }
    
    .modal-content {
        width: 95%;
        max-height: calc(100vh - 40px);
        margin: 10px 0;
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    #modalMessage {
        font-size: 14px;
        line-height: 1.4;
    }
}

@media (max-width: 360px) {
}

@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-content p {
        margin-bottom: 15px;
    }
}

/* Footer Styles */
.game-footer {
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
    width: 100%;
}

.footer-content {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.footer-separator {
    color: var(--text-secondary);
    font-size: 12px;
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-separator {
        display: none;
    }
    
    .game-footer {
        margin-top: 30px;
        padding: 15px 0;
    }
}

/* Privacy Toggle Styles */
.privacy-toggle-container {
    margin-top: 8px;
    width: 100%;
}

.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.privacy-toggle input[type="checkbox"] {
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.privacy-toggle input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.privacy-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.privacy-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

.privacy-label {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

/* Setup Modal Styles */
.setup-content {
    max-width: 450px;
    width: 90%;
    text-align: left;
}

.setup-content h2 {
    text-align: center;
    color: var(--accent);
    margin-bottom: 15px;
}

.setup-content p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.setup-section {
    margin-bottom: 20px;
}

.setup-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setup-checkbox {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-transform: none !important;
    font-weight: normal !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    margin-bottom: 0 !important;
}

.setup-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    appearance: none;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.setup-checkbox input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.setup-checkbox input[type="checkbox"]:checked::before {
    content: '✓';
    display: block;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 14px;
}

.setup-checkbox a {
    color: var(--accent);
    text-decoration: none;
}

.setup-checkbox a:hover {
    text-decoration: underline;
}

.setup-actions {
    text-align: center;
    margin-top: 25px;
}

.setup-actions .profile-btn {
    min-width: 150px;
    justify-content: center;
}

/* Delete Account Modal Styles */
.delete-account-content {
    max-width: 500px;
    width: 90%;
    text-align: left;
}

.delete-account-content h2 {
    text-align: center;
    color: #ff5555;
    margin-bottom: 20px;
}

.delete-account-content p {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.delete-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 20px;
}

.delete-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
}

.delete-list li:last-child {
    border-bottom: none;
}

.delete-list li::before {
    content: "•";
    color: #ff5555;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.delete-confirmation {
    margin: 25px 0;
    padding: 20px;
    background: rgba(255, 85, 85, 0.1);
    border: 2px solid #ff5555;
    border-radius: 6px;
}

.delete-confirmation label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.delete-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.delete-actions .profile-btn {
    min-width: 120px;
    justify-content: center;
}

/* Admin Panel Styles */
.admin-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
}

.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.admin-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.admin-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.admin-content-area {
    min-height: 400px;
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

.admin-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.admin-section h4 {
    margin: 0 0 15px 0;
    color: var(--accent);
    font-size: 18px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-form label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.admin-form input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 14px;
}

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

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.admin-btn.primary {
    background: var(--accent);
    color: white;
}

.admin-btn.primary:hover {
    filter: brightness(1.1);
}

.admin-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.admin-btn.secondary:hover {
    background: var(--bg-color);
}

.admin-btn.danger {
    background: #dc3545;
    color: white;
}

.admin-btn.danger:hover {
    background: #c82333;
}

.admin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 18px;
}

.admin-console {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.admin-console h4 {
    margin: 0 0 10px 0;
    color: var(--accent);
}

.admin-output {
    background: #1e1e1e;
    color: #00ff00;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.admin-item {
    border-left: 3px solid var(--accent);
}

.maintenance-warning {
    background: #2d1b1b;
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #ffcccc;
    font-weight: 600;
    font-size: 14px;
}

.button-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 5px 0 15px 0;
    font-style: italic;
}

/* Puzzle Preview Styles */
.puzzle-preview {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.puzzle-preview h5 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.puzzle-preview .preview-section {
    margin-bottom: 15px;
}

.puzzle-preview .preview-label {
    font-weight: bold;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

.puzzle-preview .preview-content {
    font-family: 'Courier New', monospace;
    background: var(--bg-color);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.puzzle-preview .clue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.puzzle-preview .clue-list li {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
}

.puzzle-preview .clue-list li:last-child {
    border-bottom: none;
}

.puzzle-preview .puzzle-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.puzzle-preview .stat-item {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.puzzle-preview .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
}

.puzzle-preview .stat-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
}

/* Date Input with Calendar Icon */
.date-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.date-input-wrapper input[type="date"] {
    width: 100%;
    padding-right: 35px;
}

.calendar-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
    user-select: none;
    pointer-events: auto;
    transition: transform 0.2s ease;
}

.calendar-icon:hover {
    transform: translateY(-50%) scale(1.1);
}

.calendar-icon:active {
    transform: translateY(-50%) scale(0.95);
}

/* Mapping Display Styles */
.mapping-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.mapping-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.mapping-row:last-child {
    border-bottom: none;
}

.mapping-header {
    font-weight: bold;
    background: var(--bg-light);
    margin-bottom: 5px;
    border-radius: 4px;
    padding: 6px 8px;
}

.mapping-cell {
    min-width: 60px;
    text-align: center;
    padding: 0 8px;
}

.mapping-status {
    min-width: 80px;
    text-align: center;
    padding: 0 8px;
    font-size: 12px;
}

.mapping-arrow {
    margin: 0 8px;
    color: var(--text-secondary);
    font-weight: bold;
}

.original-digit {
    background: var(--bg-light);
    border-radius: 3px;
    font-weight: bold;
    color: var(--text-primary);
}


.mapping-trivial .zagged-digit {
    color: var(--text-secondary);
    opacity: 0.7;
}

.mapping-trivial .mapping-note {
    margin-left: 10px;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 12px;
}

.mapping-revealed {
    background: rgba(83, 141, 78, 0.1);
    border-radius: 4px;
    margin: 1px 0;
}

.mapping-summary {
    margin-top: 10px;
    padding: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    text-align: center;
    color: var(--text-secondary);
}

.mapping-unavailable {
    color: var(--text-secondary);
    font-style: italic;
}

/* Status indicators */
.status-revealed {
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.status-trivial {
    background: var(--text-secondary);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0.7;
}

.status-hidden {
    color: var(--text-secondary);
    font-style: italic;
}

/* Admin warning text */
.admin-warning {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    color: #dc3545;
    font-size: 14px;
    font-weight: 500;
}

/* Checkbox group styling */
.checkbox-group {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .admin-content {
        width: 98%;
    }
    
    .admin-tabs {
        flex-direction: column;
    }
    
    .admin-tab {
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    
    .admin-tab.active {
        border-bottom-color: var(--accent);
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
}

/* Daily Puzzle Completion Indicator */
.daily-completion-indicator {
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    animation: fadeInScale 0.3s ease-out;
}

.daily-completion-indicator .completion-message h3 {
    color: var(--accent);
    margin: 0;
    font-size: 1.2em;
}

.daily-completion-indicator .completion-message p {
    color: var(--text-primary);
    margin: 8px 0;
    line-height: 1.5;
}

.daily-completion-indicator .completion-message p:last-child {
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 15px;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Profile Creation Prompt in Post-Game Modal */
.profile-creation-prompt {
    text-align: center;
    padding: 5px 0;
}

.profile-creation-prompt h3 {
    color: var(--accent);
    margin: 15px 0 10px 0;
    font-size: 1.1em;
}

.profile-creation-prompt p {
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.profile-creation-prompt .profile-btn {
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 0.9em;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Completed daily puzzle grid styling */
.daily-puzzle-completed .tile {
    pointer-events: none;
    opacity: 0.8;
}

.daily-puzzle-completed .tile.filled {
    opacity: 1;
}

/* Remove active tile styling for completed daily puzzles */
.daily-puzzle-completed .tile.active,
.daily-puzzle-completed .tile:focus,
.daily-puzzle-completed .tile:focus-visible {
    border-color: var(--border-color) !important;
    box-shadow: none !important;
    transform: none !important;
    animation: none !important;
    outline: none !important;
}

/* Feedback Modal Styles */
.feedback-content {
    max-width: 600px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.feedback-intro {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 1.05em;
    line-height: 1.5;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.feedback-form-content {
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

.form-group select,
.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.char-counter {
    text-align: right;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: -5px;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-group label {
    font-weight: normal;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.turnstile-widget {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.feedback-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 10px;
    flex-shrink: 0;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--modal-bg);
}

.cancel-btn {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.submit-btn {
    padding: 12px 24px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-success {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 3em;
    margin-bottom: 20px;
}

.feedback-success h3 {
    color: var(--accent);
    margin: 0 0 15px 0;
    font-size: 1.4em;
}

.feedback-success p {
    color: var(--text-secondary);
    margin: 0 0 25px 0;
    line-height: 1.5;
}

/* Mobile optimizations for feedback modal */
@media (max-width: 768px) {
    .feedback-content {
        width: 95vw;
        max-width: none;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .feedback-actions {
        flex-direction: column;
        gap: 10px;
        flex-shrink: 0;
        margin-top: 15px;
    }
    
    .cancel-btn,
    .submit-btn {
        width: 100%;
        padding: 14px 20px;
    }
}

/* Very small screens */
@media (max-height: 600px) {
    .feedback-content {
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .feedback-intro {
        margin-bottom: 15px;
        font-size: 1em;
    }
    
    .form-group {
        gap: 6px;
    }
    
    .feedback-form {
        gap: 15px;
    }
}


