/* The chat page as a game screen (views/chatPartial.jsx): the trophy-hall
   frame from public/achievements-hall.css, the conversation in a
   stone panel, and who is around in a panel beside it (below it on phones).
   The theme tokens are re-pointed inside the hall so the message rows from
   public/chat.css read light-on-dark in both themes. Scoped to .chat-hall;
   the mini chat on the home page and the pregame chat are untouched. */

.chat-hall {
  --text: #f6e9cc;
  --papyrus-text: #f6e9cc;
  --surface-border: rgba(255, 220, 160, 0.16);
  --ch-gold: #ffd23a;
  --ch-ink-dim: #d4c39f;
  --ch-edge: rgba(255, 220, 160, 0.16);
  --ch-panel: rgba(18, 14, 10, 0.62);
  font-family: "Comfortaa", sans-serif;
}
.chat-hall .chat-hall-frame { max-width: 1120px; padding: 18px; }
/* The old page box becomes a plain two-column layout inside the frame. */
.chat-hall .chat-container.chat-hall-body {
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
  align-items: stretch;
}
.chat-hall .chat-hall-panel,
.chat-hall .chat-online-sidebar {
  background: var(--ch-panel);
  border: 1px solid var(--ch-edge);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 12px rgba(0, 0, 0, 0.35);
}
.chat-hall .chat-with-sidebar .chat-main.chat-hall-panel { padding: 12px; }

/* ── Messages ── */
.chat-hall .chat-messages {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--ch-edge);
  border-radius: 10px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}
.chat-hall .chat-message {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 8px 8px 0;
}
.chat-hall .chat-username { color: #ffd76a; }
.chat-hall .chat-time,
.chat-hall .chat-edited-mark { color: var(--ch-ink-dim); opacity: 0.8; }
.chat-hall .chat-edit-btn,
.chat-hall .chat-delete-btn { color: rgba(246, 233, 204, 0.35); }

/* ── Input row ── */
.chat-hall .chat-form input,
.chat-hall .chat-name-setup input,
.chat-hall .chat-name-setup select {
  border-radius: 10px;
  border: 1px solid var(--ch-edge);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
}
.chat-hall .chat-form input::placeholder,
.chat-hall .chat-name-setup input::placeholder { color: var(--ch-ink-dim); opacity: 0.8; }
.chat-hall .chat-form input:focus,
.chat-hall .chat-name-setup input:focus { border-color: rgba(255, 210, 58, 0.7); outline: none; }
.chat-hall .chat-form button,
.chat-hall .chat-name-setup button {
  border: 2px solid #7a5310;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffe48a 0%, #f0b52e 55%, #c98a12 100%);
  color: #3d2000;
  font: 800 0.95rem/1 "Cinzel", serif;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #6b4410;
}
.chat-hall .chat-form button:hover,
.chat-hall .chat-name-setup button:hover { filter: brightness(1.06); }
.chat-hall .chat-image-btn {
  border-radius: 10px;
  border: 1px solid rgba(200, 150, 12, 0.55);
  background: linear-gradient(180deg, rgba(48, 44, 40, 0.92), rgba(22, 20, 18, 0.95));
  color: var(--ch-gold);
}
.chat-hall .chat-filter { color: var(--text); }
.chat-hall .chat-filter-hint { color: var(--ch-ink-dim); opacity: 1; }
.chat-hall .chat-filter-switch { background: rgba(0, 0, 0, 0.5); border-color: var(--ch-edge); }

/* Set-your-name and the admin gift box. */
.chat-hall .chat-name-setup {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ch-edge);
  border-radius: 10px;
  color: var(--text);
}
.chat-hall .chat-name-setup h2 { font-family: "Cinzel", serif; color: var(--text); }

