:root {
    color-scheme: light;
    --font-sans: "Manrope", "Segoe UI", system-ui, sans-serif;
    --font-display: "Syne", "Segoe UI", system-ui, sans-serif;
    --ink: #121a22;
    --ink-soft: #3a4a58;
    --muted: #677887;
    --paper: #e8eef2;
    --surface: #f7fafb;
    --border: #cfd8df;
    --primary: #1a5f4a;
    --primary-hover: #144c3b;
    --primary-light: rgba(26, 95, 74, 0.08);
    --accent: #e85d3a;
    --accent-light: rgba(232, 93, 58, 0.1);
    --focus: #2a8f70;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 0 rgba(20, 33, 43, 0.04),
        0 18px 40px rgba(20, 33, 43, 0.08);
    --shadow-sm: 0 1px 3px rgba(20, 33, 43, 0.06);
    font-family: var(--font-sans);
    line-height: 1.55;
}

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

body {
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ===== App Shell ===== */

.app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow-x: hidden;
}

/* ===== Festival Header ===== */

.festival-header {
    background: linear-gradient(135deg, var(--primary) 0%, #0d3d2e 100%);
    color: #fff;
    padding: 40px 24px 32px;
}

.festival-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.festival-header__left {
    flex: 1;
}

.festival-header__title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 6px;
}

.festival-header__subtitle {
    font-size: 0.95rem;
    opacity: 0.75;
}

.festival-header__user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.user-rating-mini {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

/* ===== Tabs ===== */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tabs__btn {
    flex: 0 0 auto;
    min-width: 0;
    padding: 14px 14px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, box-shadow 0.15s;
    position: relative;
    white-space: nowrap;
}

.tabs__btn--active {
    color: var(--primary);
}

.tabs__btn--active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tabs__btn:active {
    background: var(--primary-light);
}

/* ===== Content ===== */

.content {
    padding: 20px 16px 40px;
}

.section {
    margin-bottom: 50px;
}

.section:last-child {
    margin-bottom: 0;
}

.section__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 16px;
    color: var(--ink);
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 40px 0;
    font-size: 0.95rem;
}

/* ===== Schedule ===== */

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: box-shadow 0.15s;
    overflow: hidden;
}

.event-item--live {
    border-color: #11b419;
    background: rgba(239, 68, 68, 0.04);
}

.event-item:active {
    box-shadow: var(--shadow-sm);
}

.event-item__time {
    flex-shrink: 0;
    width: 90px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    padding-top: 2px;
}

.event-item--live .event-item__time {
    color: #11b419;
}

.event-item__body {
    flex: 1;
    min-width: 0;
}

.event-item__title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
    word-break: break-word;
}

.event-item__desc {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.event-item__room {
    font-size: 0.8rem;
    color: var(--muted);
}

.event-item__speakers {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
}

/* ===== Top Hugs ===== */

.top-hugs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.top-hug-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.top-hug-place {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.top-hug-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.top-hug-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.top-hug-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-hug-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.top-hug-rating {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 6px;
}

.top-hug-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
}

/* ===== Speakers ===== */

.speakers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.speaker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.speaker-item__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.speaker-item__avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.speaker-item__info {
    flex: 1;
    min-width: 0;
}

.speaker-item__name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.speaker-item__bio {
    font-size: 0.82rem;
    color: var(--ink-soft);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hug-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hug-btn:active {
    background: rgba(232, 93, 58, 0.18);
}

/* ===== Hugs Feed ===== */

.hugs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hug-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.4;
}

.hug-item__users {
    flex: 0 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    column-gap: 10px;
}

.hug-item__party,
.hug-item__verb {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.hug-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.hug-avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
}

.hug-item__verb {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.hug-item__time {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
}

.hug-item__from,
.hug-item__to {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 7.5rem;
}

.hug-item__from {
    color: var(--primary);
}

.hug-item__to {
    color: var(--accent);
}

.hug-item__message {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
}

/* ===== Modal ===== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal__content {
    position: relative;
    width: 100%;
    max-width: 340px;
    padding: 28px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: modal-in 0.25s ease;
}

.modal__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.modal__input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.95rem;
    margin-bottom: 10px;
    background: var(--paper);
    transition: border-color 0.15s;
}

.modal__input:focus {
    outline: none;
    border-color: var(--primary);
}

.modal__submit {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s;
}

.modal__submit:active {
    background: var(--primary-hover);
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== Speaker Profile ===== */

.speaker-profile {
    text-align: center;
    margin-bottom: 24px;
}

.speaker-profile__avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

/* ===== Hug Form ===== */

.hug-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hug-btn--full {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.hug-btn--full:active {
    background: #d14e2e;
}

/* ===== Profile ===== */

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
}

.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 12px;
    overflow: hidden;
}

.profile-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s;
}

.profile-photo-btn:active {
    background: var(--border);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.profile-form .modal__input {
    margin-bottom: 0;
}

.profile-logout {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border-strong, #c5cdd4);
    border-radius: 12px;
    background: transparent;
    color: var(--ink-soft, #677887);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.profile-logout:active {
    opacity: 0.8;
}

/* ===== User Rating ===== */

.user-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(26, 95, 74, 0.1);
    color: var(--primary);
}

.hugs-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
}

/* ===== User Badges ===== */

.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--ticket {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.badge--verified {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.badge--invited {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
}

.badge--speaker {
    background: rgba(26, 95, 74, 0.12);
    color: var(--primary);
}

.badge--volunteer {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.badge--support {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

/* ===== Responsive ===== */

@media (max-width: 400px) {
    .festival-header {
        padding: 28px 16px 20px;
    }
    .festival-header__title {
        font-size: 1.3rem;
    }
    .festival-header__subtitle {
        font-size: 0.82rem;
    }
    .content {
        padding: 14px 12px 32px;
    }
    .section__title {
        font-size: 1rem;
    }
    .tabs__btn {
        padding: 12px 12px;
        font-size: 0.82rem;
    }
    .event-item {
        flex-direction: column;
        gap: 6px;
    }
    .event-item__time {
        width: auto;
    }
    .speaker-item {
        flex-wrap: wrap;
    }
    .hug-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .profile-card {
        padding: 20px 16px;
    }
    .user-rating {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal__content {
        animation: none;
    }
}

@media (max-width: 360px) {
    .festival-header__title {
        font-size: 1.2rem;
    }
    .tabs__btn {
        padding: 10px 10px;
        font-size: 0.78rem;
    }
    .speaker-item {
        padding: 10px;
    }
    .speaker-item__avatar {
        width: 40px;
        height: 40px;
    }
}

/* ===== Notification Popup ===== */

.notif-popup {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
}

.notif-popup__content {
    width: 100%;
    max-width: 340px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    animation: modal-in 0.25s ease;
}

.notif-popup__header {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
}

.notif-popup__text {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: var(--ink);
}

.notif-popup__close {
    padding: 10px 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.notif-popup__close:active {
    background: var(--primary-hover);
}
