/* ===== ROOT VARIABLES ===== */
:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --secondary-color: #6366f1;
    --secondary-dark: #4f46e5;
    --accent-color: #f59e0b;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-light: #475569;
    --error-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* ===== GLOBAL STYLES ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', Georgia, serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ===== TYPOGRAPHY ===== */
h1 {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
    letter-spacing: 0.06em;
}

h2 {
    font-family: 'Cinzel', serif;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0.875rem 0;
    letter-spacing: 0.05em;
}

h3 {
    font-family: 'Cinzel', serif;
    color: var(--primary-light);
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0.75rem 0;
    text-shadow: 0 1px 4px rgba(52, 211, 153, 0.25);
    letter-spacing: 0.04em;
}

.title {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* ===== UTILITY CLASSES ===== */
.error {
    color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    font-weight: 500;
    animation: shake 0.3s ease-in-out;
}

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

.hidden {
    display: none !important;
}

/* ===== BUTTONS ===== */
button, .btn {
    margin-top: 10px;
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:active, .btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

button:disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.submit-button, .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.submit-button:hover, .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
}

.other-button, .btn-secondary {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--border-color) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.other-button:hover, .btn-secondary:hover {
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, var(--border-light) 100%);
    border-color: var(--primary-color);
}

.btn-link {
    text-decoration: none;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
    box-shadow: none;
}

.btn-link:hover {
    color: var(--primary-light);
    background: rgba(16, 185, 129, 0.1);
    transform: translateX(4px);
}

.btn-group {
    box-shadow: var(--shadow-md);
    border-radius: 0.5rem;
    overflow: hidden;
}

.btn-group .btn {
    margin: 0;
    border-radius: 0;
}

/* ===== FORMS ===== */
.input-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    display: inline-block;
}

.input {
    margin-bottom: 1rem;
}

.form-control, input[type="text"], input[type="number"], input[type="password"], select, textarea {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    padding: 0.625rem 1rem;
    transition: all var(--transition-fast);
    width: 100%;
    font-size: 0.9375rem;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    background-color: var(--bg-card-hover);
}

.form-control::placeholder, input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

/* ===== NAVIGATION TABS ===== */
.nav-tabs {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    gap: 0.5rem;
}

.nav-tabs .nav-link {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--border-color) 100%);
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.75rem 1.5rem;
    transition: all var(--transition-normal);
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, var(--border-light) 100%);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.nav-tabs .nav-link:not(.active) {
    opacity: 0.7;
}

/* ===== LOADING BAR ===== */
#api-keys-note {
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--secondary-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.loading-bar-container {
    display: none;
    position: relative;
    background-color: var(--bg-card);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.loading-bar {
    width: 0%;
    height: 24px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    text-align: center;
    line-height: 24px;
    color: white;
    font-weight: 600;
    transition: width var(--transition-normal);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.loading-percent {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 24px;
    color: var(--text-primary);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== SCROLLABLE SECTIONS ===== */
.scrollable-section {
    height: 600px;
    overflow-y: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
}

.scrollable-section:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-xl);
}

/* Custom Scrollbar */
.scrollable-section::-webkit-scrollbar {
    width: 10px;
}

.scrollable-section::-webkit-scrollbar-track {
    background: var(--bg-darker);
    border-radius: 0.5rem;
}

.scrollable-section::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 0.5rem;
    transition: background var(--transition-fast);
}

.scrollable-section::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== ACCORDION ===== */
.accordion-button {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.75rem 0 !important;
    font-weight: 600;
    text-align: left;
    color: var(--text-primary) !important;
    transition: all var(--transition-fast);
}

.accordion-button:hover {
    color: var(--primary-light) !important;
    padding-left: 0.5rem !important;
}

.accordion-button:focus {
    box-shadow: none !important;
}

.accordion-button::after {
    display: none;
}

.accordion-item {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.accordion-item:hover {
    background-color: rgba(16, 185, 129, 0.05);
}

.accordion-body {
    padding: 0.75rem 0 1rem 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accordion-collapse {
    border: none;
}


/* ===== GAME AREA ===== */
#game-output {
    margin-bottom: 1.5rem;
}

#narrativeList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#narrativeList .nav-item {
    background-color: var(--bg-card);
    border-left: 3px solid var(--primary-color);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#narrativeList .nav-item:hover {
    background-color: var(--bg-card-hover);
    border-left-width: 5px;
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

#optionsList {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

#optionsList .nav-item {
    margin-bottom: 0.5rem;
}

#optionsList .btn-link {
    width: 100%;
    text-align: left;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

#optionsList .btn-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-light);
    color: white;
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

#game-input {
    margin-top: 1rem;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

