/* =====================================================================
   screens-coding-fc.css —— AI 编程屏「FC 风 v2」（cd- 前缀）。
   电竞 / EA Sports FC Mobile 风：复用 theme-fc.css 的 fc-* 组件
   （fc-screen/fc-bg/fc-title/fc-card/fc-btn/fc-input/fc-badge），
   本文件只写编程屏自己的布局与细节。
   竖版 1080x1920（默认）：顶栏 / 表单卡 / OUTPUT 代码区纵叠；
   横版 1920x1080（body.landscape）：顶栏横贯，表单卡(左) | 代码区(右) 双栏。
   旧版样式（screens-misc.css 的 coding 段 + main.css .coding-*）不再被
   #screen-coding 引用，但按约定原文件一律不动。
   ===================================================================== */

/* ---------------- 布局根（竖版默认纵叠） ---------------- */
.cd-app {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  gap: 26px;
  padding: 48px 44px 34px;
  min-height: 0;
}

/* 竖版（默认，非 body.landscape）：表单 + 一键生成滑杆 + OUTPUT + 「我生成的 Agent」
   纵叠后常高于 1920 设计高度 —— 整屏改为可上下滚动，否则下半部分（历史列表）够不到、
   且移动端会感觉「卡死」。历史列表与 OUTPUT 不再各自内层滚动（嵌套滚动会吞掉触摸手势），
   改为随整页一起滚；overscroll-behavior:contain 防止滚动穿透到门户外层页。 */
body:not(.landscape) #screen-coding .cd-app {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body:not(.landscape) #screen-coding .cd-output { flex: 0 0 auto; }
body:not(.landscape) #screen-coding .cd-result { max-height: 560px; }
body:not(.landscape) #screen-coding .cd-history { flex: 0 0 auto; }
body:not(.landscape) #screen-coding .cd-history-list { max-height: none; overflow: visible; }

/* ---------------- 顶栏：标题条 + 额度徽章（金）+ 返回（红） ---------------- */
.cd-top { display: flex; align-items: center; gap: 26px; flex: 0 0 auto; }
.cd-title { font-size: 54px; }
.cd-quota { font-size: 25px; padding: 8px 22px; flex: none; }
.cd-back { margin-left: auto; font-size: 26px; padding: 12px 34px; flex: none; }

/* ---------------- 表单卡（fc-card 斜切玻璃卡 + 左侧绿→青能量竖条） ---------------- */
.cd-form {
  position: relative;
  display: flex; flex-direction: column;
  gap: 22px;
  padding: 32px 40px 36px;
  flex: 0 0 auto;
  min-height: 0;
}
.cd-form::before {
  content: '';
  position: absolute; left: 0; top: 0; width: 8px; height: 100%;
  background: linear-gradient(180deg, var(--fc-energy), var(--fc-cyan));
  box-shadow: 0 0 16px rgba(21, 227, 113, 0.5);
  pointer-events: none;
}

/* 引导文案（卡内顶部，弱化为次级说明） */
.cd-intro { font-size: 24px; line-height: 1.65; color: var(--fc-txt-dim); }

/* =====================================================================
   ★ 三模式 UX（① 一键生成 / ② 描述战术 / ③ 代码编辑）+ 一键生成滑杆面板
   由 coding.js 动态注入 .cd-form 顶部。fc 视觉语言：棱角、电光绿强调。
   ===================================================================== */

/* "说人话"引导行：醒目电光绿，提醒玩家"你是在训练球员" */
.cd-sayhuman {
  margin: 0;
  font-family: var(--fc-d); font-style: italic; font-weight: 800;
  font-size: 27px; letter-spacing: 1px; line-height: 1.4;
  color: var(--fc-energy);
  text-shadow: 0 0 14px rgba(21, 227, 113, 0.35);
}

