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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

body.game-active {
    background: #f5f5f5;
}

.game-container-wrapper {
    position: relative;
    width: 100%;
    max-width: 650px;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.game-back-button {
    position: absolute;
    top: -50px;
    left: 0;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    padding: 10px;
    z-index: 10;
}

.game-back-button:hover {
    color: #1E9FD8;
}

h1 {
    text-align: center;
    color: #b8a4d4;
    margin-bottom: 25px;
    font-size: 2.2em;
    font-weight: 300;
    letter-spacing: 8px;
    text-transform: uppercase;
}

.top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.timer-section {
    flex: 1;
    text-align: left;
}

.timer {
    color: #ffb3ba;
    font-size: 1.3em;
    font-weight: 600;
}

.pattern-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-section {
    flex: 1;
    text-align: right;
}

.score {
    color: #bae1ff;
    font-size: 1.3em;
    font-weight: 600;
}

.pattern-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pattern-label {
    text-align: center;
    font-weight: 500;
    margin-bottom: 8px;
    color: #888;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pattern {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: fit-content;
    margin: 0 auto;
}

.pattern-square {
    width: 35px;
    height: 35px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 22px;
    margin-bottom: 20px;
    padding: 10px;
    max-width: 75%;
    margin-left: auto;
    margin-right: auto;
}

.square {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.square:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.square.selected {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 0 5px rgba(184, 164, 212, 0.5);
}

.square.hint {
    animation: gentleGlow 2s ease-in-out infinite;
}

.square.wrong {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes gentleGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4), 0 0 0 3px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 45px rgba(255, 215, 0, 0.6), 0 0 0 3px rgba(255, 215, 0, 0.7);
    }
}

.selection-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

