﻿/* ==============
   Age of Liberty 
   ============== */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand */
    --gold: #F9C70F;
    --charcoal: #1E1E1E;
    --porcelain: #F0F3F4;
    --teal: #53B8A1;
    --blue: #27AAE2;
    --orange: #E47C37;
    --pink: #D83751;
    --white: #ffffff;
    /* Typography */
    --font-serif: 'Libre Baskerville', 'Segoe UI', serif;
    --font-sans: 'Montserrat', 'Segoe UI', Roboto, system-ui, -apple-system, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    --font-ui: 'Roboto', 'Segoe UI', sans-serif;
    /* Elevation & Shape */
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.10);
    --shadow-md: 0 2px 15px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 8px;
    /* Spacing scale */
    --space-0: 0;
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    /* Component heights */
    --header-h: 80px;
    --scorebar-h: auto;
    /* Z-index */
    --z-bg: -1;
    --z-base: 10;
    --z-dialog: 20;
    --z-scores: 1001;
    --z-header: 1002;
    --z-fab: 1002;
    --z-modal: 1003;
    --z-toast: 1004;
    /* Breakpoints */
    --bp-md: 768px;
    --bp-sm: 600px;
}

/* ---------- Reset-ish ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--porcelain);
    color: #333;
    font-family: var(--font-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    margin: 0 0 .6rem;
    line-height: 1.2;
}

h1 {
    font-weight: 800;
    font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}

h2 {
    font-weight: 800;
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem);
}

h3 {
    font-weight: 700;
    font-size: 1.25rem;
}

p {
    margin: 0 0 1rem;
}

/* ---------- Utilities ---------- */
.container {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* ---------- Background Image ---------- */
.background-image {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: var(--z-bg);
    opacity: .72;
}

/* ---------- Header / Epoch Banner ---------- */
.epoch-banner,
.app-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--charcoal);
    color: var(--white);
    padding: var(--space-4) var(--space-8);
    font-family: var(--font-sans);
    font-size: 1rem;
    height: var(--header-h);
    box-sizing: border-box;
    z-index: var(--z-header);
    box-shadow: var(--shadow-lg);
}

    .epoch-banner .button-group {
        display: flex;
        gap: var(--space-4);
    }

.app-header-inner { /* if you use it */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    letter-spacing: .3px;
}

