:root {
    --primary: #ffae00;
    --primary-hover: #f9e71a;
    --primary-soft: rgba(255, 174, 0, 0.15);
    --bg-dark: #0a0a0a;
    --bg-card: #161616;
    --bg-panel: #1c1c1c;
    --text-main: #ffffff;
    --text-dim: #b0b0b0;
    --border: rgba(255, 255, 255, 0.07);
    --accent-line: rgba(255, 174, 0, 0.35);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.hidden { display: none !important; }

a { color: var(--primary); text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-line); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #0a0a0a; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255, 174, 0, 0.25); }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--primary); }

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 174, 0, 0.1);
}
.logo-text { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.5px; color: var(--text-main); }
.logo-text b { color: var(--primary); }
.logo img { height: 45px; width: auto; display: block; transition: var(--transition); }
.logo img:hover { transform: scale(1.05); }
.navbar ul { list-style: none; display: flex; gap: 30px; align-items: center; }
.btn-nav {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: var(--transition);
}
.btn-nav::after { content: ''; position: absolute; width: 0; height: 2px; bottom: -5px; left: 0; background: var(--primary); transition: var(--transition); }
.btn-nav:hover, .btn-nav.active { color: var(--primary); }
.btn-nav:hover::after, .btn-nav.active::after { width: 100%; }
.menu-toggle { display: none; font-size: 26px; cursor: pointer; color: var(--primary); }

.landing {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 8%;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(600px 320px at 15% 10%, rgba(255, 174, 0, 0.10), transparent 60%),
        radial-gradient(700px 400px at 90% 90%, rgba(255, 174, 0, 0.07), transparent 60%),
        var(--bg-dark);
}
.landing::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 24px 24px;
}
.hero-row {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.1fr 0.95fr;
    gap: 60px;
    align-items: center;
    max-width: 1100px;
    width: 100%;
}
.hero-text h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
    text-transform: uppercase;
    line-height: 1.1;
}
.hero-text h1 span { color: var(--primary); }
.hero-text p {
    color: var(--text-dim);
    font-size: 1.05rem;
    max-width: 520px;
    margin-bottom: 30px;
}
.hero-cta { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.btn-lg { padding: 16px 34px; font-size: 1.05rem; border-radius: 12px; }
.cta-label, .sel-label { display: block; color: var(--text-dim); font-size: 0.8rem; margin-bottom: 4px; }
.cta-row { width: 100%; max-width: 240px; }
.sel {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    padding: 12px 14px;
    font: inherit;
}
.sel:focus { outline: none; border-color: var(--primary); }
.cta-row .sel { width: 100%; padding: 10px 14px; }
.join-row { display: flex; gap: 10px; width: 100%; max-width: 460px; }
.join-row input {
    flex: 1;
    min-width: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    padding: 12px 14px;
    font: inherit;
}
.join-row input:focus { outline: none; border-color: var(--primary); }
.join-hint { font-size: 0.78rem; color: var(--text-dim); }

.chat-preview {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.cp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(10, 10, 10, 0.6);
    border-bottom: 1px solid var(--border);
}
.cp-name { font-weight: 700; font-size: 0.95rem; }
.cp-sub { font-size: 0.75rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.cp-messages {
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 190px;
    background-color: #0d0d0d;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}
.cp-msg { display: flex; flex-direction: column; max-width: 80%; }
.cp-msg.theirs { align-items: flex-start; }
.cp-msg.own { align-items: flex-end; margin-left: auto; }
.cp-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.88rem;
    color: var(--text-main);
}
.cp-msg.theirs .cp-bubble { background: #1f1f1f; border: 1px solid rgba(255, 255, 255, 0.06); border-top-left-radius: 4px; }
.cp-msg.own .cp-bubble { background: linear-gradient(135deg, rgba(255, 174, 0, 0.24), rgba(255, 174, 0, 0.10)); border: 1px solid rgba(255, 174, 0, 0.35); border-top-right-radius: 4px; }
.cp-time { font-size: 0.62rem; color: var(--text-dim); margin-top: 3px; }
.cp-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.6);
}
.cp-placeholder { flex: 1; color: var(--text-dim); font-size: 0.88rem; }
.cp-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
}

.section-title { text-align: center; margin-bottom: 46px; }
.section-title h2 { font-size: 2rem; color: var(--primary); margin-bottom: 12px; }
.section-title div { width: 60px; height: 4px; background: var(--primary); margin: 0 auto; }

