/* 奶蛙幸存者 —— 图鉴页样式（v0.29.0）
 * 三栏：左列表 / 中预览 / 右信息；窄屏（竖屏手机）改成上下堆叠。
 */
:root {
  --cx-bg: #0d1117;
  --cx-panel: #141a26;
  --cx-panel-2: #161d2a;
  --cx-line: #263048;
  --cx-line-2: #33415c;
  --cx-text: #dfe6f2;
  --cx-dim: #8fa0b8;
  --cx-gold: #ffd24a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body.cx-page {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(70, 110, 160, 0.18), transparent 70%),
    radial-gradient(900px 600px at 100% 110%, rgba(120, 90, 160, 0.14), transparent 70%),
    var(--cx-bg);
  color: var(--cx-text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  overflow: hidden;
}

.cx {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 16px);
  height: 100%;
  padding: clamp(8px, 1.6vh, 18px) clamp(10px, 2vw, 26px) clamp(10px, 1.8vh, 20px);
}

/* ---------------- 顶栏 ---------------- */
.cx-top {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 18px);
}

.cx-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.42em 0.9em;
  border-radius: 0.6em;
  border: 1px solid var(--cx-line-2);
  background: var(--cx-panel-2);
  color: #ffe9ad;
  text-decoration: none;
  font-size: clamp(12px, 1.7vh, 15px);
  white-space: nowrap;
}
.cx-back:hover { border-color: var(--cx-gold); color: #fff3c9; }

.cx-title {
  margin: 0;
  font-size: clamp(18px, 3vh, 30px);
  letter-spacing: 0.16em;
  text-shadow: 0 2px 10px rgba(255, 210, 74, 0.25);
}

.cx-sub {
  color: var(--cx-dim);
  font-size: clamp(10px, 1.5vh, 13px);
  letter-spacing: 0.06em;
}

.cx-tabs {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.cx-tab {
  padding: 0.42em 1.2em;
  border-radius: 999px;
  border: 1px solid var(--cx-line-2);
  background: var(--cx-panel-2);
  color: var(--cx-dim);
  font-size: clamp(12px, 1.7vh, 15px);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cx-tab:hover { color: var(--cx-text); border-color: #4b5b7c; }
.cx-tab.on {
  background: var(--cx-gold);
  border-color: var(--cx-gold);
  color: #2a2110;
  font-weight: 700;
}

/* ---------------- 主体三栏 ---------------- */
.cx-main {
  display: grid;
  grid-template-columns: clamp(148px, 13vw, 210px) minmax(0, 1fr) clamp(230px, 25vw, 360px);
  gap: clamp(8px, 1.2vw, 16px);
  min-height: 0;
}

/* 左：列表 */
.cx-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--cx-line-2) transparent;
}
.cx-list::-webkit-scrollbar { width: 6px; }
.cx-list::-webkit-scrollbar-thumb { background: var(--cx-line-2); border-radius: 99px; }

.cx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--cx-line);
  background: var(--cx-panel);
  color: var(--cx-text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.14s;
}
.cx-item:hover { border-color: #4b5b7c; transform: translateX(2px); }
.cx-item.on {
  border-color: var(--cx-gold);
  background: #212a3a;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 74, 0.55);
}
.cx-item img, .cx-item .cx-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
.cx-item .cx-thumb { display: block; background-repeat: no-repeat; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45)); }
}
.cx-txt { display: flex; flex-direction: column; min-width: 0; }
.cx-txt .nm {
  font-size: clamp(12px, 1.7vh, 14px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-txt .sub {
  font-size: clamp(9px, 1.25vh, 11px);
  color: var(--cx-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 中：画布 + 动作按钮 */
.cx-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: clamp(8px, 1.2vh, 14px);
  border-radius: 12px;
  border: 1px solid var(--cx-line);
  background: var(--cx-panel);
}

.cx-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 38%, #1d2534 0%, #0c1018 72%);
  overflow: hidden;
}

#cxCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  aspect-ratio: 3 / 2;
}

.cx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.cx-act {
  padding: 0.34em 0.9em;
  border-radius: 999px;
  border: 1px solid var(--cx-line-2);
  background: var(--cx-panel-2);
  color: var(--cx-dim);
  font-size: clamp(11px, 1.5vh, 13px);
  font-family: inherit;
  cursor: pointer;
}
.cx-act:hover { color: var(--cx-text); border-color: #4b5b7c; }
.cx-act.on { background: #2f3b52; border-color: #8fd0ff; color: #eaf3ff; }

.cx-play {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--cx-dim);
  font-size: clamp(10px, 1.4vh, 12px);
}
.cx-play button {
  padding: 0.3em 0.85em;
  border-radius: 6px;
  border: 1px solid var(--cx-line-2);
  background: var(--cx-panel-2);
  color: var(--cx-text);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}
.cx-play button:hover { border-color: var(--cx-gold); }
.cx-play input[type="range"] { width: 92px; accent-color: var(--cx-gold); vertical-align: middle; }
#cxFrame { min-width: 108px; text-align: center; color: #b9c6da; }

/* 右：信息 */
.cx-info {
  overflow-y: auto;
  padding: clamp(10px, 1.6vh, 18px);
  border-radius: 12px;
  border: 1px solid var(--cx-line);
  background: var(--cx-panel);
  scrollbar-width: thin;
  scrollbar-color: var(--cx-line-2) transparent;
}
.cx-info::-webkit-scrollbar { width: 6px; }
.cx-info::-webkit-scrollbar-thumb { background: var(--cx-line-2); border-radius: 99px; }

.cx-info h2 {
  margin: 0 0 6px;
  font-size: clamp(18px, 2.5vh, 24px);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cx-tag {
  font-size: clamp(10px, 1.35vh, 12px);
  font-weight: 400;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: rgba(255, 210, 74, 0.14);
  border: 1px solid rgba(255, 210, 74, 0.35);
  color: #ffe09a;
}
.cx-desc {
  margin: 0 0 10px;
  color: #b9c6da;
  font-size: clamp(12px, 1.6vh, 14px);
  line-height: 1.65;
}
.cx-sec {
  margin: 14px 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--cx-gold);
  font-size: clamp(12px, 1.6vh, 14px);
  color: #ffe9ad;
  letter-spacing: 0.06em;
}
.cx-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.cx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.cx-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 7px;
  background: #1b2231;
  border: 1px solid #232c40;
  font-size: clamp(11px, 1.5vh, 13px);
}
.cx-stat .k { color: var(--cx-dim); }
.cx-stat .v { color: #9fe08a; font-weight: 700; font-variant-numeric: tabular-nums; }
.cx-grid .cx-stat .v { color: #ffd9a0; }

.cx-skill {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #18202e;
  border: 1px solid #24304a;
}
.cx-skill b {
  display: block;
  margin-bottom: 4px;
  color: #ffd98a;
  font-size: clamp(12px, 1.6vh, 14px);
}
.cx-skill p {
  margin: 0;
  color: #b9c6da;
  font-size: clamp(11px, 1.5vh, 13px);
  line-height: 1.62;
}
.cx-tip {
  margin: 0;
  color: #a9b8cc;
  font-size: clamp(11px, 1.5vh, 13px);
  line-height: 1.65;
}
.cx-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cx-line);
  color: var(--cx-dim);
  font-size: clamp(10px, 1.4vh, 12px);
}
.cx-muted { color: var(--cx-dim); font-size: 13px; }

/* ---------------- 窄屏 / 竖屏：上下堆叠 ---------------- */
/* 顶栏不换行：窄屏时标题 / 标签都缩一号，避免「图鉴」「角色」被折成两行 */
.cx-title, .cx-tab, .cx-back { white-space: nowrap; }

@media (max-width: 760px) {
  .cx-top { flex-wrap: wrap; row-gap: 6px; }
  .cx-title { font-size: 19px; letter-spacing: 0.1em; }
  .cx-sub { display: none; }
  .cx-back { padding: 0.34em 0.7em; font-size: 12px; }
  .cx-tab { padding: 0.34em 0.9em; font-size: 12px; }
}

@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  body.cx-page { overflow: auto; }
  .cx { height: auto; min-height: 100%; grid-template-rows: auto auto; }
  .cx-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(240px, 46vh) auto;
  }
  .cx-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 4px;
  }
  .cx-item { flex: 0 0 auto; }
  .cx-txt .sub { display: none; }
}
