/* --- IMPORTS  --- */
@font-face { font-family: 'Sixtyfour'; src: url('assets/Sixtyfour.ttf') format('truetype'); font-display: block}
@font-face { font-family: 'RussoOne'; src: url('assets/RussoOne.ttf') format('truetype'); font-display: block}
/* --- DEFAULT  --- */
:root {
    --site-bg: rgb(0, 7, 2);
    --terminal-bg: #1a1a1a;
    --terminal-fg: #00ff41;
    --terminal-fg-dark: #00a32a;
    --border-color: #005f18;
}
* {
    box-sizing: border-box;
    margin: 0;
}
html {
    height: 100%;
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    background-color: var(--site-bg);
}
body {
    height: 100%;
    color: var(--terminal-fg);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    align-items: center;
    justify-content: center;
}
.terminal-box {
    aspect-ratio: 16 / 10;
    width: 95%;
    background-color: var(--terminal-bg);
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    margin: 1rem;
    overflow: hidden;
    text-align: center;
}
h1 {
    font-family: 'Sixtyfour', Courier, monospace;
    font-size: 3rem;
    letter-spacing: 0.2rem;
    display: inline-block;
    font-weight: normal;
}
h2 {
    font-family: 'RussoOne', Courier, monospace;
    font-size: 1.2rem;
    letter-spacing: 0.2rem;
    display: inline-block;
    font-weight: normal;
}
a {
    color: var(--terminal-fg);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.btn {
    background-color: inherit;
    color: inherit;
    font-family: 'RussoOne', Courier, monospace;
    font-size: 0.8rem;
    border: 1px solid var(--terminal-fg);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 10rem;
}
.btn:hover {
    background-color: var(--terminal-fg);
    color: var(--terminal-bg);
}
.btn.is-loading {
    background-color: var(--terminal-fg-dark);
    color: var(--terminal-bg);
    border-color: var(--terminal-fg-dark);
    cursor: wait;
    pointer-events: none;
}
/* --- LANDING  --- */
.landing {
    min-width: 365px;
    max-width: 35rem;
    justify-content: center;
}
.cursor {
    display: inline-block;
    background-color: var(--terminal-fg);
    width: 0.2em;
    height: 1.1em;
    animation: blink 1s step-end infinite;
    margin-left: 0.2em;
    vertical-align: bottom;
}
@keyframes blink {
    50% { opacity: 0; }
}
.feature-list {
    list-style: none;
    margin: 1.1rem auto 0.7rem;
    text-align: left;
    display: inline-block;
    max-width: 100%;
}
.feature-list li {
    font-size: 0.65rem;
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 1.5em; /* space for '>' */
}
.feature-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--terminal-fg-dark);
    font-weight: bold;
}
/* --- ROOM --- */
.room {
    min-width: 20rem;
    max-width: 60rem;
    display: flex;
    flex-direction: row; 
}
.info-wrapper {
    max-width: 10rem;
    display: flex;
    flex-direction: column;
    flex: 0 0 10rem;
    border-right: 1px solid var(--border-color);
}
.share-panel {
    padding: 0.8rem;
    min-width: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}
.share-info {
    display: flex;
    flex-direction: column;
    max-width: 15rem; 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.7rem;
}
.share-info h1 {
    font-size: 1.4rem;
}
.qr-code {
    background-color: white;
    margin: 0.5rem 0;
    border: 1px dotted var(--border-color);
    display: inline-block;
    font-size: 0.8em;
    color: var(--terminal-bg);
    padding: 0.2rem; 
    cursor: pointer;
    transition: outline 0.2s ease-out;
    max-width: 6rem;
}
.qr-code.copied {
    box-shadow: inset 0 0 0 2px var(--terminal-fg);
    position: relative;
    outline: 2px solid var(--terminal-fg);
    position: relative;
}
.qr-code img {
    display: block;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}
