/* Teach-Off strategy play: the coach panel (coach.js), shared by index.html and 2d.html. The pages define the palette
   (--ink, --paper, --star, --yes, --no, --head, --body ...). Cozy classroom stickers; 16 px text minimum, 44 px targets. */
.cm { display: grid; gap: 8px; min-width: 0; font-size: 16px; }
.cm[hidden] { display: none !important; }
.cm-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 2.5px solid var(--ink); background: var(--paper-2); color: var(--ink); font: 600 16px/1 var(--head); cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); text-decoration: none; white-space: nowrap; flex: none; }
.cm-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.cm-btn.cm-go { background: var(--star); }
.cm-btn:disabled { opacity: .6; cursor: default; }
.cm-btn:focus-visible, .cm-card:focus-visible, .cm-k:focus-visible, .cm-tabs button:focus-visible { outline: 3px solid var(--pop); outline-offset: 2px; }

/* plan chip */
.cm-plan { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 2px 4px 2px 12px; background: var(--paper-2);
  border: 2.5px solid var(--ink); border-radius: 16px; }
.cm-plan-txt { flex: 1; min-width: 0; font: 700 16px/1.2 var(--body); }
.cm-plan-name { font: 700 17px/1.2 var(--head); white-space: nowrap; }
.cm-news { min-height: calc(2 * 1.3em); font: 700 16px/1.3 var(--body); color: var(--ink); }

/* tabs */
.cm-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cm-tabs button { min-height: 44px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--paper-2); color: var(--ink);
  font: 600 16px/1 var(--head); cursor: pointer; white-space: nowrap; }
