*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: #14110f;
    color: #ece7e1;
    font: 16px/1.45 'Segoe UI', system-ui, sans-serif;
}

body.on-gate {
    display: grid;
    place-items: center;
    padding: 1rem;
}

.gate-box {
    width: min(100%, 18rem);
    display: grid;
    gap: 0.85rem;
}

.gate-box h1 {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.gate-box label {
    display: grid;
    gap: 0.3rem;
}

.gate-box label span {
    font-size: 0.75rem;
    color: #9a9188;
}

.gate-box input {
    width: 100%;
    border: 1px solid #3a332c;
    border-radius: 0.65rem;
    background: #1c1815;
    color: inherit;
    padding: 0.65rem 0.75rem;
    font: inherit;
}

.gate-box input:focus {
    outline: none;
    border-color: #7a4a42;
}

.gate-box button,
.bar button {
    border: 0;
    border-radius: 0.65rem;
    background: #8b4f47;
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.gate-box button {
    padding: 0.7rem;
    font-weight: 600;
}

.gate-box button:active,
.bar button:active {
    transform: scale(0.98);
}

.err {
    margin: 0;
    font-size: 0.85rem;
    color: #e08a7a;
}

body.in-chat {
    height: 100dvh;
    overflow: hidden;
}

.shell {
    height: 100%;
    max-width: 40rem;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2a2420;
    background: #171412;
}

.who {
    font-weight: 600;
}

.out {
    color: #9a9188;
    text-decoration: none;
    font-size: 0.85rem;
}

.out:hover {
    color: #ece7e1;
}

.log {
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    -webkit-overflow-scrolling: touch;
}

.msg {
    max-width: 82%;
    align-self: flex-start;
}

.msg.mine {
    align-self: flex-end;
}

.msg .meta {
    font-size: 0.68rem;
    color: #8a8178;
    margin-bottom: 0.2rem;
    padding: 0 0.35rem;
}

.msg.mine .meta {
    text-align: right;
}

.msg .txt {
    background: #221e1b;
    border: 1px solid #342e29;
    border-radius: 1rem 1rem 1rem 0.35rem;
    padding: 0.55rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg.mine .txt {
    background: #3d2a28;
    border-color: #5a3a35;
    border-radius: 1rem 1rem 0.35rem 1rem;
}

.bar {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom));
    border-top: 1px solid #2a2420;
    background: #171412;
}

.bar textarea {
    flex: 1;
    resize: none;
    border: 1px solid #3a332c;
    border-radius: 1rem;
    background: #1c1815;
    color: inherit;
    padding: 0.6rem 0.85rem;
    font: inherit;
    max-height: 7.5rem;
}

.bar textarea:focus {
    outline: none;
    border-color: #7a4a42;
}

.bar button {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
}