.link {
    background-color: #2a2a2a;
    font-family: 'RussoOne', Courier, monospace;
    padding: 0.5rem;
    font-size: 0.7rem;
    text-align: center;
    border: 1px dotted var(--border-color);
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: outline 0.2s ease-out;
}
.link.copied {
    overflow: visible;
    outline: 2px solid var(--terminal-fg);
    position: relative;
}
.copied::after {
    content: 'COPIED!';
    position: absolute;
    top: -0.9rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--terminal-fg);
    color: var(--terminal-bg);
    padding: 2px 6px;
    font-size: 0.8em;
    border-radius: 3px;
    font-family: 'RussoOne', Courier, monospace;
}
.members-panel {
    padding: 0.8rem;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.members-panel h1 {
    font-size: 1.4rem;
}
.member-list {
    list-style-type: none;
    padding: 0;
    margin: 0.5rem auto 0;
    column-count: 1; /* default to single column */
    column-gap: 0.5rem; /* space between columns */
    justify-content: center; /* won't work perfectly with column-count */
    text-align: left;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    align-content: start;
    -ms-overflow-style: none;  /* hide scrollbar in IE and edge */
    scrollbar-width: none;  /* ... in firefox */
}
.member-list::-webkit-scrollbar {
    display: none; /* ... chrome, safari, and newer edge */
}
.member-list li {
    font-size: clamp(0.5rem, 1vw, 0.7rem);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    break-inside: avoid; /* prevents names from splitting across two columns */
    padding: 0.1rem 0.2rem; /* for borders */
    overflow: hidden; 
    text-overflow: ellipsis;
}
.member-list li.is-me {/* current user indicator */
    border: 1px solid var(--terminal-fg);
}
.member-list.two-columns {
    column-count: 2;
}
.member-list.two-columns li {
    font-size: 0.5rem;
}
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    min-height: 0;
}
.messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    text-align: left;
}
.messages p {
    font-size: 0.8rem;
    margin-block-start: 1em;
    margin-block-end: 0;
    padding-left: 0.5rem;
    text-indent: -0.5rem;
}
.messages p.consecutive-message {
    margin-block-start: 0.25em;
}
.event-message {
    color: var(--terminal-fg-dark);
    font-style: italic;
    text-align: center;
}
.message-input {
    display: flex;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.message-input input {
    flex: 1;
    background: none;
    border: 1px solid var(--terminal-fg-dark);
    color: var(--terminal-fg);
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.8rem;
    min-width: 0;
}
.message-input input:focus {
    outline: 1px solid var(--terminal-fg);
}
.message-input button {
    margin-left: 0.75rem;
}
.message-input:focus-within button {
    background-color: var(--terminal-fg);
    color: var(--terminal-bg);
}
/* --- MOBILE --- */
@media (max-width: 700px) {
    .terminal-box {
        aspect-ratio: 3 / 6;
        max-height: 95vh;
    }
    .landing {
        max-height: 22rem;
    }
    .room {
        flex-direction: column;
    }
    .info-wrapper {
        flex-direction: row;
        flex: 0 1 auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 12rem;
        max-width: none; 
    }
    .share-panel {
        flex: 1;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
    }
    .members-panel {
        flex: 1;
        max-height: 14rem;
    }
    .member-list li {
    font-size: clamp(0.8rem, 1vw, 1rem);
    }
    .chat-area {
    padding: 0.5rem;
    }
    .messages {
    margin-bottom: 0.5rem;
    }
    .message-input {
    padding-top: 0.5rem;
    }
    .message-input button {
        margin-left: 0.5rem;
        max-width: 6rem;
    }
}
@media (orientation: landscape) and (max-height: 500px) {
    .terminal-box {
        width: 95vw;
        height: 95vh;
        aspect-ratio: unset;
        margin: auto;
        max-height: none;
    }
    .landing {
        max-width: 30rem;
    }
    .room {
        flex-direction: row;
    }
    .info-wrapper {
        flex-direction: column;
        flex: 0 0 10rem;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        max-height: none;
    }
    .share-panel {
        flex: initial;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
    .members-panel {
        max-height: none;
    }
}