:root {
    --cream: #F5F0E8;
    --terracotta: #C4714F;
    --warm-brown: #3D2B1F;
    --muted: #9A8C82;
    --white: #FDFBF7;
}

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

body {
    background-color: var(--cream);
    color: var(--warm-brown);
    font-family: 'Jost', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    padding: 60px 40px;
    animation: fadeIn 0.6s ease;
}

.step.active {
    display: flex;
}

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

h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.5rem;
    font-weight: 300;
    color: var(--warm-brown);
    text-align: center;
    margin-bottom: 12px;
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--warm-brown);
    text-align: center;
    margin-bottom: 40px;
}

p {
    font-family: 'Jost', sans-serif;
    font-size: 1rem;
    color: var(--muted);
    text-align: center;
    margin-bottom: 40px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--muted);
    border-radius: 12px;
    padding: 16px 20px;
    font-family: 'Jost', sans-serif;
    font-size: 1rem;
    color: var(--warm-brown);
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--terracotta);
}

button {
    margin-top: 24px;
    padding: 14px 40px;
    background: var(--terracotta);
    color: var(--white);
    border: none;
    border-radius: 30px;
    font-family: 'Jost', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

button:hover {
    opacity: 0.85;
}

button.secondary {
    background: transparent;
    color: var(--terracotta);
    border: 1px solid var(--terracotta);
}

#score-display {
    font-family: 'Cormorant Garamond', serif;
    font-size: 6rem;
    font-weight: 300;
    color: var(--terracotta);
    line-height: 1;
    margin-bottom: 24px;
}

input[type="range"] {
    width: 100%;
    appearance: none;
    height: 2px;
    background: var(--muted);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--terracotta);
    cursor: pointer;
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#score-labels {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 8px;
}

#animation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

#spinner {
    width: 48px;
    height: 48px;
    border: 2px solid var(--muted);
    border-top-color: var(--terracotta);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#chart-container {
    width: 100%;
    max-width: 700px;
    height: 320px;
    background: var(--white);
    border-radius: 24px;
    padding: 24px;
    margin-top: 24px;
    margin-bottom: 45px;
    opacity: 1;
    transition: opacity 1.2s ease;
    position: relative;
}

#myChart {
    width: 100% !important;
    height: 100% !important;
}

#chart-container.loaded {
    opacity: 1;
}

#chart-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.toggle-btn {
    margin-top: 0;
    padding: 8px 20px;
    font-size: 0.85rem;
    background: var(--cream);
    color: var(--warm-brown);
    border: none;
    border-radius: 20px;
}

.toggle-btn.active-toggle {
    background: var(--muted);
    color: var(--white);
}

#history-table {
    margin-top: 32px;
    width: 100%;
    max-width: 700px;
}

.history-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px 28px 10px 28px;
    margin-bottom: 16px;
    text-align: left;
}

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

.history-date {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: var(--terracotta);
    margin-bottom: 8px;
}

.history-text {
    font-family: 'Jost', sans-serif;
    font-size: 0.95rem;
    color: var(--warm-brown);
    line-height: 1.6;
    margin-bottom: 8px;
}

.history-text em {
    font-style: italic;
    color: var(--terracotta);
}

.history-score {
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: 24px;
    padding: 40px;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.error-message {
    color: var(--terracotta);
    font-family: 'Jost', sans-serif;
    font-size: 0.9rem;
    margin-top: 16px;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    #score-display {
        font-size: 4rem;
    }

    .step {
        padding: 40px 24px;
    }

    #chart-container {
        height: 400px;
        padding: 24px 16px;
    }
}

.nav-link {
    position: fixed;
    top: 24px;
    font-family: 'Jost', sans-serif;
    font-size: 0.8rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--terracotta);
}

.nav-link.logout {
    right: 24px;
}

.nav-link.journey {
    right: 100px;
}

.nav-link.today {
    right: 195px;
}



#custom-tooltip {
    position: absolute;
    background: var(--muted);
    color: var(--white);
    border-radius: 10px;
    padding: 8px 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 200px;
    z-index: 100;
    font-family: 'Jost', sans-serif;
    font-size: 0.7rem;
    line-height: 1.4;
    word-break: break-word;
}

#custom-tooltip p {
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.7rem !important;
    line-height: 1.4 !important;
    white-space: normal !important;
}

.tt-date {
    color: var(--white);
    margin-bottom: 2px !important;
}

.tt-score {
    color: var(--warm-brown);
    margin-bottom: 4px !important;
}

.tt-label {
    color: var(--white);
    opacity: 0.7;
    margin-top: 4px !important;
}

.tt-item {
    color: rgba(253, 251, 247, 0.85);
}

.backdate-link {
    display: inline-block;
    margin-top: 20px;
    font-family: 'Jost', sans-serif;
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.backdate-link:hover {
    color: var(--terracotta);
}

.field-label {
    display: block;
    width: 100%;
    text-align: left;
    font-family: 'Jost', sans-serif;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    margin-top: 20px;
}

input[type="date"] {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--muted);
    border-radius: 12px;
    padding: 16px 20px;
    font-family: 'Jost', sans-serif;
    font-size: 1rem;
    color: var(--warm-brown);
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="date"]:focus {
    border-color: var(--terracotta);
}

.success-message {
    color: #6a8f6a;
    font-family: 'Jost', sans-serif;
    font-size: 0.9rem;
    margin-top: 16px;
    margin-bottom: 8px;
}