/* Global Reset & Base Variables */
:root {
    --bg-color: #0c0b13;
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(124, 58, 237, 0.4);
    
    --primary-grad: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    --primary-color: #7c3aed;
    --secondary-color: #db2777;
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --glow-violet: rgba(124, 58, 237, 0.25);
    --glow-pink: rgba(219, 39, 119, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background Glows */
.background-glows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-1 {
    position: absolute;
    top: -10%;
    right: 15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--glow-violet) 0%, rgba(12, 11, 19, 0) 70%);
    filter: blur(80px);
}

.glow-2 {
    position: absolute;
    bottom: 20%;
    left: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--glow-pink) 0%, rgba(12, 11, 19, 0) 70%);
    filter: blur(80px);
}

/* Typography styling */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #ffffff, #c084fc, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.subtitle {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Header */
.app-header {
    border-bottom: 1px solid var(--card-border);
    padding: 1.25rem 2rem;
    backdrop-filter: blur(12px);
    background-color: rgba(12, 11, 19, 0.7);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.75rem;
}

.highlight {
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.model-badges {
    display: flex;
    gap: 0.75rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-llm {
    background-color: rgba(219, 39, 119, 0.15);
    border-color: rgba(219, 39, 119, 0.3);
    color: #f472b6;
}

.badge-ml {
    background-color: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.3);
    color: #a78bfa;
}

/* Main Layout */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.intro-section {
    text-align: center;
    margin-bottom: 3.5rem;
}

/* Form & Generator Card */
.generator-section {
    max-width: 760px;
    margin: 0 auto 4rem auto;
}

.card {
    border-radius: 1.25rem;
    border: 1px solid var(--card-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: 0.75rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Custom Multi-select Tag Field */
.custom-select-container {
    position: relative;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tag {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: scaleUp 0.2s ease-out;
}

.tag-remove {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 700;
    transition: color 0.2s;
}

.tag-remove:hover {
    color: #ef4444;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: var(--primary-grad);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.5);
}

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

/* Loading Overlay */
.loading-container {
    text-align: center;
    padding: 3rem 0;
    animation: fadeIn 0.4s ease-out;
}

.loading-spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    position: relative;
    animation: rotate 1.2s linear infinite;
}

.inner-spinner {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid transparent;
    border-bottom: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: rotate-reverse 0.8s linear infinite;
}

.loading-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Results section */
.results-section {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease-out;
}

.results-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.results-subtitle {
    font-size: 1.1rem;
}

/* Grid of Cards */
.concepts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .concepts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Game Design Card */
.concept-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 1.25rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.concept-card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: var(--card-border-hover);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.15);
}

/* Card Header */
.card-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.rank-badge {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.25rem 0.5rem;
    border-radius: 0.35rem;
}

.viability-score-box {
    text-align: right;
}

.score-num {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
}

.score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.concept-title {
    font-size: 1.6rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.concept-theme {
    font-size: 0.85rem;
    font-weight: 600;
    color: #c084fc;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Card Body */
.concept-pitch {
    font-size: 1rem;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 1rem;
    border-left: 2px solid var(--primary-color);
    padding-left: 0.75rem;
}

.concept-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Card Mechanisms section */
.mechanisms-box {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.25rem;
}

.mech-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.mech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.mech-pill {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.35rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mech-pill.core {
    background-color: rgba(192, 132, 252, 0.08);
    border-color: rgba(192, 132, 252, 0.2);
    color: #e9d5ff;
}

.mech-pill.sec {
    background-color: rgba(244, 114, 182, 0.05);
    border-color: rgba(244, 114, 182, 0.15);
    color: #fce7f3;
}

/* Tier Pill */
.tier-pill {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

/* Utility Helpers */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes rotate-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

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

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--card-border);
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
}

.app-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Header Alignment & Auth Profile */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.auth-box {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.user-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-grad);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.25rem;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #ef4444;
}

.auth-config-warning {
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px dashed var(--card-border);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
}

/* Card Copy Design Buttons */
.btn-copy-container {
    margin-top: 1.25rem;
}

.btn-copy {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    width: 100%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-copy:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.15);
}

.btn-copy:active {
    transform: scale(0.97);
}

/* Floating Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background-color: rgba(12, 11, 19, 0.95);
    border: 1px solid var(--primary-color);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.4s ease forwards 2.6s;
}

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

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

/* GCS Saved History Layout */
.history-section {
    margin-top: 5rem;
    border-top: 1px solid var(--card-border);
    padding-top: 4rem;
}

.history-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.history-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .history-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.history-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s;
    text-align: left;
}

.history-card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.05);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.history-date {
    font-weight: 500;
}

.history-query {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.history-tag {
    font-size: 0.7rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    color: var(--text-secondary);
}

.history-games-preview {
    background-color: rgba(0, 0, 0, 0.18);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.history-game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.history-game-item:last-child {
    margin-bottom: 0;
}

.history-game-name {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.history-game-score {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #c084fc;
}

.btn-history-load {
    background: var(--primary-grad);
    border: none;
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: opacity 0.2s;
}

.btn-history-load:hover {
    opacity: 0.9;
}

