/* Practice app: summary, tabs, decks, progress, rewards, dialogs. The card itself is in card.css. */

/* ---------- Practice app ---------- */
.practice-app { padding-bottom: 24px; }
.loading { color: var(--muted); }
.practice-banner .notice { max-width: none; }
.summary-bar { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 22px; }
@media (min-width: 760px) { .summary-bar { grid-template-columns: repeat(3, 1fr); } }
.chip-card { background: var(--white); border: 2px solid var(--indigo); border-radius: var(--r-m); padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.chip-card p { margin: 0; }
.chip-label { font: 700 .95rem var(--f-head); color: var(--muted); }
.chip-value { font: 800 1.5rem/1.1 var(--f-head); color: var(--indigo); }
.chip-sub { font-size: .92rem; color: var(--muted); line-height: 1.4; }
.meter { height: 10px; border-radius: 99px; background: var(--lilac-2); overflow: hidden; margin: 4px 0; }
.meter > span { display: block; height: 100%; background: var(--coral); border-radius: 99px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 2.5px solid var(--indigo); padding-bottom: 0; }
.tab {
  flex: none; font: 700 1.02rem var(--f-head); color: var(--ink); background: transparent; border: 2px solid transparent; border-bottom: 0;
  border-radius: 14px 14px 0 0; padding: 10px 18px; min-height: 46px; cursor: pointer;
}
.tab:hover { background: var(--lilac); }
.tab[aria-selected="true"] { background: var(--indigo); color: var(--paper); }
.tab:focus-visible { outline-offset: -3px; outline-color: var(--coral); }
.tab-panel { padding-block: 28px 8px; }
.tab-panel:focus { outline: none; }
.tab-panel > h2 { font-size: 1.7rem; }

.study-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 22px; max-width: 640px; }
@media (min-width: 640px) { .study-controls { grid-template-columns: 1.5fr 1fr; } }
.facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0 0 22px; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: .92rem; color: var(--muted); }
.facts dd { margin: 0; font: 800 1.9rem/1.1 var(--f-head); color: var(--indigo); }
.start-row { margin: 22px 0; }
.caught-up { max-width: 640px; background: var(--ok-bg); border: 2px solid var(--ok); border-style: solid; }
.caught-up h3 { color: var(--ok); }
.prompt-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; justify-content: space-between; max-width: 640px; background: var(--butter-soft); border: 2px solid var(--ink); border-radius: var(--r-m); padding: 14px 18px; margin: 12px 0 28px; }
.prompt-card p { margin: 0; }
.how-to-study { max-width: 700px; margin-top: 32px; }
.how-to-study ul { padding-left: 1.2em; }

.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.session-count { margin: 0; font: 700 1.05rem var(--f-head); color: var(--indigo); }
.session-progress { display: block; width: 100%; height: 12px; margin-bottom: 26px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--lilac-2); overflow: hidden; }
.session-progress::-webkit-progress-bar { background: var(--lilac-2); }
.session-progress::-webkit-progress-value { background: var(--coral); border-radius: 99px; }
.session-progress::-moz-progress-bar { background: var(--coral); border-radius: 99px; }
.session-xp { text-align: center; font: 700 1rem var(--f-head); color: var(--indigo); margin: 12px 18px 0 0; min-height: 1.5em; }
.session-done { max-width: 720px; }
.session-done:focus { outline: none; }
.missed-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.missed-list li { background: var(--white); border: 2px solid var(--lilac-2); border-radius: var(--r-s); padding: 10px 14px; display: flex; flex-direction: column; }
.missed-list span { color: var(--muted); font-size: 1rem; }

/* Decks */
.decks-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.decks-head h2 { margin: 0; }
.deck-filters { margin-top: 0; }
@media (min-width: 760px) { .deck-filters { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); } }
.spaced { margin-top: 2em; }
.grid-decks { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); margin-bottom: 12px; }
.deck-card { background: var(--white); border: 2px solid var(--indigo); border-radius: var(--r-m); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.deck-card h4 { margin: 0 0 4px; font-size: 1.2rem; }
.deck-card p { margin: 0 0 6px; font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--lilac); border-radius: 999px; padding: 2px 12px; font-size: .88rem; font-weight: 700; color: var(--indigo); }
.deck-desc { color: var(--muted); }
.deck-stats { font-size: .95rem !important; color: var(--ink); }
.deck-sources { font-size: .85rem !important; color: var(--muted); overflow-wrap: anywhere; }
.deck-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.deck-actions .btn { min-height: 38px; }

