/* ============================================================
   PRIVATE GM CHANNEL — player FAB + thread modal, moderator inbox.
   Reuses Torchlit tokens (HSL vars, liquid-glass, Cinzel/Inter).
   ============================================================ */

/* ---- player: floating "Message the GM" button ---- */
.gm-fab {
  position: fixed; left: clamp(12px, 3vw, 22px); bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  z-index: 5200; display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem .9rem; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-size: .82rem; color: hsl(var(--foreground));
  background: hsl(var(--surface) / .82); border: 1px solid hsl(var(--border) / .8);
  box-shadow: 0 8px 22px hsl(0 0% 0% / .42); backdrop-filter: blur(10px);
  transition: transform .08s, border-color .25s, box-shadow .25s;
}
.gm-fab:active { transform: scale(.95); }
.gm-fab.has-unread { border-color: hsl(var(--primary) / .6); box-shadow: 0 8px 26px hsl(var(--primary) / .25); }
.gm-fab.pulse { animation: gm-fab-pulse 1.1s ease-in-out 2; }
@keyframes gm-fab-pulse { 0%,100% { box-shadow: 0 8px 22px hsl(0 0% 0% / .42); } 50% { box-shadow: 0 8px 30px hsl(var(--primary) / .6); } }
.gm-fab-label { letter-spacing: .01em; white-space: nowrap; }
.gm-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-grid; place-items: center; font-family: var(--font-display);
  font-size: .68rem; line-height: 1; color: hsl(var(--primary-foreground));
  background: hsl(var(--primary)); box-shadow: 0 0 10px hsl(var(--primary) / .6);
}
@media (max-width: 560px){
  .gm-fab-label { display: none; }
  .gm-fab { padding: .7rem; }
}

