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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a1410 0%, #0f1f1a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
}

.container {
    background: #152520;
    border-radius: 15px;
    padding: 15px;
    max-width: 100%;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

h1 {
    color: #e0e0e0;
    font-size: 1.8em;
    margin-bottom: 8px;
}

.subtitle {
    color: #b0b0b0;
    font-size: 0.95em;
}

.header-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.header-btn, .settings-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    background: #1e3228;
    color: #e0e0e0;
    border: 2px solid #10b981;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    touch-action: manipulation;
}

.header-btn:active, .settings-btn:active {
    background: #10b981;
    transform: scale(0.98);
}

.settings-panel {
    margin-bottom: 0;
    padding: 0 20px;
    background: #1e3228;
    border-radius: 10px;
    border: 2px solid #10b981;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-20px);
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, transform 0.3s ease-out, margin-bottom 0.3s ease-out, padding 0.3s ease-out;
}

.settings-panel.open {
    margin-bottom: 20px;
    padding: 20px;
    max-height: 1000px;
    opacity: 1;
    transform: translateY(0);
}

.settings-title {
    color: #e0e0e0;
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.setting-item label {
    color: #e0e0e0;
    font-size: 0.95em;
    font-weight: 500;
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-item input[type="number"] {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    background: #152520;
    color: #e0e0e0;
    border: 2px solid #555;
    border-radius: 6px;
    text-align: center;
    min-width: 80px;
    max-width: 100px;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
}

.setting-item input[type="number"]::-webkit-inner-spin-button,
.setting-item input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: #10b981;
}

.setting-range {
    color: #b0b0b0;
    font-size: 0.85em;
    font-weight: normal;
    white-space: nowrap;
}

.setting-value {
    color: #34d399;
    font-weight: bold;
    font-size: 1.1em;
    min-width: 30px;
    text-align: center;
}

.apply-settings-btn {
    width: 100%;
    padding: 14px;
    font-size: 1em;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 48px;
    margin-top: 10px;
}

.apply-settings-btn:active {
    background: #34d399;
    transform: scale(0.98);
}


.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 12px;
    background: #1e3228;
    border-radius: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.label {
    font-size: 0.85em;
    color: #b0b0b0;
}

#attempts, #maxAttempts, #timer {
    font-size: 1.3em;
    font-weight: bold;
    color: #34d399;
}

.feedback-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #1e3228;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85em;
    color: #e0e0e0;
}

.feedback-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #555;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-dot.correct {
    background-color: #4caf50;
    border-color: #4caf50;
}

.feedback-dot.wrong-position {
    background-color: #ffc107;
    border-color: #ffc107;
}

.feedback-dot.not-found {
    background-color: #f44336;
    border-color: #f44336;
}

.color-picker-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #1e3228;
    border-radius: 8px;
}

.picker-label {
    text-align: center;
    margin-bottom: 12px;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.95em;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    position: relative;
}

.color-picker-wrapper .clear-x-btn {
    margin-left: 80px;
}

.clear-x-btn {
    width: 50px;
    height: 50px;
    padding: 0;
    font-size: 2.5em;
    background: #555;
    color: #e0e0e0;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.clear-x-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.clear-x-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.clear-x-btn:disabled {
    background: #333;
    cursor: not-allowed;
    opacity: 0.5;
}

.color-picker {
    display: grid;
    gap: 10px;
    justify-items: center;
    width: 100%;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    position: relative;
}

.color-option:active {
    transform: scale(0.95);
}

.color-option.selected {
    border-color: #34d399;
    transform: scale(1.1);
}

.submit-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.current-guess-row {
    opacity: 1;
}

.current-guess-row .guess-color {
    cursor: pointer;
    border: 2px solid #333;
    background: #152520;
    transition: all 0.2s;
    touch-action: manipulation;
}

.current-guess-row .guess-color:active {
    transform: scale(0.95);
}

.current-guess-row .guess-color[data-color="white"] {
    border: 2px solid #555;
}

.guess-slot[data-color="red"] {
    background-color: #f44336;
}

.guess-slot[data-color="blue"] {
    background-color: #2196F3;
}

.guess-slot[data-color="green"] {
    background-color: #4CAF50;
}

.guess-slot[data-color="yellow"] {
    background-color: #FFEB3B;
}

.guess-slot[data-color="white"] {
    background-color: #FFFFFF;
    border: 3px solid #555;
}

.guess-slot[data-color="black"] {
    background-color: #212121;
}

.guess-slot[data-color="orange"] {
    background-color: #FF9800;
}

