:root {
    --bg-color: #313338;
    --panel-bg: #2b2d31;
    --sidebar-bg: #1e1f22;
    --text-primary: #dbdee1;
    --text-secondary: #949ba4;
    --input-bg: #383a40;
    --accent: #5865f2;
    --danger: #f23f42;
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    overflow: hidden;
}

/* m1-mode override */
.m1-mode #login-screen {
    display: none !important;
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-content {
    background: var(--bg-color);
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

/* Chat Screen */
#chat-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.chat-header {
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    background: var(--bg-color);
}

.channel-name {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.channel-hashtag {
    color: var(--text-secondary);
    margin-right: 8px;
    font-size: 1.2rem;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.logout-text {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.logout-text:hover {
    color: var(--text-primary);
}

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

/* Message Grouping and Styling */
.message-group {
    display: flex;
    padding: 4px 16px;
    margin: 0;
}

.message-group:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-group.consecutive {
    padding-top: 0;
    padding-bottom: 0;
}

.avatar-wrapper {
    width: 40px;
    margin-right: 16px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: 4px;
}

.message-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: baseline;
    margin-bottom: 2px;
    margin-top: 4px;
}

.username {
    font-weight: 500;
    color: #fff;
    margin-right: 8px;
}

.username.admin {
    color: #f23f42;
}

.timestamp {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.message-text {
    color: #dbdee1;
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.375rem;
}

.msg-img {
    max-width: 400px;
    max-height: 400px;
    border-radius: 8px;
    margin-top: 4px;
    display: block;
}

/* Input Area */
.input-area-wrapper {
    padding: 0 16px 24px;
}

.input-area {
    background: var(--input-bg);
    border-radius: 8px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    position: relative;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 12px 0;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

/* Context Menu */
#context-menu {
    display: none;
    position: fixed;
    z-index: 10000;
    background: #111214;
    padding: 8px;
    border-radius: 4px;
    min-width: 150px;
}

.context-menu-item {
    padding: 6px 12px;
    font-size: 14px;
    color: #dbdee1;
    cursor: pointer;
    border-radius: 2px;
}

.context-menu-item:hover {
    background: var(--accent);
    color: white;
}

.context-menu-item.danger {
    color: var(--danger);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #1a1b1e;
    border-radius: 4px;
}