/* FlowCyto screens: main menu, game, settings, enlarged plot.
   Marks: X = ruled out, dot = chosen; right = check icon + "right", wrong = cross icon + "wrong" +
   a wavy underline; hints are labeled "Hint." Never color alone. */
[hidden] { display: none !important; }

/* ---------- main menu ---------- */
.menu-in { max-width: 760px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.logo { display: flex; gap: 14px; align-items: center; color: var(--blue); margin-bottom: 6px; }
.logo h1 { font-size: 34px; font-weight: 800; letter-spacing: -.01em; }
.logo p { margin: 2px 0 0; color: var(--muted); font-weight: 600; }
.cont { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 14px 16px; cursor: pointer; border: 2px solid var(--blue); }
.cont .cont-k { grid-row: 1 / 3; font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); }
.cont b { font-size: var(--fs-md); }
.cont span:not(.cont-k) { grid-column: 2; font-size: var(--fs-sm); color: var(--muted); }
.cont .ic { grid-row: 1 / 3; grid-column: 3; color: var(--blue); }
.mcard { padding: 18px; }
.mhead { display: flex; gap: 12px; align-items: center; }
.micon { width: 36px; height: 36px; color: var(--blue); flex: none; }
.micon svg { width: 100%; height: 100%; }
.mhead h2 { font-size: var(--fs-xl); }
.mcard > p { margin: 8px 0 14px; color: var(--ink-2); font-size: var(--fs-sm); }
.lvls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lvl { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--sunk); cursor: pointer; }
.lvl b { font-size: var(--fs-lg); }
.lvl span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.lvl:hover, .lvl:focus-visible { border-color: var(--blue); }
.menu-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: var(--fs-xs); }

