/* ============================================================
   apps.css —— 六个内置应用（终端 / 文件 / 文本 / 图片 / 音频 / 代码）
   ============================================================ */

/* ============================ 终端 ============================ */
.term { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.term__stage {
  flex: 1; min-height: 0; position: relative;
  background: linear-gradient(180deg, rgba(16,20,30,.94), rgba(11,14,22,.96));
  color: #dbe2f0; overflow: hidden;
}
.term__log {
  position: absolute; inset: 0; overflow: auto;
  padding: 14px 16px 20px;
  font-family: var(--font-mono);
  font-size: calc(var(--app-font) * .92);
  line-height: 1.7;
  word-break: break-word;
}
.term__line { white-space: pre-wrap; }
.term__line + .term__line { margin-top: 1px; }
.term__line[data-t="cmd"] { color: #fff; }
.term__line[data-t="ok"] { color: #7ee0b8; }
.term__line[data-t="dim"] { color: #7f8aa6; }
.term__line[data-t="warn"] { color: #f3c46b; }
.term__line[data-t="err"] { color: #ff8f8a; }
.term__line[data-t="head"] { color: #9fc0ff; }
.term__neofetch { display: flex; gap: 16px; align-items: flex-start; }
.term__neofetch pre { margin: 0; color: #7fb2ff; line-height: 1.35; }
.term__neofetch div { font-size: .96em; line-height: 1.55; }
.term__neofetch b { color: #fff; }
.term__bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.term__prompt {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  /* 输入行属于终端机身的一部分：必须是暗色，否则浅绿提示符会落在浅色玻璃上 */
  background: linear-gradient(180deg, #12172180, #0b0e16f2), #0d1119;
  color: #dbe2f0;
}
.term__ps { font-family: var(--font-mono); color: #6ee7b7; font-size: calc(var(--app-font) * .9); white-space: nowrap; }
.term__ps b { color: #9fc0ff; font-weight: 600; }
.term__input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  color: #fff; font-family: var(--font-mono);
  font-size: calc(var(--app-font) * .95);
  caret-color: #6ee7b7;
}
.term__hint { color: #8f9ab5; font-family: var(--font-mono); font-size: calc(var(--app-font) * .8); padding-right: 4px; }

/* 终端：刷视频式 Feed 模式 */
.tfeed {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #1b2334 0%, #0b0e16 70%);
}
.tfeed[hidden] { display: none; }
.tfeed__track {
  position: absolute; inset: 0;
  transition: transform .5s cubic-bezier(.22,.9,.24,1);
}
.tfeed__card {
  position: absolute; left: 0; right: 0; height: 100%;
  padding: 18px 18px 56px;
  display: flex; flex-direction: column; gap: 10px;
  color: #e6ecf8;
}
.tfeed__idx { font-size: 11px; letter-spacing: 2px; color: #7c88a5; }
.tfeed__title { font-size: calc(15px * var(--font-scale)); font-weight: 700; }
.tfeed__cmd {
  font-family: var(--font-mono); font-size: calc(var(--app-font) * .95);
  padding: 11px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  word-break: break-all;
}
.tfeed__cmd em { font-style: normal; color: #6ee7b7; }
.tfeed__out {
  flex: 1; min-height: 0; overflow: auto;
  font-family: var(--font-mono); font-size: calc(var(--app-font) * .86);
  line-height: 1.72; color: #a7b2cc; white-space: pre-wrap;
}
.tfeed__out .k { color: #9fc0ff; }
.tfeed__foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
}
.tfeed__foot .grow { flex: 1; }
.tfeed__foot .pill {
  height: 30px; font-size: calc(12px * var(--font-scale));
  /* 这条操作栏是终端机身的一部分（深色），按钮必须换成深底配色，
     否则会拿默认的深色字压在深底上 */
  --pill-fg: #e6ecf8;
  border-color: rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.tfeed__foot .pill--ghost { --pill-bg: rgba(255, 255, 255, .1); }
.tfeed__foot .pill--bare { --pill-bg: transparent; --pill-fg: #aab5cc; box-shadow: none; }
.tfeed__foot .pill--bare[aria-pressed="true"] {
  --pill-bg: rgba(43, 108, 246, .92); --pill-fg: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.tfeed__page { color: #8b96b1; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tfeed__hint {
  position: absolute; left: 0; right: 0; bottom: 52px; text-align: center;
  color: #97a2ba; font-size: 11px; letter-spacing: 1px; pointer-events: none;
}
.tfeed__arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.1); color: #cfd8ea;
  border: 1px solid rgba(255,255,255,.16);
  transition: background .2s, transform .2s;
}
.tfeed__arrow:hover { background: rgba(255,255,255,.2); }
.tfeed__arrow svg { width: 15px; height: 15px; }
.tfeed__arrow--up { top: 22%; }
.tfeed__arrow--down { top: auto; bottom: 22%; transform: translateY(0); }

/* ============================ 文件资源浏览器 ============================ */
.files { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.files__main { flex: 1; min-height: 0; display: flex; }
.files__grid {
  flex: 1; min-width: 0; overflow: auto; padding: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px; align-content: start;
}
.fitem {
  padding: 12px 8px 10px; border-radius: var(--r-md);
  display: grid; justify-items: center; gap: 7px;
  cursor: default; user-select: none;
  transition: background .16s, transform .16s;
}
.fitem:hover { background: rgba(255, 255, 255, .72); }
.fitem.is-sel { background: rgba(43, 108, 246, .12); box-shadow: inset 0 0 0 1px rgba(43,108,246,.28); }
.fitem__ico {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #fff, #eaeff8);
  box-shadow: var(--sh-1), inset 0 1px 0 #fff;
  color: var(--ink-600);
  overflow: hidden;
}
.fitem__ico svg { width: 22px; height: 22px; }
.fitem__ico img { width: 100%; height: 100%; object-fit: cover; }
.fitem[data-k="dir"] .fitem__ico { background: linear-gradient(160deg, #ffe0a3, #f6b04a); color: #7a4c0c; }
.fitem[data-k="image"] .fitem__ico { color: #178a68; }
.fitem[data-k="audio"] .fitem__ico { color: #c0455a; }
.fitem[data-k="code"] .fitem__ico { color: #2f4d9c; }
.fitem__name {
  font-size: calc(11.8px * var(--font-scale)); text-align: center;
  color: var(--ink-800); line-height: 1.38;
  overflow-wrap: anywhere; word-break: normal; hyphens: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 列表视图 */
.files.is-list .files__grid { grid-template-columns: 1fr; gap: 2px; padding: 8px; }
.files.is-list .fitem {
  grid-template-columns: 30px 1fr auto; align-items: center;
  justify-items: start; padding: 6px 10px; gap: 10px;
}
.files.is-list .fitem__ico { width: 28px; height: 28px; border-radius: 9px; }
.files.is-list .fitem__ico svg { width: 16px; height: 16px; }
.files.is-list .fitem__name { text-align: left; display: block; -webkit-line-clamp: 1; }
.files.is-list .fitem__meta { display: block; }
.fitem__meta { display: none; font-size: 11.4px; color: var(--ink-500); }

/* ============================ 文本编辑器 ============================ */
.tedit { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.tedit__area {
  flex: 1; min-height: 0; display: flex; padding: 0;
}
.tedit textarea {
  flex: 1; min-width: 0; width: 100%; height: 100%;
  padding: 16px 18px; border: 0; outline: none; resize: none;
  background: rgba(255, 255, 255, .62);
  color: var(--ink-800);
  font-family: var(--font-ui);
  font-size: var(--app-font);
  line-height: 1.85;
  tab-size: 2;
}
.tedit textarea.mono { font-family: var(--font-mono); line-height: 1.7; }
.tedit[data-wrap="off"] textarea { white-space: pre; overflow-x: auto; }

/* ============================ 图片查看器 ============================ */
.imgv { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.imgv__stage {
  flex: 1; min-height: 0; position: relative;
  display: grid; place-items: center; overflow: auto;
  padding: 16px;
  background:
    radial-gradient(80% 70% at 50% 0%, rgba(255,255,255,.7), rgba(236,240,248,.5));
}
.imgv__stage img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  transition: transform .28s cubic-bezier(.2,.9,.25,1);
  transform: scale(var(--zoom, 1));
  -webkit-user-drag: none;
}
.imgv__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--sh-2); color: var(--ink-700);
  transition: background .2s, transform .2s;
}
.imgv__nav:hover { background: #fff; }
.imgv__nav svg { width: 17px; height: 17px; }
.imgv__nav--l { left: 12px; }
.imgv__nav--r { right: 12px; }
.imgv__strip {
  flex: none; display: flex; gap: 8px; padding: 10px 12px;
  overflow-x: auto; border-top: 1px solid rgba(16,19,26,.07);
  background: rgba(255, 255, 255, .42);
}
.imgv__thumb {
  width: 66px; height: 44px; flex: none; border-radius: 9px; overflow: hidden;
  border: 2px solid transparent; background-size: cover; background-position: center;
  opacity: .72; transition: opacity .2s, border-color .2s, transform .2s;
}
.imgv__thumb:hover { opacity: 1; transform: translateY(-2px); }
.imgv__thumb[aria-current="true"] { border-color: var(--blue-500); opacity: 1; }

/* ============================ 音频播放器 ============================ */
.aud { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.aud__main { flex: 1; min-height: 0; display: flex; gap: 0; }
.aud__list { width: 210px; flex: none; overflow: auto; padding: 10px; border-right: 1px solid rgba(16,19,26,.07); background: rgba(255,255,255,.3); }
.atrack {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 12px; cursor: default;
  transition: background .16s;
}
.atrack:hover { background: rgba(255,255,255,.8); }
.atrack[aria-current="true"] { background: linear-gradient(180deg, #fff, #f2f6fd); box-shadow: var(--sh-1); }
.atrack__ico { width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center; background: linear-gradient(160deg, #fff, #e6ecf7); color: var(--ink-600); }
.atrack__ico svg { width: 16px; height: 16px; }
.atrack__t { font-size: calc(12.6px * var(--font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atrack__d { font-size: 11px; color: var(--ink-400); }
.aud__now { flex: 1; min-width: 0; display: grid; place-items: center; padding: 18px; gap: 4px; }
.aud__inner { display: grid; justify-items: center; gap: 12px; width: 100%; max-width: 420px; }
.aud__art {
  width: 148px; height: 148px; border-radius: 26px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #fff, #e4eaf6);
  box-shadow: var(--sh-2), inset 0 1px 0 #fff;
  color: var(--ink-500);
  position: relative; overflow: hidden;
}
.aud__art svg { width: 52px; height: 52px; }
.aud__art.is-play::after {
  content: ""; position: absolute; inset: -40%;
  background: conic-gradient(from 0deg, rgba(43,108,246,.16), rgba(255,255,255,0) 40%);
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.aud__title { font-size: calc(15.5px * var(--font-scale)); font-weight: 700; text-align: center; }
.aud__sub { font-size: calc(12.2px * var(--font-scale)); color: var(--ink-400); }
.aud__viz { width: 100%; height: 58px; border-radius: 14px; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px rgba(255,255,255,.7); }
.aud__seek { width: 100%; }
.aud__row { display: flex; align-items: center; gap: 10px; width: 100%; }
.aud__time { font-size: 11.5px; color: var(--ink-400); font-variant-numeric: tabular-nums; width: 40px; }
.aud__time:last-child { text-align: right; }
.aud__ctl { display: flex; align-items: center; gap: 8px; justify-content: center; }
.aud__ctl .pill--icon { width: 40px; height: 40px; }
.aud__ctl .pill--play { width: 52px; height: 52px; }
.aud__ctl .pill--play > svg { width: 20px; height: 20px; }

/* ============================ 代码编辑器 ============================ */
.cedit { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.cedit__tabs {
  flex: none; display: flex; gap: 4px; padding: 7px 10px 0;
  overflow-x: auto; background: rgba(255,255,255,.3);
  border-bottom: 1px solid rgba(16,19,26,.07);
}
.ctab {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px; border-radius: 10px 10px 0 0;
  font-size: calc(12.2px * var(--font-scale)); color: var(--ink-500);
  background: rgba(255,255,255,.42);
  border: 1px solid rgba(16,19,26,.06); border-bottom: 0;
  white-space: nowrap;
}
.ctab[aria-selected="true"] { background: rgba(255,255,255,.9); color: var(--ink-900); font-weight: 600; }
.ctab__x { width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-400); }
.ctab__x:hover { background: rgba(16,19,26,.12); color: var(--ink-900); }
.ctab__x svg { width: 9px; height: 9px; }
.ctab__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

.cedit__body { flex: 1; min-height: 0; display: flex; position: relative; background: rgba(255,255,255,.6); }
.cedit__gutter {
  flex: none; width: 46px; overflow: hidden; padding: 12px 8px 12px 0;
  text-align: right; font-family: var(--font-mono);
  font-size: calc(var(--app-font) * .92); line-height: 1.65;
  color: var(--ink-500); background: rgba(255,255,255,.62);
  border-right: 1px solid rgba(16,19,26,.06);
  user-select: none;
}
.cedit__code { position: relative; flex: 1; min-width: 0; }
.cedit__hl, .cedit__input {
  margin: 0; padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: calc(var(--app-font) * .92);
  line-height: 1.65;
  white-space: pre; word-break: normal;
  tab-size: 2;
}
.cedit__hl {
  position: absolute; inset: 0; overflow: auto;
  pointer-events: none; color: var(--ink-800);
  background: transparent;
}
.cedit__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: auto; resize: none; border: 0; outline: none;
  background: transparent; color: transparent;
  caret-color: var(--blue-600);
  -webkit-text-fill-color: transparent;
}
.cedit__input::selection { background: rgba(43, 108, 246, .2); }
/* 语法着色 */
.tk-com { color: #6f7a91; font-style: italic; }
.tk-str { color: #1a8a5a; }
.tk-num { color: #b45309; }
.tk-key { color: #6d3ff0; font-weight: 600; }
.tk-fn  { color: #1f5fe0; }
.tk-tag { color: #c0455a; }
.tk-attr { color: #b45309; }
.tk-meta { color: #0f766e; }

.cedit__out {
  flex: none; max-height: 40%; overflow: auto;
  border-top: 1px solid rgba(16,19,26,.08);
  background: rgba(16, 20, 30, .95); color: #d7deee;
  font-family: var(--font-mono); font-size: calc(var(--app-font) * .86);
  line-height: 1.68; padding: 10px 13px; white-space: pre-wrap;
}
.cedit__out[hidden] { display: none; }
.cedit__out .e { color: #ff8f8a; }
.cedit__out .o { color: #7ee0b8; }

/* 对话框（重命名 / 新建） */
.sheet {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(240, 244, 251, .5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.sheet[hidden] { display: none; }
.sheet__box { width: min(360px, 88%); padding: 18px; border-radius: var(--r-lg); display: grid; gap: 12px; }
.sheet__box h4 { font-size: calc(14.5px * var(--font-scale)); }
.sheet__actions { display: flex; justify-content: flex-end; gap: 8px; }