/* Dialogs */
dialog.dlg { border: 2.5px solid var(--indigo); border-radius: var(--r-m); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); color: var(--ink); background: var(--paper); overflow: auto; }
dialog.dlg-wide { width: min(780px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(27, 25, 70, .6); }
.dlg-body { padding: 22px 22px 8px; }
.dlg-body h2 { font-size: 1.5rem; }
.dlg-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 22px; border-top: 2px solid var(--lilac-2); position: sticky; bottom: 0; background: var(--paper); }
.editor-two { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 14px 0; }
@media (min-width: 560px) { .editor-two { grid-template-columns: 1fr 1fr; } }
.card-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.card-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px; border: 1.5px solid var(--lilac-2); border-radius: var(--r-s); background: var(--white); }
@media (min-width: 640px) { .card-row { grid-template-columns: 1fr 1fr auto; align-items: center; border: 0; padding: 0; background: transparent; } }
.card-row input { min-height: 44px; }
.cards-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.cards-list li { background: var(--white); border: 2px solid var(--lilac-2); border-radius: var(--r-s); padding: 10px 14px; }
.cards-list p { margin: 0; }
.cl-front { font-weight: 700; }
.cl-back { color: var(--muted); }
.cl-status { font-size: .88rem; margin-top: 2px !important; color: var(--indigo); }

/* Progress */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); margin-bottom: 28px; }
.stat { background: var(--white); border: 2px solid var(--indigo); border-radius: var(--r-m); padding: 14px 18px; }
.stat p { margin: 0; }
.stat-label { font: 700 .95rem var(--f-head); color: var(--muted); }
.stat-value { font: 800 2.1rem/1.15 var(--f-head); color: var(--indigo); }
.stat-sub { font-size: .9rem; color: var(--muted); line-height: 1.4; }
.panel-block { margin: 0 0 32px; max-width: 860px; }
.panel-block h3 { margin-bottom: .4em; }
.goal-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0 6px; }
.goal-form .field { max-width: 240px; }
.dist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-width: 520px; }
.dist li { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dist-n { font: 800 1.1rem var(--f-head); color: var(--indigo); }
.dist-track { display: flex; align-items: flex-end; width: 100%; height: 120px; background: var(--lilac); border-radius: 10px; overflow: hidden; }
.dist-bar { display: block; width: 100%; background: var(--indigo); border-radius: 10px 10px 0 0; min-height: 2px; }
.dist li:last-child .dist-bar { background: var(--coral); }
.dist-label { font-size: .85rem; text-align: center; color: var(--muted); line-height: 1.3; }
.calendar-wrap { max-width: 520px; }
table.calendar { min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 5px; }
.calendar th, .calendar td { border: 0; padding: 0; text-align: center; }
.calendar th { background: transparent; font-size: .82rem; color: var(--muted); padding-bottom: 2px; }
.calendar td { height: 44px; border-radius: 10px; font: 700 .95rem/44px var(--f-head); }
.lv0 { background: var(--lilac); color: var(--muted); }
.lv1 { background: #BDB9EA; color: var(--ink); }
.lv2 { background: #6862B5; color: var(--white); }
.lv3 { background: var(--indigo); color: var(--white); }
.calendar td.is-today { outline: 3px solid var(--coral); outline-offset: 1px; }
.calendar td.is-future { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--lilac-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 5px; }

/* Rewards */
.badge-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.badge { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border: 2px solid var(--indigo); border-radius: var(--r-m); padding: 12px 14px; }
.badge.is-locked { background: transparent; border: 2px dashed var(--lilac-2); color: var(--muted); }
.badge-icon { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--butter); color: var(--ink); }
.badge.is-locked .badge-icon { background: var(--lilac); color: var(--muted); }
.badge-text { display: flex; flex-direction: column; font-size: .98rem; line-height: 1.35; }
.badge-text strong { font-family: var(--f-head); color: var(--indigo); }
.badge.is-locked strong { color: var(--muted); }
.badge-date { font-size: .85rem; margin-top: 2px; }
.cover-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.cover-option { position: relative; }
.cover-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cover-option label { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--white); border: 2px solid var(--lilac-2); border-radius: var(--r-m); cursor: pointer; }
.cover-option label img { width: 100%; height: auto; border-radius: 8px; border: 1.5px solid var(--indigo); }
.cover-name { font: 700 1rem var(--f-head); color: var(--indigo); }
.cover-option input:checked + label { border-color: var(--indigo); box-shadow: 4px 4px 0 var(--indigo); }
.cover-option input:focus-visible + label { outline: 3px solid var(--coral); outline-offset: 3px; }
.cover-option.is-locked label { background: transparent; border-style: dashed; cursor: not-allowed; }
.cover-option.is-locked label img { opacity: .5; filter: grayscale(.6); }
.cover-option.is-locked .cover-name { color: var(--muted); }

/* Toasts */
.toast-region { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(94vw, 440px); pointer-events: none; }
.toast { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); font-size: 1rem; line-height: 1.4; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.toast-badge, .toast-level { background: var(--butter); color: var(--ink); border: 2px solid var(--ink); }

/* Info section under the app */
.practice-info { background: var(--lilac); margin-top: 24px; }
.info-grid { display: grid; gap: 36px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .info-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 56px; } }
.practice-info .prose h3 { margin-top: 1.4em; }
.practice-info .prose h3:first-child { margin-top: 0; }

