/* ==========================================================================
 * XUI Interactive Showcase & 4-App Scenario Demos
 * Strictly consumes XUI CSS custom properties.
 * ========================================================================== */

.sc-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  font-weight: var(--t-weight-semibold);
}

.sc-brand-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--text-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-caption-size);
  font-weight: var(--t-weight-bold);
  flex: none;
}

/* 展厅顶栏塞了明暗 / 皮肤 / 密度 / 动效 / 语言 / 命令面板六组控件：
 * 视口偏窄或切到英文时 .sc-controls 会换行，而 .xui-topbar 是固定高度，
 * 换行后的第二排会溢出并压住下方内容。这里按内容增高，让换行成为正常布局。 */
.sc-topbar {
  height: auto;
  min-height: var(--topbar-h);
  flex-wrap: wrap;
  row-gap: var(--s-1-5);
  padding-block: var(--s-1-5);
}

.sc-controls {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.sc-swatch-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-1-5);
  background: var(--bg-base);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.sc-color-input {
  width: 20px;
  height: 20px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--r-pill);
}

.sc-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}

.sc-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  border-bottom: 1px solid var(--line-subtle);
  padding-bottom: var(--s-2);
}

.sc-page {
  padding: var(--s-5);
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.sc-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.sc-view.is-active {
  display: flex;
  animation: xui-fade-in var(--d-fast) var(--ease-out);
}

/* Token Swatch Tiles */
.sc-ramp {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-2-5);
}

.sc-chip-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-elev-1);
}

.sc-chip-preview {
  height: 44px;
  border-bottom: 1px solid var(--line-subtle);
}

.sc-chip-meta {
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* App Frame Wrapper for the 4 Scenario Previews */
.sc-app-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Demo 1: Text Editor / IDE ---------- */
.sc-code-surface {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface-code);
  font-family: var(--font-mono);
  font-size: var(--t-small-size);
  line-height: 1.65;
  padding: var(--s-3) var(--s-0);
}

.sc-code-line {
  display: flex;
  padding: var(--s-0) var(--s-4);
}

.sc-code-line.is-current {
  background: var(--accent-soft);
}

.sc-code-ln {
  width: 40px;
  flex: none;
  color: var(--text-3);
  text-align: right;
  padding-right: var(--s-4);
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.sc-tok-kw { color: var(--accent); font-weight: var(--t-weight-medium); }
.sc-tok-str { color: var(--success); }
.sc-tok-fn { color: var(--info); }
.sc-tok-cm { color: var(--text-3); font-style: italic; }
.sc-tok-num { color: var(--warn); }

.sc-terminal {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-base);
  font-family: var(--font-mono);
  font-size: var(--t-caption-size);
  line-height: 1.55;
  padding: var(--s-3) var(--s-4);
  color: var(--text-2);
}

/* ---------- Demo 2: Video Editor / NLE ---------- */
.sc-nle-viewport {
  flex: 1;
  min-height: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  gap: var(--s-3);
}

.sc-nle-canvas {
  width: min(100%, 560px);
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 28% 32%, var(--accent-soft), transparent 55%),
    var(--tone-grad-1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-3);
}

.sc-nle-safe {
  position: absolute;
  inset: 10%;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xs);
  pointer-events: none;
  opacity: 0.6;
}

.sc-nle-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.sc-nle-tc {
  font-family: var(--font-mono);
  font-size: var(--t-h2-size);
  font-weight: var(--t-weight-semibold);
  color: var(--text-pure);
  font-variant-numeric: tabular-nums;
}

/* ---------- Demo 3: Chat / IM ---------- */
.sc-chat-list {
  width: 248px;
  flex: none;
  border-right: 1px solid var(--line);
  background: var(--bg-elev-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sc-chat-item {
  display: flex;
  align-items: center;
  gap: var(--s-2-5);
  padding: var(--s-2-5) var(--s-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-1);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease);
}

.sc-chat-item:hover { background: var(--bg-elev-3); }
.sc-chat-item.is-active { background: var(--accent-soft); }

.sc-chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3-5);
}

.sc-chat-composer {
  flex: none;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
  background: var(--bg-elev-1);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ---------- Demo 4: Cloud Drive ---------- */
.sc-drive-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-elev-1);
  cursor: pointer;
  transition: border-color var(--d-fast) var(--ease), background var(--d-fast) var(--ease);
}

.sc-drive-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-elev-2);
}

.sc-drive-thumb {
  height: 84px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-pure);
}

/* ---------- Demo: Interaction Primitives ---------- */
.sc-stage {
  margin-top: var(--s-3);
  height: 88px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--line-strong);
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sc-stage-box {
  width: 54px;
  height: 32px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--t-micro-size);
  font-weight: var(--t-weight-semibold);
  will-change: transform;
}

@media (max-width: 899px) {
  .sc-chat-list {
    width: 196px;
  }
  .sc-page {
    padding: var(--s-3-5);
  }
}

@media (max-width: 639px) {
  .sc-controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
  }
  .sc-controls::-webkit-scrollbar {
    display: none;
  }
  .sc-chat-list {
    display: none;
  }
}
