/* Bocce — "the garden party": a terracotta-clay card with cream buttons, the lawn drawn on a canvas by
   bocce.js inside a wooden court frame. Layout and button basics come from cb-arcade.css. */
/* the dialog lives in the top layer, outside .bc-page, so it gets the same tokens */
.bc-page, .bc-dlg {
  --ink: #fff7e8; --ink-2: #f0dcc0; --ink-3: #c9a98a;
  --clay-1: #7a3b22; --clay-2: #5a2a17; --clay-3: #3a1a0d;
  --cream-hi: #fffaf0; --cream-1: #f6e6c4; --cream-2: #e2c58e; --cream-3: #a8834a; --cream-4: #7d5f30;
  --red: #c8323a; --grn: #2f8a57; --gold: #ffd38a;
}
.bc-page [hidden], .bc-dlg [hidden] { display: none !important; }

/* ---------- who to play ---------- */
.bc-tabs { display: flex; gap: 4px; margin: 0 0 10px; padding: 4px; border-radius: 15px;
  background: linear-gradient(180deg, var(--clay-1), var(--clay-2)); box-shadow: inset 0 1px 0 rgba(255, 220, 190, .12), 0 6px 16px -8px rgba(58, 26, 13, .6); }
.bc-tabs button { flex: 1; border: 0; background: transparent; padding: 10px 4px; border-radius: 11px; font: 900 14px var(--cbx-body); color: var(--ink-3); cursor: pointer; min-height: 44px; transition: color .2s; }
.bc-tabs button:hover { color: var(--ink); }
.bc-tabs button[aria-selected="true"] { color: var(--clay-3); background: linear-gradient(180deg, var(--cream-hi), var(--cream-1) 45%, var(--cream-2));
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--cream-3), 0 6px 12px -4px rgba(0, 0, 0, .45); }

/* ---------- the card ---------- */
.cbx-card.bc-card { --cbx-full-pad: 6px; padding: 10px 12px 12px; color: var(--ink); overflow: visible; isolation: isolate;
  background: radial-gradient(120% 40% at 50% -5%, rgba(255, 200, 120, .2), transparent 60%), linear-gradient(180deg, var(--clay-1), var(--clay-2) 50%, var(--clay-3));
  border: 1px solid rgba(255, 230, 200, .08);
  box-shadow: 0 1px 0 rgba(255, 230, 200, .1) inset, 0 34px 70px -28px rgba(58, 26, 13, .8), 0 10px 24px -12px rgba(58, 26, 13, .5); }
.cbx-card.bc-card p { color: inherit; }
.bc-card .cb-rv-slot { color: initial; }

.bc-banner, .cbx-card .bc-banner { margin: 0 0 8px; padding: 9px 14px; border-radius: 14px; color: #fff4dc; font: 800 14px/1.4 var(--cbx-body);
  background: linear-gradient(135deg, rgba(255, 211, 138, .22), rgba(255, 211, 138, .06)); border: 1px solid rgba(255, 211, 138, .35); }
.bc-banner b { color: var(--gold); }

