﻿
/* Fade-In Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pressFlash {
    0% { background-color: #424242; }
    50% { background-color: #4a4a4a; }
    100% { background-color: #424242; }
}


/* Index page styling scoped to the main form that's a direct child of .container. */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: #1e1e1e;
    padding: 20px;
}

.custom-game-loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(41, 131, 221, 0.22), transparent 42%),
        linear-gradient(180deg, rgba(9, 16, 29, 0.96), rgba(6, 10, 20, 0.99));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 5000;
}

body.custom-game-loading-active {
    overflow: hidden;
}

body.custom-game-loading-active .custom-game-loading-screen {
    opacity: 1;
    pointer-events: auto;
}

.custom-game-loading-panel {
    width: min(100%, 560px);
    padding: 36px 32px;
    border: 1px solid rgba(41, 131, 221, 0.5);
    border-radius: 18px;
    background: rgba(18, 24, 38, 0.94);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 32px rgba(41, 131, 221, 0.16);
    text-align: center;
}

.custom-game-loading-kicker {
    margin-bottom: 14px;
    color: #8abfff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.custom-game-loading-title {
    color: #ffffff;
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.custom-game-loading-copy {
    margin-top: 16px;
    color: #d2ddf0;
    font-size: 1rem;
    line-height: 1.6;
}

.container h1 {
    color: #2983dd;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-align: center;
}

/* Only style the panel form, not nested forms */
.container > form {
    background-color: #2c2c2c;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
}

.container > form label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
    color: #e0e0e0;
    
}

/* Inputs in that panel only */
.container > form input[type="text"],
.container > form input[type="password"],
.container > form input[type="file"],
.container > form textarea,
.container > form select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    background-color: #424242;
    color: #e0e0e0;
    
    outline: none;
    transition: background-color 0.3s ease-in-out;
}

.container > form input[type="text"]:focus,
.container > form input[type="password"]:focus,
.container > form input[type="file"]:focus,
.container > form textarea:focus,
.container > form select:focus {
    background-color: #555555;
}

.container > form input[type="file"] {
    cursor: pointer;
}

.container > form input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    background: #2983dd;
    color: #fff;
    cursor: pointer;
}

/* Submit button in that panel only */
.container > form input[type="submit"] {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    background-color: #2983dd;
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, transform 0.2s;
}

.container > form input[type="submit"]:hover {
    background-color: #1c6fb4;
    transform: translateY(-2px);
}

.legal-ack-wrapper {
    margin-bottom: 20px;
    text-align: center;
}

.legal-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.legal-ack-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid #2983dd;
    border-radius: 10px;
    background-color: transparent;
    color: #e0e0e0;
    font-weight: 700;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.legal-checkbox:focus + .legal-ack-btn,
.legal-checkbox:checked + .legal-ack-btn {
    background-color: #2983dd;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(41, 131, 221, 0.45);
    transform: translateY(-2px);
}

.legal-ack-note {
    margin-top: 8px;
    font-size: 0.9em;
    color: #cccccc;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-game-loading-panel {
        padding: 30px 24px;
    }

    .custom-game-loading-kicker {
        letter-spacing: 0.16em;
    }

    .chat-container {
        flex-direction: column;
    }
    .message-text {
        font-size: 22px; /* slightly smaller for better mobile readability */
        max-width: 95%;
    }

    .chat-main {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .stats-sidebar {
        display: none;
        border-left: none;
        border-top: none;
        height: auto;
        flex: none;
        width: calc(100% - 40px);
        font-size: 18px;
        position: fixed;
        bottom: 10%;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.65);
        max-height: 70vh;
        overflow-y: visible;
        padding: 20px;
        border: 1px solid #444;
        z-index: 3600;
    }

    .stats-sidebar.open {
        display: block;
        animation: fadeIn 0.25s ease-out;
    }

    .stats-sidebar h3 {
        display: block;
    }

    .stat-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .stat-value {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        text-align: left;
    }

    .inventory-section-label--count {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .chat-window {
        padding: 20px 20px 170px;
        max-width: 100%;
        font-size: 20px;
        height: auto;
    }

    .chat-input {
        height: 120px;
        padding: 10px 20px;
    }

    .chat-input form {
        flex-direction: column;
    }

    .chat-input input[type="text"] {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        font-size: 18px;
    }

    .chat-input button {
        width: 100%;
        margin-left: 0;
        margin-bottom: 10px;
        font-size: 18px;
    }

    .undo-button {
        margin-bottom: 0;
    }

    .chat-main {
        height: auto;
    }

    #stats-btn {
        display: block;
    }

    #stats-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .stats-header {
        border-bottom: 1px solid #444;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
}

/* Nicer Hyperlink Styling */
a {
    display: inline-block;
    padding: 6px 12px;
    margin: 2px;
    background-color: #2983dd;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out;
}

a:hover {
    background-color: #1c6fb4;
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background-color: #2983dd;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.btn:hover {
    background-color: #1c6fb4;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #b00020;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn:disabled {
    background-color: #555555;
    cursor: not-allowed;
}

/* Resource links keep their unique styling even with the global anchor rules */
.resource-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 40px auto 10px;
}

