/* Root variables for responsive design */
:root {
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* iOS safe area support */
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
}

h1 {
    font-size: 3rem;
    margin-bottom: 3rem;
    background: linear-gradient(45deg, #ff6b6b, #fcc419, #51cf66, #339af0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 0 1rem;
    text-align: center;
}

/* Responsive h1 for mobile */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        margin-bottom: 2rem;
        letter-spacing: 1px;
    }
}

.container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive container for mobile */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        padding: 1rem;
    }
}

.squircle {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    border-radius: 25%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    /* Minimum touch target size for mobile */
    min-width: 44px;
    min-height: 44px;
}

/* Touch-friendly hover states (only on devices with hover capability) */
@media (hover: hover) {
    .squircle:hover {
        transform: translateY(-5px) scale(1.05);
        z-index: 1;
    }
}

/* Larger squircles on mobile for better touch targets */
@media (max-width: 768px) {
    .squircle {
        width: 200px;
        height: 200px;
        font-size: 1.4rem;
    }
}

.squircle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.character {
    background-color: #ff6b6b;
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.character:hover {
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.5);
}

.quests {
    background-color: #fcc419;
    box-shadow: 0 10px 20px rgba(252, 196, 25, 0.3);
    color: #333;
}

.quests:hover {
    box-shadow: 0 15px 30px rgba(252, 196, 25, 0.5);
}

.crafting {
    background-color: #51cf66;
    box-shadow: 0 10px 20px rgba(81, 207, 102, 0.3);
}

.crafting:hover {
    box-shadow: 0 15px 30px rgba(81, 207, 102, 0.5);
}

.world {
    background-color: #339af0;
    box-shadow: 0 10px 20px rgba(51, 154, 240, 0.3);
}

.world:hover {
    box-shadow: 0 15px 30px rgba(51, 154, 240, 0.5);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #2a2a2a;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Responsive modal for mobile */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
        /* Account for iOS safe areas */
        margin-bottom: var(--safe-area-inset-bottom);
    }
}

.modal h2 {
    margin-top: 0;
    color: #fff;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ccc;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #444;
    border-radius: 0.5rem;
    background: #333;
    color: #fff;
    font-size: 1rem;
    box-sizing: border-box;
    /* Fix width issue */
    /* Prevent iOS zoom on focus */
    font-size: 16px;
}

/* Larger touch targets on mobile */
@media (max-width: 768px) {
    .form-group input {
        padding: 1rem;
        font-size: 16px;
    }
}

.btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 0.5rem;
    background: #339af0;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 1rem;
    /* Minimum touch target */
    min-height: 44px;
}

/* Larger buttons on mobile */
@media (max-width: 768px) {
    .btn {
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 48px;
    }
}

.btn:hover {
    background: #228be6;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #555;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    background: #333;
}

.switch-mode {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #888;
}

.switch-mode a {
    color: #339af0;
    text-decoration: none;
    cursor: pointer;
}

.hidden {
    display: none;
}

.error-message {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.success-message {
    color: #51cf66;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}