/* ---- The Ólsen Ólsen table ---- */
/* Everything here lives inside #olsen, which olsen.js fills. Colours and the
   look of the cards come from style.css. */
#olsen { max-width: 620px; margin: 0 auto; }
#ol-title { text-align: center; font-weight: 700; font-size: 0.9rem; padding: 0 48px; min-height: 1.3em; margin-bottom: 6px; }

/* The players: the others along the top, me above my own cards. */
#ol-others { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#ol-me { margin-top: 8px; }
#olsen .ol-player { position: relative; display: flex; align-items: center; gap: 6px; flex: 1 1 150px; min-width: 0; min-height: 46px; padding: 4px 8px; border-radius: 10px; border: 1px solid var(--t0); background: rgba(0, 0, 0, 0.18); }
#olsen .ol-player.ol-turn { border-color: var(--accent); background: rgba(255, 255, 255, 0.07); box-shadow: 0 0 0 1px var(--accent); }
#olsen .ol-player.ol-won { border-color: var(--t15); }
#olsen .ol-player.ol-empty { opacity: 0.55; border-style: dashed; min-height: 34px; }
#olsen .ol-player.ol-vacant { opacity: 1; cursor: pointer; }
#olsen .ol-player.ol-vacant .ol-name { text-decoration: underline; }
#olsen .ol-who { flex: 1; min-width: 0; }
#olsen .ol-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#olsen .ol-empty .ol-name { font-weight: 400; font-size: 0.85rem; white-space: normal; }
#olsen .ol-info { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#olsen .ol-cam { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #000; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); flex: none; }
#olsen .ol-cam.ol-mirror { transform: none; /* my own picture is shown as the others see it, not mirrored */ }
#olsen .ol-cam.blank { display: none; }
#olsen .ol-count { display: flex; align-items: center; gap: 5px; flex: none; }
#olsen .ol-fan { display: flex; }
#olsen .ol-back { width: 13px; height: 19px; border-radius: 3px; margin-left: -7px; border: 1.5px solid var(--card); background: repeating-linear-gradient(45deg, #7b1e2b, #7b1e2b 3px, #932838 3px, #932838 6px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
#olsen .ol-back:first-child { margin-left: 0; }
#olsen .ol-num { font-weight: 700; font-variant-numeric: tabular-nums; }
#olsen .ol-badge { flex: none; font-size: 0.75rem; font-weight: 800; color: #1b1b1b; background: var(--t15); border-radius: 999px; padding: 2px 8px; animation: ol-pulse 1s ease-in-out infinite alternate; }
#olsen .ol-clock { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.9rem; padding: 2px 7px; border-radius: 8px; background: #f4f4f4; color: #111; }
#olsen .ol-clock.ol-low { background: #d93025; color: #fff; }
@keyframes ol-pulse { from { transform: scale(1); } to { transform: scale(1.1); } }

/* Table talk: a speech bubble under a player's box (above it, for mine). */
#olsen .ol-bubble { position: absolute; left: 8px; top: calc(100% + 4px); z-index: 5; width: max-content; max-width: min(300px, 78vw); 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; }
#olsen .ol-bubble::after { content: ''; position: absolute; left: 18px; top: -12px; border: 6px solid transparent; border-bottom-color: #fdfdfd; }
#olsen .ol-bubble.ol-up { top: auto; bottom: calc(100% + 4px); }
#olsen .ol-bubble.ol-up::after { top: auto; bottom: -12px; border-bottom-color: transparent; border-top-color: #fdfdfd; }
#olsen .ol-bubble.ol-pop { animation: ol-pop 0.22s ease-out; }
@keyframes ol-pop { from { transform: scale(0.7); opacity: 0; } }

/* The middle: the stock, the pile, the suit named with an 8. */
#ol-centre { display: flex; justify-content: center; align-items: flex-start; gap: 18px; margin: 14px auto 4px; padding: 14px 10px 10px; max-width: 380px; border-radius: 22px; background: var(--felt); border: 3px solid var(--felt-edge); }
#ol-centre[hidden], #ol-called[hidden], #ol-hand[hidden], #ol-me[hidden], #ol-actions[hidden], #ol-setup[hidden], #ol-suits[hidden], #ol-result[hidden] { display: none; }
#olsen .ol-stack { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 64px; }
#olsen .ol-stack .card { width: 58px; height: 80px; font-size: 1.4rem; }
#olsen .ol-stack .card .suit { font-size: 1.5rem; }
#olsen .ol-stack .card.ol-top { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 4px 12px rgba(0, 0, 0, 0.55); }
#olsen .ol-stack .card.ol-called-card { width: 46px; height: 46px; border-radius: 50%; margin-top: 17px; margin-bottom: 17px; box-shadow: 0 0 0 3px var(--accent); }
#olsen .ol-stack .card.ol-called-card .suit { font-size: 1.7rem; }
#olsen .ol-label { font-size: 0.72rem; color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
#ol-last { min-height: 1.3em; }
#ol-status { text-align: center; font-weight: 700; min-height: 1.5em; margin: 6px 0 2px; }
#ol-status.ol-go { color: var(--accent); }
#ol-error { text-align: center; min-height: 1.2em; margin: 0; }
#ol-hint { margin-top: 8px; }

