/* The Restaurant chat (public/restaurant/chat.mjs): a compact pixel window bottom-left on desktop (collapsible),
   a bottom sheet behind a chat button on phones. Restaurant only. It wears the Restaurant HUD's dark look (the top
   bar's chips: style.css --panel / --line / --ink, Galmuri pixel text) with the name plates' and hotbar's pixel
   corners (--rcorners in restaurant.css: one pixel off each corner). Accents: --focus (yours, new lines, focus). */
.rchat { position: fixed; z-index: 9; left: max(12px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: clamp(220px, calc(50vw - 190px), 320px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line); clip-path: var(--rcorners); color: var(--ink); will-change: transform; }
/* the panel clips its corners, so focus rings inside it sit inside their buttons */
.rchat :focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rchat__head { display: flex; align-items: stretch; background: #ffffff0d; border-bottom: 1px solid var(--line); color: var(--ink); }
.rchat__title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.rchat__title:hover { background: #ffffff0d; }
.rchat__title b { font: 700 12px var(--pixel); letter-spacing: 1px; text-transform: uppercase; }
.rchat__floor { flex: 1; min-width: 0; font: 11px var(--mono); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchat__new { flex: none; padding: 1px 5px; background: var(--focus); color: var(--ink-dark); font: 700 11px var(--pixel); }
.rchat__icon { flex: none; width: 34px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; }
.rchat__icon:hover { background: #ffffff14; }
.rchat__x { display: none; color: var(--ink); font: 700 14px var(--pixel); }
.rchat__svg { display: block; image-rendering: pixelated; }
.rchat__body { display: flex; flex-direction: column; min-height: 0; }
.rchat.is-folded .rchat__head { border-bottom: 0; }
.rchat.is-folded .rchat__body { display: none; }
.rchat__list { list-style: none; margin: 0; padding: 6px 8px 2px; max-height: 172px; min-height: 64px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff40 transparent; font: 12px/16px var(--pixel); word-break: break-word; }
.rchat__list:focus-visible { outline: 1px solid var(--focus); outline-offset: -1px; }
.rchat__list li { margin: 0 0 4px; position: relative; }
.rchat__line time { display: none; position: absolute; right: 0; top: -1px; padding: 0 4px; background: var(--panel-solid); border: 1px solid var(--line); color: var(--ink-soft); font: 11px var(--mono); }
.rchat__line:hover time, .rchat__line:focus-within time { display: block; }
/* each name in its owner's Plate colours (the same plates as over the chefs) */
.rchat__name { display: inline; margin: 0 6px 0 0; padding: 0 4px; border: 0; background: var(--pb, #24160f); color: var(--pi, #f6ead2); box-shadow: inset 0 0 0 1px var(--pe, #4a2e1f); font: 700 11px/15px var(--pixel); cursor: pointer; vertical-align: 1px; }
.rchat__name:hover { filter: brightness(1.1); }
.rchat .rchat__name:focus-visible { outline-offset: 1px; }
.rchat__line.is-mine .rchat__name { outline: 1px solid var(--focus); outline-offset: 0; }
.rchat__text { color: var(--ink); }
.rchat__sys { color: var(--ink-soft); font: 11px var(--mono); }
.rchat__empty { color: var(--ink-soft); font: 11px var(--mono); padding: 8px 0; text-align: center; }
.rchat__off { display: grid; gap: 8px; justify-items: start; padding: 10px; }
.rchat__off p { margin: 0; font: 11px var(--mono); color: var(--ink-soft); }
/* buttons: the top bar's chips (dark face, a --line edge that lights up on hover) */
.rchat__btn, .rchat__send { border: 1px solid var(--line); background: #1a2a34; color: var(--ink); font: 700 11px var(--pixel); letter-spacing: 1px; text-transform: uppercase; cursor: pointer; }
.rchat__btn { padding: 4px 10px; }
.rchat__btn:hover, .rchat__send:hover:not(:disabled) { border-color: var(--ink-soft); }
.rchat__send:disabled { color: var(--ink-dim); cursor: not-allowed; }
.rchat__note { margin: 0; padding: 2px 8px 4px; font: 11px var(--mono); color: var(--ink-soft); }
.rchat__form { position: relative; display: flex; gap: 4px; padding: 0 6px 6px; }
.rchat__input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #0b141a; color: var(--ink); font: 12px var(--pixel); border-radius: 0; }
.rchat__input::placeholder { color: var(--ink-dim); }
.rchat__input:hover { border-color: #e6f0f04d; }
.rchat .rchat__input:focus, .rchat .rchat__input:focus-visible { outline: none; border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.rchat__count { position: absolute; right: 72px; top: 8px; font: 10px var(--mono); color: var(--ink-soft); pointer-events: none; }
.rchat__count.is-full { color: #ffb09a; }
.rchat__send { flex: none; height: 30px; padding: 0 10px; }
.rchat__send:active:not(:disabled) { transform: translateY(1px); }
/* a refused line, or "Some words were hidden." (masked words): the game's warm warning tone, AA on the dark panel */
.rchat__err { margin: 0; padding: 0 8px; font: 11px var(--mono); color: #ffb09a; min-height: 0; }
.rchat__err:empty { display: none; }
.rchat__err:not(:empty) { padding-bottom: 6px; }
.rchat.is-hidden .rchat__note { display: none; }

/* Phones: a chat button above the hotbar opens a bottom sheet; its input rides above the keyboard (--kb). */
.rchatbtn { position: fixed; z-index: 10; left: max(10px, env(safe-area-inset-left)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 64px); width: 48px; height: 44px; display: grid; place-items: center; padding: 0; background: var(--panel); border: 1px solid var(--line); clip-path: var(--rcorners); cursor: pointer; }
.rchatbtn[hidden] { display: none; }
.rchatbtn:hover { border-color: var(--ink-soft); }
.rchatbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.rchatbtn:active { transform: translateY(2px); }
.rchatbtn__n { position: absolute; right: 2px; top: 2px; min-width: 18px; padding: 1px 4px; background: var(--focus); color: var(--ink-dark); font: 700 11px var(--pixel); text-align: center; }
.rchat.is-sheet { left: 0; right: 0; bottom: var(--kb, 0px); width: auto; max-height: min(56vh, 440px); border-left: 0; border-right: 0; border-bottom: 0; clip-path: none; padding-bottom: env(safe-area-inset-bottom); background: var(--panel-solid); z-index: 30; display: none; }
.rchat.is-sheet.is-open { display: flex; animation: rchat-up 0.16s steps(4, end); }
.rchat.is-sheet .rchat__x { display: grid; }
.rchat.is-sheet .rchat__title { height: 44px; }
.rchat.is-sheet .rchat__icon { height: 44px; width: 44px; }
.rchat.is-sheet .rchat__body { flex: 1; }
.rchat.is-sheet .rchat__list { flex: 1; max-height: none; min-height: min(120px, 20vh); font-size: 13px; line-height: 18px; } /* landscape phones: the input stays in the sheet */
.rchat.is-sheet .rchat__input { height: 44px; font-size: 16px; } /* 16px: no zoom on focus (iOS) */
.rchat.is-sheet .rchat__send { height: 44px; padding: 0 14px; }
.rchat.is-sheet .rchat__btn { min-height: 44px; }
.rchat.is-sheet .rchat__count { top: 15px; right: 84px; }
.rchat.is-sheet .rchat__line time { display: none; }
body.has-chat-sheet .hotbar, body.has-chat-sheet .rhint { visibility: hidden; }
@keyframes rchat-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rchat.is-sheet.is-open { animation: none; } }

/* Mute / Report on a bubble, a name or a line: the same dark panel, pixel corners. */
.rchatmenu { position: fixed; z-index: 45; min-width: 170px; max-width: calc(100vw - 16px); padding: 4px; background: #1a2a34; color: var(--ink); border: 1px solid var(--line); clip-path: var(--rcorners); display: grid; gap: 2px; animation: rise-in 0.12s; }
.rchatmenu__who { margin: 0; padding: 4px 8px 6px; font: 700 12px var(--pixel); letter-spacing: 1px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchatmenu button { min-height: 36px; padding: 0 10px; border: 0; background: transparent; color: inherit; text-align: left; font: 700 12px var(--pixel); cursor: pointer; }
.rchatmenu button:hover { background: #ffffff14; }
.rchatmenu button:focus-visible { background: #ffffff14; outline: 2px solid var(--focus); outline-offset: -2px; }
.rchatmenu button[data-m="report"] { color: #ffb09a; }
@media (hover: none), (pointer: coarse) { .rchatmenu button { min-height: 44px; } }
