/* ---- The Open-Face Chinese table ---- */
#ofc { max-width: 560px; margin: 0 auto; --ofc-w: 44px; --ofc-gap: 4px; }
#ofc-title { text-align: center; font-weight: 700; font-size: 0.9rem; padding: 0 48px; min-height: 1.3em; margin-bottom: 6px; }

/* A player's bar: picture, name, score. */
#ofc .ofc-bar { position: relative; display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 4px 8px; border-radius: 10px; min-height: 44px; border: 1px solid transparent; }
#ofc .ofc-bar.ofc-turn { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }
#ofc .ofc-bar.ofc-vacant { cursor: pointer; }
#ofc .ofc-bar.ofc-vacant .ofc-name { text-decoration: underline; }
#ofc .ofc-cam { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: #000; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); flex: none; }
#ofc .ofc-cam.ofc-mirror { transform: none; /* my own picture is shown as the others see it, not mirrored */ }
#ofc .ofc-cam.blank { display: none; }
#ofc .ofc-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#ofc .ofc-tag { font-size: 0.72rem; color: #1b1b1b; background: var(--t15); border-radius: 999px; padding: 1px 8px; font-weight: 700; flex: none; }
#ofc .ofc-tag.ofc-fl { background: #c9a2ff; }
#ofc .ofc-first { font-size: 0.72rem; flex: none; }
#ofc .ofc-score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.2rem; padding: 2px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); color: var(--muted); flex: none; }
#ofc .ofc-score.ofc-plus { color: #8fe0a0; }
#ofc .ofc-score.ofc-minus { color: #ffb4a9; }

/* A board: three rows of slots, with what each row makes beside it. */
#ofc .ofc-board { position: relative; margin: 0 auto; padding: 6px 8px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--t0); }
#ofc .ofc-top-board { --ofc-w: 34px; --ofc-gap: 3px; }
#ofc .ofc-row { display: flex; align-items: center; gap: 8px; padding: 2px; border-radius: 8px; border: 1px solid transparent; }
#ofc .ofc-slots { display: flex; justify-content: center; gap: var(--ofc-gap); flex: none; width: calc(var(--ofc-w) * 5 + var(--ofc-gap) * 4); }
#ofc .ofc-board .card { width: var(--ofc-w); height: calc(var(--ofc-w) * 1.36); font-size: calc(var(--ofc-w) * 0.4); border-radius: 5px; flex: none; }
#ofc .ofc-board .card .suit { font-size: calc(var(--ofc-w) * 0.42); }
#ofc .ofc-board .card.back { border-width: 2px; }
#ofc .ofc-note { flex: 1; min-width: 0; font-size: 0.74rem; line-height: 1.2; }
#ofc .ofc-made { font-weight: 600; }
#ofc .ofc-roy { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--t17); font-weight: 800; font-size: 0.72rem; }
#ofc .ofc-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.66rem; }
#ofc .ofc-secret { text-align: left; margin: 4px 2px 0; }
/* My board while I am placing: rows are buttons. */
#ofc .ofc-placing .ofc-row { cursor: pointer; border-color: rgba(255, 255, 255, 0.14); margin: 2px 0; -webkit-tap-highlight-color: transparent; }
#ofc .ofc-placing .ofc-row:active { background: rgba(255, 255, 255, 0.07); }
#ofc .card.ofc-draft { cursor: pointer; box-shadow: 0 0 0 2px var(--accent), 0 2px 4px rgba(0, 0, 0, 0.4); }
/* After the hand: rows won and lost, and a fouled board. */
#ofc .ofc-row.ofc-won { background: rgba(var(--r1), 0.16); border-color: rgba(var(--r1), 0.55); }
#ofc .ofc-row.ofc-lost .card { opacity: 0.6; }
#ofc .ofc-board.ofc-fouled .card { opacity: 0.4; }
#ofc .ofc-foulmark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); padding: 2px 14px; border: 3px solid var(--danger); border-radius: 8px; color: #ffb4a9; background: rgba(0, 0, 0, 0.6); font-weight: 800; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.08em; pointer-events: none; }