/* the court: as big as the phone allows (bocce.js measures and sets --cw) */
.bc-page { --cw: min(calc(100vw - 44px), 360px); }
.bc-side { width: var(--cw); margin: 0 auto; }
.bc-players { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 0 0 6px; }
.bc-chip { min-width: 0; padding: 6px 10px; border-radius: 13px; background: rgba(255, 245, 230, .07); border: 2px solid rgba(255, 245, 230, .09); }
.bc-chip.turn { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 211, 138, .22), rgba(255, 211, 138, .05)); }
.bc-chip.won { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 211, 138, .35); }
.bc-chip .nm { display: flex; align-items: center; gap: 6px; font: 900 15px/1.2 var(--cbx-body); white-space: nowrap; overflow: hidden; }
.bc-chip .nm span { overflow: hidden; text-overflow: ellipsis; }
.bc-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.bc-dot.a { background: var(--red); } .bc-dot.b { background: var(--grn); } .bc-dot.j { background: #f6f1e0; }
.bc-balls { display: flex; gap: 4px; margin-top: 4px; min-height: 9px; }
.bc-balls i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, .3); }
.bc-balls.a i { background: var(--red); } .bc-balls.b i { background: var(--grn); }
.bc-balls i.used { opacity: .2; }
.bc-chip .lbl { display: block; font: 900 10px/1.3 var(--cbx-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-chip .big { font: 900 20px/1.1 'Fraunces', Georgia, serif; color: #fff; }
.bc-score { font: 900 26px/1 'Fraunces', Georgia, serif; color: #fff; text-align: center; white-space: nowrap; }
.bc-score small { display: block; font: 900 10px var(--cbx-body); letter-spacing: .12em; color: var(--ink-3); margin-top: 3px; }

.bc-status, .cbx-card .bc-status { margin: 0 0 8px; min-height: 19px; text-align: center; font: 800 14px/1.35 var(--cbx-body); color: var(--ink-2); }
.cbx-card .bc-status b { color: #fff; }
.cbx-card .bc-status.good { color: var(--gold); } .cbx-card .bc-status.bad { color: #ffb3a3; }

.bc-stage { position: relative; width: var(--cw); margin: 9px auto; border-radius: 10px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 7px #8a5a32, 0 0 0 9px #5c3a1d, 0 18px 30px -12px rgba(0, 0, 0, .6); }
.bc-stage { container-type: inline-size; }
.bc-stage canvas { display: block; width: 100%; height: auto; }
.bc-skip { position: absolute; right: 10px; top: 10px; }
.bc-skip.cbx-btn { min-height: 38px; padding: 6px 14px; font-size: 14px; }

/* the end of a frame: the measuring pill, the result and the next-frame button sit over the court's near end */
.bc-end { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px; display: grid; gap: 8px; justify-items: center;
  background: linear-gradient(180deg, transparent, rgba(40, 18, 8, .25) 28%, rgba(40, 18, 8, .55)); animation: bc-up .35s ease-out; }
@keyframes bc-up { from { opacity: 0; transform: translateY(14px); } }
.bc-pill { padding: 8px 16px; border-radius: 999px; font: 900 15px var(--cbx-body); color: var(--clay-3); background: var(--cream-hi); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); white-space: nowrap; }
.bc-result { width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(90, 42, 23, .92), rgba(58, 26, 13, .92));
  border: 1px solid rgba(255, 211, 138, .4); backdrop-filter: blur(3px); }
.bc-result h3 { margin: 0; font: 900 20px/1.15 'Fraunces', Georgia, serif; color: #fff; }
.cbx-card .bc-result p { margin: 3px 0 0; font: 800 13px/1.35 var(--cbx-body); color: var(--ink-2); }
.bc-end .cbx-btn { min-height: 46px; font-size: 16px; }

.bc-card .cbx-btn { border-radius: 14px; font-weight: 900; }
.bc-card .cbx-btn.alt { background: linear-gradient(180deg, rgba(255, 245, 230, .13), rgba(255, 245, 230, .05)); color: var(--ink); border: 1px solid rgba(255, 230, 200, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 3px 0 rgba(0, 0, 0, .35); }
.bc-card .cbx-btn:not(.alt) { background: linear-gradient(180deg, var(--cream-hi), var(--cream-1) 45%, var(--cream-2)); color: var(--clay-3); border: 0;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 var(--cream-3), 0 4px 0 var(--cream-4); }
.bc-card .cbx-btn:active { transform: translateY(3px); }
.bc-under { width: var(--cw); margin: 0 auto; }
.bc-send { display: grid; gap: 8px; margin: 12px 0 0; }
.bc-send .cbx-btn { animation: bc-sendglow 2.4s ease-in-out infinite; }
@keyframes bc-sendglow { 50% { box-shadow: inset 0 1px 0 #fff, 0 3px 0 var(--cream-3), 0 4px 0 var(--cream-4), 0 0 28px rgba(255, 211, 138, .65); } }
.bc-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.bc-actions:not(:has(.cbx-btn:not([hidden]))) { display: none; }
.bc-actions .cbx-btn { min-height: 44px; padding: 9px 16px; font-size: 15px; }
.bc-stats, .cbx-card .bc-stats { margin: 10px 0 0; text-align: center; font: 800 14px/1.4 var(--cbx-body); color: var(--ink-3); }
.bc-stats b { color: var(--gold); }
.bc-hint, .cbx-card .bc-hint { margin: 12px 2px 0; font: 800 13px/1.4 var(--cbx-body); color: var(--ink-3); text-align: center; }

/* ---------- vs the computer: level ---------- */
.bc-level { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 auto 8px; font: 900 13px var(--cbx-body); color: var(--ink-3); }
.bc-level button { border: 1px solid rgba(255, 230, 200, .18); background: rgba(255, 245, 230, .07); color: var(--ink-2); font: 900 13px var(--cbx-body); padding: 6px 14px; min-height: 34px; border-radius: 999px; cursor: pointer; }
.bc-level button[aria-pressed="true"] { color: var(--clay-3); border-color: transparent; background: linear-gradient(180deg, var(--cream-hi), var(--cream-1) 45%, var(--cream-2)); box-shadow: inset 0 1px 0 #fff, 0 2px 0 var(--cream-3); }

/* ---------- start a friend game ---------- */
.bc-dlg { border: 0; padding: 0; border-radius: 22px; width: min(420px, calc(100vw - 32px)); color: #2a1408;
  background: linear-gradient(180deg, var(--cream-hi), #f6ecd8); box-shadow: inset 0 0 0 1.5px rgba(168, 131, 74, .55), 0 30px 80px rgba(0, 0, 0, .45); }
.bc-dlg::backdrop { background: rgba(40, 18, 8, .6); backdrop-filter: blur(3px); }
.bc-dlg-card { padding: 20px; }
.bc-dlg h2 { margin: 0 0 6px; font: 900 22px 'Fraunces', Georgia, serif; color: #2a1408; }
.bc-dlg p { margin: 0 0 12px; font: 800 15px/1.45 'Nunito', system-ui, sans-serif; color: #7a5d48; }
.bc-field { display: grid; gap: 4px; margin: 0 0 10px; font: 900 13px 'Nunito', system-ui, sans-serif; color: #5a3a24; }
.bc-field input { font: 800 17px 'Nunito', system-ui, sans-serif; padding: 11px 12px; border: 2px solid var(--cream-2); border-radius: 12px; background: #fffdf7; color: #2a1408; }
.bc-field input:focus { outline: none; border-color: var(--clay-1); box-shadow: 0 0 0 3px rgba(162, 83, 46, .25); }
.bc-choice { display: flex; gap: 8px; margin: 4px 0 10px; }
.bc-choice label { flex: 1; display: grid; place-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px; border: 2px solid var(--cream-2); background: #fffdf7;
  font: 900 14px 'Nunito', system-ui, sans-serif; color: #5a3a24; cursor: pointer; text-align: center; }
.bc-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bc-choice label:has(input:checked) { border-color: var(--clay-1); background: #fbeee0; box-shadow: 0 2px 0 var(--clay-2), 0 0 0 3px rgba(162, 83, 46, .2); }
.bc-choice label:has(input:focus-visible) { outline: 3px solid var(--clay-1); outline-offset: 2px; }
.bc-choice .em { font-size: 22px; line-height: 1; }
.bc-dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.bc-dlg .cbx-btn { border-radius: 14px; }
.bc-dlg .cbx-btn:not(.alt) { background: linear-gradient(180deg, #a2532e, var(--clay-1)); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 3px 0 var(--clay-3); }
.bc-dlg .cbx-btn.alt { background: #fffdf7; color: #5a3a24; box-shadow: inset 0 0 0 2px var(--cream-2), 0 3px 0 var(--cream-3); }
.bc-mine { margin-top: 14px; border-top: 2px solid var(--cream-2); padding-top: 10px; }
.bc-mine h3 { margin: 0 0 6px; font: 900 14px 'Nunito', system-ui, sans-serif; }
.bc-mine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bc-mine a { display: block; padding: 9px 12px; border-radius: 10px; background: #fffdf7; box-shadow: inset 0 0 0 1.5px var(--cream-2); font: 800 14px 'Nunito', system-ui, sans-serif; color: #2a1408; text-decoration: none; }

@media (max-width: 560px) {
  .cbx-card.bc-card { --cbx-full-pad: 4px; padding: 8px 8px 12px; }
  .bc-page .cbx-hero { margin: 0 0 10px; }
  .bc-page .cbx-kicker { font-size: 11px; }
  .bc-page .cbx-sub { font-size: 14px; line-height: 1.35; }
  .bc-tabs { margin-bottom: 8px; }
  .bc-tabs button { min-height: 40px; padding: 6px 2px; font-size: 13px; line-height: 1.15; }
  .bc-banner, .cbx-card .bc-banner { margin-bottom: 6px; padding: 8px 12px; font-size: 13px; line-height: 1.4; }
}
@media (max-width: 360px) { .bc-tabs button { font-size: 12px; } .bc-chip { padding: 5px 8px; } .bc-chip .nm { font-size: 14px; } .bc-score { font-size: 22px; } }
@media (max-width: 560px) and (max-height: 740px) { .bc-page .cbx-sub { display: none; } }

/* phone on its side: the court on the right, everything else beside it (bocce.js adds .bc-wide) */
.bc-wide .cbx-card.bc-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; column-gap: 18px; align-items: start; }
.bc-wide .bc-banner { grid-column: 1; grid-row: 1; }
.bc-wide .bc-side { grid-column: 1; grid-row: 2; width: auto; margin: 0; }
.bc-wide .bc-under { grid-column: 1; grid-row: 3; width: auto; margin: 0; }
.bc-wide .bc-stage { grid-column: 2; grid-row: 1 / span 3; margin: 9px; }
.bc-wide .bc-end { padding: 8px; gap: 6px; }
.bc-wide .bc-result h3 { font-size: 17px; }

/* a small court: keep the end-of-frame box low so the measuring stays in sight */
@container (max-width: 330px) {
  .bc-end { padding: 6px; gap: 5px; }
  .bc-pill { padding: 5px 12px; font-size: 13px; }
  .bc-result { padding: 6px 10px; border-radius: 12px; }
  .bc-result h3 { font-size: 16px; }
  .cbx-card .bc-result p { font-size: 12px; margin-top: 1px; }
  .bc-end .cbx-btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .bc-send .cbx-btn, .bc-end { animation: none; } .bc-card .cbx-btn:active { transform: none; } }