/* ---------- game shell: no page scroll; plots fit the space that's left ---------- */
.game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.bar { flex: none; background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.bar-in { max-width: 1400px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 8px; align-items: center; }
.iconbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 10px; border: 1.5px solid transparent; border-radius: var(--ctrl); background: none; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { border-color: var(--line); }
.iconbtn:disabled { opacity: .4; cursor: default; }
.gtitle { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; min-width: 0; }
.gtitle b { font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtitle .short { display: none; }
.gtitle > span { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.board { flex: 1; min-height: 0; width: 100%; max-width: 1400px; margin: 0 auto; padding: 12px 16px 16px; display: flex; gap: 16px; }
.plots-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.board-head { flex: none; display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; min-width: 0; }
.board-head h1 { font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plots { flex: 1; min-height: 0; display: grid; gap: 8px; align-content: start; justify-content: center; }
.plots figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; cursor: zoom-in;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.plots .dotplot { width: var(--plot, 240px); height: var(--plot, 240px); }
.plots figcaption { font-size: 11px; line-height: 12px; color: var(--muted); text-align: center; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plots figure.flash { box-shadow: 0 0 0 3px var(--blue); border-color: var(--blue); }
.panel { flex: 0 0 420px; padding: 12px 16px 16px; overflow: auto; min-height: 0; }
.panel .sub { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 12px; }

/* tabs: Answer · Scratch pad */
.tabs { display: flex; gap: 4px; align-items: center; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.tabs [role="tab"] { border: 0; background: none; padding: 8px 10px; font-weight: 700; font-size: var(--fs-sm); color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs [role="tab"][aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.sheet-tg { display: none; margin-left: auto; border: 1.5px solid var(--line); background: var(--card); border-radius: 8px; width: 36px; height: 32px; place-items: center; cursor: pointer; }

/* grid (Name every population) */
.lgrid { border-collapse: collapse; font-size: var(--fs-sm); margin-bottom: 10px; }
.lgrid thead th { vertical-align: bottom; padding: 0 0 4px; }
.lgrid .colh { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; white-space: nowrap; font-size: var(--fs-xs); font-weight: 700; border: 0; background: none; cursor: pointer; padding: 4px 2px; color: var(--ink-2); max-height: 150px; overflow: hidden; text-overflow: ellipsis; }
.lgrid .colh:hover { color: var(--blue); text-decoration: underline; }
.lgrid tbody th { text-align: left; white-space: nowrap; padding-right: 8px; font-weight: 700; cursor: pointer; }
.lgrid td { width: var(--cell, 32px); height: var(--cell, 32px); border: 1px solid var(--line); padding: 0; }
.lgrid td button { width: 100%; height: 100%; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.lgrid td.no { background: var(--sunk); }
.lgrid td.yes { background: var(--blue-bg); }
.lgrid tr.focus th { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.rowmark { display: inline-flex; gap: 3px; align-items: center; font-size: var(--fs-xs); font-weight: 700; margin-left: 4px; }
.rowmark.right { color: var(--teal); }
.rowmark.wrong { color: var(--pink); text-decoration: underline wavy; text-underline-offset: 3px; }

/* list (Diagnose the clone) */
.dxrow { display: flex; gap: 6px; margin-bottom: 6px; }
.dx { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; font-size: var(--fs-sm); font-weight: 600; background: var(--card); cursor: pointer; }
.dx.no { color: var(--muted); background: var(--sunk); }
.dx.no .nm { text-decoration: line-through; }
.dx.yes { border: 3px solid var(--blue); background: var(--blue-bg); }
.padlink { border: 1.5px solid var(--line); background: var(--card); border-radius: 9px; padding: 0 10px; font-size: var(--fs-xs); font-weight: 700; color: var(--blue); cursor: pointer; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.tally { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.help { font-size: var(--fs-xs); color: var(--muted); margin: 6px 0 0; }
.msg { border-radius: 10px; padding: 10px 12px; font-size: var(--fs-sm); margin: 10px 0; border: 1.5px solid var(--line); background: var(--sunk); }
.msg.good { border-color: var(--teal); background: var(--teal-bg); }
.msg.bad { border-color: var(--pink); background: var(--pink-bg); }
.msg.hint { border-color: var(--blue); background: var(--blue-bg); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.pctq { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.recap { margin-top: 10px; font-size: var(--fs-sm); }
.recap h3 { font-size: var(--fs-md); margin: 12px 0 6px; }
.recap .item { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.recap .why { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }

/* scratch pad: + − ± as text first; tint only repeats it */
.padwrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.pad { border-collapse: collapse; font-size: var(--fs-sm); }
.pad thead th { font-size: var(--fs-xs); font-weight: 700; padding: 0 2px 4px; white-space: nowrap; color: var(--ink-2); }
.pad tbody th { text-align: left; font-weight: 600; font-size: var(--fs-xs); max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.pad tr.hl th { color: var(--blue); }
.pad tr.hl td.pv { box-shadow: inset 0 0 0 1px var(--blue); }
.pad td.pv { width: 34px; min-width: 34px; height: 30px; border: 1px solid var(--line); text-align: center; padding: 0; font-weight: 800; font-size: var(--fs-sm); }
.pad td.pv button { width: 100%; height: 100%; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.pad td.pv.p { background: var(--blue-bg); }
.pad td.pv.n { background: var(--sunk); color: var(--muted); }
.pad td.pv.s { background: var(--gold-bg); }
.pad td.pv.diff span { text-decoration: underline wavy var(--pink); text-underline-offset: 3px; }
.pad td.rv { padding-left: 6px; white-space: nowrap; }
.reveal { width: 30px; height: 28px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); color: var(--blue); cursor: pointer; display: grid; place-items: center; }

/* ---------- enlarged plot ---------- */
.zoom { position: fixed; inset: 0; z-index: 20; background: rgba(10,12,16,.55); display: grid; place-items: center; padding: 12px; -webkit-user-select: none; user-select: none; }
.zoom figure { margin: 0; background: var(--card); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); }
.zoom .dotplot { width: var(--zoom); height: var(--zoom); }
.zoom figcaption { text-align: center; font-weight: 700; color: var(--ink-2); font-size: var(--fs-sm); margin-top: 4px; }

/* ---------- settings ---------- */
.settings { border: 1px solid var(--line); padding: 16px 18px; width: min(520px, calc(100vw - 24px)); color: var(--ink); background: var(--card); }
.settings::backdrop { background: rgba(10,12,16,.45); }
.set-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.set-head h2 { font-size: var(--fs-xl); }
.set-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.set-row > div:first-child { flex: 1 1 200px; }
.set-row b { display: block; }
.set-row span { display: block; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: var(--ctrl); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--card); color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }

/* appearance picker (as in Pathways) */
.set-row.themes { align-items: flex-start; }
.theme-row { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-pick { display: grid; gap: 6px; justify-items: start; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; }
.theme-pick[aria-checked="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.theme-pick > span:last-child { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.theme-sw { display: grid; place-items: center; width: 92px; height: 58px; border-radius: 8px; border: 1px solid var(--line); }
.theme-sw > span { display: grid; align-items: end; width: 62px; height: 36px; border-radius: 5px; padding: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.theme-sw i { display: block; height: 6px; width: 70%; border-radius: 3px; }
.board-head .pill { white-space: nowrap; }

/* ---------- daily boards, timer, why replay, coach marks ---------- */
.daily { padding: 16px 18px; }
.dhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dhead h2 { font-size: var(--fs-xl); }
.streak { font-size: var(--fs-sm); font-weight: 800; color: var(--blue); }
.daily > p { margin: 6px 0 12px; color: var(--ink-2); font-size: var(--fs-sm); }
.dbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dbtn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--sunk); cursor: pointer; }
.dbtn .micon { grid-row: 1 / 3; width: 28px; height: 28px; }
.dbtn b { font-size: var(--fs-sm); }
.dbtn span:last-child { display: inline-flex; gap: 4px; align-items: center; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.dbtn.done { border-color: var(--teal); }
.dbtn:hover { border-color: var(--blue); }
.timer { font-variant-numeric: tabular-nums; }
.btn.mini { min-height: 26px; padding: 2px 10px; font-size: var(--fs-xs); }
.recap .item .btn.mini { margin-left: 4px; }
.whyhead { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.whybox p { margin: 6px 0 0; }
.coach { position: fixed; inset: 0; z-index: 30; }
.coach-spot { position: fixed; border-radius: 12px; border: 3px solid var(--blue); box-shadow: 0 0 0 9999px rgba(10,12,16,.55); pointer-events: none; transition: all .18s ease; }
.coach-card { position: fixed; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); padding: 14px 16px; }
.coach-card p { margin: 0 0 4px; font-size: var(--fs-md); }
.coach-card .actions { justify-content: flex-end; margin-bottom: 0; }
.coach-card .actions .tally { margin-right: auto; }

/* Launched from the home screen: iOS 26 softens the top edge of the page under the status bar, so
   give the bar's contents room to clear it. */
@media (display-mode: standalone) {
  .bar { padding-top: calc(env(safe-area-inset-top, 0px) + 10px); }
  .menu-in { padding-top: calc(env(safe-area-inset-top, 0px) + 24px); }
}

/* ---------- phones and narrow tablets: plots above, the panel as a bottom sheet ---------- */
@media (max-width: 900px) {
  .bar-in { padding: 6px 8px; gap: 2px; }
  .iconbtn { padding: 6px 8px; }
  .iconbtn span { display: none; }
  #hintBtn span { display: inline; }
  .lvl { padding: 10px 2px; }
  .lvl b { font-size: var(--fs-md); }
  .dbtns { grid-template-columns: 1fr; }
  #newBtn { min-height: 34px; padding: 4px 12px; }
  #newBtn .wide { display: none; }
  .board { flex-direction: column; padding: 8px 8px 0; gap: 8px; }
  .board-head { margin-bottom: 6px; }
  .board-head h1 { font-size: var(--fs-md); }
  .plots { gap: 6px; }
  .plots figure { padding: 2px; border-radius: 8px; }
  .plots figcaption { font-size: 10px; line-height: 11px; }
  .panel { flex: 0 0 46%; margin: 0 -8px; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 4px 12px calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 30px -12px rgba(20,24,31,.35); }
  .panel.min { flex: 0 0 auto; padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  .panel.min .tabbody { display: none; }
  .panel.min .tabs { margin: 0; border-bottom: 0; }
  .tabs { position: sticky; top: -4px; z-index: 1; background: var(--card); margin: 0 0 10px; padding-top: 4px; }
  .sheet-tg { display: grid; }
  .panel .sub { display: none; } /* the rules show on wider screens; phones keep the room for plots */
  .lgrid .colh { max-height: none; font-size: 10px; padding: 2px 1px; }
  .iconbtn { min-height: 44px; min-width: 44px; justify-content: center; }
  #newBtn { min-height: 40px; }
  .tabs [role="tab"] { padding: 11px 12px; }
  .sheet-tg { width: 44px; height: 38px; }
  .panel .btn { min-height: 44px; }
  .panel .btn.mini { min-height: 34px; }
  .dx { min-height: 46px; }
  .padlink { min-width: 48px; }
  .gchip { min-height: 40px; }
  .pad td.pv { width: 38px; min-width: 38px; height: 36px; }
  .reveal { width: 36px; height: 34px; }
  .board-head .pill { font-size: 10px; padding: 1px 8px; }
  .gtitle .long { display: none; }
  .gtitle .short { display: inline; }
  .plots.tiny figcaption { font-size: 9.5px; }
  .plots figcaption { font-size: 10.5px; line-height: 13px; }
}

/* ---------- Hard: player-placed gates ---------- */
.gstat { font-size: var(--fs-sm); font-weight: 700; margin: 0 0 10px; }
.gpick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; font-size: var(--fs-sm); font-weight: 700; }
.gchip { display: inline-flex; gap: 4px; align-items: center; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.gchip[aria-pressed="true"] { border: 3px solid var(--blue); background: var(--blue-bg); }
.game.gating .plots figure, .zoom svg { touch-action: none; cursor: crosshair; }
.zoom-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }

/* Short phones (iPhone SE): a little more room for the plots. */
@media (max-width: 900px) and (max-height: 700px) {
  .panel { flex-basis: 42%; }
}