#user-options {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

/* ===== BATTLE UI ===== */
#battle-ui {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 2px solid var(--error-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.battle-info, .enemy-info {
    background-color: var(--bg-card);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.battle-info p, .enemy-info p {
    margin: 0.5rem 0;
    font-weight: 500;
}

.battle-info strong, .enemy-info strong {
    color: var(--primary-light);
}

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

.battle-actions .btn {
    flex: 1;
    min-width: 120px;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success-color) 100%);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: var(--bg-darker);
    font-weight: 600;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24 0%, var(--warning-color) 100%);
    color: var(--bg-darker);
}


/* ===== HEADER ===== */
.container-fluid > .row.align-items-center {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-darker) 100%);
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                margin-bottom 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s ease;
}

/* Collapsed: uniform scale keeps content proportional and readable.
   margin-bottom is set by JS to compensate for the freed layout space. */
.container-fluid > .row.align-items-center.header-collapsed {
    transform: scale(0.2625);
    opacity: 0.55;
    cursor: pointer;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    h1 {
        font-size: 1.875rem;
    }

    .scrollable-section {
        height: 400px;
        margin-bottom: 1rem;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .battle-actions {
        flex-direction: column;
    }

    .battle-actions .btn {
        width: 100%;
    }
}

/* ===== DROPDOWN MENUS ===== */
.dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.625rem 1rem;
    border-radius: 0.375rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--primary-light);
}

.dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== TOOLTIPS & POPOVERS ===== */
.tooltip-inner {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--border-color);
}

/* ===== BADGES ===== */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

.badge-secondary {
    background-color: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: var(--bg-darker);
}

.badge-danger {
    background-color: var(--error-color);
    color: white;
}

/* ===== CARDS ===== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--border-color) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
    color: var(--text-secondary);
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ===== FOCUS STATES ===== */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== SELECTION ===== */
::selection {
    background-color: var(--primary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-color);
    color: white;
}

/* ===== GAME VIEW LAYOUT ===== */
#game-view .row {
    gap: 1rem;
}

#game-view .col-md-3,
#game-view .col-md-5,
#game-view .col-md-4 {
    margin-bottom: 1rem;
}

/* ===== OPTIONS VIEW ===== */
#options-view {
    padding: 1.5rem;
    background-color: var(--bg-card);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
}

#new-game-view,
#load-game-view,
#story-settings-view,
#api-keys-view {
    padding: 1.5rem;
    background-color: rgba(30, 41, 59, 0.3);
    border-radius: 0.5rem;
    margin-top: 1rem;
}

/* ===== ENHANCED INTERACTIONS ===== */
.clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clickable:hover {
    transform: scale(1.02);
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== GLOW EFFECTS ===== */
.glow-primary {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.glow-secondary {
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.glow-danger {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}


/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* ===== IMPROVED CONTAINER PADDING ===== */
.container-fluid {
    padding: 0 1.5rem;
}

/* ===== LABEL IMPROVEMENTS ===== */
label {
    display: block;
    margin-bottom: 0.5rem;
}

/* ===== ENHANCED BUTTON STATES ===== */
button:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* ===== IMPROVED TEXTAREA ===== */
textarea.form-control {
    min-height: 80px;
    line-height: 1.5;
}

/* ===== PLACEHOLDER STYLING ===== */
::placeholder {
    font-style: italic;
    opacity: 0.6;
}

/* ===== IMPROVED SELECT DROPDOWNS ===== */
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2310b981' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2334d399' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* ===== NUMBER INPUT STYLING ===== */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* ===== IMPROVED ROW SPACING ===== */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* ===== ENHANCED ACCORDION HEADERS ===== */
.accordion-header {
    margin-bottom: 0;
}

.accordion-header button {
    width: 100%;
    text-align: left;
}

/* ===== LOADING STATE ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
}

.loading-content .spinner {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
    margin-bottom: 1rem;
}

/* ===== IMPROVED TRANSITIONS ===== */
.nav-link,
.accordion-button,
.btn,
button,
input,
select,
textarea {
    transition: all var(--transition-normal);
}

/* ===== ENHANCED HOVER EFFECTS ===== */
.scrollable-section:hover {
    border-color: var(--primary-color);
}

/* ===== BETTER SPACING FOR GAME SECTIONS ===== */
#game-view {
    margin-top: 1rem;
}

/* ===== IMPROVED BUTTON GROUP ===== */
.btn-group .btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
    }

    .btn-group,
    button,
    .nav-tabs {
        display: none;
    }
}

/* ===== DARK MODE ENHANCEMENTS ===== */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== LANDING PAGE ===== */
.landing-page-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    padding: 2rem;
}

