:root {
    --primary-color: #6C5CE7;
    --primary-hover: #5649c0;
    --secondary-color: #00CEC9;
    --accent-color: #FD79A8;
    --background-color: #DFE6E9;
    --card-bg: #FFFFFF;
    --text-color: #2D3436;
    --font-family: 'Fredoka', sans-serif;
    --border-radius: 16px;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.2rem;
}

header nav a,
header nav span {
    margin-left: 1.5rem;
}

main {
    padding: 2rem;
    min-height: calc(100vh - 80px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    width: 100%;
    max-width: 800px;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

h1,
h2,
h3 {
    color: var(--primary-color);
    margin-top: 0;
}

.game-list {
    display: grid;
    gap: 1.5rem;
}

.game-card {
    border: 2px solid #eee;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-color);
}

.game-card img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    margin-right: 1.5rem;
    background: #f0f0f0;
    object-fit: cover;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    background: #00b5b0;
    transform: scale(1.05);
}

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

.btn.secondary {
    background: var(--accent-color);
}

.btn.secondary:hover {
    background: #e84393;
}

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

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

.btn.outline {
    background: transparent;
    border: 2px solid #ccc;
    color: var(--text-color);
    box-shadow: none;
}

.btn.outline:hover {
    background: #f1f1f1;
    border-color: #bbb;
    transform: translateY(-1px);
}

/* Game Specific Styles */
.digit-input {
    width: 40px;
    height: 50px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin: 0 2px;
    font-family: var(--font-family);
}

.digit-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.carry-input {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 50%;
    margin-bottom: 5px;
}

.feedback {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.feedback.success {
    background-color: #dff9fb;
    color: #00b894;
    border: 2px solid #00b894;
}

.feedback.error {
    background-color: #ffeaa7;
    color: #d63031;
    border: 2px solid #d63031;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    main {
        padding: 0;
    }

    .container {
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
        min-height: calc(100vh - 60px);
        /* Ensure full height minus header */
    }

    .game-container {
        margin-left: -1rem;
        margin-right: -1rem;
        width: calc(100% + 2rem);
    }

    header {
        padding: 0.5rem 1rem;
    }
}

/* Login and Registration Form Styles */
form[method="post"] p {
    margin-bottom: 1.5rem;
}

form[method="post"] p label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

form[method="post"] p input[type="text"],
form[method="post"] p input[type="password"],
form[method="post"] p input[type="email"] {
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: var(--font-family);
    transition: all 0.3s ease;
    background: #f8f9fa;
    box-sizing: border-box;
}

form[method="post"] p input[type="text"]:focus,
form[method="post"] p input[type="password"]:focus,
form[method="post"] p input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
    transform: translateY(-2px);
}

form[method="post"] p input[type="text"]:hover,
form[method="post"] p input[type="password"]:hover,
form[method="post"] p input[type="email"]:hover {
    border-color: #c0c0c0;
    background: white;
}

form[method="post"] h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 700;
}

/* Error messages */
form[method="post"] .errorlist {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

form[method="post"] .errorlist li {
    color: #d63031;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Help text */
form[method="post"] .helptext {
    font-size: 0.85rem;
    color: #636e72;
    margin-top: 0.3rem;
    display: block;
}

/* Make container narrower for auth forms */
form[method="post"]~h2,
h2:has(+ form[method="post"]) {
    text-align: center;
}

/* Improve container for login/register pages */
.container:has(form[method="post"]) {
    max-width: 600px;
}

/* Registration Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.parent-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: var(--primary-color);
}

.game-accounts-section {
    background: linear-gradient(135deg, #fff5f8 0%, #ffe8f0 100%);
    border-color: var(--accent-color);
}

.game-accounts-section h3 {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
}

.section-description {
    margin-bottom: 1rem;
    color: #636e72;
    font-size: 0.9rem;
    font-style: italic;
}

.game-account-form {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
}

.game-account-form:last-of-type {
    margin-bottom: 0;
}

.game-account-form h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 600;
}

/* Error styling for formset errors */
.form-section .errorlist {
    background: #ffe5e5;
    border: 1px solid #d63031;
    color: #d63031;
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Add Another Kid Button */
.btn-add-kid {
    display: inline-block;
    padding: 0.7rem 1.3rem;
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    font-family: var(--font-family);
}

.btn-add-kid:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-add-kid:active {
    transform: translateY(0);
}

.btn-add-kid span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--card-bg);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border-radius: 12px;
    border-radius: 12px;
    overflow: visible;
    /* Changed from hidden to allow pseudo-element outside */
    margin-top: 0.5rem;
}

/* Bridge the gap between trigger and content */
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a,
.dropdown-content button {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    width: 100%;
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-content a:hover,
.dropdown-content button:hover {
    background-color: #f1f1f1;
    color: var(--primary-color);
}

.dropdown-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: background 0.2s;
}

.dropdown-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Settings List Styles */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
}

.settings-item:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.settings-label {
    font-weight: 500;
}

.settings-arrow {
    color: #ccc;
    font-weight: bold;
}

.settings-item:hover .settings-arrow {
    color: var(--primary-color);
}

/* Form Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.actions .btn {
    flex: 1;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Profile Selection */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.profile-card {
    width: 100%;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-card:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.profile-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
    display: block;
}

.profile-card:hover .profile-name {
    color: white;
}

.profile-level {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.profile-add-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 100px;
    background: transparent;
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.2s;
}

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