.cm-tabs button[aria-selected=true] { background: var(--board, #2f5d46); color: var(--chalk, #f7f3e6); }
.cm-pct { font-size: 16px; opacity: .9; }
.cm-pane { display: grid; gap: 8px; min-width: 0; }
.cm-pane[hidden] { display: none !important; }

/* the NOW card: fixed height (a lesson coming or going never moves anything) */
.cm-now { position: relative; display: grid; gap: 6px; min-height: 186px; padding: 10px 12px; background: #fffdf6; border: 3px solid var(--ink);
  border-radius: 16px; box-shadow: 0 3px 0 var(--shadow); align-content: start;
  background-image: repeating-linear-gradient(180deg, transparent 0 29px, rgba(80,130,200,.14) 29px 30px); }
.cm-now.wasted { background-color: #f3efe6; }
.cm-now-h { display: flex; align-items: center; gap: 8px; min-height: 26px; font: 700 16px/1.2 var(--head); color: var(--ink-soft); }
.cm-now-n { flex: 1; min-width: 0; }
.cm-tag { font: 800 16px/1.15 var(--body); color: #1f6b30; text-align: right; }
.cm-tag.waste { color: #7a5a2a; }
.cm-tag.wrong { color: #b02a3a; }
.cm-thing { display: grid; gap: 2px; }
.cm-d { display: flex; align-items: center; gap: 8px; font: 700 18px/1.25 var(--head); min-height: 28px; }
.cm-ic { width: 26px; text-align: center; font-size: 20px; flex: none; }
.cm-m { display: inline-flex; gap: 3px; flex: none; }
.cm-m i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; }
.cm-m[data-l="0"] i:nth-child(-n+1), .cm-m[data-l="1"] i:nth-child(-n+2), .cm-m[data-l="2"] i:nth-child(-n+3),
.cm-m[data-l="3"] i:nth-child(-n+4), .cm-m[data-l="4"] i { background: var(--star); }
.cm-m[data-l="0"] i:nth-child(1) { background: var(--paper-2); }
.cm-yn { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 2px solid var(--ink); font: 700 16px/1.25 var(--head); color: #fff; }
.cm-yn.y { background: var(--yes); } .cm-yn.n { background: var(--no); }
.cm-think { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.cm-face { font-size: 28px; line-height: 1; grid-row: span 2; }
.cm-bub { position: relative; display: grid; padding: 6px 10px; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px;
  font: 700 16px/1.3 var(--body); min-height: calc(2 * 1.3em + 12px); }
.cm-bub::before { content: ""; position: absolute; left: -8px; top: 14px; width: 10px; height: 10px; background: #fff; border: solid var(--ink);
  border-width: 0 0 2.5px 2.5px; transform: rotate(45deg); }
.cm-who { font: 700 16px/1.2 var(--head); color: var(--ink-soft); }
.cm-q { color: var(--ink-soft); }
.cm-think.two .cm-q { text-decoration: none; }
.cm-a { color: var(--ink); font-family: var(--head); font-weight: 700; }
.cm-ans { grid-column: 2; font: 700 16px/1.3 var(--body); }
.cm-idle { position: absolute; inset: 0; display: none; place-items: center; padding: 14px; text-align: center; font: 600 18px/1.3 var(--head);
  color: var(--ink); background: #fffdf6; border-radius: 13px; }
.cm-now.idle .cm-idle { display: grid; }

/* kinds of things: 3 x 3 cards with word headers */
.cm-kinds { display: grid; gap: 6px; min-width: 0; }
.cm-kh { font: 700 18px/1.2 var(--head); }
.cm-ksub { font: 700 16px/1.2 var(--body); color: var(--ink-soft); }
.cm-grid { display: grid; grid-template-columns: 60px repeat(3, minmax(0, 1fr)); gap: 5px; align-items: stretch; }
.cm-corner { font-size: 16px; align-self: end; text-align: center; line-height: 1.1; }
.cm-colh, .cm-rowh { font: 700 16px/1.1 var(--body); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; text-align: center; overflow-wrap: anywhere; }
.cm-rowh { justify-content: flex-start; }
.cm-k { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 64px; padding: 4px 2px; border: 2.5px solid var(--ink);
  border-radius: 12px; background: var(--paper-2); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.cm-k .cm-ki { font-size: 18px; line-height: 1.1; }
.cm-k .cm-kw { font: 700 16px/1.1 var(--head); white-space: nowrap; }
.cm-k .cm-kn { font: 700 16px/1.1 var(--body); color: var(--ink-soft); min-height: 1.1em; }
.cm-k.none { background: #f6f1e7; border-style: dashed; color: var(--ink-soft); }
.cm-k.knows { background: #d9f2d6; }
.cm-k.shaky { background: #fff0c2; }
.cm-k.wrong { background: #ffd9dc; }
.cm-k.now { box-shadow: 0 0 0 3px var(--star), 0 0 10px 2px rgba(255,201,60,.8); }
.cm-k.open { outline: 3px solid var(--ink); outline-offset: 1px; }
.cm-wrongs ul, .cm-detail ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cm-wrongs li { font: 700 16px/1.3 var(--body); padding: 6px 10px; background: #fff3f4; border: 2px solid #e5a1a8; border-radius: 12px; }
.cm-detail { padding: 8px 10px; background: var(--paper-2); border: 2.5px solid var(--ink); border-radius: 14px; font-size: 16px; }
.cm-detail[hidden] { display: none !important; }
.cm-dh { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 4px; font: 700 17px/1.2 var(--head); }
.cm-dx { min-width: 44px; padding: 0; }
.cm-detail li { display: flex; flex-wrap: wrap; gap: 2px 8px; justify-content: space-between; font-weight: 700; line-height: 1.3; padding: 4px 0; border-top: 1px dashed rgba(43,33,64,.2); }
.cm-detail p { margin: 4px 0 0; font-weight: 700; color: var(--ink-soft); }

/* the test paper: 20 real questions */
.cm-ph p { margin: 0; font: 700 16px/1.35 var(--body); }
.cm-paper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.cm-pq { position: relative; display: grid; justify-items: start; gap: 2px; padding: 4px 6px 6px; background: #fff; border: 2px solid rgba(43,33,64,.45);
  border-radius: 10px; background-image: repeating-linear-gradient(180deg, transparent 0 21px, rgba(80,130,200,.14) 21px 22px); }
.cm-pq[hidden] { display: none; }
.cm-pn { font: 700 16px/1 var(--head); color: var(--ink-soft); }
.cm-pd { display: flex; align-items: center; gap: 3px; font-size: 16px; line-height: 1.2; }
.cm-pd .cm-m i { width: 8px; height: 8px; border-width: 1.5px; }
.cm-pd .cm-m { gap: 2px; }
.cm-pa .cm-yn { font-size: 16px; padding: 0 6px; }
.cm-pm { position: absolute; right: 5px; top: 1px; font: 700 22px/1 var(--head); color: rgba(43,33,64,.3); }
.cm-pq.ok { border-color: var(--yes); } .cm-pq.ok .cm-pm { color: #2d8a3c; }
.cm-pq.x { border-color: var(--no); background-color: #fff5f6; } .cm-pq.x .cm-pm { color: #c8303f; }

/* plan cards (lobby picker, decision sheet, change sheet) */
.cm-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 6px 10px;
  text-align: left; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper-2); color: var(--ink); cursor: pointer; font: inherit;
  box-shadow: 0 3px 0 var(--ink); }
.cm-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.cm-card.cur { background: #fff1c4; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink), inset 0 0 0 2px var(--star); }
.cm-ce { font-size: 26px; text-align: center; line-height: 1; }
.cm-cb { display: grid; gap: 1px; min-width: 0; }
.cm-cb b { font: 700 17px/1.2 var(--head); }
.cm-cb span { font: 600 16px/1.25 var(--body); color: var(--ink-soft); }
.cm-curtag { display: inline-block; font: 800 16px/1 var(--body); padding: 1px 6px; border-radius: 999px; background: var(--star); color: var(--ink) !important; border: 2px solid var(--ink); vertical-align: 1px; }
.cm-tick { font: 700 22px/1 var(--head); color: #2d8a3c; min-width: 18px; }
.cm-pkh { margin: 4px 0 0; font: 700 19px/1.2 var(--head); }
.cm-pkl { margin: 0 0 6px; font: 600 16px/1.3 var(--body); color: var(--ink-soft); }
.cm-pk { display: grid; gap: 7px; }

/* the overlay sheet (decisions, Change plan): over the panel area, never over the header */
.cm-sheet { position: fixed; z-index: 12; left: calc(env(safe-area-inset-left, 0px) + 8px); right: calc(env(safe-area-inset-right, 0px) + 8px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); max-height: calc(100% - 96px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 8px; padding: 12px 12px 14px; background: var(--paper); border: 3px solid var(--ink); border-radius: 20px;
  box-shadow: 0 -2px 0 rgba(0,0,0,.05), 6px 6px 0 var(--shadow); animation: cmup .28s cubic-bezier(.2,.9,.3,1.1); }
.cm-sheet[hidden] { display: none !important; }
@keyframes cmup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) {
  .cm-sheet { left: auto; width: min(430px, 47vw); top: auto; }
}
.cm-sbar { height: 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.cm-sbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--s2, #22C3A6), var(--star)); transform-origin: left center; }
.cm-sheet:not(.timed) .cm-sbar { display: none; }
.cm-sh { display: flex; align-items: flex-start; gap: 8px; }
.cm-sh h2 { flex: 1; margin: 0; font: 700 21px/1.2 var(--head); }
.cm-secs { font: 700 18px/1.2 var(--head); color: #c47a00; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.cm-why { margin: 0; font: 600 16px/1.35 var(--body); color: var(--ink-soft); }
.cm-cards { display: grid; gap: 8px; }
.cm-sheet .cm-card { min-height: 64px; }
.cm-keep { min-height: 48px; border-radius: 999px; border: 2.5px dashed var(--ink); background: transparent; color: var(--ink); font: 600 17px/1.1 var(--head); cursor: pointer; padding: 0 14px; }

/* Save as my teacher */
.cm-save-box { display: grid; gap: 8px; padding: 12px 14px; background: var(--paper-2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--shadow); text-align: left; }
.cm-save-box[hidden] { display: none !important; }
.cm-save-box h3 { margin: 0; font: 700 19px/1.2 var(--head); }
.cm-save-box p { margin: 0; font: 600 16px/1.35 var(--body); }
.cm-save-box .cm-soft { color: var(--ink-soft); }
.cm-runs { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font: 700 16px/1.3 var(--body); }
.cm-runs li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 10px; background: rgba(255,201,60,.18); }
.cm-runs b { font: 700 16px/1.3 var(--head); }
.cm-save-box .cm-btn { justify-self: start; min-height: 48px; }
/* a short phone (375x667): the five plan cards and Keep fit in the sheet without scrolling */
@media (max-height: 700px) and (orientation: portrait) {
  .cm-sheet { gap: 6px; padding: 10px 10px 12px; max-height: calc(100% - 72px); }
  .cm-sheet .cm-card { min-height: 56px; padding: 4px 10px; }
  .cm-sheet .cm-cards { gap: 6px; }
  .cm-sheet .cm-keep { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .cm-sheet { animation: none; } .cm-sbar i { transition: none !important; } }