.landing-content {
    max-width: 500px;
    width: 100%;
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
}

.auth-form {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.auth-form .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.auth-form .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    margin-bottom: 0;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.auth-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 0.375rem;
    display: none;
}

.auth-error:not(:empty) {
    display: block;
}

.user-welcome {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== MAIN MENU ===== */
.main-menu-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 2rem;
}

.menu-content {
    max-width: 600px;
    width: 100%;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-darker) 100%);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 3rem 2rem;
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.5s ease-out;
}

.menu-title {
    text-align: center;
    color: var(--primary-color);
    font-size: clamp(1.375rem, 4vw + 0.5rem, 2.5rem);
    font-weight: 700;
    margin-bottom: 2.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-button {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--border-color) 100%);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    color: var(--text-primary);
    font-size: clamp(0.9375rem, 1.5vw + 0.5rem, 1.25rem);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    text-align: left;
    width: 100%;
}

.menu-button:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-light);
    transform: translateX(10px) scale(1.02);
    box-shadow: var(--shadow-lg);
    color: white;
}

.menu-button:active {
    transform: translateX(10px) scale(0.98);
}

.menu-icon {
    font-size: clamp(1.25rem, 2.5vw + 0.5rem, 2rem);
    min-width: 2.5rem;
    text-align: center;
}

.menu-text {
    flex: 1;
}

@media (max-width: 768px) {
    .menu-content {
        padding: 2rem 1.5rem;
    }

    .menu-button {
        padding: 1.25rem 1.5rem;
        gap: 1rem;
    }

    .menu-icon {
        min-width: 2rem;
    }
}

@media (max-width: 480px) {
    .menu-content {
        padding: 1.5rem 1rem;
    }

    .menu-button {
        padding: 1rem 1.25rem;
        gap: 0.75rem;
    }

    .menu-icon {
        min-width: 1.75rem;
    }
}

/* ===== ADVENTURE TABS ===== */
.adventure-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.adventure-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    bottom: -2px;
}

.adventure-tab:hover {
    color: var(--primary-light);
    background: rgba(16, 185, 129, 0.05);
}

.adventure-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
}

.tab-icon {
    font-size: 1.25rem;
}

.tab-text {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.03em;
}

/* Tab Content */
.tab-content-container {
    min-height: 400px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-heading {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Story Inspiration Help */
.inspiration-help {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid var(--primary-color);
    border-radius: 0.5rem;
}

.inspiration-help p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Image Upload Container */
.image-upload-container {
    margin: 1.5rem 0;
}

.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: rgba(30, 41, 59, 0.3);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-light);
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon {
    font-size: 3rem;
    opacity: 0.7;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.upload-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Image Preview */
.image-preview {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.remove-image-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    border: 2px solid var(--bg-dark);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.remove-image-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Stereotype Status */
.stereotype-status {
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--secondary-color);
}

.status-message {
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
}

/* Stereotype Result */
.stereotype-result {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
}

.stereotype-result h4 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-family: 'Cinzel', serif;
}

.result-content {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Adventure Action */
.adventure-action {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design for Tabs */
@media (max-width: 768px) {
    .adventure-tabs {
        gap: 0.25rem;
    }

    .adventure-tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .tab-icon {
        font-size: 1.1rem;
    }

    .tab-text {
        display: none;
    }

    .upload-area {
        padding: 1.5rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .adventure-tab {
        padding: 0.5rem 0.75rem;
        flex: 1;
        justify-content: center;
    }

    .tab-content-container {
        min-height: 300px;
    }
}

/* ===== CONFIRMATION MODAL STYLES ===== */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.confirmation-modal-content {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-primary) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirmation-modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.confirmation-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    text-align: center;
}

.confirmation-modal-body {
    margin-bottom: 2rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.confirmation-modal-body p {
    margin-bottom: 1rem;
}

.confirmation-modal-body p:last-child {
    margin-bottom: 0;
}

.confirmation-modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-button-cancel {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-button-cancel:hover {
    background: var(--bg-primary);
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.modal-button-confirm {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-light);
}

.modal-button-confirm:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.modal-button:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .confirmation-modal-content {
        padding: 1.5rem;
    }

    .confirmation-modal-footer {
        flex-direction: column;
    }

    .modal-button {
        width: 100%;
    }
}

/* ===== SETTINGS VIEW ===== */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section-title {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.settings-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.emotional-attribute-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.attribute-header h5 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.word-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}

.word-text {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.word-actions {
    display: flex;
    gap: 0.25rem;
}

.word-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    border-radius: 3px;
}

.add-word-btn {
    margin-top: 0.5rem;
}

.settings-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
}