.info-section { padding: 80px 8%; }
.info-section.alt { background: var(--bg-card); border-top: 1px solid var(--border); }
.info-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; max-width: 1000px; margin: 0 auto; }
.info-col { text-align: center; padding: 28px 22px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.info-col h3 { color: var(--primary); margin-bottom: 10px; font-size: 1.15rem; }
.info-col p { color: var(--text-dim); font-size: 0.95rem; }
.info-narrow { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.info-narrow p { color: var(--text-dim); font-size: 1rem; }

.main-footer { padding: 40px 10%; text-align: center; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 0.9rem; }

.chat-body { height: 100vh; overflow: hidden; }
.chat-app { display: flex; flex-direction: column; height: 100vh; }

.chat-header {
    flex: none;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--accent-line);
}
.chat-header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}
.chat-title { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #0a0a0a;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}
.chat-name { font-weight: 700; font-size: 1.05rem; }
.chat-sub { font-size: 0.78rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; }
.chat-actions { display: flex; gap: 8px; }

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { border-color: var(--accent-line); color: var(--primary); transform: translateY(-1px); }
.btn-icon.active { border-color: var(--primary); background: var(--primary-soft); }

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 0;
    background-color: #0d0d0d;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 22px 22px;
}
.msg-system {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 6px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.msg { display: flex; margin: 6px 16px; }
.msg.own { justify-content: flex-end; align-items: center; gap: 6px; }
.msg.theirs { justify-content: flex-start; }
.bubble {
    max-width: 70%;
    padding: 8px 12px 6px;
    border-radius: 16px;
    font-size: 0.95rem;
    overflow-wrap: break-word;
    word-break: break-word;
}
.msg.theirs .bubble { background: #1f1f1f; border: 1px solid rgba(255, 255, 255, 0.06); border-top-left-radius: 4px; }
.msg.own .bubble { background: linear-gradient(135deg, rgba(255, 174, 0, 0.24), rgba(255, 174, 0, 0.10)); border: 1px solid rgba(255, 174, 0, 0.35); border-top-right-radius: 4px; }
.sender { font-size: 0.75rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.text { white-space: pre-wrap; }
.text a { color: var(--primary-hover); }
.time { text-align: right; font-size: 0.68rem; color: var(--text-dim); margin-top: 3px; }
.msg.own .time { color: rgba(255, 255, 255, 0.55); }
.img-box { margin-top: 2px; }
.img-box img { max-width: 260px; max-height: 260px; border-radius: 12px; display: block; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.1); }
.img-cap { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }
.img-box .loading, .img-box .decrypt-fail { font-size: 0.8rem; color: var(--text-dim); }
.del-btn {
    flex: none;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 4px;
    border-radius: 8px;
    opacity: 0;
    transition: var(--transition);
}
.msg.own:hover .del-btn,
.del-btn:focus-visible { opacity: 1; }
.del-btn:hover { color: #e74c3c; transform: scale(1.1); }
@media (hover: none) { .del-btn { opacity: 0.5; } }

.composer-wrap {
    flex: none;
    position: relative;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 10px 16px 14px;
}
.composer {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 8px;
}
.composer:focus-within { border-color: var(--accent-line); }
#msgInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-main);
    font: inherit;
    padding: 8px 6px;
    max-height: 120px;
    min-height: 24px;
}
#msgInput::placeholder { color: var(--text-dim); }
.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #0a0a0a;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    flex: none;
}
.btn-send:hover { background: var(--primary-hover); transform: scale(1.06); }
.btn-send:disabled { opacity: 0.5; cursor: default; transform: none; }

.emoji-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, calc(100vw - 32px));
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    z-index: 50;
}
.emoji-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 0;
    border-radius: 8px;
    transition: var(--transition);
}
.emoji-btn:hover { background: var(--primary-soft); transform: scale(1.15); }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-line);
    border-radius: 18px;
    padding: 26px;
    width: min(520px, 100%);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.modal-card h3 { color: var(--primary); margin-bottom: 10px; }
.modal-note { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 14px; }
.modal-card textarea {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    padding: 10px;
    font: inherit;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 70px;
}
.modal-card textarea:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

.overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 3000;
}
.overlay-card { text-align: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 40px 30px; max-width: 480px; }
.overlay-icon { font-size: 3rem; margin-bottom: 14px; }
.overlay-card h2 { color: var(--primary); margin-bottom: 12px; }
.overlay-card p { color: var(--text-dim); margin-bottom: 20px; font-size: 0.95rem; }
.overlay-card code { background: var(--bg-panel); padding: 2px 6px; border-radius: 6px; color: var(--primary-hover); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--accent-line);
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 0.9rem;
    z-index: 4000;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

@media (max-width: 992px) {
    .main-header { padding: 14px 5%; }
    .navbar ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 75px;
        left: 0;
        width: 100%;
        background: var(--bg-dark);
        padding: 20px;
        border-bottom: 1px solid var(--primary);
    }
    .navbar ul.active { display: flex; }
    .menu-toggle { display: block; }
    .btn-nav { font-size: 1.1rem; width: 100%; text-align: center; padding: 10px; }
    .landing { padding: 50px 5%; }
    .hero-row { grid-template-columns: 1fr; gap: 40px; }
    .hero-text p { margin-bottom: 22px; }
    .info-section { padding: 60px 5%; }
    .bubble { max-width: 85%; }
}
