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

:root {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --surface-2: #22222f;
    --primary: #68F1AE;
    --secondary: #D79EF1;
    --accent: #F4809B;
    --text: #f0f0f0;
    --text-muted: #8888aa;
    --radius: 14px;
    --radius-sm: 8px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===================== AUTH ===================== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -2px;
    text-align: center;
    margin-bottom: 40px;
}

.auth-tabs {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--surface-2);
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea {
    background: var(--surface);
    border: 1.5px solid var(--surface-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

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

.form-group textarea {
    resize: vertical;
}

.auth-message {
    font-size: 0.85rem;
    min-height: 20px;
    color: var(--accent);
}

.auth-message.success {
    color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: #0a0a0e;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s, transform 0.1s;
    letter-spacing: 0.01em;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================== APP HEADER ===================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--surface-2);
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -1px;
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.25s;
}

/* ===================== SIDE MENU ===================== */

.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    z-index: 200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--surface-2);
}

.side-menu.open { right: 0; }

.side-menu-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 64px 24px 32px;
}

.user-info { margin-bottom: auto; }

.user-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.user-email {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-logout {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--accent);
    color: var(--bg);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ===================== MAIN CONTENT ===================== */

.main-content {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* ===================== RECORD BUTTON ===================== */

.btn-record {
    background: var(--primary);
    color: #0a0a0e;
    border: none;
    border-radius: var(--radius);
    padding: 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s, transform 0.1s;
    letter-spacing: 0.02em;
}

.btn-record:hover { opacity: 0.9; }
.btn-record:active { transform: scale(0.99); }

/* ===================== SECTION NAV ===================== */

.section-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav-btn {
    background: var(--surface-2);
    border: none;
    color: var(--text);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.nav-btn:hover {
    background: var(--primary);
    color: #0a0a0e;
}

/* ===================== WEEK VIEW ===================== */

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-circle {
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid transparent;
    gap: 2px;
    transition: all 0.18s;
}

.day-circle:hover {
    border-color: var(--primary);
}

.day-circle.today {
    border-color: var(--secondary);
}

.day-circle.has-session {
    background: var(--primary);
}

.day-circle.has-session.today {
    border-color: var(--secondary);
}

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

.day-number {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}

.day-circle.has-session .day-letter,
.day-circle.has-session .day-number {
    color: #0a0a0e;
}

/* ===================== MONTH VIEW ===================== */

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

.month-day-header {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 4px 0 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.month-day {
    aspect-ratio: 1;
    border-radius: 6px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.month-day.empty {
    background: transparent;
    cursor: default;
}

.month-day.has-session {
    background: var(--primary);
    color: #0a0a0e;
    font-weight: 700;
}

.month-day.today {
    outline: 2px solid var(--secondary);
    outline-offset: -2px;
}

.month-day:not(.empty):hover {
    opacity: 0.75;
}

/* ===================== MODAL ===================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px 20px 32px;
    animation: slideUp 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: var(--surface-2);
    border: none;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--accent);
    color: #fff;
}

.duration-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.duration-row input {
    width: 68px;
    text-align: center;
}

/* ===================== FEELING BUTTONS ===================== */

.feeling-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.feeling-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--surface-2);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.feeling-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #0a0a0e;
}

/* ===================== SESSION DETAIL ===================== */

.session-detail {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--surface-2);
}

.detail-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.detail-notes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
}

.detail-notes p {
    font-size: 0.93rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--surface-2);
    padding: 14px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
}

/* ===================== RESPONSIVE ===================== */

@media (min-width: 600px) {
    .modal-overlay {
        align-items: center;
    }

    .modal {
        border-radius: var(--radius);
        max-height: 85vh;
    }
}