/* ---------- Buttons ---------- */
.btn {
    --btn-bg: var(--charcoal);
    --btn-color: var(--white);
    --btn-bg-hover: #2a2a2a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.1rem;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--btn-bg);
    color: var(--btn-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform .06s ease, background-color .2s ease;
}

    .btn:hover {
        background: var(--btn-bg-hover);
    }

    .btn:active {
        transform: translateY(1px);
    }

.btn-lg {
    padding: .9rem 1.2rem;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-gold {
    --btn-bg: var(--gold);
    --btn-color: #1a1700;
    --btn-bg-hover: #eabf0e;
}

.btn-teal {
    --btn-bg: var(--teal);
    --btn-bg-hover: #47a791;
}

.btn-blue {
    --btn-bg: var(--blue);
    --btn-bg-hover: #1e9bd0;
}

.btn-orange {
    --btn-bg: var(--orange);
    --btn-bg-hover: #d96c28;
}

.btn-pink {
    --btn-bg: var(--pink);
    --btn-bg-hover: #c82f47;
}

.btn-charcoal {
    --btn-bg: var(--charcoal);
    --btn-bg-hover: var(--gold);
}

.btn-outline {
    background: transparent;
    color: var(--charcoal);
    border: 2px solid var(--charcoal);
}

    .btn-outline:hover {
        background: var(--charcoal);
        color: var(--white);
    }

/* Icon buttons in header */
.home-button, .music-button, .settings-button {
    background-color: #363535;
    border: none;
    color: white;
    font-size: 1.2rem;
    border-radius: 6px;
    padding: var(--space-2);
    cursor: pointer;
    transition: background-color .2s;
}

    .home-button:hover, .music-button:hover, .settings-button:hover {
        background-color: #fae289;
    }

/* ---------- Situation Card / Dialog ---------- */
.situation-card {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000;
    font-family: var(--font-ui);
}

    .situation-card.visible {
        display: flex;
    }

.situation-box {
    background: var(--white);
    padding: var(--space-8);
    border-radius: 12px;
    max-width: 700px;
    width: min(700px, 90%);
    box-shadow: var(--shadow-md);
}

    .situation-box h2 {
        margin-top: 0;
        font-family: var(--font-sans);
    }

.philosopher-choice {
    background: #ecf0f1;
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    text-align: left;
}

.philosopher-name {
    font-weight: bold;
    margin-bottom: var(--space-4);
}

.choice-buttons button {
    display: block;
    width: 100%;
    font-family: var(--font-ui);
    margin: .5rem 0;
    padding: .75rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--porcelain);
    transition: background-color .2s;
}

    .choice-buttons button:hover {
        background-color: #95a5a6;
    }

.dialog-bubble {
    position: fixed;
    bottom: 420px;
    max-width: 320px;
    padding: var(--space-4);
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transition: opacity .5s ease-in-out;
    pointer-events: none;
    z-index: var(--z-dialog);
    font-size: .87rem;
}

    .dialog-bubble.visible {
        opacity: 1;
        pointer-events: auto;
    }

.dialog-left {
    left: 100px;
}

.dialog-right {
    right: 100px;
}

.philosopher-img {
    position: fixed;
    bottom: 50px;
    width: 260px;
    height: 390px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    opacity: 0;
    transition: opacity .5s ease-in-out;
    z-index: var(--z-base);
}

    .philosopher-img.visible {
        opacity: 1;
    }

.left-img {
    left: 20px;
}

.right-img {
    right: 20px;
}

.philosopher-label {
    position: fixed;
    width: 200px;
    bottom: 75px;
    text-align: center;
    font-weight: normal;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--white);
    background: var(--charcoal);
    padding: var(--space-3);
    border-radius: 6px;
    opacity: 0;
    transition: opacity .5s ease-in-out;
    z-index: calc(var(--z-base) + 1);
}

    .philosopher-label.visible {
        opacity: 1;
    }

.label-left {
    left: 20px;
}

.label-right {
    right: 20px;
}

/* ---------- Scores Bar ---------- */
.scores {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: var(--font-sans);
    background: var(--charcoal);
    color: var(--white);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    padding: var(--space-4);
    font-weight: bold;
    box-sizing: border-box;
    z-index: var(--z-scores);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    transition: transform .3s ease-in-out;
}

    .scores.hidden {
        transform: translateY(100%);
    }

.score-item {
    display: flex;
    align-items: center;
    font-size: 1rem;
    padding: var(--space-2);
    margin: .25rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    transition: transform .2s;
}

    .score-item:hover {
        transform: scale(1.05);
    }

    .score-item span {
        margin-right: .5rem;
        font-size: 1.1rem;
    }

.score-value {
    font-size: 1.2rem;
}

.score-toggle-button {
    display: none;
    position: fixed;
    bottom: 10px;
    left: 10px;
    background-color: var(--charcoal);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: .5rem 1rem;
    font-family: var(--font-sans);
    font-size: .9rem;
    font-weight: normal;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: var(--z-header);
    transition: background-color .2s;
}

    .score-toggle-button:hover {
        background-color: #4a606e;
    }

/* ---------- Floating Quest Button ---------- */
.quest-button {
    position: fixed;
    top: 90px;
    right: 20px;
    background-color: var(--gold);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform .2s, background-color .2s;
    z-index: var(--z-fab);
    font-family: var(--font-sans);
}

    .quest-button:hover {
        transform: scale(1.1);
        background-color: #c0392b;
    }

/* ---------- Modals (Quest & Settings) ---------- */
.quest-modal, .settings-modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.6);
    z-index: var(--z-modal);
}

    .quest-modal.visible, .settings-modal.visible {
        display: flex;
    }

.quest-content, .settings-content {
    background: var(--white);
    padding: var(--space-8);
    border-radius: 12px;
    max-width: 90%;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn .3s ease-out;
    box-shadow: var(--shadow-md);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.quest-content h2, .settings-content h2 {
    margin-top: 0;
    color: #2c3e50;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
}

/* ---------- Quest List & Badges ---------- */
.quest-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    background: #f9f9f9;
}

    .quest-item.completed {
        background: #dff0d8;
        color: #3c763d;
    }

    .quest-item.pending {
        background: #f5f5f5;
        color: #333;
    }