/* 模式切换卡：三张大卡平分一行，选中态电光绿描边 + 底色 */
.cd-modes { display: flex; gap: 16px; }
.cd-mode {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 10px 14px;
  cursor: pointer;
  background: rgba(8, 16, 28, 0.7);
  border: 2px solid rgba(120, 150, 175, 0.28);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  color: var(--fc-txt-dim);
  transition: border-color .14s, background .14s, color .14s;
}
.cd-mode-tab {
  font-family: var(--fc-d); font-style: italic; font-weight: 800;
  font-size: 28px; letter-spacing: 1px;
}
.cd-mode-sub { font-size: 20px; letter-spacing: 2px; opacity: .8; }
.cd-mode.on {
  background: linear-gradient(135deg, rgba(21, 227, 113, 0.22), rgba(13, 161, 78, 0.1));
  border-color: var(--fc-energy);
  color: var(--fc-txt);
  box-shadow: 0 0 18px rgba(21, 227, 113, 0.3);
}
.cd-mode.on .cd-mode-tab { color: var(--fc-energy); }

/* 一键生成滑杆面板：整块纵排（与 cd-form 内字段同节奏） */
.cd-slider-panel { display: flex; flex-direction: column; gap: 22px; }

/* 位置选择：四个棱角小按钮一行 */
.cd-pos-row { display: flex; gap: 14px; }
.cd-pos {
  flex: 1 1 0; min-width: 0;
  padding: 14px 6px;
  cursor: pointer;
  background: rgba(8, 16, 28, 0.7);
  border: 2px solid rgba(120, 150, 175, 0.28);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  font-family: var(--fc-d); font-style: italic; font-weight: 700;
  font-size: 24px; letter-spacing: 1px;
  color: var(--fc-txt-dim);
  transition: border-color .14s, background .14s, color .14s;
}
.cd-pos.on {
  background: linear-gradient(135deg, rgba(21, 227, 113, 0.22), rgba(13, 161, 78, 0.1));
  border-color: var(--fc-energy);
  color: var(--fc-energy);
  box-shadow: 0 0 14px rgba(21, 227, 113, 0.28);
}

/* 滑杆字段：标签 + 两端短语 + range */
.cd-slider-field { gap: 8px; }
.cd-slider-ends {
  display: flex; justify-content: space-between;
  font-size: 21px; letter-spacing: 1px;
  color: var(--fc-txt-faint);
}
.cd-slider-ends em { font-style: normal; }

/* 原生 range 轻量 fc 化（电光绿棱形滑块 + 暗轨） */
.cd-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 10px; margin: 6px 0;
  background: rgba(120, 150, 175, 0.22);
  border: 1px solid rgba(21, 227, 113, 0.3);
  cursor: pointer;
}
.cd-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px;
  background: var(--fc-energy);
  border: 2px solid #03140a;
  box-shadow: 0 0 12px rgba(21, 227, 113, 0.6);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  cursor: pointer;
}
.cd-range::-moz-range-thumb {
  width: 30px; height: 30px; border: 2px solid #03140a;
  background: var(--fc-energy);
  box-shadow: 0 0 12px rgba(21, 227, 113, 0.6);
  cursor: pointer;
}

/* 只读"说人话"摘要框：展示拼出的中文 prompt，让小白看到训练结果 */
.cd-summary {
  padding: 16px 20px;
  background: rgba(4, 8, 16, 0.85);
  border: 1px solid rgba(21, 227, 113, 0.3);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  font-size: 22px; line-height: 1.6;
  color: #8df5a9;
}

/* 字段：标签 + 控件纵排（覆盖 main.css 全局 label 配色） */
.cd-field { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cd-field > span {
  font-family: var(--fc-d); font-style: italic; font-weight: 700;
  font-size: 24px; letter-spacing: 2px;
  color: var(--fc-txt-dim);
}

/* 模板/模型双下拉、上传/下载双按钮的横排容器 */
.cd-row { display: flex; gap: 24px; align-items: flex-end; }
.cd-row > .cd-field { flex: 1 1 0; }

/* 输入控件：fc-input 之上补屏内细节（main.css 给原生控件的 12px 圆角必须清零，
   否则与 fc 斜切角打架；宽度吃满字段列） */
#screen-coding .fc-input { width: 100%; border-radius: 0; }

/* select 也 fc-input 化：去原生外观 + 电光绿自绘箭头；
   弹出列表跟随深色底（option 不吃 clip-path，单独给底色） */
#screen-coding select.fc-input {
  cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 64px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='14' viewBox='0 0 22 14'%3E%3Cpath d='M2 2l9 9 9-9' fill='none' stroke='%2315e371' stroke-width='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 22px center;
  background-size: 22px 14px;
}
#screen-coding select.fc-input option {
  background: #0a101e;
  color: var(--fc-txt);
  font-family: var(--fc-f);
}
/* 未配置模型等禁用项灰显 */
#screen-coding select.fc-input option:disabled { color: var(--fc-txt-faint); }

