/* ========== Mobile Layout ========== */
.mobile-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== Register Page ========== */
.register-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.register-hero {
    text-align: center;
    margin-bottom: 36px;
}

.register-hero .icon-grad {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    animation: breathe 3s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(102,126,234,0.15);
    filter: drop-shadow(0 0 20px rgba(102,126,234,0.2));
}

.register-hero h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.register-hero p {
    color: var(--text-dim);
    font-size: 14px;
}

.register-card {
    width: 100%;
    max-width: 400px;
    transition: transform 0.3s, box-shadow 0.3s;
}
.register-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow), 0 0 40px rgba(102,126,234,0.08);
}

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

.register-form .input-field {
    padding: 14px 18px;
    font-size: 16px;
}

.register-form .btn {
    padding: 14px;
    font-size: 16px;
    margin-top: 4px;
}

.register-error {
    color: var(--accent);
    font-size: 13px;
    text-align: center;
    padding: 4px 0;
}

.register-hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 16px;
    line-height: 1.6;
}

/* ========== Chat Page ========== */
.chat-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 16px;
}

/* Top bar */
.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px 12px;
    gap: 12px;
}

.chat-topbar .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(102,126,234,0.3);
    cursor: pointer;
}

.avatar-upload-wrap {
    position: relative;
    cursor: pointer;
    display: inline-block;
}

.avatar-edit-hint {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.avatar-upload-wrap:hover .avatar-edit-hint {
    opacity: 1;
}

.avatar-upload-wrap:hover .user-avatar {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(102,126,234,0.3);
    transition: all 0.3s;
}

.chat-topbar .user-name {
    font-size: 16px;
    font-weight: 600;
    margin-left: 10px;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    margin-left: 8px;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--accent);
    background: rgba(245,87,108,0.1);
}

.chat-topbar .left-section {
    display: flex;
    align-items: center;
}

/* Chat messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border: 1px solid var(--border);
    min-height: 200px;
    max-height: 50vh;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255,255,255,0.05);
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.chat-msg {
    padding: 12px 16px;
    margin: 0 0 8px 0;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    font-size: 14px;
    line-height: 1.6;
    animation: fadeIn 0.3s ease-out;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    position: relative;
}

.chat-msg:hover {
    border-color: var(--border);
    background: rgba(255,255,255,0.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chat-msg.self {
    background: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.08));
    border-color: rgba(102,126,234,0.25);
    box-shadow: inset 3px 0 0 var(--primary);
    margin-left: 20%;
}

.chat-msg.self:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.16), rgba(118,75,162,0.12));
    border-color: rgba(102,126,234,0.35);
}

.chat-msg .msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(102,126,234,0.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.chat-msg .msg-body {
    flex: 1;
    min-width: 0;
    padding-right: 45px; /* Space for time */
}

.chat-msg .msg-name {
    color: var(--primary);
    font-weight: 700;
    margin-right: 8px;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 2px;
}

.chat-msg .msg-time {
    color: var(--text-dim);
    font-size: 11px;
    position: absolute;
    right: 12px;
    top: 14px;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.chat-msg.self .msg-time {
    background: rgba(102,126,234,0.2);
    color: rgba(255,255,255,0.8);
}

.chat-msg .msg-content {
    color: var(--text-mid);
    word-break: break-word;
    line-height: 1.5;
    font-size: 14.5px;
}

/* Chat input */
.chat-input-wrap {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    align-items: center;
}

.chat-input-wrap input {
    flex: 1;
    padding: 12px 18px;
    font-size: 15px;
    border-radius: 24px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-input-wrap input:focus {
    outline: none;
    background: rgba(102,126,234,0.1);
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(102,126,234,0.2);
}

.input-with-counter {
    flex: 1;
    position: relative;
}

.input-with-counter input {
    padding-right: 60px;
}

.char-counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(0,0,0,0.4);
    padding: 2px 6px;
    border-radius: 8px;
    pointer-events: none;
    transition: color 0.2s;
}

.char-counter.near-limit {
    color: var(--accent);
    font-weight: 600;
}

.chat-input-wrap input::placeholder {
    color: var(--text-dim);
    opacity: 0.7;
}

.chat-input-wrap .btn {
    border-radius: 24px;
    padding: 12px 24px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.chat-input-wrap .btn:active {
    transform: scale(0.95);
}

/* Lottery notification */
.lottery-notification {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    animation: fadeIn 0.4s ease-out;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.35s cubic-bezier(.4,0,.2,1);
}

.lottery-notification.scrolling {
    background: linear-gradient(135deg, rgba(245,87,108,0.1), rgba(255,107,107,0.1));
    border: 1px solid rgba(245,87,108,0.2);
    color: var(--accent);
    animation: fadeIn 0.4s ease-out, pulse 2s infinite;
}

.lottery-notification.result {
    background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(240,165,0,0.1));
    border: 1px solid rgba(255,215,0,0.2);
    color: var(--gold);
}

.lottery-notification .prize-label {
    font-size: 13px;
    opacity: 0.8;
}

.lottery-notice-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lottery-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(245,87,108,0.5);
    animation: pulse 1.5s infinite;
    flex-shrink: 0;
}

.lottery-winners-list {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.lottery-winner-chip {
    background: rgba(255,215,0,0.15);
    border: 1px solid rgba(255,215,0,0.3);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 13px;
    color: var(--gold);
    animation: chipPop 0.4s cubic-bezier(.68,-0.55,.265,1.55) both;
}
.lottery-winner-chip:nth-child(1) { animation-delay: 0s; }
.lottery-winner-chip:nth-child(2) { animation-delay: 0.08s; }
.lottery-winner-chip:nth-child(3) { animation-delay: 0.16s; }
.lottery-winner-chip:nth-child(4) { animation-delay: 0.24s; }
.lottery-winner-chip:nth-child(5) { animation-delay: 0.32s; }
.lottery-winner-chip:nth-child(6) { animation-delay: 0.4s; }

@keyframes chipPop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Winners panel button */
.winners-panel-btn {
    background: rgba(255,215,0,0.15);
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.winners-panel-btn:hover {
    background: rgba(255,215,0,0.25);
    border-color: rgba(255,215,0,0.5);
    transform: scale(1.05);
}

/* Winners panel overlay */
.winners-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.winners-panel-mobile {
    background: linear-gradient(180deg, rgba(30,30,50,0.98), rgba(20,20,35,0.98));
    width: 100%;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.winners-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
}

.panel-close-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.panel-close-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--accent);
}

.winners-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.winners-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
}

/* Prize card */
.prize-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease-out;
}

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

.prize-name {
    font-weight: 600;
    font-size: 15px;
}

.prize-progress {
    font-size: 12px;
    color: var(--primary);
    background: rgba(102,126,234,0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.prize-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
    line-height: 1.4;
}

.prize-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.prize-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.prize-winners {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.winner-chip {
    background: rgba(255,215,0,0.15);
    border: 1px solid rgba(255,215,0,0.3);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 13px;
    color: var(--gold);
}

.prize-no-winner {
    color: var(--text-dim);
    font-size: 12px;
    font-style: italic;
}

/* Slide up transition */
.slide-up-enter-active,
.slide-up-leave-active {
    transition: opacity 0.25s ease;
}
.slide-up-enter-active .winners-panel-mobile,
.slide-up-leave-active .winners-panel-mobile {
    transition: transform 0.25s ease;
}
.slide-up-enter-from,
.slide-up-leave-to {
    opacity: 0;
}
.slide-up-enter-from .winners-panel-mobile,
.slide-up-leave-to .winners-panel-mobile {
    transform: translateY(100%);
}
