body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #f8f9fa;
    margin: 0;
}

.app-container {
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    width: 320px;
}

h2 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.stats-container {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.puzzle-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    width: 300px;
    margin: 0 auto;
}

.tile {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tile.empty {
    background: transparent;
    cursor: default;
}

/* Rainbow Colors */
.tile:nth-child(1) { background: #ff595e; color: white; }
.tile:nth-child(2) { background: #ff924c; color: white; }
.tile:nth-child(3) { background: #ffca3a; color: white; }
.tile:nth-child(4) { background: #8ac926; color: white; }
.tile:nth-child(5) { background: #1982c4; color: white; }
.tile:nth-child(6) { background: #6a4c93; color: white; }
.tile:nth-child(7) { background: #ff595e; color: white; }
.tile:nth-child(8) { background: #ff924c; color: white; }
.tile:nth-child(9) { background: #ffca3a; color: white; }
.tile:nth-child(10) { background: #8ac926; color: white; }
.tile:nth-child(11) { background: #1982c4; color: white; }
.tile:nth-child(12) { background: #6a4c93; color: white; }
.tile:nth-child(13) { background: #ff595e; color: white; }
.tile:nth-child(14) { background: #ff924c; color: white; }
.tile:nth-child(15) { background: #ffca3a; color: white; }

.button-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.ios-button {
    background: #007aff;
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-button:hover {
    background: #005ecb;
    box-shadow: 0 6px 12px rgba(0, 122, 255, 0.4);
}

/* Hint Popup */
.hint-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    width: 250px;
    text-align: center;
    max-height: 80vh;        /* Limits height to 80% of the viewport */
    overflow-y: auto;        /* Adds vertical scroll if needed */
}

.hint-popup h3 {
    margin-bottom: 10px;
}

.hint-popup ul {
    list-style: none;
    padding: 0;
}

.hint-popup li {
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: bold;
    color: white;
}

.hidden {
    display: none;
}

/* Win Popup */
.win-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    width: 250px;
    text-align: center;
}

.win-popup h3 {
    color: #28a745;
    font-weight: 600;
}

.win-popup button {
    background: #28a745;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
}

.win-popup button:hover {
    background: #218838;
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

.back-btn {
    margin-top: 10px;
    width: 100%;
    background: #ff3b30;
    box-shadow: 0 4px 10px rgba(255, 59, 48, 0.3);
}

.back-btn:hover {
    background: #d32f2f;
    box-shadow: 0 6px 12px rgba(255, 59, 48, 0.4);
}