/* 描述 textarea */
#screen-coding .cd-prompt { min-height: 216px; line-height: 1.6; }

/* 生成主按钮：fc-btn-primary 全宽 + 主页同款流光扫过（::after sheen） */
.cd-generate {
  position: relative; overflow: hidden;
  width: 100%;
  font-size: 36px; letter-spacing: 4px;
  padding: 22px;
}
.cd-generate::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.5) 50%, transparent 60%);
  transform: translateX(-130%);
  animation: cd-sheen 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cd-sheen { 0% { transform: translateX(-130%); } 55%, 100% { transform: translateX(130%); } }
/* 生成中（disabled）流光停掉，避免「忙碌却闪亮」的误导 */
.cd-generate:disabled::after { display: none; }

/* 上传 / 下载（ghost 次级操作，平分一行） */
.cd-actions { align-items: stretch; }
.cd-actions .fc-btn { flex: 1 1 0; min-width: 0; font-size: 25px; padding: 15px 20px; }

/* ---------------- 结果代码区：深色等宽代码框 + 电光绿描边 + OUTPUT 角标 ---------------- */
.cd-output {
  position: relative;
  flex: 1 1 auto; min-height: 220px;
  display: flex;
  background: rgba(4, 8, 16, 0.92);
  border: 1px solid rgba(21, 227, 113, 0.38);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55), 0 0 22px rgba(21, 227, 113, 0.08);
}
/* 左上角「OUTPUT」绶带角标（右缘斜切，呼应整体棱角语言） */
.cd-output-tag {
  position: absolute; left: 0; top: 0; z-index: 1;
  padding: 5px 26px 5px 18px;
  background: linear-gradient(120deg, var(--fc-energy), #0aa14e);
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
  font-family: var(--fc-d); font-style: italic; font-weight: 800;
  font-size: 21px; letter-spacing: 4px;
  color: #03140a;
  pointer-events: none;
}
/* 代码本体：内部滚动（pre 由 JS textContent 填充） */
.cd-result {
  flex: 1 1 auto; min-width: 0;
  margin: 0;
  overflow: auto;
  padding: 58px 30px 26px;
  font-family: Consolas, 'JetBrains Mono', 'SF Mono', Menlo, 'Courier New', monospace;
  font-size: 22px; line-height: 1.55;
  color: #8df5a9;
  white-space: pre-wrap; word-break: break-all;
}
/* 空态占位（生成/上传成功后由 coding.js 填充文本） */
.cd-result:empty::before {
  content: '// 生成或上传成功后，agent 代码会显示在这里…';
  color: var(--fc-txt-faint);
  font-family: var(--fc-f);
}

/* ---------------- 状态行（额度/生成/上传等业务提示，金色与额度徽章呼应） ---------------- */
.cd-status { flex: 0 0 auto; min-height: 34px; font-size: 25px; letter-spacing: 1px; color: var(--fc-gold); }

/* ---------------- 动效弱化 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .cd-generate::after { display: none; animation: none; }
}

/* =====================================================================
   ★ 横版（body.landscape，1920x1080）：顶栏横贯，表单卡(左 54%) | 代码区(右 46%)
   双栏，状态行横贯底部。表单高度吃紧时卡内滚动，代码区独立滚动。
   ===================================================================== */
/* 横版三栏区：左=表单(主, 通高)；右上=OUTPUT(最不重要, 小范围)；右下=我生成的 Agent(填满, 可滚) */
body.landscape #screen-coding .cd-app {
  display: grid;
  grid-template-columns: 54fr 46fr;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    'top    top'
    'form   output'
    'form   history'
    'status status';
  gap: 18px 30px;
  padding: 34px 64px 26px;
}
body.landscape #screen-coding .cd-top { grid-area: top; }
body.landscape #screen-coding .cd-form {
  grid-area: form;
  gap: 17px;
  padding: 26px 32px 28px;
  overflow-y: auto;
}
/* OUTPUT 降级为小窗（生成的代码极少有人逐行看；右下让位给 Agent 列表） */
body.landscape #screen-coding .cd-output { grid-area: output; height: 190px; min-height: 0; }
body.landscape #screen-coding .cd-history {
  grid-area: history; margin-top: 0; min-height: 0;
  display: flex; flex-direction: column;
}
body.landscape #screen-coding .cd-history-list { max-height: none; flex: 1 1 auto; min-height: 0; }
body.landscape #screen-coding .cd-status { grid-area: status; min-height: 30px; }
body.landscape #screen-coding .cd-title { font-size: 46px; }
body.landscape #screen-coding .cd-intro { font-size: 22px; line-height: 1.55; }
body.landscape #screen-coding .cd-prompt { min-height: 150px; }
body.landscape #screen-coding .cd-generate { font-size: 31px; padding: 16px; letter-spacing: 3px; }
body.landscape #screen-coding .cd-actions .fc-btn { font-size: 23px; padding: 12px 16px; }
/* 三模式 UX 在横版收紧字号/间距，保证表单卡内可滚动不溢出 */
body.landscape #screen-coding .cd-sayhuman { font-size: 23px; }
body.landscape #screen-coding .cd-modes { gap: 12px; }
body.landscape #screen-coding .cd-mode { padding: 11px 8px 10px; }
body.landscape #screen-coding .cd-mode-tab { font-size: 24px; }
body.landscape #screen-coding .cd-mode-sub { font-size: 18px; }
body.landscape #screen-coding .cd-slider-panel { gap: 15px; }
body.landscape #screen-coding .cd-pos { font-size: 21px; padding: 11px 5px; }
body.landscape #screen-coding .cd-slider-ends { font-size: 19px; }
body.landscape #screen-coding .cd-summary { font-size: 20px; padding: 12px 16px; }

