/* Platform apps: Trophies and the RJ.OS SDK. This sheet loads with the page, so rules on short or shared class names
   (.tr, .st, canvas.scene3d) sit under the app's window, :where(.app-<id>), which adds no specificity. */

/* ── Trophies ── */
:where(.app-trophies) .tr { padding: 18px 22px 24px; }
.tr-head { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.tr-level { display: grid; justify-items: center; width: 84px; padding: 10px 0 8px; border: 1px solid var(--acc-a35); border-radius: 10px; background: var(--acc-a06); }
.tr-level .display { font-size: 44px; line-height: 1; color: var(--acc); }
.tr-who { display: grid; gap: 6px; min-width: 0; }
.tr-namerow { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tr-name { min-width: 0; width: 16ch; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 500 12px var(--font-mono); }
.tr-name:focus { outline: 0; border-color: var(--acc); }
.tr-bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.tr-bar i { display: block; height: 100%; background: var(--acc); }
.tr-xp { font-size: 11.5px; }
.tr-group { margin-top: 18px; }
.tr-group-t { margin-bottom: 6px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.tr-item { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 12px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; opacity: 0.72; }
.tr-item.is-on { opacity: 1; border-color: var(--acc-a35); background: var(--acc-a06); }
.tr-ic .px-icon { width: 24px; height: 24px; }
.tr-item:not(.is-on) .tr-ic { filter: grayscale(1); opacity: 0.6; }
.tr-t { font-size: 13px; color: var(--text); }
.tr-d { font-size: 11.5px; color: var(--muted); }
.tr-prog { font-size: 11px; margin-top: 2px; }
.tr-x { font: 600 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
.tr-item.is-on .tr-x { color: var(--acc); }
.tr-foot { margin-top: 16px; font-size: 11px; }
.os.is-mobile :where(.app-trophies) .tr { padding: 14px; }
.os.is-mobile .tr-item { grid-template-columns: 24px 1fr auto; }
.os.is-mobile .tr-item .btn { display: none; }
[data-mode='light'] .tr-item.is-on { border: 2px solid var(--nb-line); background: var(--nb-tag-bg); }
[data-mode='light'] .tr-item.is-on .tr-x { color: var(--text); }
[data-mode='light'] .tr-level { border: 2px solid var(--nb-line); background: var(--nb-tag-bg); }
[data-mode='light'] .tr-level .display { color: var(--text); }
[data-mode='light'] .tr-bar { border: 1px solid var(--nb-line); }

/* ── RJ.OS SDK ── */
.sdk { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sdk-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.sdk-tab { flex: none; padding: 5px 12px; border-radius: 6px; font: 500 12px var(--font-mono); color: var(--muted); }
.sdk-tab:hover { color: var(--text); background: var(--panel-3); }
.sdk-tab[aria-selected='true'] { background: var(--nb-fill); color: var(--nb-fill-ink); }
.sdk-pane { flex: 1; min-height: 0; padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.sdk-lead { max-width: 70ch; font-size: 12.5px; line-height: 1.6; }
.sdk-small { font-size: 11px; line-height: 1.5; }
.sdk-pad { padding: 18px; }
.sdk-rows { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sdk-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.sdk-row:last-child { border-bottom: 0; }
.sdk-k { color: var(--text); font-weight: 600; }
.sdk-v { color: var(--muted); min-width: 0; }
.sdk-s { font: 600 10px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.sdk-s.is-live { color: var(--green); }
.sdk-s.is-setup, .sdk-s.is-local { color: var(--acc); }
.sdk-s.is-wait { color: var(--dim); }
.sdk-actions { display: flex; gap: 8px; }
.sdk-cam { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sdk-cam-v { width: 240px; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); transform: scaleX(-1); }
.sdk-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sdk-bar .h3 { margin-right: auto; }
.sdk-select, .sdk-input { height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 500 12px var(--font-mono); }
.sdk-input { flex: 1; min-width: 0; height: 32px; }
.sdk-input:focus, .sdk-select:focus { outline: 0; border-color: var(--acc); }
.sdk-sky { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: auto; font: 500 12px var(--font-mono); }
.sdk-sky-r { display: grid; grid-template-columns: 1.2fr 0.8fr 1fr 1fr 1fr 0.9fr; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); min-width: 520px; }
.sdk-sky-r:last-child { border-bottom: 0; }
.sdk-sky-h { color: var(--dim); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; background: var(--panel-2); }
.sdk-rev { color: var(--acc); font-weight: 700; }
.sdk-seg { display: flex; gap: 4px; }
.sdk-range { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.sdk-range input { width: 90px; accent-color: var(--acc); }
.sdk-3d { position: relative; flex: 1; min-height: 280px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #000; }
:where(.app-sdk) .sdk-3d canvas.scene3d { display: block; }
.sdk-peers { display: flex; gap: 6px; flex-wrap: wrap; }
.sdk-board { display: grid; gap: 4px; padding: 12px; border-radius: 8px; background: #000; border: 1px solid var(--line); }
.sdk-dot { aspect-ratio: 1; border-radius: 50%; background: var(--led-off, #2a1d0b); }
.sdk-dot.is-on { background: var(--acc); box-shadow: 0 0 8px var(--acc-a35); }
.sdk-ask { display: flex; gap: 8px; max-width: 640px; }
.sdk-ai-out { max-width: 640px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.os.is-mobile .sdk-pane { padding: 14px; }
.os.is-mobile .sdk-row { grid-template-columns: 1fr auto; }
.os.is-mobile .sdk-row .sdk-v { grid-column: 1 / -1; grid-row: 2; }
[data-mode='light'] .sdk-board { background: var(--panel-2); }
[data-mode='light'] .sdk-dot { background: var(--panel-3); }
[data-mode='light'] .sdk-dot.is-on { background: var(--print-ink, var(--acc)); box-shadow: none; }
[data-mode='light'] .sdk-3d { background: var(--bg); }
[data-mode='light'] .sdk-s.is-setup, [data-mode='light'] .sdk-s.is-local, [data-mode='light'] .sdk-rev { color: var(--text); }

/* ── Settings ── */
.st-app { padding: 18px 22px 24px; }
.st-seg { flex: none; display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.st-seg button { padding: 5px 10px; border-radius: 6px; font: 500 11.5px var(--font-mono); color: var(--muted); }
.st-seg button:hover { color: var(--text); }
.st-seg button[aria-checked='true'] { background: var(--nb-fill); color: var(--nb-fill-ink); }
.st-name { width: 18ch; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 500 12px var(--font-mono); }
.st-name:focus { outline: 0; border-color: var(--acc); }
.os.is-mobile .st-app { padding: 14px; }
.os.is-mobile :where(.app-settings) .st .md-set { flex-wrap: wrap; }

/* ── Bit, the LED assistant ── */
.bit { position: absolute; z-index: 50; right: 22px; bottom: calc(var(--dock-h) + 22px); display: grid; justify-items: end; gap: 8px; pointer-events: none; }
.bit[hidden] { display: none; }
.os:not([data-phase='desktop']) .bit { display: none; }
.bit > * { pointer-events: auto; }
.bit-btn { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 12px; animation: bit-bob 3.2s ease-in-out infinite; }
.bit-btn canvas { width: 48px; height: 48px; }
.bit-btn:hover, .bit-btn[aria-expanded='true'] { background: var(--acc-a10); }
@keyframes bit-bob { 50% { transform: translateY(-3px); } }
.bit-bubble {
  position: relative; width: min(330px, calc(100vw - 32px)); padding: 14px 14px 12px; border-radius: 12px;
  background: var(--surface-pop); border: 1px solid var(--acc-a35); box-shadow: var(--shadow-pop); animation: pop 0.18s var(--ease-out);
}
.bit-bubble::after { content: ''; position: absolute; right: 22px; bottom: -7px; width: 12px; height: 12px; background: inherit; border-right: inherit; border-bottom: inherit; transform: rotate(45deg); }
.bit-x { position: absolute; top: 4px; right: 6px; width: 26px; height: 26px; color: var(--muted); font-size: 16px; }
.bit-x:hover { color: var(--text); }
.bit-t { margin: 0 22px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--text); }
.bit-d { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }
.bit-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bit-form { margin-top: 10px; }
.bit-in { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 500 12px var(--font-mono); }
.bit-in:focus { outline: 0; border-color: var(--acc); }
.bit-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); }
.bit-list button { color: var(--acc); font: 600 11.5px var(--font-mono); text-decoration: underline; text-underline-offset: 2px; }
.os.is-mobile .bit { right: 10px; bottom: calc(var(--dock-h) + 12px); }
.os.is-mobile.has-windows .bit { display: none; }
[data-mode='light'] .bit-bubble { border: 2px solid var(--nb-line); box-shadow: var(--nb-shadow); }
[data-mode='light'] .bit-list button { color: var(--text); }

/* ── Folder windows ── */
.fd { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.fd-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.fd-crumb { flex: 1; min-width: 0; font: 500 12px var(--font-mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-search { width: 180px; min-width: 0; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 500 12px var(--font-mono); }
.fd-search:focus { outline: 0; border-color: var(--acc); }
.fd-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.fd-side { border-right: 1px solid var(--line); background: var(--bg-2); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.fd-place { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 7px; text-align: left; font-size: 12.5px; color: var(--text-2); }
.fd-place .px-icon { width: 18px; height: 18px; }
.fd-place:hover { background: var(--panel-3); color: var(--text); }
.fd-place[aria-current='true'] { background: var(--acc-a10); color: var(--text); box-shadow: inset 2px 0 0 var(--acc); }
.fd-n { font: 500 10.5px var(--font-mono); color: var(--dim); }
.fd-main { padding: 18px 22px 24px; min-width: 0; }
.fd-title { display: flex; align-items: center; gap: 10px; }
.fd-title h2 { margin: 0; font: 800 26px/1 var(--font-dot); color: var(--acc); letter-spacing: 0.02em; }
.fd-title .px-icon { width: 28px; height: 28px; }
.fd-count { margin-left: auto; font: 500 11px var(--font-mono); color: var(--dim); }
.fd-note { margin: 6px 0 16px; font-size: 12.5px; }
.fd-grid { display: grid; gap: 10px; }
.fd-grid--cards { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); grid-auto-flow: row dense; }
.fd-grid--list { grid-template-columns: 1fr; gap: 4px; }
.fd-group { grid-column: 1 / -1; margin: 10px 0 0; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.fd-group:first-child { margin-top: 0; }
.fd-card {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); transition: transform 0.15s var(--ease-out), border-color 0.15s;
}
.fd-card:hover { border-color: var(--acc-a35); transform: translateY(-2px); }
.fd-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.fd-ic .px-icon { width: 40px; height: 40px; filter: drop-shadow(0 0 10px var(--acc-a20)); }
.fd-txt { display: grid; gap: 3px; min-width: 0; }
.fd-txt b { font-size: 13px; color: var(--text); }
.fd-d { font-size: 11.5px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fd-grid--list .fd-card { grid-template-columns: 30px minmax(0, 1fr); align-items: center; padding: 8px 10px; }
.fd-grid--list .fd-ic .px-icon { width: 26px; height: 26px; }
.fd-grid--list .fd-txt { grid-template-columns: minmax(0, 14em) 1fr; gap: 12px; align-items: baseline; }
.fd-grid--list .fd-d { -webkit-line-clamp: 1; }
.fd-empty { grid-column: 1 / -1; padding: 24px 0; }
.os.is-mobile .fd-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
.os.is-mobile .fd-side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.os.is-mobile .fd-place { flex: none; grid-template-columns: 18px auto; padding: 6px 10px; }
.os.is-mobile .fd-n { display: none; }
.os.is-mobile .fd-main { padding: 14px; }
.os.is-mobile .fd-search { width: 120px; }
.os.is-mobile .fd-grid--list .fd-txt { grid-template-columns: 1fr; gap: 2px; }
[data-mode='light'] .fd-side { background: var(--panel-2); border-right: 2px solid var(--nb-line); }
[data-mode='light'] .fd-place[aria-current='true'] { background: var(--nb-tag-bg); box-shadow: inset 3px 0 0 var(--nb-line); }
[data-mode='light'] .fd-card { border: 2px solid var(--nb-line); background: var(--panel); box-shadow: var(--nb-shadow-sm); }
[data-mode='light'] .fd-card:hover { box-shadow: var(--nb-shadow); }
[data-mode='light'] .fd-title h2 { color: var(--text); }
[data-mode='light'] .fd-ic .px-icon { filter: drop-shadow(2px 2px 0 rgba(28, 24, 20, 0.45)); }