/* ---- player: thread modal ---- */
.gm-modal {
  position: fixed; inset: 0; z-index: 6200; display: flex; align-items: flex-end; justify-content: center;
  padding: 0; background: hsl(var(--background) / .72); backdrop-filter: blur(4px);
  animation: gm-fade .2s ease-out;
}
@keyframes gm-fade { from { opacity: 0; } to { opacity: 1; } }
.gm-panel {
  width: min(460px, 100%); max-height: 84vh; display: flex; flex-direction: column;
  border-radius: 22px 22px 0 0; padding: 1rem 1rem 1.1rem;
  border: 1px solid hsl(var(--border)); border-bottom: none;
  animation: gm-rise .26s cubic-bezier(.3,.9,.3,1);
}
@keyframes gm-rise { from { transform: translateY(28px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 620px){ .gm-modal { align-items: center; } .gm-panel { border-radius: 22px; border-bottom: 1px solid hsl(var(--border)); } }
.gm-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.gm-panel-id { display: flex; flex-direction: column; gap: .15rem; }
.gm-panel-eyebrow { font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: hsl(var(--primary)); white-space: nowrap; }
.gm-panel-title { font-size: 1.25rem; color: hsl(var(--foreground)); letter-spacing: .02em; }
.gm-x { background: none; border: none; color: hsl(var(--muted-foreground)); font-size: 1.05rem; cursor: pointer; padding: .2rem .4rem; border-radius: 8px; }
.gm-x:hover { color: hsl(var(--foreground)); background: hsl(var(--surface)); }

/* ---- thread bubbles (shared) ---- */
.gm-thread {
  flex: 1; min-height: 120px; max-height: 52vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .5rem; padding: .4rem .1rem .6rem;
}
.gm-thread-empty { margin: auto; max-width: 30ch; text-align: center; font-size: .82rem; line-height: 1.5;
  color: hsl(var(--muted-foreground)); text-wrap: pretty; padding: 1.4rem 1rem; }
.gm-msg {
  position: relative; max-width: 82%; display: flex; flex-direction: column; gap: .15rem;
  padding: .55rem .8rem .42rem; border-radius: 14px; font-size: .88rem; line-height: 1.4;
  color: hsl(var(--foreground)); word-break: break-word;
}
.gm-msg.player { align-self: flex-end; background: hsl(var(--surface)); border: 1px solid hsl(var(--border)); border-bottom-right-radius: 5px; }
.gm-msg.gm { align-self: flex-start; background: hsl(var(--primary) / .15); border: 1px solid hsl(var(--primary) / .4); border-bottom-left-radius: 5px; }
.gm-msg-text { white-space: pre-wrap; }
.gm-msg-time { align-self: flex-end; font-size: .6rem; letter-spacing: .04em; color: hsl(var(--muted-foreground)); }

/* ---- composer (shared) ---- */
.gm-compose { display: flex; align-items: flex-end; gap: .5rem; margin-top: .7rem; }
.gm-input {
  flex: 1; resize: none; max-height: 120px; font-family: var(--font-body); font-size: .88rem; line-height: 1.4;
  padding: .6rem .8rem; border-radius: 14px; color: hsl(var(--foreground));
  background: hsl(var(--background) / .7); border: 1px solid hsl(var(--border)); outline: none;
}
.gm-input:focus { border-color: hsl(var(--primary) / .7); }
.gm-send {
  flex: none; font-family: var(--font-display); font-size: .88rem; letter-spacing: .03em;
  padding: .62rem 1.1rem; border-radius: 12px; cursor: pointer; color: hsl(var(--primary-foreground));
  background: linear-gradient(180deg, hsl(var(--primary)), hsl(var(--primary) / .82)); border: 1px solid hsl(var(--primary) / .7);
  transition: transform .08s, opacity .2s;
}
.gm-send:active:not(:disabled) { transform: scale(.95); }
.gm-send:disabled { opacity: .35; cursor: not-allowed; }

/* ---- moderator inbox ---- */
.gm-inbox-list { display: flex; flex-direction: column; gap: .4rem; }
.gm-inbox-row {
  position: relative; display: grid; grid-template-columns: 5.2rem 1fr auto; align-items: center; gap: .6rem;
  padding: .6rem .8rem; border-radius: 12px; cursor: pointer; text-align: left;
  background: hsl(var(--surface) / .5); border: 1px solid hsl(var(--border) / .6);
  transition: border-color .2s, background .2s;
}
.gm-inbox-row:hover { background: hsl(var(--surface) / .8); border-color: hsl(var(--border)); }
.gm-inbox-row.unread { border-color: hsl(var(--primary) / .55); }
.gm-inbox-name { font-family: var(--font-display); font-size: .9rem; color: hsl(var(--foreground)); }
.gm-inbox-row.unread .gm-inbox-name { color: hsl(var(--primary)); }
.gm-inbox-preview { font-size: .76rem; color: hsl(var(--muted-foreground)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-inbox-meta { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.gm-inbox-time { font-size: .66rem; color: hsl(var(--muted-foreground) / .8); font-variant-numeric: tabular-nums; }

.gm-inbox-open { display: flex; flex-direction: column; }
.gm-inbox-bar { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.gm-inbox-with { font-size: .8rem; color: hsl(var(--muted-foreground)); }
.gm-inbox-with strong { color: hsl(var(--foreground)); }
.gm-inbox-open .gm-thread { max-height: 240px; background: hsl(var(--background) / .35); border-radius: 12px; padding: .6rem; }

/* ---- private wager: player card (in the GM panel) ---- */
.pw-card {
  margin-top: .7rem; padding: .85rem; border-radius: 16px;
  background: linear-gradient(180deg, hsl(var(--primary) / .12), hsl(var(--surface) / .6));
  border: 1px solid hsl(var(--primary) / .45); box-shadow: inset 0 0 22px hsl(var(--primary) / .08);
}
.pw-card.resolved.win { border-color: hsl(var(--heal) / .55); background: linear-gradient(180deg, hsl(var(--heal) / .14), hsl(var(--surface) / .6)); }
.pw-card.resolved.lose { border-color: hsl(var(--damage) / .5); background: linear-gradient(180deg, hsl(var(--damage) / .12), hsl(var(--surface) / .6)); }
.pw-eyebrow { font-family: var(--font-display); font-size: .72rem; letter-spacing: .04em; color: hsl(var(--primary)); margin-bottom: .35rem; }
.pw-card.resolved.win .pw-eyebrow { color: hsl(var(--heal)); }
.pw-terms { font-size: .92rem; color: hsl(var(--foreground)); line-height: 1.4; margin-bottom: .7rem; text-wrap: pretty; }
.pw-pending { font-size: .84rem; color: hsl(var(--muted-foreground)); line-height: 1.45; text-wrap: pretty; }
.pw-pending strong { color: hsl(var(--foreground)); }
.pw-options { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .7rem; }
.pw-opt { font-family: var(--font-body); font-size: .86rem; padding: .55rem .8rem; border-radius: 11px; cursor: pointer; text-align: left;
  color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); background: hsl(var(--surface) / .6); transition: transform .06s, border-color .2s, background .2s; }
.pw-opt:active { transform: scale(.98); }
.pw-opt.sel { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .16); color: hsl(var(--primary)); }
.pw-stake-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.pw-stake-lbl { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.pw-stepper { display: inline-flex; align-items: center; gap: .35rem; }
.pw-step { width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: .9rem;
  color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); background: hsl(var(--surface)); }
.pw-step.max { width: auto; padding: 0 .6rem; font-size: .72rem; letter-spacing: .04em; color: hsl(var(--primary)); border-color: hsl(var(--primary) / .5); }
.pw-step:active { transform: scale(.92); }
.pw-step:disabled { opacity: .4; cursor: not-allowed; }
.pw-stake-amt { font-family: var(--font-display); font-size: 1.2rem; min-width: 2ch; text-align: center; color: hsl(var(--primary)); font-variant-numeric: tabular-nums; }
.pw-purse { font-size: .72rem; color: hsl(var(--muted-foreground)); margin-left: auto; }
.pw-place { width: 100%; font-family: var(--font-display); font-size: .95rem; padding: .7rem; border-radius: 12px; cursor: pointer;
  color: hsl(var(--primary-foreground)); border: 1px solid hsl(var(--primary) / .7);
  background: linear-gradient(180deg, hsl(var(--primary)), hsl(var(--primary) / .82)); transition: transform .08s, opacity .2s; }
.pw-place:active:not(:disabled) { transform: scale(.98); }
.pw-place:disabled { opacity: .4; cursor: not-allowed; }

/* ---- private wager: moderator controls (in the inbox thread) ---- */
.pw-offer-btn { display: inline-flex; align-items: center; gap: .4rem; margin: .6rem 0; padding: .5rem .85rem; border-radius: 10px; cursor: pointer;
  font-size: .8rem; color: hsl(var(--primary)); background: hsl(var(--primary) / .1); border: 1px solid hsl(var(--primary) / .4); transition: background .2s; }
.pw-offer-btn:hover { background: hsl(var(--primary) / .18); }
.pw-form { margin: .6rem 0; padding: .8rem; border-radius: 12px; background: hsl(var(--background) / .4); border: 1px solid hsl(var(--border)); display: flex; flex-direction: column; gap: .5rem; }
.pw-form-title { font-family: var(--font-display); font-size: .86rem; color: hsl(var(--foreground)); }
.pw-form-row { display: flex; gap: .5rem; }
.pw-form-row .tinput { flex: 1; min-width: 0; }
.pw-form-btns { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .2rem; }
.pw-mod { margin: .6rem 0; padding: .7rem .85rem; border-radius: 12px; background: hsl(var(--primary) / .08); border: 1px solid hsl(var(--primary) / .35);
  display: flex; flex-direction: column; gap: .5rem; font-size: .82rem; color: hsl(var(--foreground)); }
.pw-mod.waiting, .pw-mod.done { flex-direction: row; align-items: center; justify-content: space-between; color: hsl(var(--muted-foreground)); }
.pw-mod-line { color: hsl(var(--foreground)); }
.pw-mod-btns { display: flex; gap: .5rem; align-items: center; }
