/* Online play: lobby, rooms, chat, count battles and the shared table. */

.online { max-width: 1100px; }
.small { font-size: 0.82rem; }
.tag {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.4rem; border-radius: 6px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; background: rgba(255, 255, 255, 0.1); color: var(--muted); vertical-align: middle;
}
.tag.host { background: rgba(227, 188, 95, 0.2); color: var(--gold); }
.tag.you { background: rgba(132, 200, 255, 0.18); color: var(--info); }
.tag.off { background: rgba(255, 130, 119, 0.15); color: var(--bad); }

/* ---- lobby ---- */
.ol-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.ol-who { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ol-who .text-input { width: 12rem; min-height: 36px; padding: 0.35rem 0.6rem; }
.ol-online { font-weight: 600; }
.ol-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ol-card h2 { margin: 0 0 0.3rem; }
.ol-card p { margin: 0 0 0.8rem; }
.ol-card .row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ol-code { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.ol-code .text-input.code { width: 8.5rem; text-transform: uppercase; letter-spacing: 0.15em; font-family: ui-monospace, Consolas, monospace; min-height: 40px; }
.ol-rooms { width: 100%; border-collapse: collapse; margin-bottom: 1.2rem; }
.ol-rooms td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ol-rooms td:last-child { text-align: right; }
.ol-boards .seg { flex-wrap: wrap; margin-bottom: 0.4rem; }
.ol-board, .b-scores, .b-standings { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ol-board li {
  counter-increment: rank; display: grid; grid-template-columns: 2rem 1fr auto auto; gap: 0.6rem; align-items: center;
  padding: 0.4rem 0.2rem; border-bottom: 1px solid var(--line);
}
.ol-board li::before { content: counter(rank); color: var(--dim); font-weight: 700; text-align: right; }
.ol-board li.me, .b-scores li.me, .b-standings li.me, .room-members li.me { color: var(--gold); }
.pts { font-weight: 800; text-align: right; }

/* ---- room shell ---- */
.room-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 0.8rem; }
.room-head h1 { margin: 0; }
.room-code { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.room-code strong { font-size: 1.2rem; letter-spacing: 0.12em; color: var(--gold); }
.room-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1rem; align-items: start; }
.room-side .panel { margin-bottom: 0.8rem; }
.room-side h3 { margin: 0 0 0.5rem; }
.room-members { list-style: none; margin: 0; padding: 0; }
.room-members li { display: flex; align-items: center; flex-wrap: wrap; gap: 0.15rem; padding: 0.25rem 0; }
.room-members .who { font-weight: 600; color: inherit; text-decoration: none; padding: 0; }
.room-members .who:disabled { cursor: default; opacity: 1; }
.room-members .muted-name { text-decoration: line-through; color: var(--dim); }
.room-members .kick { margin-left: auto; padding: 0.15rem 0.5rem; }
.room-chat { display: flex; flex-direction: column; }
.chat-list { height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.5rem; padding-right: 0.2rem; overflow-wrap: anywhere; }
.chat-msg { font-size: 0.9rem; line-height: 1.35; }
.chat-msg strong { margin-right: 0.1rem; }
.chat-msg.me strong { color: var(--gold); }
.chat-msg.system { color: var(--dim); font-style: italic; font-size: 0.82rem; }
.chat-form { display: flex; gap: 0.4rem; }
.chat-form .text-input { min-height: 38px; padding: 0.4rem 0.6rem; }
.room-chat .small { margin: 0.5rem 0 0; }

/* ---- count battle ---- */
.battle { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; min-height: 420px; display: flex; flex-direction: column; gap: 0.8rem; }
.b-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.b-score strong { font-size: 1.3rem; color: var(--gold); }
.b-timer { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.b-timer i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width 0.1s linear; }
.b-timer.low i { background: var(--bad); }
.b-stage { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.7rem; }
.b-intro .b-count { font: 800 5rem/1 Georgia, serif; color: var(--gold); }
.b-flash .flash { justify-content: center; }
.b-progress { font-variant-numeric: tabular-nums; }
.b-q { font-size: 1.25rem; font-weight: 700; }
.b-help { margin: 0; max-width: 46ch; }
.b-tc { display: flex; align-items: center; gap: 1.5rem; text-align: left; }
.b-tc .big { font-size: 2.6rem; font-weight: 800; }
.b-hand { display: flex; align-items: flex-end; justify-content: center; gap: 1.6rem; flex-wrap: wrap; }
.b-hand .zone-label { text-align: center; margin-bottom: 0.3rem; }
.b-reveal { display: flex; flex-direction: column; gap: 0.3rem; align-items: center; }
.b-answer strong { font-size: 1.8rem; color: var(--gold); }
.b-you { font-size: 1.15rem; font-weight: 700; }
.b-form { display: flex; justify-content: center; }
.b-form .answer-form { justify-content: center; }
.b-locked { font-weight: 600; color: var(--muted); }
.b-scores li, .b-standings li { display: grid; grid-template-columns: 1fr auto 4rem; gap: 0.6rem; align-items: center; padding: 0.35rem 0.2rem; border-bottom: 1px solid var(--line); }
.b-scores .st { font-weight: 700; text-align: right; }
.b-wait { align-self: stretch; text-align: left; display: flex; flex-direction: column; gap: 0.8rem; }
.b-wait h2, .b-wait p { margin: 0; }
.b-wait .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }
.b-settings { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.b-final { align-self: stretch; display: flex; flex-direction: column; gap: 0.8rem; }
.b-final .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; justify-content: center; }
.b-standings li { grid-template-columns: 2.2rem 1fr 4rem auto auto; text-align: left; }
.b-standings .place { font-size: 1.3rem; text-align: center; }
.b-standings .rating { font-weight: 700; font-size: 0.9rem; }

/* ---- shared table: the solo table's layout (table.css), plus seats for other players ---- */
body[data-view="online-table"] .online { max-width: none; }
@media (min-width: 641px) {
  body[data-view="online-table"] main { max-width: 1500px; padding: 0.6rem 1rem 0.7rem; }
}
@media (max-width: 640px) {
  body[data-view="online-table"] .topbar { display: none; }
  body[data-view="online-table"] main { padding: 0; }
}
.st-barin { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; font-size: 0.85rem; }
.st-barin .btn.sm { padding: 0.25rem 0.65rem; }
.st-code { color: var(--gold); letter-spacing: 0.12em; }
.st-barin .st-rules { font-size: 0.75rem; }
.online-table .hud-btns { display: flex; align-items: center; gap: 0.5rem; }
@media (min-width: 1051px) { .online-table .side .feedback { flex: 1 1 0; min-height: 90px; } }
.online-table .side .feedback:empty::after { content: "Your bets, plays and count checks are graded here. Only you see this."; color: var(--dim); font-size: 0.82rem; }

/* Players and chat: in the side column on wide screens, a pop-out panel otherwise. */
.table-chat {
  display: flex; flex-direction: column; gap: 0.4rem; min-height: 0; flex: 1.3 1 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.7rem;
}
.table-chat .tc-head { display: flex; align-items: center; justify-content: space-between; }
.table-chat h3 { margin: 0; font: 600 0.68rem system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.table-chat .room-members { max-height: 7rem; overflow-y: auto; font-size: 0.88rem; }
.table-chat .chat-list { height: auto; flex: 1; min-height: 70px; margin: 0; }
.table-chat .chat-note { margin: 0; }
.tc-close { display: none; }
.chat-toggle .unread { margin-left: 0.35rem; background: var(--bad); color: #fff; border-radius: 999px; padding: 0 0.42rem; font-size: 0.72rem; font-weight: 800; }
.chat-toggle .unread:empty { display: none; }
.st-barin .chat-toggle { display: none; }
@media (max-width: 1050px) {
  .st-barin .chat-toggle { display: inline-flex; }
  .online-table .table-chat {
    display: none; position: fixed; z-index: 60; right: 0.6rem; bottom: calc(var(--tab-h, 0px) + 0.6rem);
    width: min(380px, calc(100vw - 1.2rem)); height: min(72dvh, 560px);
    background: #0b2a1f; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  }
  .online-table .table-chat.open { display: flex; }
  .tc-close { display: inline-flex; }
}

/* Other players: small cards, their bet, stack and what they're doing. */
.online-table .seat.other .slot { --cw: var(--cw-other); }
.online-table .other-hands { display: flex; gap: 0.3rem; }
.online-table .other-hand { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.15rem; border-radius: 10px; }
.online-table .other-hand.active { background: rgba(227, 188, 95, 0.18); box-shadow: 0 0 0 2px rgba(227, 188, 95, 0.55); }
.online-table .other-meta { display: flex; align-items: center; gap: 0.25rem; min-height: 1.35rem; font-size: 0.8rem; }
.online-table .seat.other .zone-label { margin: 0; gap: 0.2rem; }
.online-table .o-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-table .o-sub { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); text-align: center; white-space: nowrap; }
.online-table .seat.other.empty { opacity: 0.65; }
.online-table .sit-btn { margin-top: 0.2rem; }
.online-table .seat.me.watching { gap: 0.3rem; }
@media (min-width: 641px) {
  /* Lift the side seats clear of the felt's curved corners. */
  .online-table .seats .others { padding-bottom: 1.6rem; }
}
@media (min-width: 641px) and (max-width: 1050px) {
  .online-table .side .hud-info { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .online-table .side .hud-info .stat:first-child { grid-column: auto; }
  .online-table .hud-btns { flex-direction: column; align-items: stretch; gap: 0.3rem; }
}

/* The dock: the latest table event, a prompt with its timer, then your controls. */
.st-event { text-align: center; color: var(--gold); font-size: 0.85rem; min-height: 1.25em; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-table .controls { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.st-prompt { display: flex; align-items: center; gap: 0.8rem; font-weight: 700; flex-wrap: wrap; justify-content: center; }
.st-msg { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.6rem 0; }
.st-timer { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; color: var(--muted); }
.st-timebar { display: inline-block; width: 90px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.st-timebar i { display: block; height: 100%; width: 100%; background: var(--gold); transition: width 0.2s linear; }
.online-table .check-title { display: flex; align-items: center; gap: 0.6rem; }
@media (max-width: 640px) {
  .st-event { font-size: 0.75rem; margin-bottom: 0.15rem; }
  .online-table .st-prompt { font-size: 0.85rem; }
  .online-table .st-msg { padding: 0.3rem 0; font-size: 0.85rem; }
  .online-table .m-count { font-size: 0.78rem; }
  .online-table .o-name { max-width: 7ch; }
  /* Your hand shows its total, so leave it a little more room than the solo table. */
  .table-view.online-table { --cw-me: min(15.5cqh, 88px); }
  .online-table .seat.me .zone-label.you { display: none; }
  .online-table .my-hand .hand-meta { position: absolute; top: -0.35rem; right: -0.35rem; z-index: 4; margin: 0; min-height: 0; }
  .online-table .seat.me.watching .zone-label.you { display: flex; }
}

@media (max-width: 900px) {
  .room-body { grid-template-columns: 1fr; }
  .chat-list { height: 200px; }
}
@media (max-width: 640px) {
  .ol-cards { grid-template-columns: 1fr; }
  .ol-rooms td:nth-child(2) { display: none; }
  .b-tc { flex-direction: column; text-align: center; }
  .b-standings li { grid-template-columns: 2rem 1fr 3.4rem; }
  .b-standings li > :nth-child(4), .b-standings li > :nth-child(5) { grid-column: 2 / -1; font-size: 0.82rem; }
}
