@font-face {
    font-family: 'GyeonggiMillenniumTitle';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-3@1.0/Title_Light.woff') format('woff');
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'GyeonggiMillenniumTitle';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-3@1.0/Title_Medium.woff') format('woff');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'GyeonggiMillenniumTitle';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-3@1.0/Title_Bold.woff') format('woff');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'GyeonggiMillenniumTitle';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2410-3@1.0/TitleV.woff') format('woff');
    font-weight: 800;
    font-display: swap;
}

:root {
    --pink-primary: #F18E8E;
    --pink-bubble: #F8B4B4;
    --white: #FFFFFF;
    --grey-light: #F5F5F5;
    --grey-sidebar-icon: #F0F0F0;
    --grey-divider: #E8E8E8;
    --text-dark: #333333;
    --text-medium: #666666;
    --text-light: #999999;
    --blue-button: #5C9EE8;
    --yellow-accent: #F5C344;
    --theme-slate: #4b5a6f;
    --theme-momosys: #e2edf0;
}

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

html,
body {
    font-family: 'GyeonggiMillenniumTitle', sans-serif;
    font-weight: 500;
    background: var(--theme-slate);
}

.app-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 5px;
    border: 2px solid var(--white);
    overflow: hidden;
    animation: popInCenter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.header {
    background: var(--pink-primary);
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
}

.header-title {
    color: var(--white);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Icon Bar */
.icon-bar {
    width: 64px;
    background: var(--theme-slate);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.icon-bar-item {
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
}

.icon-bar-item:hover {
    background: #5a667c;
}

.icon-bar-item.active {
    background: #687690;
}

.icon-bar-item.active:hover {
    background: #7787a5;
}

.icon-bar-item svg {
    width: 30px;
    height: 30px;
    fill: var(--text-light);
}

.icon-bar-item svg[fill="none"] {
    fill: none;
    stroke: var(--text-light);
}

.icon-bar-item:first-child svg {
    width: 36px;
    height: 36px;
}

/* User Settings Icon - Push to bottom */
.icon-bar-item:last-child {
    margin-top: auto;
}

.icon-bar-item.active svg {
    fill: var(--white);
}

.icon-bar-item.active svg[fill="none"] {
    fill: none;
    stroke: var(--white);
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--grey-divider);
}

.sidebar-header,
.stats-header,
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--grey-divider);
}

.sidebar-header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.sidebar-header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Settings Specifics */
.language-options {
    display: flex;
    justify-content: flex-end;
}

/* Settings Specifics */
.language-options {
    display: flex;
    justify-content: flex-end;
}

/* Custom Dropdown (modeled after sidebar-dropdown) */
.sidebar-dropdown,
.custom-dropdown {
    font-size: 16px;
    color: var(--text-medium);
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    background: var(--white);
    border-radius: 2px;
    box-shadow: 0px 2px 0px rgba(102, 102, 102, 0.3);
    height: 24px;
    position: relative;
    user-select: none;
    /* overflow: hidden; */
}

.custom-dropdown {
    min-width: 100px;
    justify-content: space-between;
    padding: 0 8px;
    /* Match sidebar padding roughly or set specific */
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.sidebar-dropdown:hover,
.custom-dropdown:hover {
    background: var(--grey-light);
}

.sidebar-dropdown svg.triangle-icon,
.custom-dropdown svg.triangle-icon {
    width: 12px;
    height: 12px;
    fill: var(--text-medium);
    position: absolute;
    top: 0;
    right: 0;
    /* transition removed */
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 100%;
    background: var(--white);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 20;
    overflow: hidden;
    border: 1px solid var(--grey-divider);
}

.custom-dropdown.open .dropdown-menu {
    display: block;
    animation: fadeIn 0.15s ease-out backwards;
}

.dropdown-item {
    padding: 8px 12px;
    font-size: 15px;
    color: var(--text-medium);
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: var(--grey-light);
    color: var(--text-dark);
}

.dropdown-item.active {
    background: var(--pink-primary);
    color: var(--white);
}

.sidebar-dropdown svg.sort-icon,
.custom-dropdown svg.sort-icon {
    width: 16px;
    height: 16px;
    fill: var(--text-medium);
}

/* Contacts */
.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--grey-divider);
    transition: background 0.15s;
}

.contact-item:hover,
.contact-item.active {
    background: var(--grey-light);
}