.message {
    text-align: center;
    font-size: 0.95em;
    font-weight: 500;
    min-height: 25px;
    margin-bottom: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message.show {
    opacity: 1;
}

.message.success {
    color: #baffc9;
}

.message.error {
    color: #ffb3ba;
}

.button {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-weight: 500;
    border: 2px solid #b8a4d4;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    color: #b8a4d4;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.button:hover {
    background: #b8a4d4;
    color: white;
}

.button:disabled {
    background: #f0f0f0;
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.game-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-top: 20px;
}

.action-item {
    text-align: center;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid #e0e0e0;
    border-top: 3px solid #1E9FD8;
}

.action-item.depleted {
    border-top: 3px solid transparent;
}

.action-item:last-child {
    border-right: none;
}

.action-item:hover {
    background: #f5f5f5;
}

.action-count {
    font-size: 2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.action-label {
    font-size: 0.9em;
    color: #999;
    text-transform: lowercase;
}

.game-over {
    text-align: center;
}

.game-over h2 {
    color: #667eea;
    margin-bottom: 15px;
}

.final-score {
    font-size: 2em;
    color: #27ae60;
    margin: 20px 0;
}

/* Home Screen Styles */
.home-screen {
    text-align: center;
    color: #333;
    background: #f5f5f5;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.home-core {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    display: grid;
    grid-template-columns: repeat(2, 36px);
    grid-template-rows: repeat(2, 36px);
    gap: 3.6px;
}

.logo-square {
    background: #1E9FD8;
    border-radius: 3px;
    position: relative;
}

.logo-square.hollow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14.4px;
    height: 14.4px;
    background: white;
    border-radius: 2px;
}

.home-screen h1 {
    font-size: 3.5em;
    font-weight: 300;
    letter-spacing: 2px;
    color: #333;
    margin: 0;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 250px;
}

.menu-button {
    background: white;
    color: #333;
    border: none;
    padding: 18px 30px;
    font-size: 1.4em;
    font-weight: 400;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #fafafa;
}

.menu-icon {
    display: grid;
    grid-template-columns: repeat(2, 12px);
    grid-template-rows: repeat(2, 12px);
    gap: 2px;
}

.menu-icon-square {
    background: #1E9FD8;
    border-radius: 2px;
}

.tutorial-screen {
    background: #f5f5f5;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    min-height: 600px;
    min-width: 450px;
}

.tutorial-screen-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.tutorial-container {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.tutorial-back-button {
    position: absolute;
    top: -50px;
    left: 0;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    padding: 10px;
    z-index: 5;
}

.tutorial-back-button:hover {
    color: #1E9FD8;
}

.tutorial-title {
    font-size: 1.8em;
    font-weight: 600;
    color: #333;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tutorial-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tutorial-tab {
    background: none;
    border: none;
    font-size: 1.2em;
    padding: 10px 5px;
    cursor: pointer;
    color: #999;
    position: relative;
    transition: color 0.3s;
    text-transform: lowercase;
}

.tutorial-tab.active {
    color: #333;
    font-weight: 500;
}

.tutorial-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #333;
}

.tutorial-tab-panel {
    display: none;
}

.tutorial-tab-panel.active {
    display: block;
}

.tutorial-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.tutorial-description {
    flex: 1;
    text-align: left;
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
}

.tutorial-pattern-block {
    min-width: 160px;
    text-align: center;
}

.tutorial-pattern-block .pattern-square {
    width: 28px;
    height: 28px;
}

.tutorial-grid-wrapper {
    margin-top: 30px;
    
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 22px;
    width: 75%;
    margin: 0 auto;
    padding: 10px;
}

.tutorial-square {
    aspect-ratio: 1;
    border-radius: 4px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.tutorial-square.highlight {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(184, 164, 212, 0.45), 0 0 0 5px rgba(184, 164, 212, 0.35);
}

.tutorial-square.highlight::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 7px;
    border: 2px solid rgba(184, 164, 212, 0.6);
    box-shadow: 0 0 12px rgba(184, 164, 212, 0.45);
}

.tutorial-message {
    margin-top: 20px;
    text-align: center;
    color: #888;
    font-weight: 500;
    min-height: 24px;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.tutorial-packs {
    margin-top: 35px;
    -top: 25px;
    display: grid;
    gap: 20px;
}

.tutorial-pack {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 15px;
    align-items: center;
}

.tutorial-pack-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #333;
    text-align: right;
}

.tutorial-pack-description {
    color: #666;
    line-height: 1.5;
    text-align: left;
}

.decorative-squares {
    position: absolute;
    inset: -40px;
    pointer-events: none;
}

.decorative-pattern {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(2, 30px);
    grid-template-rows: repeat(2, 30px);
    gap: 3px;
    opacity: 0.5;
}

.decorative-pattern.top-right {
    top: -5%;
    right: 10%;
    grid-template-columns: repeat(2, 15px);
    grid-template-rows: repeat(2, 15px);
    transform: translate(60%, -40%);
    opacity: 0.8;
}

.decorative-pattern.top-right-small {
    top: -5%;
    right: 75%;
    grid-template-columns: repeat(2, 10px);
    grid-template-rows: repeat(2, 10px);
    transform: translate(50%, -60%);
    opacity: 0.7;
}

.decorative-pattern.middle-left {
    top: 35%;
    left: 2%;
    grid-template-columns: repeat(2, 20px);
    grid-template-rows: repeat(2, 20px);
    transform: translate(-60%, -40%);
    opacity: 0.6;
}

.decorative-pattern.middle-right {
    top: 55%;
    right: 2%;
    grid-template-columns: repeat(2, 10px);
    grid-template-rows: repeat(2, 10px);
    transform: translate(60%, -40%);
}

.decorative-pattern.bottom-left {
    bottom: 12%;
    left: 2%;
    grid-template-columns: repeat(2, 15px);
    grid-template-rows: repeat(2, 15px);
    transform: translate(-60%, 40%);
}

.decorative-pattern.bottom-left-small {
    bottom: 0;
    left: 28%;
    grid-template-columns: repeat(2, 8px);
    grid-template-rows: repeat(2, 8px);
    transform: translate(-50%, 60%);
    opacity: 0.9;
}

.decorative-pattern.bottom-right {
    bottom: 0;
    right: 2%;
    grid-template-columns: repeat(2, 18px);
    grid-template-rows: repeat(2, 18px);
    transform: translate(50%, 60%);
}

.decorative-square {
    background: #bae1ff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform: scale(1);
    opacity: 1;
}

.decorative-square.hidden {
    transform: scale(0);
    opacity: 0;
}

.start-button {
    background: white;
    color: #000;
    border: none;
    padding: 20px 80px;
    font-size: 1.3em;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.5);
}

