/* 第一节 V7 · 界面零件：重建的 Codex 窗口、输入框、菜单，手机与浏览器外框，以及贯穿全课的平均值小项目。 */

/* ---------- Codex app ---------- */
.cx-app {
  --cx-text: #0d0d0f; --cx-2: #5d5d63; --cx-3: #8e8e94; --cx-line: #e6e6ea; --cx-soft: #f4f4f6; --cx-side: #f7f7f8;
  position: relative; border-radius: 14px; background: #fff; color: var(--cx-text);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .07), 0 30px 70px -30px rgba(10, 14, 60, .55), 0 10px 24px -14px rgba(10, 14, 60, .3);
  overflow: hidden; font-size: 13px; line-height: 1.45; text-align: left;
}
.cx-titlebar { height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 12px; background: var(--cx-side); border-bottom: 1px solid var(--cx-line); }
.cx-titlebar i { width: 11px; height: 11px; border-radius: 50%; background: #e5e5e8; }
.cx-titlebar i:nth-child(1) { background: #fe5f57; } .cx-titlebar i:nth-child(2) { background: #febc2e; } .cx-titlebar i:nth-child(3) { background: #28c840; }
.cx-titlebar span { flex: 1; text-align: center; margin-right: 50px; font-size: 12px; color: var(--cx-3); }
.cx-body { display: flex; min-height: 0; }
.cx-side { width: 184px; flex: none; background: var(--cx-side); border-right: 1px solid var(--cx-line); padding: 12px 10px; display: flex; flex-direction: column; gap: 1px; }
.cx-side p { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; white-space: nowrap; overflow: hidden; color: var(--cx-text); }
.cx-side p span { overflow: hidden; text-overflow: ellipsis; }
.cx-brandrow { font-size: 14px; padding-bottom: 8px !important; }
.cx-new { background: #ececef; }
.cx-sh { font-size: 11.5px; color: var(--cx-3) !important; margin-top: 10px; }
.cx-row.on, .cx-new.on { background: #e6e6ea; }
.cx-recent { color: var(--cx-2) !important; }
.cx-main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.ic { width: 15px; height: 15px; flex: none; }

.cx-composer { position: relative; border-radius: 18px; background: #f1f1f4; padding: 0; color: var(--cx-text, #0d0d0f); text-align: left; font-size: 13px; }
.cx-ctop { display: flex; align-items: center; gap: 4px; padding: 6px 10px 5px; color: #5d5d63; flex-wrap: wrap; }
.cx-ctop .cx-grow { flex: 1; }
.cx-card { background: #fff; border-radius: 17px; box-shadow: 0 0 0 1px #e3e3e8, 0 6px 18px -10px rgba(0, 0, 0, .25); }
.cx-composer:not(:has(.cx-ctop)) { background: transparent; }
.cx-input { padding: 13px 16px 4px; min-height: 46px; }
.cx-ph { color: #a2a2a8; }
.cx-text { color: #1b1b1f; white-space: pre-wrap; }
.cx-cbot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 10px; }
.cx-left, .cx-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cx-plus { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #5d5d63; }
.cx-chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border-radius: 8px; color: #45454b; white-space: nowrap; font-size: 12.5px; transition: background-color .2s, color .2s, box-shadow .2s; }
.cx-chip .ic:last-child { width: 12px; height: 12px; opacity: .6; }
.cx-chip b { font-weight: 600; color: #0d0d0f; }
button.cx-chip:hover { background: #ececef; }
.cx-chip.lit { background: #fff3c4; box-shadow: 0 0 0 1.5px #f0c419; color: #0d0d0f; }
.cx-send { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #0d0d0f; color: #fff; }
.cx-send.off { background: #d4d4d8; }
.cx-send .ic { width: 15px; height: 15px; }
.cx-mic { width: 28px; height: 28px; display: grid; place-items: center; color: #5d5d63; }

.cx-menu {
  min-width: 230px; padding: 6px; border-radius: 14px; background: #fff; color: #0d0d0f; font-size: 13px; text-align: left;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .07), 0 18px 40px -12px rgba(10, 14, 50, .35);
}
.cx-mhead { font-size: 11.5px; color: #8e8e94; padding: 6px 10px 4px; }
.cx-mi { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 9px; color: #1b1b1f; text-align: left; transition: background-color .15s; }
button.cx-mi:hover, .cx-mi.hover { background: #f2f2f4; }
.cx-mi.on { font-weight: 500; }
.cx-mi .cx-ml { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cx-mi small { font-size: 11.5px; color: #8e8e94; font-weight: 400; line-height: 1.35; }
.cx-mi .cx-mv { color: #6b6b72; }
.cx-mi > .ic:first-child { color: #45454b; }
.cx-mi > .ic:last-child:not(:first-child) { width: 14px; height: 14px; color: #0d0d0f; }
.cx-radio { width: 17px; height: 17px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #c9c9cf; flex: none; }
.cx-radio.on { box-shadow: inset 0 0 0 5px #0d0d0f; }
.cx-mi.off { color: #b3b3b8; }
.cx-sep { height: 1px; background: #ececef; margin: 5px 6px; }

/* a hotspot drawn over any recreated interface */
.spot { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; display: grid; place-items: center; z-index: 3;
  background: var(--mark); color: var(--ink); font: 600 13px/1 var(--mono); box-shadow: 0 0 0 4px rgba(255, 216, 77, .35), 0 6px 14px rgba(0, 0, 0, .25);
  transition: transform .25s var(--spring), box-shadow .25s; }
.spot:hover, .spot[aria-pressed="true"] { transform: scale(1.14); box-shadow: 0 0 0 7px rgba(255, 216, 77, .4), 0 6px 14px rgba(0, 0, 0, .25); }
.spot[aria-pressed="true"] { background: var(--ink); color: var(--mark); }
@keyframes spot-ping { 0% { box-shadow: 0 0 0 0 rgba(255, 216, 77, .7), 0 6px 14px rgba(0, 0, 0, .25); } 100% { box-shadow: 0 0 0 16px rgba(255, 216, 77, 0), 0 6px 14px rgba(0, 0, 0, .25); } }
.page.in:not(.touched) .spot[aria-pressed="false"] { animation: spot-ping 2.2s var(--ease) infinite; }

/* ---------- phone ---------- */
.phone {
  position: relative; width: 300px; aspect-ratio: 300 / 620; border-radius: 46px; padding: 11px;
  background: #121214; box-shadow: inset 0 0 0 2px #2c2c31, 0 40px 80px -30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .3);
}
.phone-notch { position: absolute; left: 50%; top: 20px; width: 92px; height: 26px; margin-left: -46px; border-radius: 20px; background: #121214; z-index: 3; }
.phone-screen { position: relative; height: 100%; border-radius: 36px; overflow: hidden; background: #f2f2f7; color: #111; font-size: 13px; line-height: 1.45; }

/* ---------- browser ---------- */
.bw { border-radius: 12px; overflow: hidden; background: #fff; color: #111; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 24px 60px -28px rgba(0, 0, 0, .4); }
.bw-bar { height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 12px; background: #f1f1f3; border-bottom: 1px solid #e4e4e8; }
.bw-bar i { width: 10px; height: 10px; border-radius: 50%; background: #d9d9de; }
.bw-url { flex: 1; margin: 0 30px 0 8px; height: 22px; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; font: 11.5px/1 var(--mono); color: #6b6b72; box-shadow: 0 0 0 1px #e4e4e8; overflow: hidden; white-space: nowrap; }
.bw-body { position: relative; }

/* ---------- the mean project ---------- */
.mean { --max: 10; display: grid; gap: 14px; color: inherit; }
.mean-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mean-eq { font-family: var(--mono); font-size: .9rem; opacity: .75; font-variant-numeric: tabular-nums; }
.mean-eq b { font-weight: 600; opacity: 1; }
.mean output { font-family: var(--display); font-size: 2.6rem; font-weight: 650; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.mean-bars { position: relative; height: 150px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: end; border-bottom: 1px solid currentColor; padding-top: 18px; }
.mean-bars .bar { position: relative; height: calc(var(--v) / var(--max) * 100%); min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, currentColor 18%, transparent); transition: height .35s var(--ease); }
.mean-bars .bar.x { background: var(--mark); }
.mean-bars .bar em { position: absolute; left: 0; right: 0; bottom: 100%; text-align: center; font: 500 .78rem/1.6 var(--mono); font-style: normal; }
.mean-bars .avg-line { position: absolute; left: -4px; right: -4px; bottom: calc(var(--v) / var(--max) * (100% - 18px)); height: 0; border-top: 2px dashed currentColor; transition: bottom .35s var(--ease); }
.mean-range { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; font-size: .84rem; opacity: .9; }
.mean-range input { width: 100%; }

/* range inputs, one look everywhere */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: currentColor; opacity: .9; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: currentColor; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--mark); box-shadow: 0 0 0 2px var(--ink), 0 3px 8px rgba(0, 0, 0, .3); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--mark); border: 2px solid var(--ink); }

/* a check that lights when it becomes true */
.tick { display: flex; gap: 10px; align-items: baseline; transition: color .3s; }
.tick::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .35; transform: translateY(3px); transition: all .3s var(--spring); }
.tick.on::before { opacity: 1; box-shadow: inset 0 0 0 8px var(--ok); }
.tick.bad::before { opacity: 1; box-shadow: inset 0 0 0 8px var(--bad); }

/* small status words in simulations */
.st { font: 500 .72rem/1 var(--mono); letter-spacing: .02em; padding: 4px 7px; border-radius: 5px; white-space: nowrap; }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.bad { background: var(--bad-soft); color: var(--bad); }
.st.ask { background: var(--amber-soft); color: #a75f00; }
.st.dim { background: rgba(127, 127, 127, .13); color: inherit; opacity: .8; }
.t-ink .st.ok { color: #4fd18f; } .t-ink .st.bad { color: #ff7a7a; } .t-ink .st.ask { color: #ffb347; }

@media (max-width: 760px) {
  .cx-side { display: none; }
  .phone { width: min(280px, 78vw); }
}

/* ---------- module openers (dark, particle number) ---------- */
.op { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); grid-template-areas: "num emblem" "text emblem" "parts parts"; column-gap: clamp(28px, 5vw, 80px); row-gap: 14px; align-content: space-between; }
.op-num { grid-area: num; margin: 0; font-family: var(--display); font-size: clamp(6.5rem, 14vw, 14rem); line-height: .78; font-weight: 700; letter-spacing: -.06em; color: var(--mark); justify-self: start; transition: color .6s; }
body.field-on .page.is-now .op-num { color: transparent; }
.op-text { grid-area: text; align-self: end; }
.op-text .lede { max-width: 30em; }
.op-emblem { grid-area: emblem; align-self: center; justify-self: stretch; }
.op-parts { grid-area: parts; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); border-top: 1px solid var(--line-ink); margin-top: 10px; }
.op-parts > li { padding: 16px 24px 0 0; border-right: 1px solid var(--line-ink); transition: background-color .3s; }
.op-parts > li + li { padding-left: 24px; }
.op-parts > li:last-child { border-right: 0; }
.op-pn { font: 500 .74rem/1 var(--mono); color: var(--mark); }
.op-parts h2 { font-size: 1.08rem; margin-top: 8px; }
.op-pt { font-size: .84rem; color: var(--on-ink-muted); margin-top: 4px; line-height: 1.55; }
.op-parts ul { margin-top: 10px; display: grid; }
.op-parts ul button { width: 100%; display: flex; gap: 10px; align-items: baseline; padding: 4px 0; text-align: left; font-size: .88rem; color: var(--on-ink-2); transition: color .2s, transform .25s var(--ease); }
.op-parts ul button i { font-style: normal; font: .7rem/1 var(--mono); color: var(--on-ink-muted); min-width: 1.8em; }
.op-parts ul button:hover { color: var(--mark); transform: translateX(4px); }
.op.hl-0 [data-part-i="0"] h2, .op.hl-1 [data-part-i="1"] h2, .op.hl-2 [data-part-i="2"] h2, .op.hl-3 [data-part-i="3"] h2 { color: var(--mark); }
@media (max-width: 860px) {
  .op { grid-template-columns: 1fr; grid-template-areas: "num" "text" "emblem" "parts"; }
  .op-parts { grid-template-columns: 1fr; }
  .op-parts > li, .op-parts > li + li { padding: 14px 0; border-right: 0; border-bottom: 1px solid var(--line-ink); }
}
