/* 台股資金地圖 · 做我的股票圖卡（r20）— the editor overlay. Same dark tokens as one.css; the card itself is drawn on a canvas. */
.cx { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(4,7,11,.78); color: var(--fg, #E7ECF2); font: 13px/1.5 var(--font-ui, 'IBM Plex Sans', 'Noto Sans TC', sans-serif); -webkit-font-smoothing: antialiased; }
.cx[hidden] { display: none !important; }
.cx * { box-sizing: border-box; }
:where(.cx) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; } /* :where = zero specificity, so every .cx-* button class below wins */
:where(.cx) button:disabled { cursor: default; opacity: .55; }
.cx button:focus-visible, .cx input:focus-visible, .cx textarea:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.cx-box { position: relative; width: min(1180px, 100%); height: min(920px, 100%); display: grid; grid-template-rows: auto 1fr auto; background: var(--bg-2, #0F151D); border: 1px solid var(--line-2, rgba(148,163,184,.24)); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.cx-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line, rgba(148,163,184,.12)); min-width: 0; }
.cx-head h2 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; }
.cx-co { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); flex: none; white-space: nowrap; }
.cx-co b { font-size: 14px; white-space: nowrap; } .cx-co span { color: var(--fg-2, #A7B3C1); font-family: var(--font-mono, monospace); font-size: 12px; } .cx-co i { font-style: normal; color: #6ea8ff; font-size: 12px; white-space: nowrap; }
.cx-co:not(:disabled):hover { border-color: #1f6feb; }
.cx-date { color: var(--fg-2, #A7B3C1); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.cx-date.up { color: #ff7b7b; } .cx-date.down { color: #4bd37b; }
.cx-x { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; color: var(--fg-2, #A7B3C1); font-size: 16px; flex: none; }
.cx-x:hover { background: var(--bg-3, #151D27); color: var(--fg, #E7ECF2); }
.cx-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.cx-stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center; gap: 10px; padding: 16px; min-height: 0; background: radial-gradient(circle at 50% 40%, #16202c, #0a0f15 70%); }
.cx-frame { position: relative; height: 100%; max-height: 100%; aspect-ratio: 1080 / 1350; max-width: 100%; min-height: 0; }
.cx-cv { display: block; width: 100%; height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #1a2330; }
.cx-ov { position: absolute; inset: 0; touch-action: none; cursor: default; }
.cx[data-mode="edit"] .cx-ov { cursor: crosshair; }
.cx[data-mode="view"] .cx-stbar { display: none !important; }
.cx-sel { position: absolute; border: 2px dashed #1f6feb; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.65); }
.cx-h { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: #1f6feb; color: #fff; font-size: 14px; line-height: 30px; text-align: center; pointer-events: auto; box-shadow: 0 2px 8px rgba(0,0,0,.4); touch-action: none; }
.cx-hdel { right: -16px; top: -16px; background: #e5484d; }
.cx-hrot { right: -16px; bottom: -16px; cursor: nwse-resize; }
.cx-prot { position: absolute; inset: 0; pointer-events: none; }
.cx-prot i { position: absolute; background: repeating-linear-gradient(45deg, rgba(229,72,77,.18) 0 8px, rgba(229,72,77,.06) 8px 16px); outline: 1px dashed rgba(229,72,77,.7); }
.cx-prot span { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 6px; background: rgba(229,72,77,.9); color: #fff; font-size: 11px; }
.cx-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,15,21,.72); color: var(--fg-2, #A7B3C1); font-size: 13px; border-radius: 6px; }
.cx-load[hidden] { display: none; }
.cx-stbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 34px; }
.cx-stbar[hidden] { display: flex !important; visibility: hidden; } /* keeps its row so the card does not jump when a sticker is selected */
.cx-stbar button { height: 34px; min-width: 40px; padding: 0 12px; border-radius: 9px; background: var(--bg-3, #151D27); border: 1px solid var(--line-2, rgba(148,163,184,.24)); font-size: 13px; }
.cx-stbar button.warn { color: #ff8a8a; }
.cx-stbar .cx-sthint { display: none; align-self: center; color: var(--fg-3, #74808F); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-stbar.idle .cx-sthint { display: inline; } .cx-stbar.idle button { display: none; }
.cx-side { position: relative; min-height: 0; border-left: 1px solid var(--line, rgba(148,163,184,.12)); overflow-y: auto; overscroll-behavior: contain; }
.cx-ctrl { padding: 4px 16px 18px; }
.cx-sec { padding: 12px 0; border-bottom: 1px solid var(--line, rgba(148,163,184,.12)); }
.cx-sec:last-child { border-bottom: 0; }
.cx-sec h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.cx-sec h3 small { color: var(--fg-3, #74808F); font-weight: 400; font-size: 11.5px; }
.cx-hint { margin: 6px 0 0; color: var(--fg-3, #74808F); font-size: 11.5px; line-height: 1.5; }
.cx-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cx-pre { display: flex; flex-direction: column; gap: 5px; padding: 6px; border-radius: 10px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); text-align: left; }
.cx-pre canvas { width: 100%; height: auto; aspect-ratio: 216 / 270; border-radius: 5px; display: block; background: #1a2330; }
.cx-pre span { font-size: 11px; line-height: 1.3; color: var(--fg-2, #A7B3C1); } .cx-pre span b { display: block; font-size: 12px; }
.cx-pre[aria-pressed="true"] { border-color: #1f6feb; box-shadow: 0 0 0 1px #1f6feb inset; } .cx-pre[aria-pressed="true"] span { color: var(--fg, #E7ECF2); }
.cx-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cx-seg button { position: relative; height: 38px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); font-size: 12.5px; white-space: nowrap; }
.cx-seg.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cx-townbar { margin-top: 10px; } .cx-townbar[hidden] { display: none; } .cx-townbar .cx-btn { height: 34px; }
.cx-sun { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; } .cx-sun span { color: var(--fg-3, #74808F); font-size: 12px; margin-right: 2px; }
.cx-sun button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); font-size: 12px; }
.cx-sun button[aria-pressed="true"] { border-color: #1f6feb; background: rgba(31,111,235,.18); color: #fff; }
.cx-seg button[aria-pressed="true"] { background: rgba(31,111,235,.18); border-color: #1f6feb; color: #fff; font-weight: 600; }
.cx-seg em { position: absolute; top: -7px; right: -3px; padding: 0 5px; border-radius: 6px; background: #F3C65E; color: #1b1405; font-style: normal; font-size: 10px; line-height: 15px; font-weight: 700; }
.cx-in { width: 100%; height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); color: var(--fg, #E7ECF2); font: 14px var(--font-ui, sans-serif); }
.cx-in:disabled { opacity: .5; }
.cx-lab { display: block; margin-top: 10px; color: var(--fg-2, #A7B3C1); font-size: 12px; }
.cx-lab .cx-in { margin-top: 4px; }
.cx-link { margin-left: auto; color: #6ea8ff; font-size: 12px; font-weight: 500; }
.cx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cx-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); font-size: 12px; text-align: left; }
.cx-chip[aria-pressed="true"] { border-color: #1f6feb; background: rgba(31,111,235,.18); color: #fff; }
.cx-chip i { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 999px; background: #F3C65E; color: #1b1405; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 17px; vertical-align: 1px; }
.cx-charbar { display: flex; align-items: center; gap: 10px; margin-top: 10px; } .cx-charbar[hidden] { display: none; } .cx-charbar .cx-btn { height: 34px; } .cx-charbar .cx-hint { margin: 0; }
.cx-sw { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cx-sw button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 2px; border-radius: 9px; border: 1px solid transparent; }
.cx-sw button i { position: relative; display: block; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); overflow: hidden; }
.cx-sw button i b { position: absolute; right: 3px; bottom: 3px; width: 12px; height: 12px; border-radius: 50%; }
.cx-sw button span { font-size: 10.5px; color: var(--fg-2, #A7B3C1); white-space: nowrap; }
.cx-sw button[aria-pressed="true"] { border-color: #1f6feb; background: rgba(31,111,235,.12); }
.cx-stk { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cx-stk button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 9px; background: var(--bg-3, #151D27); border: 1px solid var(--line, rgba(148,163,184,.12)); }
.cx-stk button:hover { border-color: #1f6feb; }
.cx-stk svg { width: 38px; height: 38px; display: block; }
.cx-stk span { font-size: 10.5px; color: var(--fg-2, #A7B3C1); white-space: nowrap; }
.cx-stk[data-full="1"] button { opacity: .45; }
.cx-tg { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; cursor: pointer; }
.cx-tg input { width: 16px; height: 16px; accent-color: #1f6feb; flex: none; }
.cx-tg small { color: var(--fg-3, #74808F); font-size: 11px; }
.cx-tg:has(input:disabled) { opacity: .55; cursor: default; }
.cx-sign { margin: 2px 0 4px 24px; width: calc(100% - 24px); height: 34px; }
.cx-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cx-btn:hover { border-color: #1f6feb; }
.cx-btn.pri { background: #1f6feb; border-color: #1f6feb; color: #fff; box-shadow: 0 0 16px rgba(31,111,235,.4); }
.cx-btn.pri:hover { background: #3b82f6; }
.cx-btn.ghost { background: none; font-weight: 500; color: var(--fg-2, #A7B3C1); }
textarea.cx-cap { width: 100%; min-height: 190px; resize: vertical; padding: 10px; border-radius: 9px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); color: var(--fg, #E7ECF2); font: 13px/1.6 var(--font-ui, sans-serif); }
.cx-act { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line, rgba(148,163,184,.12)); background: var(--bg-2, #0F151D); }
.cx-act .cx-btn { min-width: 120px; }
.cx-act [hidden] { display: none; }
.cx-act[hidden] { display: none !important; }
.cx-view { padding: 18px 18px 22px; }
.cx-view[hidden], .cx-ctrl[hidden] { display: none; }
.cx-eyebrow { margin: 0 0 6px; color: #F3C65E; font-size: 12px; font-weight: 600; }
.cx-view h3 { margin: 0 0 4px; font-size: 22px; } .cx-view h3 small { color: var(--fg-2, #A7B3C1); font: 500 14px var(--font-mono, monospace); }
.cx-vdate { margin: 0 0 12px; color: var(--fg-2, #A7B3C1); }
.cx-vdate .up, .cx .up { color: #ff7b7b; } .cx-vdate .down, .cx .down { color: #4bd37b; }
.cx-ver { margin: 0 0 10px; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; }
.cx-ver.ok { background: rgba(75,211,123,.1); border: 1px solid rgba(75,211,123,.35); color: #b8f0cb; }
.cx-ver.warn { background: rgba(243,198,94,.1); border: 1px solid rgba(243,198,94,.4); color: #f6dc9b; }
.cx-ver.info { background: rgba(148,163,184,.1); border: 1px solid rgba(148,163,184,.3); color: var(--fg-2, #A7B3C1); }
.cx-vbtns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cx-vbtns .cx-btn { width: 100%; height: 44px; font-size: 14px; }
.cx-picker { position: absolute; inset: 0; z-index: 3; display: flex; justify-content: center; align-items: flex-start; padding: 64px 16px 16px; background: rgba(4,7,11,.6); }
.cx-picker[hidden] { display: none; }
.cx-pk { width: min(460px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--bg-2, #0F151D); border: 1px solid var(--line-2, rgba(148,163,184,.24)); border-radius: 14px; overflow: hidden; box-shadow: 0 16px 50px rgba(0,0,0,.5); }
.cx-pk-h { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line, rgba(148,163,184,.12)); }
.cx-pk-q { flex: 1 1 auto; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2, rgba(148,163,184,.24)); background: var(--bg-3, #151D27); color: var(--fg, #E7ECF2); font: 14px var(--font-ui, sans-serif); }
.cx-pk-h .cx-x { margin: 0; }
.cx-pk-l { overflow-y: auto; padding: 4px 6px 10px; overscroll-behavior: contain; }
.cx-pk-l h4 { margin: 10px 8px 4px; color: var(--fg-3, #74808F); font-size: 11.5px; font-weight: 600; }
.cx-pk-r { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.cx-pk-r:hover, .cx-pk-r:focus-visible { background: var(--bg-3, #151D27); }
.cx-pk-r b { font-size: 14px; } .cx-pk-r span { color: var(--fg-3, #74808F); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cx-pk-r em { font-style: normal; font-family: var(--font-mono, monospace); font-size: 12.5px; }
.cx-toast { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.cx-toast div { padding: 8px 14px; border-radius: 10px; background: rgba(15,21,29,.97); border: 1px solid var(--line-2, rgba(148,163,184,.24)); font-size: 12.5px; transition: opacity .4s; max-width: 86vw; text-align: center; }
/* phones: the card on top, the controls scroll under it, the actions stay at the bottom */
@media (max-width: 860px) {
  .cx { padding: 0; align-items: stretch; }
  .cx-box { width: 100%; height: 100%; border-radius: 0; border: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
  .cx-head { gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .cx-head h2 { display: none; }
  .cx-date { font-size: 11px; }
  .cx-main { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .cx-stage { padding: 10px 10px 8px; }
  .cx-frame { height: min(50vh, calc((100vw - 20px) * 1.25)); }
  .cx-side { border-left: 0; border-top: 1px solid var(--line, rgba(148,163,184,.12)); }
  .cx-ctrl { padding: 0 12px 12px; }
  .cx-stk { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cx-presets { display: flex; overflow-x: auto; scrollbar-width: none; } .cx-presets::-webkit-scrollbar { display: none; } .cx-pre { flex: 0 0 31%; }
  .cx-stbar { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; max-width: 100%; scrollbar-width: none; } .cx-stbar::-webkit-scrollbar { display: none; }
  .cx-stbar button { height: 32px; min-width: 36px; padding: 0 10px; flex: none; }
  .cx-act { flex-wrap: nowrap; gap: 6px; padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cx-act .cx-btn { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 12.5px; }
  .cx-picker { padding: 52px 8px 8px; }
  .cx-toast { bottom: 70px; }
}
@media (max-width: 400px) { .cx-stk { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cx-sw { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .cx * { transition: none !important; } }
