/* ═══════════════════════════════════════════════════════════════
   ui-compact.css — Nov 5 UI pass (playtester feedback)
   Loaded AFTER style.css. Overrides only; style.css is untouched.
   Goals: see your own melds without going full screen, smaller
   completed canastas / Red 3s / meld cards, less scrolling.
═══════════════════════════════════════════════════════════════ */

/* 1. Never clip the play area. The game view used to be locked to the
      window height with overflow hidden, so once the score tally and the
      completed-canastas row took their share, the meld area shrank to
      nothing and couldn't be reached. Now the play area keeps a usable
      minimum height and the whole game view scrolls if the window is short. */
#view-game.view.active { overflow-y: auto; }
#view-game .game-body { min-height: 340px; flex-shrink: 0; flex-grow: 1; }

/* 2. Score tally: cap its height so it can't push the table off-screen. */
#view-game .live-tally { max-height: 132px; overflow-y: auto; }

/* 3. Completed canastas row (your basket) — compact tiles. */
#canastas-row { padding: 4px 12px !important; }
#canastas-row > div:first-child { margin-bottom: 3px !important; }
#canastas-display { gap: 6px !important; }
.canasta-display.canasta-compact { gap: 2px; }
.canasta-display.canasta-compact:hover { transform: translateY(-2px); }
.canasta-compact .canasta-card {
  width: 40px; height: 54px;
  border-width: 2px; border-radius: 4px;
  padding: 2px 1px; gap: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}
.canasta-compact .cc-rank { font-size: 17px; font-weight: bold; line-height: 1; }
.canasta-compact .cc-type { font-size: 7px; font-weight: bold; letter-spacing: 0.5px; opacity: 0.8; margin-top: 2px; }
.canasta-compact .canasta-pts { font-size: 9px; line-height: 1.1; white-space: nowrap; }

/* Graveyard tiles use the same compact card. */
.graveyard-canasta .canasta-compact .canasta-card { width: 40px; height: 54px; font-size: inherit; }
.graveyard-canasta.dirty-yard { cursor: pointer; opacity: 0.85; } /* dirty yards accept naturals now */
.graveyard-cards { gap: 6px; }
.section-divider { margin: 8px 0 6px; }

/* 4. Open melds — smaller cards and tighter boxes. */
.melds-grid { gap: 8px; }
.meld-display { padding: 5px 6px; min-width: 0; }
.meld-rank-label { font-size: 11px; margin-bottom: 4px; }
.canasta-tag { font-size: 9px; padding: 1px 4px; }
.meld-cards-row { gap: 3px; }
.meld-mini-card {
  width: 38px; height: 54px;
  font-size: 12px; border-radius: 4px;
}
.meld-count { font-size: 10px; margin-top: 3px; }

/* 5. Waiting-room setup guide. */
.setup-guide-card { max-width: 440px; width: 100%; animation: lobbyRise 0.6s ease-out 0.12s both; }
.setup-guide summary { cursor: pointer; color: var(--gold); font-size: 14px; font-weight: bold; padding: 2px 0; }
.setup-guide summary:hover { color: var(--gold-light); }
.setup-guide-body { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--text); }
.setup-guide-body p { margin-bottom: 8px; }
.setup-guide-body p:last-child { margin-bottom: 0; }
.setup-guide-body b { color: var(--gold-light); }

/* Short windows (most laptops when not full screen): tighter tally so the
   table and hand fit without scrolling where possible. */
@media (max-height: 720px) {
  #view-game .live-tally { max-height: 76px; padding: 4px 10px; }
  #view-game .game-body { min-height: 300px; }
}

