.bw-tg-notice,
.bw-tg-dialog,
.bw-tg-card {
    --tg-ink: #342513;
    --tg-gold: #835e22;
    --tg-border: #caaa72;
    box-sizing: border-box;
    color: var(--tg-ink);
    font: 500 14px/1.5 Arial, sans-serif;
}

#chat-container .bw-tg-notice {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 7px 10px;
    border-top: 1px solid var(--tg-border);
    background: #fff3d5;
    font-size: 12px;
}

.bw-tg-notice p { flex: 1 1 180px; margin: 0; }

#chat-container .bw-tg-compose-gate .bw-tg-notice {
    flex: 1 1 100%;
    justify-content: space-between;
    border: 1px solid var(--tg-border);
    border-radius: 6px;
}

#chat-container .bw-tg-online-gate {
    display: grid;
    align-items: center;
    min-height: 100%;
}

#chat-container .bw-tg-online-gate .bw-tg-notice {
    flex-direction: column;
    text-align: center;
    border: 0;
    background: transparent;
}

.bw-tg-online-gate .bw-tg-notice p { flex: 0 1 auto; }

.bw-tg-dialog,
.bw-tg-card {
    width: min(424px, calc(100% - 24px));
    padding: 18px;
    border: 1px solid var(--tg-border);
    border-radius: 12px;
    background: #fff8eb;
    box-shadow: 0 14px 38px #1f140b5c;
}

.bw-tg-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    max-height: min(88dvh, 520px);
    overflow: auto;
    overscroll-behavior: contain;
}

.bw-tg-dialog::backdrop { background: #120d08a6; }
.bw-tg-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.bw-tg-heading h2,
.bw-tg-card h1 { margin: 0; font: 700 21px/1.2 Georgia, serif; }
.bw-tg-dialog p,
.bw-tg-card p { margin: 10px 0; }
.bw-tg-close,
.bw-tg-retry { font: inherit; color: var(--tg-gold); cursor: pointer; }
.bw-tg-close { border: 0; background: transparent; padding: 0 8px; font-size: 23px; line-height: 1; }
.bw-tg-retry { border: 0; background: transparent; padding: 5px 0; text-decoration: underline; }
.bw-tg-link { display: inline-block; color: #634313; font-weight: 700; margin: 0 0 8px; }

.bw-tg-card label,
.bw-tg-dialog label { display: grid; gap: 4px; margin: 10px 0; font-weight: 700; }
.bw-tg-card input,
.bw-tg-dialog input {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--tg-border);
    border-radius: 6px;
    background: white;
    color: var(--tg-ink);
    font: 500 16px/1.25 Arial, sans-serif;
}

.bw-tg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    min-height: 32px;
    border: 1px solid var(--tg-gold);
    border-radius: 6px;
    background: #8c6529;
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.bw-tg-button:hover { background: #6c4a1a; color: white; }
.bw-tg-button:disabled,
.bw-tg-retry:disabled { opacity: .65; cursor: wait; }
.bw-tg-status { color: #79321b; }
.bw-tg-recovery { display: grid; place-items: center; min-height: 100dvh; margin: 0; background: #241b13; }
.bw-tg-card > .bw-tg-link { margin-top: 14px; }

@media (pointer: coarse) {
    .bw-tg-button, .bw-tg-close, .bw-tg-retry, .bw-tg-link { min-height: 44px; }
    .bw-tg-link { display: inline-flex; align-items: center; }
}
