/* Crownsfall Game Shared Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --gold: #D4A843;
    --gold-dim: #8B7332;
    --gold-glow: rgba(212, 168, 67, 0.25);
    --ember: #C4450A;
    --deep: #0A0A0F;
    --surface: #12121A;
    --surface-light: #1A1A26;
    --surface-hover: #22222E;
    --text: #E8E4DD;
    --text-dim: #8A8578;
    --accent-purple: #6B4C9A;
    --success: #3B9B5E;
    --danger: #C4450A;
    --info: #4A7EB5;
    --rare: #4A7EB5;
    --epic: #8B5CF6;
    --legendary: #F59E0B;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--deep);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(212, 168, 67, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(107, 76, 154, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.cinzel { font-family: 'Cinzel', serif; }

/* Auth Layout */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--surface);
    border: 1px solid rgba(212, 168, 67, 0.1);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    border-radius: 16px 16px 0 0;
}

.auth-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: var(--gold);
    text-align: center;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    text-decoration: none;
    display: block;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--deep);
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.08);
}

.form-input::placeholder {
    color: rgba(138, 133, 120, 0.5);
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--gold), #B8922E);
    color: var(--deep);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.25s;
    margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--gold-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-error {
    background: rgba(196, 69, 10, 0.1);
    border: 1px solid rgba(196, 69, 10, 0.3);
    color: #E8715A;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}

.auth-error.visible { display: block; }

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.auth-link a {
    color: var(--gold);
    text-decoration: none;
}

.auth-link a:hover { text-decoration: underline; }

/* Game Layout */
.game-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.8rem 2rem;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(212, 168, 67, 0.08);
}

.game-nav-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.12em;
}

.game-nav-links {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.game-nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: all 0.2s;
}

.game-nav-links a:hover,
.game-nav-links a.active {
    color: var(--gold);
    background: rgba(212, 168, 67, 0.06);
}

.game-nav-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.nav-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.nav-stat .val {
    color: var(--gold);
    font-weight: 600;
}

.btn-logout {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid rgba(196, 69, 10, 0.3);
    border-radius: 6px;
    color: var(--ember);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(196, 69, 10, 0.1);
}

/* Game Content */
.game-content {
    padding-top: 70px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--gold);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.page-subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid rgba(212, 168, 67, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: rgba(212, 168, 67, 0.15);
}

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
}

.card-text {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Stat Bars */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.stat-row:last-child { border-bottom: none; }

.stat-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    min-width: 100px;
}

.stat-value {
    font-weight: 600;
    color: var(--gold);
    font-size: 1rem;
    min-width: 40px;
    text-align: right;
}

.stat-bar-wrap {
    flex: 1;
    height: 6px;
    background: rgba(212, 168, 67, 0.08);
    border-radius: 3px;
    margin: 0 1rem;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Action Buttons */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action.gold {
    background: linear-gradient(135deg, var(--gold), #B8922E);
    color: var(--deep);
}

.btn-action.gold:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-action.outline {
    background: transparent;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
}

.btn-action.outline:hover {
    background: rgba(212, 168, 67, 0.08);
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Energy/XP Bar */
.resource-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.resource-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    min-width: 60px;
    font-weight: 500;
}

.resource-track {
    flex: 1;
    height: 10px;
    background: rgba(212, 168, 67, 0.06);
    border-radius: 5px;
    overflow: hidden;
}

.resource-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.resource-fill.energy {
    background: linear-gradient(90deg, #3B9B5E, #4BC66E);
}

.resource-fill.xp {
    background: linear-gradient(90deg, var(--accent-purple), #8B6ABF);
}

.resource-fill.hp {
    background: linear-gradient(90deg, var(--ember), #E86040);
}

.resource-value {
    font-size: 0.8rem;
    color: var(--text-dim);
    min-width: 60px;
    text-align: right;
}

/* Quest Timer */
.quest-timer {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold);
    text-align: center;
    padding: 1rem 0;
    letter-spacing: 0.1em;
}

/* Tags/Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.easy { background: rgba(59, 155, 94, 0.15); color: #4BC66E; }
.badge.medium { background: rgba(212, 168, 67, 0.15); color: var(--gold); }
.badge.hard { background: rgba(196, 69, 10, 0.15); color: #E86040; }
.badge.legendary { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }

.badge.common { background: rgba(138, 133, 120, 0.15); color: var(--text-dim); }
.badge.uncommon { background: rgba(59, 155, 94, 0.15); color: #4BC66E; }
.badge.rare { background: rgba(74, 126, 181, 0.15); color: #5A9ED6; }
.badge.epic { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }

/* Reward Toast */
.toast-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.7);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.toast-overlay.visible {
    display: flex;
}

.toast-card {
    background: var(--surface);
    border: 1px solid var(--gold-dim);
    border-radius: 16px;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: toastIn 0.3s ease;
}

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

.toast-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 1rem;
}

.toast-reward {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.toast-reward-item {
    text-align: center;
}

.toast-reward-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.toast-reward-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.toast-loot {
    margin: 1rem 0;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .game-nav { padding: 0.6rem 0.8rem; gap: 0.5rem; }
    .game-nav-logo { font-size: 0.95rem; }
    .game-nav-right { gap: 0.6rem; }
    .game-nav-links a { padding: 0.4rem 0.6rem; font-size: 0.78rem; }
    .game-container { padding: 1rem 0.75rem; }
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .nav-stat { font-size: 0.72rem; gap: 0.2rem; }
    .btn-logout { padding: 0.35rem 0.6rem; font-size: 0.72rem; min-height: 36px; }
    .card { padding: 1rem; border-radius: 10px; }
    .card-title { font-size: 0.95rem; }
    .page-header { margin-bottom: 1.2rem; }
    .resource-bar { gap: 0.5rem; }
    .resource-label { min-width: 45px; font-size: 0.72rem; }
    .resource-value { min-width: 50px; font-size: 0.72rem; }
    .stat-row { padding: 0.5rem 0; }
    .stat-name { font-size: 0.82rem; min-width: 80px; }
    .stat-value { font-size: 0.9rem; }
    .badge { font-size: 0.68rem; padding: 0.15rem 0.45rem; }
    .toast-card { padding: 1.5rem; width: 94%; }
    .toast-title { font-size: 1.1rem; }
    .toast-reward-value { font-size: 1.2rem; }
    .auth-card { padding: 2rem 1.5rem; }
    .form-input { font-size: 16px; padding: 0.7rem 0.85rem; }
    .btn-primary { min-height: 48px; }
}

@media (max-width: 480px) {
    .game-nav { padding: 0.5rem 0.6rem; }
    .game-nav-logo { font-size: 0.85rem; letter-spacing: 0.08em; }
    .game-nav-right { gap: 0.4rem; }
    .nav-stat:nth-child(n+3) { display: none; }
    .game-container { padding: 0.75rem 0.5rem; }
    .card { padding: 0.8rem; }
    .auth-card { padding: 1.5rem 1rem; margin: 0 0.5rem; }
    .stat-bar-wrap { margin: 0 0.5rem; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(10, 10, 15, 0.3);
    border-top-color: var(--deep);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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