/* ---------- Printing a deck: 8 folded cards per US Letter page ---------- */
#print-root { display: none; }
@media print {
  @page { size: Letter; margin: .5in; }
  body.is-printing { background: #fff; display: block; }
  body.is-printing > *:not(#print-root) { display: none !important; }
  body.is-printing #print-root { display: block; }
  .print-page { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 2.45in); break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-cell { border: 1px dashed #666; padding: .12in .16in; overflow: hidden; display: flex; flex-direction: column; font-family: Arial, Helvetica, sans-serif; color: #000; }
  .print-label { margin: 0; font-size: 8pt; color: #555; }
  .print-text { margin: 0 0 .04in; font-size: 11pt; line-height: 1.25; flex: 1 1 0; overflow: hidden; }
  .print-fold { margin: 0; border-top: 1px dotted #888; font-size: 7pt; color: #888; text-align: center; padding: 1px 0 3px; }
}

/* ---------- Polish: indicators, session table, deck colors, stamps ---------- */
.chip-card { position: relative; }
.chip-level { background: var(--lilac); }
.chip-streak { background: var(--coral-soft); }
.chip-week { background: var(--butter-soft); }
.chip-icon {
  position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--white); border: 2px solid var(--indigo); color: var(--indigo);
}
.chip-card .meter { background: rgba(255, 255, 255, .75); }

.session-stage {
  background-color: var(--lilac); border: 2.5px solid var(--indigo); border-radius: 32px; padding: 30px 16px 18px;
  background-image: radial-gradient(rgba(41, 35, 122, .13) 1.2px, transparent 1.7px); background-size: 22px 22px;
}
@media (max-width: 520px) { .session-stage { padding: 24px 12px 14px; border-radius: 24px; } }

.deck-card { border-top: 8px solid var(--accent, var(--indigo)); }
.t-how { --accent: var(--acc-how); }
.t-spaced { --accent: var(--acc-spaced); }
.t-mnem { --accent: var(--acc-mnem); }
.t-routines { --accent: var(--acc-routines); }
.t-subject { --accent: var(--acc-subject); }
.t-other { --accent: var(--lilac-2); }

.stamp-topic { margin: 1.4em 0 .5em; font-size: 1.1rem; }
.stamp-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.stamp-item a {
  display: flex; gap: 12px; align-items: center; padding: 10px 14px; text-decoration: none; color: var(--ink);
  background: var(--white); border: 2px dashed var(--lilac-2); border-radius: var(--r-s);
}
.stamp-item a:hover { border-color: var(--indigo); }
.stamp-item.is-earned a { border-style: solid; border-color: var(--indigo); background: var(--butter-soft); }
.stamp-dot { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--lilac); color: var(--muted); }
.stamp-item.is-earned .stamp-dot { background: var(--butter); border: 2px solid var(--indigo); color: var(--ink); }
.stamp-text { display: flex; flex-direction: column; min-width: 0; }
.stamp-name { font-weight: 700; font-size: .98rem; line-height: 1.3; overflow-wrap: anywhere; }
.stamp-state { font-size: .86rem; color: var(--muted); }
