/* phone.css — the phone as a small messenger: chat list, open conversation with a sticky header and
   quick actions, collapsible mail letters, CT feed. Works in both the PC-98 and the neon styles. */

/* ---------- chat list ---------- */
.chats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--stroke); border-radius: 12px; background: rgba(0, 0, 0, .22); color: var(--ink); }
.chat-row:hover { border-color: var(--cyan); background: rgba(85, 204, 255, .1); }
.chat-row.on { border-color: var(--cyan); background: rgba(85, 204, 255, .14); }
.chat-row.fresh .chat-top b { color: #fff; }
.chat-row.need { border-color: var(--yellow, #ffcc44); box-shadow: inset 3px 0 0 var(--yellow, #ffcc44); }
.chat-row.gone { opacity: .45; }
.chat-row .ava { width: 40px; height: 40px; border-width: 2px; }
.ava.k-legal { border-color: #55ff55; } .ava.k-gray { border-color: #ffff55; } .ava.k-insider { border-color: #ff5555; } .ava.k-shady { border-color: #ff55ff; }
.chat-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-top time { font: 500 11px var(--mono); color: var(--ink-3); flex: none; }
.chat-sub { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.fresh .chat-sub { color: var(--ink); }
.ask-chip { font-style: normal; font: 700 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; color: #1a1200; background: var(--yellow, #ffcc44); }

/* ---------- open conversation ---------- */
.chat-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; margin: 0 0 6px;
  background: var(--win, #0b0b25); border-bottom: 1px solid var(--stroke-2); }
.chat-head .ava { width: 38px; height: 38px; border-width: 2px; }
.chat-head .back-btn { display: inline-flex; margin: 0; padding: 6px 10px; font-weight: 700; }
.chat-who { min-width: 0; } .chat-who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-who small { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trust { text-align: right; min-width: 56px; } .trust small { font: 600 10px var(--mono); color: var(--ink-3); } .trust .rel { margin: 0 0 3px; }
.chat-info { margin: 0 0 6px; } .chat-info .note { margin: 6px 0; }
.thread { margin: 6px 0 8px; }
.bub { max-width: 88%; }
.bub .choices { margin-top: 8px; }
.sysmsg { align-self: center; text-align: center; font-size: 12.5px; color: var(--ink-3); padding: 2px 10px; }
.chat-quick { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 4px; border-top: 1px solid var(--stroke-2); background: var(--win, #0b0b25); }
.chat-quick .chip-btn span { margin-left: 4px; font-family: var(--mono); font-size: 12px; opacity: .85; }
.chat-quick .ask { margin-left: auto; }

/* ---------- mail ---------- */
details.letter { border-radius: 12px; border: 1px solid var(--stroke); background: rgba(0, 0, 0, .22); padding: 0; margin-bottom: 6px; }
details.letter > summary { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border: 0 !important; text-decoration: none !important; color: var(--ink) !important; background: none !important; }
details.letter > summary b { font-weight: 600; } details.letter > summary small { font: 500 11px var(--mono); color: var(--ink-3); }
details.letter > p, details.letter > .choices, details.letter > .chosen { margin: 0; padding: 0 12px 12px; font-size: 14px; color: var(--ink-2); }
details.letter.need { border-color: var(--yellow, #ffcc44); box-shadow: inset 3px 0 0 var(--yellow, #ffcc44); }

/* ---------- CT ---------- */
.compose { display: flex; flex-direction: column; gap: 6px; }
.compose > small { color: var(--ink-3); font-size: 12px; }
.tagbtn.on { background: var(--cyan); color: #00121c; }

html.pc98 .chat-row, html.pc98 details.letter { border-radius: 0; border-width: 2px; }
html.pc98 .ask-chip { border-radius: 0; }
@media (max-width: 760px) { .chat-head { grid-template-columns: auto minmax(0, 1fr) auto; } .chat-head .ava { display: none; } }
/* On a phone the thread is its own scroller sized to the screen, so the actions just sit under it
   (sticky actions covered the last messages). */
@media (max-width: 760px) { .chat-quick { position: static; } .thread, body[data-view="phone"] .thread { margin-bottom: 4px; max-height: calc(100dvh - 545px); min-height: 170px; } }

/* An open chat in the phone view is a messenger, not a page: the window stops scrolling, the
   conversation is the only scroller and the quick actions sit under it (no overlap). */
@media (min-width: 761px) {
  body[data-view="phone"] .screen[data-screen="phone"] > .win:has(.phone-grid.has-thread) { display: flex; flex-direction: column; overflow: hidden; }
  body[data-view="phone"] .win:has(.phone-grid.has-thread) #phoneBody { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; }
  body[data-view="phone"] #phoneBody .phone-grid.has-thread { flex: 1; min-height: 0; display: flex; align-items: stretch; }
  body[data-view="phone"] #phoneBody .phone-grid.has-thread > div:last-child { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
  body[data-view="phone"] #phoneBody .phone-grid.has-thread .thread { flex: 1; min-height: 0; max-height: none; margin-bottom: 6px; }
  body[data-view="phone"] #phoneBody .phone-grid.has-thread .chat-head { position: static; }
  body[data-view="phone"] #phoneBody .phone-grid.has-thread .chat-quick { position: static; flex: none; }
}
/* One row of actions. */
.chat-quick { flex-wrap: nowrap; }
.chat-quick .chip-btn { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-quick .ask { margin-left: 0; }
/* Name on top, price (or the cooldown, "4d") on a small second line, so nothing gets cut. */
.chat-quick .chip-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.1; padding-top: 5px; padding-bottom: 5px; text-overflow: clip; }
.chat-quick .chip-btn span { display: block; margin: 0 !important; font-size: 12px !important; opacity: .85; }
