/* Parent area of the maths game (English, left to right) – what it needs on top of the parent styles in style.css. */

/* ---------------------------------------------------------------- save bar (Content, Settings) */
.parent-foot { flex: none; background: #fff; box-shadow: 0 -2px 10px rgba(0, 0, 0, .06); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
.pf-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; }
.pf-note { display: none; margin-right: auto; color: #b45309; font-weight: 600; }
.parent-foot.dirty .pf-note { display: inline; }
.parent-foot.dirty .btn.green:not(:active) { box-shadow: 0 5px 0 rgba(0, 0, 0, .2), 0 0 0 5px rgba(34, 197, 94, .3); }

.parent-overlay h3 { scroll-margin-top: 10px; }
.parent-overlay code { background: #f3f0ff; border-radius: 6px; padding: 1px 7px; font-family: inherit; font-weight: 600; white-space: nowrap; }

/* ---------------------------------------------------------------- recording studio */
.parent-overlay .rec-num { flex: none; min-width: 64px; padding: 2px 10px; border-radius: 12px; background: #f3f0ff; color: var(--purple); font-size: 1.3rem; font-weight: 700; text-align: center; white-space: nowrap; }
.parent-overlay .rec-num + .rec-text { justify-content: flex-end; }   /* (rtl: the word stands right next to its number) */
.parent-overlay .hear-num { background: #fff; border-radius: 16px; padding: 8px 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); }
.parent-overlay .hear-num input.num { width: 110px; }
.hn-parts { font-size: 1.6rem; line-height: 1.4; color: var(--ink2); }
.hn-missing { color: #dc2626; }
.qr .qr-num { font-size: min(14vmin, 90px); font-weight: 700; line-height: 1.1; color: var(--ink); }
.qr .qr-num:empty { display: none; }

/* ---------------------------------------------------------------- players */
.pc-open { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.pc-open label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.pc-open select { max-width: 100%; font-weight: 400; }
.pc-open select:disabled { opacity: .5; }
.pc-chapters .tchip.done { background: #dcfce7; color: #166534; }

/* ---------------------------------------------------------------- content: lessons of the book */
.ls-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ls-ch { background: #fff; border-radius: 16px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); }
.ls-ch > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-height: 52px; padding: 8px 16px; cursor: pointer; list-style: none; font-weight: 700; }
.ls-ch > summary::-webkit-details-marker { display: none; }
.ls-ch > summary::before { content: '▸'; color: var(--ink2); transition: transform .15s; }
.ls-ch[open] > summary::before { transform: rotate(90deg); }
.ls-ku { font-size: 1.15rem; color: var(--ink2); }
.ls-count { margin-left: auto; font-size: .9rem; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.ls-count.part { color: #b45309; }
.ls-body { padding: 0 16px 6px; }
.ls-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 4px; border-top: 1px solid #f1eefb; cursor: pointer; }
.ls-row input { flex: none; width: 22px; height: 22px; margin: 0; }
.ls-name { flex: 1; min-width: 180px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; }
.ls-name .ku { font-size: 1.15rem; color: var(--ink2); }
.ls-row.off .ls-name { opacity: .45; text-decoration: line-through; }
.ls-book { font-size: .9rem; color: var(--ink2); white-space: nowrap; }
.ls-kind { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 10px; background: #fef3c7; color: #92400e; white-space: nowrap; }

/* ---------------------------------------------------------------- content: my problems (homework) */
.parent-overlay textarea.own-in { font-size: 1.35rem; line-height: 1.6; text-align: left; }
.own-prev { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.op-sum { font-weight: 600; color: var(--ink2); }
.op-level { background: #fff; border-radius: 14px; padding: 6px 14px 10px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); }
.op-level.bad { background: #fff7f7; }
.op-title { font-size: .85rem; font-weight: 700; color: var(--ink2); margin: 2px 0 6px; }
.op-lines { display: flex; flex-wrap: wrap; gap: 6px; }
.op-line { padding: 2px 10px; border-radius: 10px; background: #f0fdf4; color: #166534; font-weight: 600; white-space: nowrap; }
.op-line b { color: var(--purple); }
.op-line.bad { background: #fff1f2; color: #b91c1c; white-space: normal; }

/* ---------------------------------------------------------------- content: number words */
.nw-try .ku { font-size: 1.6rem; line-height: 1.4; color: var(--purple); }
.parent-overlay .nw-try input.num { width: 110px; }
.nw-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin: 8px 0 16px; }
.nw-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; background: #fff; border-radius: 14px; padding: 6px 10px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); }
.nw-row.changed { box-shadow: 0 0 0 2px #fbbf24; }
.nw-num { flex: none; min-width: 58px; font-weight: 700; color: var(--purple); text-align: center; }
.nw-in { flex: 1 1 80px; min-width: 0; font-size: 1.5rem; line-height: 1.5; padding: 0 10px; border-radius: 12px; border: 2px solid #e4defc; background: #fff; }
.nw-in:focus { outline: none; border-color: var(--purple); }
.parent-overlay .nw-back { width: 40px; height: 40px; font-size: 18px; }
.nw-note { display: none; flex-basis: 100%; font-size: .8rem; color: #b45309; }
.nw-note .ku { font-size: 1rem; }
.nw-row.changed .nw-note { display: block; }

/* ---------------------------------------------------------------- settings */
.money-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 0 12px; }
.p-choices { display: flex; flex-direction: column; gap: 6px; }
.p-choice { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 8px 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .05); font-weight: 400; cursor: pointer; }
.p-choice input { flex: none; width: 22px; height: 22px; margin: 0; }
.p-choice:has(input:checked) { box-shadow: 0 0 0 3px var(--purple); }
.p-choice > span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.p-digits { font-size: 1.5rem; line-height: 1.3; }
/* a tiny sum – its direction comes from the option (style="direction: rtl|ltr"), never from the text */
.p-eq { display: inline-flex; align-items: center; gap: .35em; padding: 0 12px; border-radius: 10px; background: #f3f0ff; color: var(--purple); font-size: 1.35rem; font-weight: 700; line-height: 1.6; unicode-bidi: isolate; }

/* ---------------------------------------------------------------- phones (upright) */
@media (max-width: 600px) {
  .parent-foot { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .parent-foot .btn.big { font-size: 1.1rem; padding: 10px 22px; }
  .parent-overlay .rec-row { position: relative; gap: 8px; }
  .parent-overlay .rec-num { min-width: 46px; padding: 2px 6px; font-size: 1.1rem; }
  /* the level meter becomes a thin line along the bottom of the row */
  .parent-overlay .rec-row .rec-meter { position: absolute; left: 14px; right: 14px; bottom: 3px; width: auto; height: 4px; }
  .parent-overlay .hear-num input.num, .parent-overlay .nw-try input.num { width: 96px; }
  .ls-ch > summary { padding: 8px 12px; }
  .ls-body { padding: 0 10px 6px; }
  .ls-name { min-width: 0; flex-basis: calc(100% - 40px); }
  .ls-name + * { margin-left: 34px; }
  .nw-table { grid-template-columns: 1fr; }
  .p-choice { padding: 8px 10px; }
}