.quest-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
}

    .quest-icon img {
        display: block;
    }

.icon-completed {
    filter: brightness(0) saturate(100%) hue-rotate(120deg);
}

.icon-pending {
    filter: brightness(0) saturate(100%) hue-rotate(0deg) grayscale(100%);
}

.quest-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.quest-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.quest-status {
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
    color: white;
    user-select: none;
}

    .badge.completed {
        background-color: #4CAF50;
    }

    .badge.pending {
        background-color: #9E9E9E;
    }

/* ---------- Toast Notification ---------- */
.toast-notification {
    position: fixed;
    top: 85px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #4CAF50;
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: var(--z-toast);
    opacity: 0;
    transform: translateX(-50px);
}

    .toast-notification.visible {
        opacity: 1;
        animation: slideInBounce .5s ease-out forwards;
    }

@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }

    60% {
        opacity: 1;
        transform: translateX(15px);
    }

    80% {
        transform: translateX(-8px);
    }

    100% {
        transform: translateX(0);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
}

    .toast-icon img {
        display: block;
        filter: brightness(0) saturate(100%) hue-rotate(120deg);
    }

.toast-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    color: white;
}

.toast-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.toast-quest-name {
    font-size: .9rem;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* ---------- Forms (Register / Login / Shared) ---------- */
.register-container,
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
    padding: var(--space-8) var(--space-4);
}

.register-form {
    background: var(--charcoal);
    color: var(--white);
    padding: var(--space-8);
    border-radius: 2px;
    box-shadow: var(--shadow-md);
    max-width: 400px;
    width: 100%;
}

.tagline {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--charcoal);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

    .form-group label {
        display: block;
        font-weight: bold;
        color: var(--charcoal);
        margin-bottom: .5rem;
    }

    .form-group input,
    .form-group select {
        width: 100%;
        padding: .75rem;
        font-size: 1rem;
        border: 1px solid var(--porcelain);
        border-radius: 6px;
        box-sizing: border-box;
        transition: border-color .2s, box-shadow .2s;
        background-color: var(--porcelain);
        appearance: none;
    }

    .form-group select {
        padding-right: 2rem;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right .75rem center;
        background-size: 1rem;
    }

        .form-group input:focus, .form-group select:focus {
            border-color: var(--gold);
            box-shadow: 0 0 5px rgba(39,174,96,.3);
            outline: none;
        }

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-check-input {
    margin-right: .5rem;
    width: 1.2em;
    height: 1.2em;
    accent-color: var(--gold);
}

.form-check-label {
    color: var(--charcoal);
    font-size: .9rem;
    margin-bottom: -5px;
}

.register-btn {
    display: block;
    width: 100%;
    padding: .75rem;
    font-size: 1.2rem;
    transition: background-color .2s, transform .2s;
}

.login-link {
    margin-top: 1rem;
    text-align: center;
    font-size: .95rem;
}

    .login-link a {
        color: var(--blue);
        text-decoration: none;
        font-weight: 600;
    }

        .login-link a:hover {
            text-decoration: underline;
        }

.error-message {
    color: var(--pink);
    font-size: .9rem;
    margin-top: .5rem;
    display: none;
}

.dual-input-group {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
}

    .dual-input-group .half-input {
        flex: 1 1 48%;
        min-width: 120px;
    }

/* Glassy fieldset */
fieldset {
    position: relative;
    margin: 0 0 1.25rem;
    padding: 1.25rem;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.10));
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

legend {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: .95rem;
    color: var(--charcoal);
    padding: .3rem .75rem;
    border-radius: 999px;
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.8);
}

/* Login specific */
.login-form {
    --glass-bg: rgba(255,255,255,.18);
    background: linear-gradient(180deg, var(--glass-bg), rgba(255,255,255,.08));
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0,0,0,.12);
    width: min(400px, 100%);
    padding: var(--space-8);
}

.login-title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--charcoal);
}

.login-form .form-group {
    margin-bottom: 1.2rem;
}