/* ═══ 6. My Circle panel (Nov 5) ═════════════════════════════════════════ */
.circle-open-btn { position: relative; }
.circle-open-lobby {
  display: block; margin: 10px auto 0; padding: 5px 14px;
  font: inherit; font-size: 13px; color: var(--gold-light);
  background: rgba(212,168,67,0.12); border: 1px solid var(--gold); border-radius: 16px; cursor: pointer;
}
.circle-open-lobby:hover { background: rgba(212,168,67,0.25); }
.circle-badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  margin-left: 4px; border-radius: 9px; background: #e53935; color: #fff;
  font-size: 11px; font-weight: bold; text-align: center; font-family: Arial, sans-serif;
}
.circle-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 900; }
.circle-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 340px; max-width: 100vw; z-index: 901;
  background: #173617; border-left: 1px solid var(--gold);
  box-shadow: -10px 0 30px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
}
.circle-panel.hidden, .circle-backdrop.hidden { display: none !important; }
.circle-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--felt-dark); flex-shrink: 0;
}
.circle-title { flex: 1; font-size: 16px; color: var(--gold-light); font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.circle-close, .circle-back {
  background: none; border: 1px solid var(--border); color: var(--text); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; font-size: 15px; flex-shrink: 0;
}
.circle-close:hover, .circle-back:hover { background: rgba(255,255,255,0.1); }
.circle-body { flex: 1; overflow-y: auto; padding: 10px 14px 16px; }
.circle-section { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 6px; }
.circle-row {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px;
  border: 1px solid transparent;
}
.circle-member { cursor: pointer; }
.circle-member:hover { background: rgba(255,255,255,0.06); border-color: var(--border); }
.circle-req { background: rgba(212,168,67,0.08); border-color: rgba(212,168,67,0.35); margin-bottom: 4px; }
.circle-pending { opacity: 0.75; }
.circle-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.circle-name { font-size: 14px; color: var(--text); font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.circle-req .circle-name, .circle-pending .circle-name { flex: 1; }
.circle-status { font-size: 11px; color: var(--text-muted); }
.circle-actions { display: flex; gap: 6px; }
.circle-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.circle-dot.s-online { background: #4caf50; }
.circle-dot.s-playing { background: var(--gold); box-shadow: 0 0 0 3px rgba(212,168,67,0.25); }
.circle-dot.s-offline { background: transparent; border: 1.5px solid #888; }
.circle-unread {
  min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px; border-radius: 10px;
  background: #e53935; color: #fff; font-size: 11px; font-weight: bold; text-align: center; font-family: Arial, sans-serif;
}
.circle-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 4px; opacity: 0; }
.circle-member:hover .circle-x, .circle-x:focus { opacity: 1; }
@media (hover: none) { .circle-x { opacity: 0.6; } }
.circle-empty { font-size: 13px; color: var(--text-muted); font-style: italic; padding: 6px 2px; }
.circle-add { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.circle-add label { display: block; font-size: 12px; color: var(--gold); margin-bottom: 6px; }
.circle-add-row { display: flex; gap: 6px; }
.circle-add-row input {
  flex: 1; min-width: 0; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; color: var(--text); font: inherit; font-size: 13px; padding: 6px 10px; outline: none;
}
.circle-add-row input:focus { border-color: var(--gold); }
.circle-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.circle-notice { font-size: 12px; padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; }
.circle-notice.is-ok { background: rgba(76,175,80,0.15); border: 1px solid rgba(76,175,80,0.45); color: #a5d6a7; }
.circle-notice.is-error { background: rgba(244,67,54,0.15); border: 1px solid rgba(244,67,54,0.45); color: #ef9a9a; }
.circle-err { color: #ef9a9a; }

.circle-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.circle-thread.hidden { display: none; }
.circle-thread-status {
  font-size: 12px; color: var(--text-muted); padding: 8px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.circle-thread-msgs { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.circle-msg { display: flex; flex-direction: column; max-width: 82%; }
.circle-msg.mine { align-self: flex-end; align-items: flex-end; }
.circle-msg.theirs { align-self: flex-start; align-items: flex-start; }
.circle-bubble {
  padding: 7px 11px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.circle-msg.mine .circle-bubble { background: rgba(212,168,67,0.3); border: 1px solid rgba(212,168,67,0.5); color: var(--text); border-bottom-right-radius: 4px; }
.circle-msg.theirs .circle-bubble { background: rgba(255,255,255,0.09); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.circle-when { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.circle-compose { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0; align-items: flex-end; }
.circle-compose textarea {
  flex: 1; resize: none; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; color: var(--text); font: inherit; font-size: 14px; padding: 7px 10px; outline: none;
}
.circle-compose textarea:focus { border-color: var(--gold); }

.circle-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 950; max-width: 320px;
  background: #1e3a1e; border: 1px solid var(--gold); border-radius: 10px; padding: 10px 14px;
  color: var(--text); font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); cursor: pointer;
  animation: circleToastIn 0.25s ease-out;
}
@keyframes circleToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ═══ 7. Meld size control (Nov 5) — S / M / L in the hand header ═══════ */
.meld-size-ctl { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 12px; color: var(--text-muted); }
.meld-size-ctl .btn-tiny { min-width: 24px; padding: 0 6px; }
.meld-size-ctl .btn-tiny.active { background: rgba(212,168,67,0.35); border-color: var(--gold); color: var(--gold-light); }

/* Small */
body.meld-size-s .meld-mini-card { width: 28px; height: 40px; font-size: 10px; border-radius: 3px; }
body.meld-size-s .meld-cards-row { gap: 2px; }
body.meld-size-s .meld-display { padding: 4px 5px; }
body.meld-size-s .meld-rank-label { font-size: 10px; margin-bottom: 3px; }
body.meld-size-s .canasta-compact .canasta-card,
body.meld-size-s .graveyard-canasta .canasta-compact .canasta-card { width: 32px; height: 44px; }
body.meld-size-s .canasta-compact .cc-rank { font-size: 14px; }
body.meld-size-s .canasta-compact .cc-type { font-size: 6px; }

/* Medium = the defaults in section 3/4 above (38×54 cards, 40×54 tiles). */

/* Large */
body.meld-size-l .meld-mini-card { width: 54px; height: 76px; font-size: 15px; border-radius: 5px; }
body.meld-size-l .meld-cards-row { gap: 4px; }
body.meld-size-l .meld-display { padding: 7px 8px; }
body.meld-size-l .meld-rank-label { font-size: 12px; margin-bottom: 5px; }
body.meld-size-l .canasta-compact .canasta-card,
body.meld-size-l .graveyard-canasta .canasta-compact .canasta-card { width: 54px; height: 74px; }
body.meld-size-l .canasta-compact .cc-rank { font-size: 22px; }
body.meld-size-l .canasta-compact .cc-type { font-size: 8px; }

/* ═══ 8. Video panel (Nov 5) — one floating box, drag by title, resize corner ═ */
.voice-btn#btn-camera.active { background: rgba(76,175,80,0.4); border-color: #4caf50; color: #81c784; }
.video-panel {
  position: fixed; top: 110px; right: 16px; z-index: 800;
  width: 300px; min-width: 170px; max-width: 95vw; min-height: 70px; max-height: 85vh;
  background: rgba(10,30,10,0.92); border: 1px solid var(--gold); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden; resize: both;
}
.video-panel.hidden { display: none !important; }
.video-panel.dragging { opacity: 0.85; user-select: none; }
.video-panel.minimized { height: auto !important; min-height: 0; resize: none; }
.video-panel.minimized .video-grid { display: none; }
.video-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px 5px 12px; background: var(--felt-dark); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--gold-light); font-weight: bold; cursor: grab; touch-action: none; flex-shrink: 0;
}
.video-panel.dragging .video-panel-head { cursor: grabbing; }
.video-panel-btn {
  background: none; border: 1px solid var(--border); color: var(--text); border-radius: 4px;
  width: 24px; height: 22px; cursor: pointer; font-size: 13px; line-height: 1;
}
.video-panel-btn:hover { background: rgba(255,255,255,0.12); }
.video-grid {
  flex: 1; min-height: 0; overflow: auto; padding: 6px;
  display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); align-content: start;
}
.video-panel[data-count="1"] .video-grid { grid-template-columns: 1fr; }
.video-tile { position: relative; background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 3; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-tile.is-me video { transform: scaleX(-1); } /* mirror your own preview */
.video-name {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 4px;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; font-family: Arial, sans-serif;
}

/* ═══ 9. FAQ scoring info (Nov 5) ═══════════════════════════════════════ */
.faq-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.faq-head h3 { margin-bottom: 0 !important; }
.faq-scoring { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.faq-scoring h4 { color: var(--gold-light); font-size: 14px; margin: 14px 0 6px; }
.faq-scoring .fs-lead { font-size: 13px; line-height: 1.5; color: var(--text); }
.faq-scoring .fs-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.fs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fs-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,0.07); vertical-align: top; }
.fs-table td:last-child { text-align: right; color: var(--gold-light); font-family: monospace; white-space: nowrap; }
.fs-table.fs-rows td:first-child { white-space: nowrap; color: var(--gold-light); font-weight: bold; width: 1%; }
.fs-table.fs-rows td:last-child { text-align: left; color: var(--text); font-family: inherit; white-space: normal; }