.resource-buttons .resource-button {
    background-color: #3d3d3d;
    color: #ffffff;
    border-radius: 6px;
    padding: 10px 18px;
    margin: 0;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.resource-buttons .resource-button:hover {
    background-color: #2983dd;
    transform: translateY(-1px);
}

.community-link {
    text-align: center;
    margin: 10px 0 0;
}

.community-link .discord-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 999px;
    background-color: #5865f2;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.community-link .discord-link:hover {
    background-color: #4752c4;
    transform: translateY(-1px);
}

.auth-links {
    text-align: center;
    margin-bottom: 35px;
}

body.home-page .container.home-shell {
    min-height: 100vh;
    height: auto;
    justify-content: flex-start;
    padding: 36px 20px 56px;
}

body.home-page .home-card {
    width: min(100%, 980px);
    display: grid;
    gap: 20px;
    justify-items: center;
}

body.home-page .home-hero,
body.home-page .home-panel {
    background:
        linear-gradient(180deg, rgba(52, 52, 52, 0.96), rgba(35, 35, 35, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.34);
    width: 100%;
    text-align: center;
}

body.home-page .home-hero {
    padding: 34px 34px 30px;
}

body.home-page .home-eyebrow {
    margin: 0 0 10px;
    color: #8abfff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

body.home-page .home-hero h1 {
    margin: 0;
    font-size: clamp(2.3rem, 5vw, 3.5rem);
    line-height: 1.05;
    text-align: center;
}

body.home-page .home-subtitle {
    max-width: 700px;
    margin: 14px 0 0;
    color: #cfd8e6;
    font-size: 1.05rem;
    line-height: 1.65;
}

body.home-page .home-status-row,
body.home-page .home-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

body.home-page .home-status-pill,
body.home-page .home-muted-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    background-color: rgba(41, 131, 221, 0.15);
    border: 1px solid rgba(41, 131, 221, 0.32);
    color: #dcecff;
    font-weight: 600;
}

body.home-page .home-status-pill strong {
    color: #ffffff;
    font-size: 1rem;
}

body.home-page .save-counter {
    margin: 0;
}

body.home-page .home-panel {
    padding: 26px 28px 28px;
}

body.home-page .home-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
    text-align: center;
}

body.home-page .home-panel-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.3rem;
}

body.home-page .home-panel-header p {
    margin: 8px 0 0;
    color: #bac4d4;
    line-height: 1.5;
}

body.home-page .home-primary-link,
body.home-page .home-secondary-link {
    min-height: 46px;
    padding: 12px 20px;
    border-radius: 12px;
    margin: 0;
    font-weight: 700;
}

body.home-page .home-primary-link {
    background-color: #2983dd;
}

body.home-page .home-primary-link:hover {
    background-color: #1c6fb4;
}

body.home-page .home-secondary-link {
    background-color: #3a3f4b;
}

body.home-page .home-secondary-link:hover {
    background-color: #4a5160;
}

body.home-page .home-inline-form {
    display: inline-flex;
    margin: 0;
}

body.home-page .home-inline-form .btn,
body.home-page .save-list-actions .rename-save-button {
    min-height: 44px;
    margin: 0;
}

body.home-page .home-flash-messages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

body.home-page .home-flash-message {
    padding: 14px 16px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.home-page .home-flash-message.flash-success {
    border-color: rgba(63, 185, 80, 0.45);
    background-color: rgba(63, 185, 80, 0.14);
}

body.home-page .home-flash-message.flash-error,
body.home-page .home-flash-message.flash-danger {
    border-color: rgba(211, 47, 47, 0.45);
    background-color: rgba(211, 47, 47, 0.14);
}

body.home-page .home-flash-message.flash-warning {
    border-color: rgba(255, 193, 7, 0.45);
    background-color: rgba(255, 193, 7, 0.14);
}

body.home-page .save-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

body.home-page .save-list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.04);
    text-align: center;
}

body.home-page .save-list-name {
    display: block;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

body.home-page .save-list-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

body.home-page .home-empty-state {
    margin: 0;
    color: #bac4d4;
}

body.home-page .resource-buttons {
    justify-content: center;
    margin: 0;
}

body.home-page .community-link,
body.home-page .support-cta {
    text-align: center;
}

body.home-page .home-panel--danger {
    border-color: rgba(211, 47, 47, 0.3);
}

body.home-page .home-panel--danger .delete-account-form {
    margin: 0;
    text-align: center;
}

@media (max-width: 768px) {
    body.home-page .container.home-shell {
        padding: 20px 14px 36px;
    }

    body.home-page .home-hero,
    body.home-page .home-panel {
        padding: 22px 18px;
        border-radius: 16px;
    }

    body.home-page .home-status-row,
    body.home-page .home-action-row,
    body.home-page .save-list-item,
    body.home-page .save-list-actions {
        align-items: stretch;
    }

    body.home-page .save-list-item {
        flex-direction: column;
    }

    body.home-page .save-list-actions,
    body.home-page .resource-buttons {
        justify-content: center;
    }

    body.home-page .home-primary-link,
    body.home-page .home-secondary-link,
    body.home-page .home-inline-form,
    body.home-page .home-inline-form .btn,
    body.home-page .save-list-actions .rename-save-button,
    body.home-page .resource-buttons .resource-button,
    body.home-page .community-link .discord-link,
    body.home-page .support-button,
    body.home-page .delete-account-button {
        width: 100%;
        justify-content: center;
    }
}