.guess-slot[data-color="purple"] {
    background-color: #9C27B0;
}

.guess-slot[data-color="pink"] {
    background-color: #E91E63;
}

.guess-slot[data-color="cyan"] {
    background-color: #00BCD4;
}

.guess-slot[data-color="brown"] {
    background-color: #795548;
}

.guess-slot[data-color="gray"] {
    background-color: #9E9E9E;
}

.guess-slot[data-color="lime"] {
    background-color: #CDDC39;
}

.guess-slot[data-color="magenta"] {
    background-color: #FF00FF;
}

.guess-slot[data-color="navy"] {
    background-color: #1976D2;
}

.guess-slot[data-color="teal"] {
    background-color: #009688;
}

#submitBtn {
    width: 100%;
    padding: 16px;
    font-size: 1em;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 48px;
    box-sizing: border-box;
}

#submitBtn:active:not(:disabled) {
    background: #059669;
    transform: scale(0.98);
}

#submitBtn:disabled {
    background: #555;
    cursor: not-allowed;
    color: #888;
}

.guesses-container {
    margin-bottom: 15px;
}

.guesses-label {
    text-align: center;
    margin-bottom: 12px;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 1em;
}

#guessesList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guess-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #1e3228;
    border-radius: 8px;
    flex-wrap: wrap;
}

.guess-colors {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.guess-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #333;
    position: relative;
}

.guess-color[data-color="red"] {
    background-color: #f44336;
}

.guess-color[data-color="blue"] {
    background-color: #2196F3;
}

.guess-color[data-color="green"] {
    background-color: #4CAF50;
}

.guess-color[data-color="yellow"] {
    background-color: #FFEB3B;
}

.guess-color[data-color="white"] {
    background-color: #FFFFFF;
    border: 2px solid #555;
}

.guess-color[data-color="black"] {
    background-color: #212121;
}

.guess-color[data-color="orange"] {
    background-color: #FF9800;
}

.guess-color[data-color="purple"] {
    background-color: #9C27B0;
}

.guess-color[data-color="pink"] {
    background-color: #E91E63;
}

.guess-color[data-color="cyan"] {
    background-color: #00BCD4;
}

.guess-color[data-color="brown"] {
    background-color: #795548;
}

.guess-color[data-color="gray"] {
    background-color: #9E9E9E;
}

.guess-color[data-color="lime"] {
    background-color: #CDDC39;
}

.guess-color[data-color="magenta"] {
    background-color: #FF00FF;
}

.guess-color[data-color="navy"] {
    background-color: #1976D2;
}

.guess-color[data-color="teal"] {
    background-color: #009688;
}

.guess-feedback {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.feedback-dot-small {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #555;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-dot-small.correct {
    background-color: #4caf50;
    border-color: #4caf50;
}

.feedback-dot-small.wrong-position {
    background-color: #ffc107;
    border-color: #ffc107;
}

.feedback-dot-small.not-found {
    background-color: #f44336;
    border-color: #f44336;
}

.feedback-symbol {
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}


.message {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: bold;
    margin-bottom: 12px;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.message.success {
    background-color: #1e3a1e;
    color: #4caf50;
    border: 2px solid #4caf50;
}

.message.error {
    background-color: #3a1e1e;
    color: #f44336;
    border: 2px solid #f44336;
}

.message.info {
    background-color: #1e2a3a;
    color: #34d399;
    border: 2px solid #10b981;
}

.new-game-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 48px;
}

.new-game-btn:active {
    background: #059669;
    transform: scale(0.98);
}

/* Tablet and larger screens */
@media (min-width: 600px) {
    body {
        align-items: center;
        padding: 20px;
    }

    .container {
        padding: 25px;
        border-radius: 20px;
        max-width: 600px;
    }

    .settings-btn:hover {
        background: #10b981;
    }

    .apply-settings-btn:hover {
        background: #34d399;
    }

    h1 {
        font-size: 2.2em;
    }

    .subtitle {
        font-size: 1.05em;
    }

    .game-info {
        padding: 15px;
    }

    .label {
        font-size: 0.9em;
    }

    #attempts, #maxAttempts {
        font-size: 1.5em;
    }

    .feedback-legend {
        flex-direction: row;
        justify-content: space-around;
        padding: 15px;
    }

    .legend-item {
        font-size: 0.9em;
    }

    .feedback-dot {
        width: 20px;
        height: 20px;
    }

    .color-picker-container {
        padding: 20px;
    }

    .picker-label {
        font-size: 1em;
    }

    .color-picker {
        gap: 15px;
    }

    .color-option {
        width: 55px;
        height: 55px;
    }

    .clear-x-btn {
        width: 55px;
        height: 55px;
    }


    .guesses-label {
        font-size: 1.1em;
    }

    .guess-row {
        gap: 15px;
        padding: 10px;
    }

    .guess-colors {
        gap: 8px;
    }

    .guess-color {
        width: 45px;
        height: 45px;
    }

    .guess-feedback {
        gap: 8px;
    }

    .feedback-dot-small {
        width: 20px;
        height: 20px;
    }

    .message {
        font-size: 1.05em;
        padding: 15px;
    }
}

