/* RKT ACADEMY - reusable components: cards, tags, evidence chips, meters, tables, tooltips, modal, toast, achievements */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.ruler { height: 8px; background: var(--ruler); opacity: .8; }
.tag { display: inline-block; font-family: var(--f-mono); font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--line2); color: var(--text2); border-radius: 6px; background: var(--inset); white-space: nowrap; }
.diff { display: inline-flex; gap: 3px; align-items: center; } .diff i { width: 9px; height: 9px; background: var(--line2); border-radius: 2px; } .diff i.on { background: var(--accent); }
.dur { font-family: var(--f-mono); font-size: .72rem; color: var(--dim); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; }

/* evidence semantics: the same three chips everywhere (lessons, games, results) */
.ev { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.ev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ev.fact { color: var(--fact); background: var(--fact-soft); border-color: rgba(111,168,255,.4); }
.ev.infer { color: var(--infer); background: var(--warn-soft); border-color: rgba(229,180,69,.4); }
.ev.unk { color: var(--unk); background: var(--unk-soft); border-color: rgba(169,156,245,.4); }
.ev.good { color: var(--good); background: var(--good-soft); border-color: rgba(76,214,154,.4); }
.ev.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(255,84,112,.4); }

/* ---------- game cards (Home + Arcade) ---------- */
.cabinets { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .cabinets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1100px) { .cabinets { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cabinet { --accent-g: var(--accent); position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: border-color .15s, transform .18s var(--ease); }
.cabinet:hover, .cabinet:focus-within { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 70%, var(--line2)); }
.cabinet-screen { position: relative; aspect-ratio: 16 / 10; background: var(--inset); border-bottom: 1px solid var(--line); overflow: hidden; }
.cabinet-screen .cover, .cabinet-screen .cover svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.cabinet-body { padding: 10px 11px 12px; display: grid; gap: 6px; flex: 1; align-content: start; grid-template-rows: auto auto 1fr auto; }
.cab-title { margin: 0; font-size: .92rem; letter-spacing: 0; color: var(--text); }
.cabinet .concept { margin: 0; color: var(--dim); font-size: .78rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cabinet .meta { margin: 0; gap: 6px; } .cabinet .meta .dur { display: none; }
.cabinet .best { display: none; justify-content: space-between; align-items: baseline; font-family: var(--f-mono); font-size: .7rem; color: var(--dim); padding-top: 6px; border-top: 1px solid var(--line); }
.cabinet .best strong { color: var(--text); font-size: .95rem; }
.cab-link { color: inherit; text-decoration: none !important; } .cab-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.cabinet .btn.play { display: none; width: 100%; min-height: 40px; font-size: .85rem; margin-top: 2px; pointer-events: none; }
.cabinet .cabinet-screen { z-index: 0; }
.cabinet .tag { color: var(--accent-g); border-color: color-mix(in srgb, var(--accent-g) 40%, var(--line2)); }
@media (min-width: 720px) { .cabinet .btn.play { display: inline-flex; } .cabinet .meta .dur { display: inline; margin-left: auto; } .cabinet .best { display: flex; } .cab-title { font-size: 1rem; } .cabinet .concept { font-size: .84rem; } }
@media (max-width: 539px) { .cabinet .concept { display: none; } .cabinet-body { padding: 9px 10px 10px; gap: 5px; } .cabinet .tag { font-size: .6rem; padding: 2px 6px; } }

/* ---------- pills, tabs, inputs ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pill { min-height: 44px; padding: 0 16px; background: var(--panel); border: 1px solid var(--line2); color: var(--text2); border-radius: 999px; cursor: pointer; font-family: var(--f-body); font-size: .85rem; font-weight: 600; touch-action: manipulation; }
.pill:hover { border-color: var(--dim); color: var(--text); }
.pill.sel { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 4px; gap: 4px; margin: 10px 0; }
.tab { min-height: 44px; padding: 0 18px; border: 0; background: transparent; color: var(--dim); cursor: pointer; font-family: var(--f-display); font-weight: 600; font-size: .85rem; border-radius: 8px; }
.tab.sel { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.input { width: 100%; min-height: 48px; padding: 0 14px; background: var(--inset); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; font: inherit; font-size: 16px; }
.input:focus { border-color: var(--fact); outline: none; box-shadow: 0 0 0 3px rgba(111,168,255,.22); }
.toolbar { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 18px 0 4px; } @media (min-width: 640px) { .toolbar { grid-template-columns: 1fr 220px; } }
.lbl { display: block; font-family: var(--f-mono); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 14px 0 6px; }
@media (max-width: 720px) {
  .pills.scroll { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 4px 16px 8px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .pills.scroll::-webkit-scrollbar { display: none; }
  .pills.scroll .pill { flex: none; scroll-snap-align: start; white-space: nowrap; }
  .tabs { display: flex; } .tabs .tab { flex: 1; padding: 0 8px; }
}

/* ---------- chips, badges, meters, stats ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { font-family: var(--f-mono); font-size: .75rem; padding: 4px 10px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px; color: var(--text2); }
.chip.good { border-color: var(--good); color: var(--good); } .chip.bad { border-color: var(--bad); color: var(--bad); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.badge { font-family: var(--f-mono); font-size: .72rem; font-weight: 600; padding: 6px 10px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; color: var(--text2); }
.badge.gold { background: var(--accent-soft); border-color: rgba(255,122,61,.5); color: var(--accent); }
.meters { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 14px 0; } @media (min-width: 640px) { .meters { grid-template-columns: repeat(2, 1fr); } }
.meter .m-top { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; } .meter .m-top b { font-family: var(--f-mono); }
.meter.low .m-top b { color: var(--bad); }
.m-bar { height: 8px; background: var(--inset); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; } .m-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s var(--ease); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; } @media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats div { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--r-sm); min-width: 0; }
.stats dt { font-family: var(--f-mono); font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.stats dd { margin: 4px 0 0; font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; overflow-wrap: anywhere; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; font-family: var(--f-mono); font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; } tr:last-child td { border-bottom: 0; }
.recap-table tr.ok td:first-child { box-shadow: inset 3px 0 0 var(--good); } .recap-table tr.miss td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.board tr.gold td { background: linear-gradient(90deg, rgba(229,180,69,.14), transparent); } .board tr.silver td { background: linear-gradient(90deg, rgba(195,204,216,.10), transparent); } .board tr.bronze td { background: linear-gradient(90deg, rgba(255,122,61,.10), transparent); }
.who { display: inline-flex; align-items: center; gap: 8px; } .who.big { gap: 14px; } .who.big small { display: block; color: var(--dim); }
.rank { font-family: var(--f-display); font-weight: 700; }
@media (max-width: 480px) {
  th { padding: 8px 5px; font-size: .58rem; letter-spacing: .03em; } td { padding: 8px 5px; }
  th:first-child, td:first-child { padding-left: 10px; } th:last-child, td:last-child { padding-right: 10px; }
  table { font-size: .8rem; }
  .diff-matrix td:not(:first-child) { white-space: nowrap; font-size: .74rem; } .diff-matrix td:first-child { font-size: .78rem; line-height: 1.25; }
  .table-wrap.stack { overflow-x: visible; }
  .table-wrap.stack thead { display: none; } .table-wrap.stack table, .table-wrap.stack tbody { display: block; }
  .table-wrap.stack tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table-wrap.stack tr:last-child { border-bottom: 0; }
  .table-wrap.stack td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; box-shadow: none !important; }
  .table-wrap.stack td.wide { grid-column: 1 / -1; }
  .table-wrap.stack td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-family: var(--f-mono); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
  .table-wrap.stack td[data-label=""]::before { display: none; }
  .table-wrap.stack .recap-table tr.ok { box-shadow: inset 3px 0 0 var(--good); } .table-wrap.stack .recap-table tr.miss { box-shadow: inset 3px 0 0 var(--bad); }
}
@media (max-width: 360px) { .diff-matrix td:not(:first-child) { white-space: normal; } }

/* ---------- empty states, notices, tooltips ---------- */
.empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 28px 18px; border: 1px dashed var(--line2); border-radius: var(--r); background: var(--bg2); }
.empty .empty-ico { width: 40px; height: 40px; color: var(--dim); } .empty h3 { margin: 6px 0 0; } .empty p { color: var(--dim); max-width: 52ch; margin: 0 0 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--text2); background: var(--fact-soft); border: 1px solid rgba(111,168,255,.3); padding: 10px 12px; border-radius: var(--r-sm); margin: 12px 0; }
.notice.warn { background: var(--warn-soft); border-color: rgba(229,180,69,.35); }
.skeleton { padding: 18px; color: var(--dim); font-family: var(--f-mono); font-size: .8rem; animation: pulse 1.4s infinite; } @keyframes pulse { 50% { opacity: .5; } }
.tipbox { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); color: var(--text2); font: 700 .7rem var(--f-mono); cursor: help; vertical-align: middle; }
.tipbox > span { position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(260px, 70vw); padding: 8px 10px; background: var(--raise); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; font: 500 .78rem/1.4 var(--f-body); text-align: left; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.tipbox:hover > span, .tipbox:focus > span, .tipbox:focus-within > span { display: block; }

/* ---------- timer + counter ---------- */
.timer { display: flex; align-items: center; gap: 10px; margin: 8px 0; } .timer .bar { flex: 1; height: 8px; background: var(--inset); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; } .timer .bar i { display: block; height: 100%; background: var(--accent); }
.timer .tlabel { font-family: var(--f-mono); font-size: .78rem; min-width: 3.4em; text-align: right; }
.timer.urgent .bar i { background: var(--bad); } .timer.urgent .tlabel { color: var(--bad); }
.counter { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

/* ---------- toast + modal ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 12px); z-index: 120; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 1100px) { #toasts { bottom: 24px; } }
.toast { display: grid; gap: 2px; padding: 12px 14px; background: var(--raise); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .25s var(--ease) both; } .toast span { color: var(--dim); font-size: .85rem; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
.modal-back { position: fixed; inset: 0; z-index: 110; background: rgba(3,5,8,.78); display: grid; place-items: end center; backdrop-filter: blur(4px); animation: fade .2s both; } @keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px 18px 0 0; padding: 0 18px calc(18px + var(--safe-b)); outline: none; animation: sheet .25s var(--ease) both; } @keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 640px) { .modal-back { place-items: center; padding: 20px; } .modal { border-radius: 16px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--panel); padding: 14px 0 6px; z-index: 1; } .modal-head h2 { margin: 0; font-size: 1.2rem; }
.settings .set-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); } .settings .set-row small { display: block; color: var(--dim); max-width: 32ch; } .settings select { width: auto; min-width: 150px; }
.toggle { position: relative; width: 56px; height: 32px; border-radius: 999px; background: var(--line2); border: 0; cursor: pointer; flex: none; } .toggle i { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.toggle.on { background: var(--accent); } .toggle.on i { transform: translateX(24px); }

/* ---------- achievements: skills, not activity ---------- */
.ach-grid { display: grid; gap: 12px; grid-template-columns: 1fr; } @media (min-width: 640px) { .ach-grid { grid-template-columns: repeat(2, 1fr); } } @media (min-width: 960px) { .ach-grid { grid-template-columns: repeat(3, 1fr); } }
.ach { --t: var(--fact); display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); } .ach.rare { --t: var(--unk); } .ach.epic { --t: var(--accent); }
.ach-ico { flex: none; width: 52px; height: 52px; display: grid; place-items: center; background: var(--inset); border: 1px solid var(--t); color: var(--t); border-radius: 14px; } .ach-ico .svg { width: 28px; height: 28px; }
.ach h3 { margin: 0 0 2px; font-size: .95rem; } .ach p { margin: 0 0 4px; font-size: .82rem; color: var(--text2); } .ach small { font-family: var(--f-mono); color: var(--dim); font-size: .66rem; text-transform: uppercase; }
.ach.on { border-color: color-mix(in srgb, var(--t) 50%, var(--line)); } .ach.off { opacity: .6; } .ach.off .ach-ico { filter: grayscale(1); }
.ach-sum { display: grid; gap: 8px; margin: 14px 0 22px; } .ach-sum b { font-family: var(--f-display); font-size: 1.6rem; }
.unlocks { margin: 20px 0; display: grid; gap: 10px; }
.mini-ach { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--fact); color: var(--fact); background: var(--inset); border-radius: 10px; } .mini-ach.rare { border-color: var(--unk); color: var(--unk); } .mini-ach.epic { border-color: var(--accent); color: var(--accent); }

/* ---------- confetti: kept for the rare high score only ---------- */
.burst { position: absolute; left: 50%; top: 30%; width: 0; height: 0; z-index: 30; pointer-events: none; } .burst i { position: absolute; width: 7px; height: 7px; border-radius: 2px; animation: pop 1s ease-out forwards; } @keyframes pop { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }

/* ---------- faq ---------- */
.faq { display: grid; gap: 10px; margin-top: 20px; } .faq-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); } .faq-item.open { border-color: var(--line2); }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; min-height: 56px; padding: 12px 16px; background: transparent; color: var(--text); border: 0; cursor: pointer; font: 600 1rem var(--f-body); }
.faq-q::after { content: "+"; font: 400 1.4rem var(--f-mono); color: var(--accent); } .faq-q[aria-expanded="true"]::after { content: "\2212"; }
.faq-a { padding: 0 16px 6px; color: var(--text2); }