#ofc-status { text-align: center; font-weight: 700; min-height: 1.5em; margin: 6px 0; }
#ofc-error { text-align: center; min-height: 1.2em; margin: 4px 0 0; }
#ofc .ofc-warn { text-align: center; margin: 6px 0 0; padding: 5px 8px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; color: var(--t15); background: rgba(var(--r1), 0.12); border: 1px solid rgba(var(--r1), 0.5); }
#ofc .ofc-warn.ofc-sure { color: #ffb4a9; background: rgba(217, 83, 79, 0.15); border-color: var(--danger); }

/* The cards I have been dealt. */
#ofc-dealt { margin-top: 8px; }
#ofc-dealt .small { margin: 0 0 6px; }
#ofc .ofc-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 72px; }
#ofc .ofc-hand .card { width: 50px; height: 70px; font-size: 1.25rem; cursor: pointer; flex: none; transition: transform 0.1s; -webkit-tap-highlight-color: transparent; }
#ofc .ofc-hand.ofc-many { gap: 5px; }
#ofc .ofc-hand.ofc-many .card { width: 40px; height: 56px; font-size: 1.05rem; }
#ofc .ofc-hand.ofc-many .card .suit { font-size: 1.05rem; }
#ofc .ofc-hand .card.ofc-picked { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgba(0, 0, 0, 0.6); }
#ofc .ofc-hand .card.ofc-discard { opacity: 0.45; cursor: default; }
#ofc-undo { flex: 0 1 38%; }

/* The result of a hand. */
#ofc .ofc-result { margin: 10px 0 0; padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--t0); }
#ofc .ofc-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 3px 8px; font-size: 0.8rem; align-items: center; }
#ofc .ofc-cell { min-width: 0; padding: 2px 4px; border-radius: 6px; line-height: 1.25; }
#ofc .ofc-cell.ofc-head { color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ofc .ofc-cell.ofc-win { background: rgba(var(--r1), 0.16); font-weight: 700; }
#ofc .ofc-cell.ofc-total { font-size: 1rem; font-weight: 800; border-top: 1px solid var(--t0); border-radius: 0; padding-top: 5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
#ofc .ofc-point { margin-left: 5px; color: var(--accent); font-weight: 800; }
#ofc .ofc-flnote { color: #c9a2ff; font-weight: 700; }
#ofc .ofc-rules { margin-top: 10px; }
#ofc-bot { margin-top: 10px; }
#ofc-bot-levels { flex-wrap: wrap; justify-content: center; }
#ofc-bot-levels button { flex: 1 1 150px; }

/* Mr.GTO's speech bubble. */
#ofc .ofc-bubble { position: absolute; left: 8px; top: calc(100% + 4px); z-index: 5; max-width: min(320px, 86%); background: #fdfdfd; color: #161616; border-radius: 12px; padding: 7px 11px; font-size: 0.88rem; font-weight: 600; line-height: 1.25; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); pointer-events: none; }
#ofc .ofc-bubble::after { content: ''; position: absolute; left: 18px; top: -12px; border: 6px solid transparent; border-bottom-color: #fdfdfd; }
#ofc .ofc-bubble.ofc-up { top: auto; bottom: calc(100% + 4px); }
#ofc .ofc-bubble.ofc-up::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: #fdfdfd; }
#ofc .ofc-bubble.ofc-pop { animation: ofc-pop 0.22s ease-out; }
@keyframes ofc-pop { from { transform: scale(0.7); opacity: 0; } }

@media (max-width: 699px) {
  /* Room on the right for the column of round buttons. */
  #ofc { padding-top: 46px; --ofc-w: 38px; --ofc-gap: 3px; } /* room for the row of round buttons along the top */
  #ofc-title { padding: 0; }
  #ofc .ofc-top-board { --ofc-w: 28px; --ofc-gap: 2px; }
  #ofc .ofc-board { padding: 4px 5px; }
  #ofc .ofc-row { gap: 6px; }
  #ofc .ofc-note { font-size: 0.68rem; }
  #ofc .ofc-score { font-size: 1.05rem; }
  #ofc .ofc-hand .card { width: 46px; height: 64px; }
  #ofc .ofc-hand.ofc-many .card { width: 34px; height: 48px; font-size: 0.95rem; }
  #ofc .ofc-hand.ofc-many .card .suit { font-size: 0.95rem; }
}
@media (max-width: 380px) {
  #ofc { --ofc-w: 34px; }
}

@media (max-width: 699px) { #ofc .ofc-cam { width: 56px; height: 56px; } }