/* Desktop screens */
@media (min-width: 900px) {
    .container {
        max-width: 800px;
        padding: 30px;
    }

    h1 {
        font-size: 2.5em;
    }

    .subtitle {
        font-size: 1.1em;
    }

    .color-option {
        width: 60px;
        height: 60px;
    }

    .color-option:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .clear-x-btn {
        width: 60px;
        height: 60px;
    }


    .guess-color {
        width: 50px;
        height: 50px;
    }

    #submitBtn:hover:not(:disabled) {
        background: #34d399;
    }

    .new-game-btn:hover {
        background: #34d399;
    }

    .settings-btn:hover {
        background: #10b981;
    }

    .apply-settings-btn:hover {
        background: #34d399;
    }
}

/* Difficulty Presets */
.difficulty-presets {
    margin-bottom: 20px;
    padding: 15px;
    background: #152520;
    border-radius: 8px;
}

.presets-title {
    color: #e0e0e0;
    font-size: 1em;
    margin-bottom: 10px;
    text-align: center;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.preset-btn {
    flex: 1;
    padding: 12px;
    font-size: 1em;
    background: #1e3228;
    color: #e0e0e0;
    border: 2px solid #10b981;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    touch-action: manipulation;
}

.preset-btn:active {
    background: #10b981;
    transform: scale(0.95);
}


/* Game End Actions */
.game-end-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.share-btn {
    flex: 1;
    padding: 15px;
    font-size: 1.1em;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 48px;
}

.share-btn:active {
    background: #45a049;
    transform: scale(0.98);
}

/* Color Blind Mode */
.color-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
    color: #333;
    font-weight: bold;
    pointer-events: none;
    z-index: 1;
    margin: 0;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-option .color-symbol {
    color: #000;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

.guess-color .color-symbol {
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.guess-color[data-color="white"] .color-symbol,
.guess-color[data-color="yellow"] .color-symbol,
.guess-color[data-color="lime"] .color-symbol {
    color: #000;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
}

/* Visual Feedback Animations */
@keyframes colorPlaced {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

.color-placed {
    animation: colorPlaced 0.3s ease;
}

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

.feedback-appear {
    animation: feedbackAppear 0.3s ease;
}

@keyframes correctPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(76, 175, 80, 0.3);
    }
}

.correct-guess-pulse {
    animation: correctPulse 1s ease;
}

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

.guess-row {
    animation: rowSlideIn 0.3s ease;
}

/* Tutorial Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 20, 16, 0);
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease-out, background-color 0.3s ease-out;
}

.modal.open {
    display: flex;
    opacity: 1;
    background-color: rgba(10, 20, 16, 0.9);
}

.modal-content {
    background: #152520;
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.8) translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    color: #e0e0e0;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #34d399;
}

.modal-content h2 {
    color: #10b981;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.tutorial-content h2 {
    color: #10b981;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.tutorial-content h3 {
    color: #34d399;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.tutorial-content p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 15px;
}

.tutorial-content ol, .tutorial-content ul {
    color: #b0b0b0;
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.8;
}

.tutorial-content li {
    margin-bottom: 8px;
}

.feedback-example {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.feedback-example.correct {
    background-color: #4caf50;
}

.feedback-example.wrong-position {
    background-color: #ffc107;
}

.feedback-example.not-found {
    background-color: #f44336;
}

.tutorial-close-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 20px;
    transition: background 0.2s;
    touch-action: manipulation;
}

.tutorial-close-btn:active {
    background: #34d399;
    transform: scale(0.98);
}

/* Responsive adjustments */
@media (min-width: 600px) {
    .preset-buttons {
        gap: 15px;
    }
    
    .header-btn:hover, .settings-btn:hover {
        background: #10b981;
    }
    
    .preset-btn:hover {
        background: #10b981;
    }
    
    .clear-x-btn:hover:not(:disabled) {
        background: #10b981;
    }
    
    .share-btn:hover {
        background: #45a049;
    }
}
