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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-body {
    background: #1a1d23;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: #22262d;
    border: 1px solid #323743;
    border-radius: 16px;
    padding: 32px 28px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #3C3489;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #CECBF6;
}

.auth-header h1 {
    color: #f4f4f5;
    font-size: 20px;
    font-weight: 500;
}

.auth-header p {
    color: #8b8f96;
    font-size: 13px;
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    background: #272b33;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 22px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    color: #8b8f96;
    font-size: 13px;
    text-decoration: none;
    border-radius: 8px;
}

.auth-tab.active {
    background: #323743;
    color: #f4f4f5;
    font-weight: 500;
}

.auth-error {
    background: #2a1518;
    color: #f5a3a8;
    border: 1px solid #4a1f24;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.auth-field {
    margin-bottom: 14px;
}

.auth-field label {
    display: block;
    color: #8b8f96;
    font-size: 12px;
    margin-bottom: 6px;
}

.auth-field input {
    width: 100%;
    background: #272b33;
    border: 1px solid #3a3f4a;
    border-radius: 8px;
    padding: 11px 12px;
    color: #f4f4f5;
    font-size: 14px;
    outline: none;
}

.auth-field input:focus {
    border-color: #7F77DD;
}

.auth-field input::placeholder {
    color: #5f636a;
}

.auth-btn {
    width: 100%;
    background: #7F77DD;
    color: #1a1730;
    border: none;
    border-radius: 8px;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    margin-top: 4px;
    margin-bottom: 16px;
    cursor: pointer;
}

.auth-btn:hover {
    background: #9089E5;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #323743;
}

.auth-divider span {
    color: #5f636a;
    font-size: 11px;
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #8b8f96;
    font-size: 12px;
}

.recovery-warning {
    background: #2a2415;
    color: #f0c674;
    border: 1px solid #4a3f1f;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.recovery-word {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #272b33;
    border: 1px solid #3a3f4a;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #f4f4f5;
}

.recovery-word-num {
    color: #5f636a;
    font-size: 11px;
    min-width: 14px;
}

.recovery-confirm {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #8b8f96;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
}

.recovery-confirm input {
    margin-top: 2px;
}

.auth-btn:disabled {
    background: #3a3650;
    color: #6b6889;
    cursor: not-allowed;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 24px;
    transition: background 0.15s;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.emoji-option {
    background: #272b33;
    border: 1px solid #3a3f4a;
    border-radius: 8px;
    font-size: 18px;
    padding: 8px 0;
    cursor: pointer;
}

.emoji-option:hover {
    border-color: #7F77DD;
}

.emoji-option.selected {
    border-color: #7F77DD;
    background: #262238;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
}

.color-option.selected {
    border-color: #f4f4f5;
}

.chat-body {
    background: #1a1d23;
    min-height: 100vh;
    margin: 0;
}

.chat-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #1a1d23;
}

.chat-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 0.5px solid #272b33;
}

.chat-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    color: #f4f4f5;
    font-size: 17px;
    font-weight: 500;
}

.chat-topbar-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #3C3489;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chat-new-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #7F77DD;
    color: #1a1730;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.chat-back {
    color: #8b8f96;
    font-size: 20px;
    text-decoration: none;
}

.chat-conv-title {
    color: #f4f4f5;
    font-size: 15px;
    font-weight: 500;
    flex: 1;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 0.5px solid #22262d;
    text-decoration: none;
}

.chat-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chat-row-body {
    flex: 1;
    min-width: 0;
}

.chat-row-top {
    display: flex;
    justify-content: space-between;
}

.chat-row-name {
    color: #f4f4f5;
    font-size: 14px;
    font-weight: 500;
}

.chat-row-time {
    color: #5f636a;
    font-size: 11px;
}

.chat-row-preview {
    color: #8b8f96;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-empty {
    text-align: center;
    color: #5f636a;
    font-size: 14px;
    padding: 60px 20px;
    line-height: 1.6;
}

.chat-tabbar {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 0.5px solid #272b33;
}

.chat-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #5f636a;
    font-size: 10px;
    text-decoration: none;
}

.chat-tab span {
    font-size: 20px;
}

.chat-tab.active {
    color: #9089E5;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-row {
    display: flex;
}

.msg-mine {
    justify-content: flex-end;
}

.msg-theirs {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 75%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14px;
    position: relative;
}

.msg-mine .msg-bubble {
    background: #534AB7;
    color: #f4f4f5;
}

.msg-theirs .msg-bubble {
    background: #272b33;
    color: #f4f4f5;
}

.msg-ephemeral {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 6px;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 0.5px solid #272b33;
}

.chat-input-bar input {
    flex: 1;
    background: #272b33;
    border: 1px solid #3a3f4a;
    border-radius: 20px;
    padding: 10px 16px;
    color: #f4f4f5;
    font-size: 14px;
}

.chat-icon-btn {
    background: none;
    border: none;
    font-size: 19px;
    cursor: pointer;
    color: #8b8f96;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #7F77DD;
    color: #1a1730;
    border: none;
    font-size: 15px;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: #22262d;
    border: 1px solid #323743;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 360px;
}

.modal-box h2 {
    color: #f4f4f5;
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 18px;
}

.auth-btn-ghost {
    width: 100%;
    background: transparent;
    color: #8b8f96;
    border: 1px solid #3a3f4a;
    border-radius: 8px;
    padding: 12px 0;
    font-size: 14px;
    margin-top: 8px;
    cursor: pointer;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 10px;
    opacity: 0.6;
}

.ephemeral-menu {
    display: none;
    position: absolute;
    bottom: 64px;
    right: 12px;
    background: #272b33;
    border: 1px solid #3a3f4a;
    border-radius: 10px;
    overflow: hidden;
    z-index: 50;
    min-width: 160px;
}

.ephemeral-menu.open {
    display: block;
}

.ephemeral-option {
    padding: 10px 14px;
    color: #f4f4f5;
    font-size: 13px;
    cursor: pointer;
}

.ephemeral-option:hover {
    background: #323743;
}

.ephemeral-option.selected {
    color: #9089E5;
}

.ephemeral-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2a2415;
    color: #f0c674;
    font-size: 12px;
    padding: 8px 14px;
}

.ephemeral-banner button {
    background: none;
    border: none;
    color: #f0c674;
    cursor: pointer;
}

.chat-shell {
    position: relative;
}

.chat-call-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.chat-call-btns .chat-icon-btn {
    font-size: 18px;
}