/* How a round ended, and the scores. */
#ol-result { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent); text-align: center; }
#olsen .ol-result-head { font-weight: 800; font-size: 1.05rem; }
#olsen .ol-left { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
#olsen .ol-scores { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
#olsen .ol-score { font-weight: 700; font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
#olsen .ol-score.ol-score-won { background: var(--t15); color: #1b1b1b; }

/* My cards: they wrap onto more rows when there are many, so each stays big enough to tap. */
#ol-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 5px; margin: 10px 0 4px; padding-top: 10px; }
#olsen .ol-card { position: relative; padding: 0; margin: 0; border: 0; background: none; border-radius: 8px; min-height: 0; min-width: 0; flex: none; cursor: pointer; transition: transform 0.12s ease-out; -webkit-tap-highlight-color: transparent; }
#olsen .ol-card .card { width: 54px; height: 76px; font-size: 1.35rem; pointer-events: none; }
#olsen .ol-card .card .suit { font-size: 1.45rem; }
#ol-hand.ol-many .ol-card .card { width: 46px; height: 64px; font-size: 1.15rem; }
#ol-hand.ol-many .ol-card .card .suit { font-size: 1.25rem; }
#ol-hand.ol-lots .ol-card .card { width: 40px; height: 56px; font-size: 1rem; }
#ol-hand.ol-lots .ol-card .card .suit { font-size: 1.1rem; }
#olsen .ol-card.ol-can .card { box-shadow: 0 0 0 3px var(--accent), 0 3px 8px rgba(0, 0, 0, 0.5); }
#olsen .ol-card.ol-can { transform: translateY(-5px); }
#olsen .ol-card.ol-cannot .card { opacity: 0.55; }
#olsen .ol-card.ol-cannot { cursor: default; }
#olsen .ol-card.ol-picked { transform: translateY(-12px); }
#olsen .ol-card.ol-picked .card { box-shadow: 0 0 0 3px #fff, 0 0 14px 3px rgba(var(--r1), 0.9); }
#olsen .ol-order { position: absolute; top: -8px; right: -5px; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--t17); font-size: 0.75rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

/* Naming the suit after an 8. */
#ol-suits { margin: 6px 0; padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent); }
#ol-suits p { margin: 0 0 2px; }
#ol-suits .row { margin-top: 6px; align-items: center; }
#olsen .ol-suit { flex: 1; display: grid; place-items: center; padding: 4px 0; background: none; border-color: transparent; }
#olsen .ol-suit .card { width: 50px; height: 50px; pointer-events: none; }
#olsen .ol-suit .card .suit { font-size: 1.8rem; }
#ol-actions > button, #ol-setup > button { min-height: 46px; }
#ol-setup > button[hidden], #ol-actions > button[hidden] { display: none; }

@media (max-width: 699px) {
  /* Room on the right for the column of round buttons. */
  #olsen { padding-top: 46px; } /* room for the row of round buttons along the top */
  #ol-title { padding: 0; }
  #olsen .ol-player { flex-basis: 130px; padding: 3px 6px; }
  #olsen .ol-cam { width: 40px; height: 40px; }
  #olsen #ol-me .ol-cam, #olsen .ol-mine .ol-cam { width: 52px; height: 52px; }
  #ol-centre { gap: 12px; padding: 10px 6px 8px; }
}
@media (max-width: 400px) {
  #olsen .ol-card .card { width: 48px; height: 68px; font-size: 1.2rem; }
  #ol-hand.ol-many .ol-card .card { width: 42px; height: 59px; font-size: 1.05rem; }
  #ol-hand.ol-lots .ol-card .card { width: 38px; height: 53px; font-size: 0.95rem; }
  #olsen .ol-suit .card { width: 42px; height: 42px; }
}