/* Shared Avatar Styles */
.contact-avatar,
.message-avatar,
.profile-avatar-large,
.bonus-item {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.contact-avatar img,
.message-avatar img,
.profile-avatar-large img,
.bonus-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    background: var(--grey-divider);
    margin-right: 10px;
    font-size: 20px;
    color: var(--text-light);
    font-weight: 700;
    border: 2px solid #E0E0E0;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.contact-preview {
    font-size: 17px;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Area */
.chat-area {
    flex: 1;
    background: var(--grey-light);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

.message-group {
    margin-bottom: 12px;
}

.message-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
}

.message-row.sent {
    justify-content: flex-end;
}

.message-avatar {
    width: 44px;
    height: 44px;
    background: var(--grey-divider);
    margin-right: 8px;
    font-size: 16px;
    color: var(--text-light);
    font-weight: 700;
    border: 2px solid #E0E0E0;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-sender-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.message-bubble {
    padding: 10px 14px;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 3px;
    color: var(--grey-light);
    width: fit-content;
}

.message-bubble.received {
    background: var(--theme-slate);
    border-radius: 0 12px 12px 12px;
}

.message-bubble.sent {
    background: #4589c7;
    border-radius: 12px 0 12px 12px;
    margin-left: auto;
}

.message-choices {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    margin: 16px;
    background: var(--pink-bubble);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 3px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    width: 100%;
}

.choice-header {
    display: flex;
    flex-direction: row;
    align-items: left;
    width: 100%;
    gap: 0 6px;
}

.choice-header-point {
    height: 18px;
    width: 2px;
    background: var(--white);
}

.choice-header-title {
    width: 100%;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    text-align: left;
}

.choice-section-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.choice-button {
    width: 100%;
    border-radius: 8px;
    background: var(--pink-primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-family: 'GyeonggiMillenniumTitle', sans-serif;
    font-size: 20px;
    font-weight: 500;
    padding: 16px 0;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    display: block;
    text-align: center;
}

.choice-button:hover {
    transform: translateY(-2px);
    background: #E07878;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.choice-button.secondary {
    background: var(--text-medium);
    color: var(--white);
}

.choice-button.secondary:hover {
    background: var(--text-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* User Info Page */
.user-info-page {
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    row-gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 6px;
}

.profile-avatar-large {
    width: 140px;
    height: 140px;
    border: 4px solid var(--pink-bubble);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.profile-name-large {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-dark);
}

.mobile-break {
    display: none;
}

.profile-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px 8px;
}

.profile-status {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-medium);
}

.profile-birthdate {
    font-size: 18px;
    color: var(--text-light);
    border: 2px solid var(--text-light);
    padding: 0px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Social Links */
.social-links {
    margin-top: 2px;
    display: flex;
    gap: 12px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    text-decoration: none;
    font-size: 24px;
    transition: color 0.05s, transform 0.05s;
}

.social-link:hover {
    color: var(--pink-primary);
}

.social-link:active {
    transform: scale(1.1);
}

/* Stats Container */
.profile-stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 820px;
}

/* Stats Card */
.profile-stats-card,
.profile-bonus-card {
    width: 100%;
    background: #EBF5FC;
    border-radius: 8px;
    border: 1px solid #D6E6F2;
    overflow: hidden;
}

.profile-bonus-card {
    max-width: 400px;
    margin-top: 20px;
}

.stats-header {
    background: #D5E9F7;
    padding: 10px 15px;
    font-size: 18px;
    color: #4A7A9F;
}

.stat-row {
    background: var(--white);
    padding: 14px 15px;
    line-height: 1;
    border-bottom: 1px solid var(--grey-divider);
}

.profile-stats-card .stat-row:last-child {
    border-bottom: none !important;
}

.stat-label {
    font-size: 16px;
    color: var(--text-medium);
    font-weight: 500;
    text-align: left;
}

.stat-value {
    font-size: 16px;
    color: var(--text-medium);
    font-weight: 700;
    text-align: right;
}

/* Radio Button Options */
.option-group {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0 20px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0 8px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-medium);
}

.option-radio {
    width: 16px;
    height: 16px;
    border-radius: 8px;
    border: 2px solid #ccc;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}

.option-item:hover .option-radio {
    border-color: #999;
}

.option-item.active .option-radio {
    border-color: #5C9EE8;
}

.option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #5C9EE8;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.option-item.active .option-radio::after {
    opacity: 1;
    transform: scale(1);
}

.option-label {
    font-weight: 500;
}

/* Bonus List */
.bonus-list {
    background: var(--white);
    padding: 15px;
    display: flex;
    gap: 10px;
}

.bonus-item {
    width: 50px;
    height: 50px;
    border: 2px solid #E0E0E0;
}

/* Easter Egg */
.profile-easter-egg {
    font-size: 20px;
    font-weight: 800;
    padding-top: 800px;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.profile-easter-egg:hover {
    color: var(--pink-primary);
}

/* Mobile Return Button */
.mobile-return-button {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 20px;
    width: 48px;
    height: 48px;
    background: var(--blue-button);
    color: var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.mobile-return-button:active {
    transform: scale(0.95);
    background: #4A8ED8;
}

.mobile-return-button svg {
    width: 24px;
    height: 24px;
    fill: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        height: 100dvh;
        width: 100vw;
        overflow: hidden;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .header {
        height: calc(48px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .mobile-break {
        display: inline;
    }

    .app-container {
        position: relative;
        transform: none;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border: none;
        border-radius: 0px;
        animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    }

    .sidebar.open {
        display: flex;
    }

    .sidebar {
        width: 100%;
        display: none;
    }

    .chat-area {
        width: 100%;
        display: flex;
    }

    .user-info-page {
        padding: 20px;
        z-index: 5;
    }

    .profile-stats-container {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .stat-row {
        line-height: 1.3;
    }

    .user-view-active .mobile-return-button {
        display: none !important;
    }

    .profile-name-large {
        font-size: 32px;
    }

    .profile-status {
        font-size: 20px;
    }

    .profile-birthdate {
        font-size: 16px;
    }

    .header-title {
        font-size: 20px;
    }

    .contact-name {
        font-size: 17px;
    }

    .contact-preview {
        font-size: 15px;
    }

    .message-bubble {
        font-size: 16px;
    }

    .choice-button {
        font-size: 18px;
    }

    .choice-header-title {
        font-size: 16px;
    }

    .option-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px 0;
    }
}

/* << Animations */

@keyframes popInCenter {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-10px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.anim-pop {
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.anim-slide-left {
    animation: slideInLeft 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.anim-slide-up {
    animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.anim-fade {
    animation: fadeIn 0.2s ease-out backwards;
}

.message-bubble {
    /* Animation removed for generic messages, added via class if needed */
    transform-origin: bottom left;
}

.message-bubble.sent {
    transform-origin: bottom right;
}

/* Stagger delays handled in JS, but defaults here */
.choice-button {
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.1s;
}

.choice-button:hover {
    transform: scale(1.02);
}

.choice-button:active {
    transform: scale(0.96);
}

.mobile-return-button:hover {
    transform: scale(1.05);
}