/* ========== CODES-AMIS — Discord-style mock ========== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap');

:root {
    /* Layer palette (darker, warmer than stock Discord) */
    --bg-rail: #08090c;
    --bg-sidebar: #13151b;
    --bg-channel: #1a1c22;
    --bg-input: #25282f;
    --bg-hover: #23262e;
    --bg-active: #2a2d36;

    --border: #242731;
    --border-hi: #31353f;
    --divider: #1f222a;

    --text: #ebeef4;
    --text-dim: #8a8f9a;
    --text-soft: #c6cad3;
    --text-muted: #6a6f7a;

    /* User DA — violet + mint, NOT Discord blurple */
    --accent: #6b5cff;
    --accent-hi: #8778ff;
    --accent-glow: rgba(107, 92, 255, .35);
    --success: #4ad3a8;
    --warn: #e0b43e;
    --danger: #ff6577;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 22px;
    --radius-squircle: 30%;

    --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html, body {
    height: 100%;
    background: var(--bg-channel);
    color: var(--text);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ========== APP SHELL ========== */

.app {
    display: grid;
    grid-template-columns: 72px 240px 1fr 240px;
    height: 100vh;
    overflow: hidden;
}

/* ========== SERVER RAIL ========== */

.rail {
    background: var(--bg-rail);
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    overflow-y: auto;
}

.rail::-webkit-scrollbar { width: 0; }

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-channel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    transition: border-radius .2s var(--ease), background .15s var(--ease);
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.server-icon:hover { border-radius: var(--radius); background: var(--accent); color: #fff; }
.server-icon.active { border-radius: var(--radius); background: var(--accent); color: #fff; }

.server-icon.active::before,
.server-icon:hover::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 40px;
    background: var(--text);
    border-radius: 0 4px 4px 0;
}

.server-icon.active::before { height: 40px; }
.server-icon:hover::before { height: 20px; }

.server-divider {
    width: 32px;
    height: 2px;
    background: var(--divider);
    border-radius: 2px;
    margin: 4px 0;
}

.server-add {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-channel);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    transition: border-radius .2s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.server-add:hover { border-radius: var(--radius); background: var(--success); color: #fff; }

/* ========== CHANNEL SIDEBAR ========== */

.sidebar {
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.server-banner {
    height: 135px;
    position: relative;
    background:
        linear-gradient(180deg, transparent 30%, var(--bg-sidebar) 100%),
        var(--banner-image, linear-gradient(135deg, #2a1a4e 0%, #1a1928 50%, #2e1a3a 100%));
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}

.server-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: -42px;
    position: relative;
    z-index: 2;
}

.server-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.01em;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.server-chev {
    color: var(--text-dim);
    font-size: 12px;
}

.channels {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.channels::-webkit-scrollbar { width: 6px; }
.channels::-webkit-scrollbar-thumb { background: #2a2d36; border-radius: 3px; }

.category {
    padding: 14px 8px 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
}
.category-chev { font-size: 10px; }

.channel {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.channel:hover { background: var(--bg-hover); color: var(--text-soft); }
.channel.active { background: var(--bg-active); color: var(--text); }
.channel-hash { color: var(--text-muted); font-weight: 400; font-size: 18px; flex-shrink: 0; }
.channel.active .channel-hash { color: var(--text-dim); }
.channel-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-panel {
    padding: 8px;
    background: var(--bg-rail);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.user-panel .avatar-xs { width: 32px; height: 32px; border-radius: 50%; }
.user-panel-info { flex: 1; min-width: 0; }
.user-panel-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-status { font-size: 11px; color: var(--text-dim); }
.user-panel-action { color: var(--text-dim); padding: 6px; border-radius: 6px; transition: background .15s, color .15s; font-size: 13px; }
.user-panel-action:hover { background: var(--bg-hover); color: var(--text); }

/* ========== MAIN CHANNEL AREA ========== */

.main {
    background: var(--bg-channel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.channel-header {
    height: 48px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
    z-index: 2;
}
.channel-header-hash { font-size: 22px; color: var(--text-muted); font-weight: 400; }
.channel-header-name { font-weight: 700; font-size: 15px; }
.channel-header-topic {
    color: var(--text-dim);
    font-size: 13px;
    border-left: 1px solid var(--border);
    padding-left: 10px;
    margin-left: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    scroll-behavior: smooth;
}
.channel-body::-webkit-scrollbar { width: 10px; }
.channel-body::-webkit-scrollbar-thumb { background: #2a2d36; border-radius: 5px; }

/* Channel inner banner (hero) */
.channel-banner {
    height: 200px;
    margin: 0 20px 24px;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(11, 12, 16, .2) 0%, rgba(11, 12, 16, .7) 100%),
        var(--hero-image, linear-gradient(135deg, #1e1a3a 0%, #0f1020 50%, #2a1538 100%));
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 24px 28px;
    border: 1px solid var(--border);
    opacity: 0;
    animation: rise .7s var(--ease) .05s forwards;
}

.channel-banner-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 32px;
    letter-spacing: -.02em;
    line-height: 1.05;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.channel-banner-sub {
    color: rgba(235, 238, 244, .85);
    font-size: 14px;
    margin-top: 4px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}

/* ========== MESSAGES (bot-style) ========== */

.message {
    display: flex;
    gap: 16px;
    padding: 4px 20px;
    position: relative;
    opacity: 0;
    animation: rise .5s var(--ease) forwards;
}
.message + .message { margin-top: 16px; }
.message:hover { background: rgba(35, 38, 46, .3); }
.message:nth-child(2) { animation-delay: .15s; }
.message:nth-child(3) { animation-delay: .25s; }
.message:nth-child(4) { animation-delay: .35s; }
.message:nth-child(n+5) { animation-delay: .45s; }

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hi));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(107, 92, 255, .3);
}

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

.message-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.message-author {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}
.message-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.message-time {
    color: var(--text-muted);
    font-size: 12px;
}
.message-text {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.55;
}
.message-text a { color: var(--accent-hi); }
.message-text a:hover { text-decoration: underline; }

/* ========== EMBED (bot message attachment) ========== */

.embed {
    margin-top: 8px;
    max-width: 540px;
    display: grid;
    grid-template-columns: 4px 1fr;
    border-radius: 6px;
    background: var(--bg-sidebar);
    overflow: hidden;
}

.embed-bar {
    background: var(--accent);
}
.embed-body {
    padding: 14px 18px 16px;
}

.embed-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 6px;
}
.embed-desc {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
}
.embed-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-top: 12px;
}
.embed-field-inline { grid-column: auto; }
.embed-field-full { grid-column: 1 / -1; }
.embed-field-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}
.embed-field-value {
    color: var(--text-soft);
    font-size: 14px;
}

.embed-thumb {
    margin-top: 12px;
    border-radius: 8px;
    width: 80px;
    height: 80px;
    object-fit: cover;
}
.embed-footer {
    margin-top: 10px;
    color: var(--text-dim);
    font-size: 12px;
}
.embed-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* ========== BUTTONS (Discord interaction style) ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s var(--ease), transform .12s var(--ease);
    line-height: 1.2;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hi); transform: translateY(-1px); }

.btn-secondary {
    background: #40434a;
    color: var(--text);
}
.btn-secondary:hover { background: #4b4f57; transform: translateY(-1px); }

.btn-success { background: #2e7d5b; color: #fff; }
.btn-success:hover { background: #359669; transform: translateY(-1px); }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 101, 119, .35); }
.btn-danger:hover { background: rgba(255, 101, 119, .1); border-color: var(--danger); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }

/* ========== ACTION BAR (replaces message input) ========== */

.action-bar {
    padding: 12px 20px 22px;
    flex-shrink: 0;
}

.action-inner {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    transition: border-color .15s var(--ease);
}
.action-inner:hover, .action-inner:focus-within { border-color: var(--border-hi); }

.action-prompt {
    color: var(--text-muted);
    font-size: 14px;
    flex: 1;
}

.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========== MEMBER LIST ========== */

.members {
    background: var(--bg-sidebar);
    overflow-y: auto;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.members::-webkit-scrollbar { width: 6px; }
.members::-webkit-scrollbar-thumb { background: #2a2d36; border-radius: 3px; }

.members-head {
    padding: 4px 8px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 8px;
}
.members-head:first-child { margin-top: 0; }

.member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
    color: inherit;
}
.member:hover { background: var(--bg-hover); }

.avatar {
    display: inline-block;
    object-fit: cover;
    background: var(--bg-hover);
}
.avatar-rail { width: 48px; height: 48px; border-radius: 50%; }
.avatar-sm  { width: 32px; height: 32px; border-radius: 50%; }
.avatar-md  { width: 40px; height: 40px; border-radius: 50%; }
.avatar-lg  { width: 80px; height: 80px; border-radius: var(--radius); }

.member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.member-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========== MODAL (Discord popup) ========== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fade-in .2s var(--ease);
}

.modal {
    background: var(--bg-channel);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
    animation: rise-big .25s var(--ease);
}

.modal-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--divider);
}
.modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 18px;
}
.modal-sub {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 4px;
}

.modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    background: var(--bg-sidebar);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== FORMS ========== */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.input, .select, .textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-rail);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.textarea { resize: vertical; min-height: 80px; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f9a' d='M5 6L0 0h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ========== GAME PICKER GRID ========== */

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.game-tile {
    padding: 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .12s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.game-tile:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-2px); }
.game-tile-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}
.game-tile-hint { color: var(--text-dim); font-size: 12px; }
.game-tile-registered {
    display: inline-block;
    background: rgba(107, 92, 255, .15);
    color: var(--accent-hi);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
}

/* ========== BADGE / PILL ========== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 500;
}
.badge-accent { background: rgba(107, 92, 255, .15); border-color: rgba(107, 92, 255, .3); color: var(--accent-hi); }
.badge-success { background: rgba(74, 211, 168, .1); border-color: rgba(74, 211, 168, .3); color: var(--success); }
.badge-warn { background: rgba(224, 180, 62, .1); border-color: rgba(224, 180, 62, .3); color: var(--warn); }

.id-mono {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 13px;
    background: var(--bg-rail);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: inline-block;
    word-break: break-all;
}

/* ========== ANIMATIONS ========== */

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes rise-big {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1080px) {
    .app { grid-template-columns: 72px 240px 1fr; }
    .members { display: none; }
}
@media (max-width: 720px) {
    .app { grid-template-columns: 60px 1fr; }
    .sidebar { display: none; }
    .channel-banner { height: 140px; margin: 0 12px 18px; padding: 16px; }
    .channel-banner-title { font-size: 22px; }
    .message { padding: 4px 12px; }
    .embed { max-width: 100%; }
}

/* ========== UTILS ========== */
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
