* {
    box-sizing: border-box;
}

:root {
    --gold: #d9a441;
    --gold-light: #f0d58a;
    --bg: #080808;
    --card: #131313;
    --card-2: #191919;
    --border: #2c2c2c;
    --text: #ffffff;
    --muted: #999999;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(217,164,65,.13), transparent 32%),
        var(--bg);
}

button,
input {
    font: inherit;
}

.chat-shell {
    width: min(760px, 100%);
    min-height: 100vh;
    margin: auto;
    display: grid;
    place-items: center;
    padding: 24px;
}

.card {
    width: 100%;
    background: rgba(19,19,19,.96);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0,0,0,.55);
    overflow: hidden;
}

.name-screen {
    max-width: 520px;
    padding: 44px;
    text-align: center;
}

.brand-mark,
.support-avatar {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 18px;
    color: #111;
    background: linear-gradient(145deg, #f2d38c, #b8862c);
    font-weight: 900;
    font-size: 28px;
    box-shadow: 0 12px 30px rgba(217,164,65,.2);
}

.eyebrow {
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

h1,
h2,
p {
    margin-top: 0;
}

.name-screen h1 {
    margin: 9px 0 10px;
    font-size: 32px;
}

.name-screen p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 28px;
}

.name-screen form {
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #ddd;
    font-size: 13px;
}

input {
    width: 100%;
    border: 1px solid var(--border);
    outline: none;
    border-radius: 13px;
    padding: 15px 16px;
    color: white;
    background: #0d0d0d;
}

input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(217,164,65,.09);
}

button {
    border: 0;
    cursor: pointer;
}

#startBtn,
#sendBtn {
    color: #111;
    background: linear-gradient(145deg, #f1d17f, #c39439);
    font-weight: 800;
}

#startBtn {
    width: 100%;
    margin-top: 16px;
    padding: 15px;
    border-radius: 13px;
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.error {
    display: block;
    min-height: 18px;
    margin-top: 7px;
    color: #e88b8b;
    font-size: 12px;
}

.back-link {
    display: inline-block;
    margin-top: 25px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
}

.hidden {
    display: none !important;
}

.chat-screen {
    height: min(720px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    background: #111;
}

.chat-header .support-avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    margin: 0;
    border-radius: 14px;
    font-size: 21px;
}

.chat-header h2 {
    margin: 4px 0 4px;
    font-size: 19px;
}

.online {
    color: #89cda4;
    font-size: 12px;
}

.online i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #69b987;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.message-row {
    display: flex;
    margin-bottom: 13px;
}

.message-row.mine {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 76%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #1b1b1b;
}

.message-row.mine .message-bubble {
    border-color: #725720;
    background: #2a2110;
    border-bottom-right-radius: 5px;
}

.message-row.theirs .message-bubble {
    border-bottom-left-radius: 5px;
}

.message-sender {
    margin-bottom: 4px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    color: #eee;
}

.message-time {
    margin-top: 6px;
    color: #777;
    font-size: 10px;
}

.message-form {
    display: flex;
    gap: 9px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: #111;
}

.message-form input {
    min-width: 0;
}

#sendBtn {
    flex: 0 0 82px;
    border-radius: 12px;
}

.chat-error {
    margin: 0 14px 10px;
    padding: 10px 12px;
    border: 1px solid #633b3b;
    border-radius: 10px;
    color: #f0aaaa;
    background: #241414;
    font-size: 12px;
}

.chat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px 13px;
    color: #777;
    font-size: 11px;
    background: #111;
}

.chat-footer strong {
    color: #bbb;
}

#changeNameBtn {
    color: #aaa;
    background: transparent;
    font-size: 11px;
}

@media (max-width: 600px) {
    .chat-shell {
        padding: 0;
    }

    .card {
        min-height: 100vh;
        border-radius: 0;
    }

    .name-screen {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 30px;
    }

    .chat-screen {
        height: 100vh;
    }

    .message-bubble {
        max-width: 88%;
    }
}