/* More Page Styles */
.more-screen-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.more-screen {
    background: white;
    width: 100%;
    padding: 30px;
    box-sizing: border-box;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-height: 600px;
}

.more-back-button {
    position: absolute;
    top: -50px;
    left: 0;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    padding: 10px;
}

.more-back-button:hover {
    color: #1E9FD8;
}

.more-header {
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 30px;
    color: #333;
}

.more-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.more-tab {
    background: none;
    border: none;
    font-size: 1.3em;
    padding: 10px 5px;
    cursor: pointer;
    color: #999;
    position: relative;
    transition: color 0.3s;
}

.more-tab.active {
    color: #333;
    font-weight: 500;
}

.more-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #333;
}

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

.setting-label {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.username-input {
    width: 100%;
    padding: 15px;
    font-size: 1em;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.username-input:focus {
    outline: none;
    border-color: #1E9FD8;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-label {
    font-size: 1em;
    color: #333;
}

.toggle-switch {
    position: relative;
    width: 80px;
    height: 32px;
    background: #e0e0e0;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s;
    border: 2px solid #333;
}

.toggle-switch.active {
    background: #1E9FD8;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    border: 2px solid #333;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(48px);
}

.theme-grid {
    display: grid;
    grid-template-columns: auto repeat(5, minmax(25px, 1fr));
    gap: 10px;
    align-items: center;
    max-width: 100%;
}

.theme-row {
    display: contents;
}

.theme-radio {
    width: 30px;
    height: 30px;
    border: 2px solid #333;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    background: white;
    flex-shrink: 0;
}

.theme-radio.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #333;
    border-radius: 50%;
}

.theme-color {
    width: 80%;
    aspect-ratio: 1;
    max-width: 40px;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-color:hover {
    transform: scale(1.1);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .home-core {
        gap: 40px;
    }

    .decorative-squares {
        inset: -20px;
    }

    .grid {
        max-width: 86.25%; /* 75% * 1.15 = 86.25% for 15% bigger squares */
        gap: 15px; /* Reduced gap for better spacing on mobile */
    }

    .logo-container {
        gap: 12px;
    }

    .logo-icon {
        grid-template-columns: repeat(2, 28px);
        grid-template-rows: repeat(2, 28px);
        gap: 2.8px;
    }

    .logo-square.hollow::after {
        width: 11.2px;
        height: 11.2px;
    }

    .home-screen h1 {
        font-size: 2.5em;
        letter-spacing: 1px;
    }

    .menu {
        width: 220px;
    }

    .menu-button {
        padding: 15px 25px;
        font-size: 1em;
    }

    .tutorial-screen {
        padding: 20px 16px;
    }

    .tutorial-container {
        padding: 24px;
    }

    .tutorial-title {
        font-size: 1.5em;
    }

    .tutorial-tabs {
        gap: 15px;
    }

    .tutorial-tab {
        font-size: 1em;
    }

    .tutorial-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .tutorial-pattern-block {
        width: 100%;
    }

    .tutorial-description {
        font-size: 0.9em;
    }

    .tutorial-grid {
        gap: 15px;
        width: 86.25%;
    }

    .tutorial-square {
        width: 100%;
    }

    .tutorial-pack {
        grid-template-columns: 1fr;
    }

    .tutorial-pack-title {
        text-align: left;
    }
}