/* ── Who's around ── */
.chat-hall .chat-online-sidebar {
  width: auto;
  padding: 12px;
  border-left: 1px solid var(--ch-edge);
}
.chat-hall .chat-sidebar-header {
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  border-bottom-color: var(--ch-edge);
}
.chat-hall .chat-sidebar-header i { color: var(--ch-gold); opacity: 1; }
.chat-hall .chat-sidebar-user { border-radius: 8px; }
.chat-hall .chat-sidebar-user:hover { background: rgba(255, 210, 58, 0.08); }
.chat-hall .chat-sidebar-name { color: var(--text); }
.chat-hall .chat-sidebar-name:hover { color: #ffe27a; }
.chat-hall .chat-sidebar-status,
.chat-hall .chat-sidebar-section-label,
.chat-hall .chat-sidebar-empty { color: var(--ch-ink-dim); opacity: 1; }
.chat-hall .chat-sidebar-divider { background: var(--ch-edge); }

/* Desktop: the frame fills the screen and the message list scrolls inside
   it, as the old page did. */
@media (min-width: 769px) {
  .chat-hall.ach-hall { padding-top: 18px; padding-bottom: 18px; }
  .chat-hall .chat-hall-frame {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 120px);
    min-height: 520px;
  }
  .chat-hall .chat-container.chat-with-sidebar.chat-hall-body {
    flex: 1;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  .chat-hall .chat-online-sidebar { overflow-y: auto; }
}

/* Phones: one column, players under the chat as a strip of chips. */
@media (max-width: 768px) {
  .chat-hall.ach-hall { padding: 16px 6px 28px; }
  .chat-hall .chat-hall-frame { padding: 10px 8px 12px; }
  .chat-hall .chat-container.chat-hall-body { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .chat-hall .chat-with-sidebar .chat-main.chat-hall-panel { padding: 8px; }
  .chat-hall .chat-messages { min-height: 340px; max-height: 58vh; padding: 10px; }
  .chat-hall .chat-online-sidebar {
    margin-top: 0;
    padding: 10px;
    border-top: 1px solid var(--ch-edge);
  }
  .chat-hall .chat-sidebar-user {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--ch-edge);
    border-radius: 999px;
    margin: 0 6px 6px 0;
  }
}

/* Game-event cards (match results, land taken): their light-theme ink is
   dark, which vanishes on the stone panel. */
.chat-hall .chat-match-line,
.chat-hall .chat-match-meta,
.chat-hall .chat-match-score { color: var(--text); }
.chat-hall .chat-match-meta { color: var(--ch-ink-dim); }
.chat-hall .chat-match-details-btn { color: var(--text); border-color: var(--ch-edge); }

/* ── Room tabs (views/chatPartial.jsx) ── one row of pills; on narrow
   screens it scrolls sideways (with a fade on the right edge) instead of
   squeezing. General is open; the rest are under construction. */
.chat-hall .chat-rooms {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.chat-hall .chat-rooms::-webkit-scrollbar { display: none; }
.chat-hall .chat-room-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ch-edge);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ch-ink-dim);
  font: 700 0.85rem/1 "Comfortaa", sans-serif;
  white-space: nowrap;
  scroll-snap-align: start;
}
.chat-hall .chat-room-tab.is-active {
  color: #3d2000;
  border-color: #7a5310;
  background: linear-gradient(180deg, #ffe48a 0%, #f0b52e 55%, #c98a12 100%);
}
.chat-hall .chat-room-tab.is-soon { cursor: not-allowed; opacity: 0.55; }
/* Under construction: dimmed, with a small digging (or lock) icon; the
   word itself only where there is room. */
.chat-hall .chat-room-soon { display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; color: #fff; }
.chat-hall .chat-room-soon-text { display: none; }
@media (max-width: 600px) {
  .chat-hall .chat-rooms {
    margin: 0 -8px 8px;
    padding: 0 8px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .chat-hall .chat-room-tab { height: 34px; padding: 0 12px; font-size: 0.8rem; gap: 6px; }
}

a.chat-room-tab { text-decoration: none; cursor: pointer; }
.chat-hall a.chat-room-tab:not(.is-active):hover { color: var(--text); border-color: rgba(255, 210, 58, 0.45); }
.chat-hall .chat-room-tab.is-locked { opacity: 0.6; }
/* Outlaw rooms sit after a divider; the active one is blood red, not gold. */
.chat-hall .chat-rooms-divider { flex: none; width: 1px; margin: 6px 2px; background: var(--ch-edge); }
.chat-hall .chat-room-tab.is-outlaw.is-active {
  color: #fff3e6;
  border-color: #5e1a12;
  background: linear-gradient(180deg, #b8443a 0%, #8d2a22 60%, #5e1a12 100%);
}
.chat-hall .chat-room-note {
  margin: -4px 0 8px;
  font-size: 0.78rem;
  color: var(--ch-ink-dim);
}
.chat-hall .chat-room-note i { font-size: 0.7rem; margin-right: 4px; }

/* ── Send: icon + word; just the paper plane on phones. ── */
.chat-input-row { align-items: stretch; }
.chat-input-row .chat-form { flex-wrap: nowrap; min-width: 0; }
.chat-input-row .chat-form input { flex: 1 1 auto; min-width: 0; }
.chat-send-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none; }
@media (max-width: 600px) {
  .chat-input-row { gap: 6px; }
  .chat-input-row .chat-form { gap: 6px; }
  .chat-input-row .chat-form input { font-size: 16px; min-height: 44px; }
  .chat-send-btn { width: 46px; min-height: 44px; padding: 0 !important; }
  .chat-send-btn .chat-send-label { display: none; }
  .chat-send-btn i { font-size: 1.1rem; }
  .chat-input-row .chat-image-btn { width: 44px; min-height: 44px; flex: none; }
}

/* ── Admin gift: icon in the input row, form in a dialog (bottom sheet on
   phones). Colours set here: the dialog also opens in lobby chats outside
   .chat-hall. ── */
.chat-gift-btn i { color: #ffd23a; }
.chat-gift-dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid rgba(255, 220, 160, 0.25);
  border-radius: 16px;
  background: #1f1912;
  color: #f6e9cc;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: auto;
}
.chat-gift-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.chat-gift-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.chat-gift-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-gift-head h2 { margin: 0; font: 700 1.1rem/1.2 "Cinzel", serif; color: #f6e9cc; }
.chat-gift-head h2 i { color: #ffd23a; margin-right: 4px; }
.chat-gift-close {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 220, 160, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #f6e9cc;
  font-size: 1.1rem;
  cursor: pointer;
}
.chat-gift-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: #d4c39f; }
.chat-gift-field input,
.chat-gift-field select {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 220, 160, 0.2);
  background: rgba(0, 0, 0, 0.45);
  color: #f6e9cc;
  font-size: 16px;
}
.chat-gift-field input:focus,
.chat-gift-field select:focus { outline: none; border-color: rgba(255, 210, 58, 0.7); }
.chat-gift-submit {
  min-height: 46px;
  border: 2px solid #7a5310;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffe48a 0%, #f0b52e 55%, #c98a12 100%);
  color: #3d2000;
  font: 800 1rem/1 "Cinzel", serif;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #6b4410;
  cursor: pointer;
}
@media (max-width: 600px) {
  .chat-gift-dialog[open] {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: chat-gift-sheet-in 0.2s ease-out;
  }
}
@keyframes chat-gift-sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