/* ===== 生成历史列表 ===== */
#screen-coding .cd-history { margin-top: 18px; }
#screen-coding .cd-history-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#screen-coding .cd-history-title {
  font-family: var(--fc-d); font-style: italic; font-weight: 800; letter-spacing: 1px;
  font-size: 24px; color: var(--fc-txt); text-transform: uppercase;
}
#screen-coding .cd-history-n {
  font-size: 19px; color: var(--fc-energy); font-weight: 700;
  background: rgba(21, 227, 113, 0.12); border: 1px solid rgba(21, 227, 113, 0.3);
  border-radius: 999px; padding: 2px 12px;
}
#screen-coding .cd-history-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
#screen-coding .cd-history-empty { font-size: 22px; color: var(--fc-txt-faint); padding: 12px 4px; }
#screen-coding .cd-hist-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 16px 20px; background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--fc-stroke); border-radius: 14px; transition: .14s;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
#screen-coding .cd-hist-row:hover { background: rgba(21, 227, 113, 0.08); border-color: rgba(21, 227, 113, 0.4); }
#screen-coding .cd-hist-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--fc-cyan); box-shadow: 0 0 14px var(--fc-cyan); }
#screen-coding .cd-hist-name {
  flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Noto Sans SC', sans-serif; font-weight: 700; font-size: 26px; color: var(--fc-txt);
}
#screen-coding .cd-hist-go { flex: none; font-size: 21px; font-weight: 700; color: var(--fc-energy); }

/* ---- 积分余额徽章（每日免费徽章右侧）+ 积分不足充值弹窗 ---- */
.cd-credits { margin-left: 12px; }

.cd-pay-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 8, 6, 0.72); backdrop-filter: blur(4px);
}
.cd-pay-modal.hidden { display: none; }
.cd-pay-card {
  width: min(560px, 90vw); padding: 36px 34px;
  background: var(--fc-panel, #0c1814); border: 1px solid var(--fc-stroke, rgba(255,255,255,.14));
  border-radius: 20px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}
.cd-pay-title { margin: 0 0 14px; font-size: 34px; font-weight: 900; color: var(--fc-txt, #eafff6); }
.cd-pay-msg { margin: 0 0 26px; font-size: 24px; line-height: 1.6; color: var(--fc-txt-dim, #b9d8cd); }
.cd-pay-row { display: flex; gap: 16px; justify-content: flex-end; }
.cd-pay-row .fc-btn { font-size: 24px; padding: 12px 30px; }