.login-form label {
    display: block;
    font-weight: 600;
    font-size: .95rem;
    margin-bottom: .4rem;
    color: var(--charcoal);
}

.login-form input {
    width: 100%;
    padding: .7rem .85rem;
    font-size: 1rem;
    border: 1px solid rgba(30,30,30,.18);
    border-radius: 10px;
    background: rgba(240,243,244,.9);
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}

    .login-form input:focus {
        outline: none;
        border-color: var(--gold);
        box-shadow: 0 0 0 3px rgba(249,199,15,.25);
        background-color: rgba(240,243,244,1);
    }

/* Settings panel buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

    .action-buttons button {
        width: 100%;
        padding: .75rem;
        font-size: 1rem;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: background-color .2s;
    }

    .action-buttons .edit-password {
        background-color: #3498db;
        color: white;
    }

        .action-buttons .edit-password:hover:not(.disabled) {
            background-color: #2980b9;
        }

    .action-buttons .logout-button {
        background-color: #8e44ad;
        color: white;
    }

        .action-buttons .logout-button:hover {
            background-color: #703688;
        }

    .action-buttons .reset-game {
        background-color: #e67e22;
        color: white;
    }

        .action-buttons .reset-game:hover {
            background-color: #d35400;
        }

    .action-buttons .delete-account {
        background-color: #e74c3c;
        color: white;
    }

        .action-buttons .delete-account:hover {
            background-color: #c0392b;
        }

    .action-buttons .disabled {
        background-color: #bdc3c7;
        cursor: not-allowed;
        opacity: .6;
    }

        .action-buttons .disabled:hover {
            background-color: #bdc3c7;
        }

    .action-buttons form.form-inline {
        display: inline-block;
        width: 100%;
    }

        .action-buttons form.form-inline button {
            width: 100%;
        }

/* ---------- App Main & Footer (optional) ---------- */
.app-main {
    min-height: calc(100vh - 140px);
    padding: var(--space-8) var(--space-4);
}

.app-footer {
    background: var(--charcoal);
    color: var(--white);
    padding: var(--space-4) 1.25rem;
    text-align: center;
    font-size: .95rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .dialog-left {
        left: 60px;
    }

    .dialog-right {
        right: 60px;
    }
}

@media (max-width: 900px) {
    .dialog-left {
        left: 30px;
    }

    .dialog-right {
        right: 30px;
    }
}

@media (max-width: 768px) {
    .epoch-banner {
        font-size: 0.88rem;
        padding: .5rem 1rem;
        height: 60px;
    }

    .scores {
        flex-direction: column;
        padding: .5rem;
    }

    .score-item {
        width: 100%;
        justify-content: center;
        margin: .2rem 0;
    }

    .score-toggle-button {
        display: block;
    }

    .dialog-bubble {
        max-width: 80%;
        bottom: 350px;
    }

    .dialog-left {
        left: 10px;
    }

    .dialog-right {
        right: 10px;
    }

    .philosopher-img {
        bottom: 102px;
        width: 150px;
        height: 225px;
    }

    .philosopher-label {
        width: 142px;
        bottom: 75px;
        text-align: center;
        font-weight: normal;
        font-size: 0.85rem;
        color: var(--white);
        background: var(--charcoal);
        padding: var(--space-3);
        border-radius: 6px;
        opacity: 0;
        transition: opacity .5s ease-in-out;
        z-index: calc(var(--z-base) + 1);
    }

    .quest-button {
        top: 90px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: .7rem;
    }

    .situation-box {
        padding: 1rem;
        max-width: 90%;
    }

    .settings-content {
        padding: 1rem;
    }

    .tagline {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .register-form {
        padding: 1.5rem;
        max-width: 90%;
    }

    .form-group input, .form-group select {
        padding: .6rem;
        font-size: .9rem;
    }

    .form-group select {
        background-size: .9rem;
    }

    .register-button {
        padding: .6rem;
        font-size: 1rem;
    }

    .login-link {
        font-size: .9rem;
    }

    .dual-input-group {
        flex-direction: column;
    }

        .dual-input-group .half-input {
            flex: 1 1 100%;
        }
}

@media (max-width: 600px) {
    .login-form {
        padding: 1.5rem;
    }

    .login-title {
        font-size: 1.3rem;
    }
}
