/* 3D condition guide — phone product pages only. Scoped so it does not restyle the sell flow. */
.spec-selector-wrap .q-sub-with-guide {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.spec-selector-wrap .cg-open-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--spec-green-dark, #0d6b3e);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.spec-selector-wrap .cg-open-link:hover { color: #0a5c34; }
.spec-selector-wrap .cg-open-link svg { flex: none; }
.spec-selector-wrap .cg-open-link-block { margin: -8px 0 18px; }

#guide {
  --cg-surface: #fff;
  --cg-surface-2: #f8faf9;
  --cg-line: #dde3e0;
  --cg-line-strong: #c5cec9;
  --cg-text: #16201b;
  --cg-muted: #5a6761;
  --cg-accent: #1a9e5a;
  --cg-accent-hover: #0d6b3e;
  --cg-orange: #f47c20;
  --cg-orange-hover: #de680d;
  --cg-accent-soft: #eaf6ef;
  --cg-warn-bg: #fff5ea;
  --cg-warn-line: #f0d6b8;
  --cg-warn-text: #86460f;
  --cg-stage-top: #f1f4f3;
  --cg-stage-bottom: #dbe1de;
  --cg-font: "Poppins", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cg-radius: 12px;
  --cg-radius-sm: 8px;
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
  font-family: var(--cg-font);
  color: var(--cg-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
#guide[hidden] { display: none !important; }
#guide button { font: inherit; color: inherit; }
#guide :focus-visible { outline: 2px solid var(--cg-accent-hover); outline-offset: 2px; }
#guide h2, #guide h3 { margin: 0; font-weight: 600; line-height: 1.25; }
#guide p { margin: 0; }
body.cg-open { overflow: hidden; }

#guide .cg-backdrop { position: absolute; inset: 0; background: rgba(12, 20, 16, .55); }
#guide .cg-panel {
  position: relative;
  background: var(--cg-surface);
  border-radius: 14px;
  width: min(1080px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(10, 20, 15, .3);
}
#guide .cg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 6px 24px; flex-shrink: 0; }
#guide .cg-head > div { min-width: 0; }
#guide .cg-head h2 { font-size: 20px; }
#guide .cg-head p { font-size: 13.5px; color: var(--cg-muted); margin-top: 2px; }
#guide .cg-icon-btn {
  width: 40px; height: 40px; flex: none; border: 0; background: none; border-radius: var(--cg-radius-sm);
  display: grid; place-items: center; cursor: pointer; color: var(--cg-muted);
}
#guide .cg-icon-btn:hover { background: var(--cg-surface-2); color: var(--cg-text); }
#guide .cg-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--cg-line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex-shrink: 0; min-height: 46px; -webkit-overflow-scrolling: touch; }
#guide .cg-tabs::-webkit-scrollbar { display: none; }
#guide .cg-tab {
  flex: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  height: auto; min-height: 46px; padding: 10px 14px; font-size: 14px; font-weight: 500; line-height: 1.2; color: var(--cg-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; box-sizing: border-box;
}
#guide .cg-tab:hover { color: var(--cg-text); }
#guide .cg-tab[aria-selected="true"] { color: var(--cg-text); border-bottom-color: var(--cg-accent); }
#guide .cg-tab .cg-mine { font-size: 11px; font-weight: 500; color: var(--cg-accent-hover); display: inline-flex; align-items: center; gap: 3px; }
#guide .cg-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); overflow: auto; flex: 1 1 auto; min-height: 0; }
#guide .cg-stage { display: flex; flex-direction: column; border-right: 1px solid var(--cg-line); min-width: 0; }
#guide .cg-stage-view {
  position: relative; height: clamp(320px, 58vh, 560px);
  background: radial-gradient(ellipse at 50% 38%, #fbfcfc 0%, var(--cg-stage-top) 45%, var(--cg-stage-bottom) 100%);
  overflow: hidden;
}
#guide #canvasHost { position: absolute; inset: 0; }
#guide #canvasHost canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
#guide #canvasHost canvas:active { cursor: grabbing; }
#guide #canvasHost canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--cg-accent-hover); }
#guide .cg-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--cg-muted); font-size: 13.5px; }
#guide .cg-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #cfd8d3; border-top-color: var(--cg-accent); animation: cg-spin .8s linear infinite; }
@keyframes cg-spin { to { transform: rotate(360deg); } }
#guide .cg-example { background: var(--cg-warn-bg); border-top: 1px solid var(--cg-warn-line); color: var(--cg-warn-text); padding: 9px 16px; font-size: 13px; line-height: 1.45; }
#guide .cg-example strong { font-weight: 600; margin-right: 4px; }
#guide .cg-chip { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.86); border: 1px solid var(--cg-line); border-radius: 6px; padding: 3px 9px; font-size: 12px; color: var(--cg-muted); z-index: 2; }
#guide .cg-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(22,32,27,.78); color: #fff; border-radius: 6px; padding: 5px 11px; font-size: 12px; line-height: 1.35; white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 24px); pointer-events: none; transition: opacity .4s; z-index: 2; }
#guide .cg-hint.gone { opacity: 0; }
#guide .cg-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--cg-line); background: var(--cg-surface); flex-shrink: 0; }
#guide .cg-group { display: inline-flex; border: 1px solid var(--cg-line-strong); border-radius: var(--cg-radius-sm); overflow: hidden; background: var(--cg-surface); }
#guide .cg-group button { height: 36px; min-width: 40px; padding: 0 12px; border: 0; border-right: 1px solid var(--cg-line); background: none; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--cg-text); font-variant-numeric: tabular-nums; }
#guide .cg-group button:last-child { border-right: 0; }
#guide .cg-group button:hover { background: var(--cg-surface-2); }
#guide .cg-group button[aria-pressed="true"] { background: var(--cg-accent-soft); color: var(--cg-accent-hover); }
#guide .cg-group .cg-readout { min-width: 54px; color: var(--cg-muted); cursor: default; }
#guide .cg-group .cg-readout:hover { background: none; }
#guide .cg-fallback { position: absolute; inset: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
#guide .cg-fallback .cg-msg { font-size: 12.5px; color: var(--cg-muted); background: rgba(255,255,255,.8); border: 1px solid var(--cg-line); border-radius: 6px; padding: 6px 10px; align-self: flex-start; }
#guide .cg-shots { display: flex; gap: 20px; justify-content: center; align-items: flex-end; flex-wrap: wrap; margin: auto 0; }
#guide .cg-shots figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#guide .cg-shots figcaption { font-size: 12px; color: var(--cg-muted); }
#guide .cg-shots canvas { max-width: 100%; height: auto; }
#guide #fbFront, #guide #fbBack { height: clamp(200px, 40vh, 380px); width: auto; }
#guide #fbFrame { width: 200px; }
#guide .cg-detail { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#guide .cg-eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--cg-muted); font-weight: 500; }
#guide .cg-detail h3 { font-size: 22px; margin-top: 2px; }
#guide .cg-summary { color: var(--cg-text); max-width: 52ch; }
#guide .cg-rows { margin: 0; display: grid; border-top: 1px solid var(--cg-line); }
#guide .cg-rows div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--cg-line); font-size: 14px; }
#guide .cg-rows dt { color: var(--cg-muted); }
#guide .cg-rows dd { margin: 0; }
#guide .cg-reqs ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
#guide .cg-note { font-size: 13px; color: var(--cg-muted); background: var(--cg-surface-2); border: 1px solid var(--cg-line); border-radius: var(--cg-radius-sm); padding: 12px 14px; display: grid; gap: 6px; }
#guide .cg-note strong { color: var(--cg-text); font-weight: 600; }
#guide .cg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--cg-line); background: var(--cg-surface); flex-shrink: 0; }
#guide .cg-foot p { font-size: 13.5px; color: var(--cg-muted); }
#guide .cg-foot p strong { color: var(--cg-text); font-weight: 600; }
#guide .cg-foot-actions { display: flex; gap: 10px; margin-left: auto; }
#guide .cg-btn-secondary { height: 44px; padding: 0 18px; border: 1px solid var(--cg-line-strong); border-radius: var(--cg-radius-sm); background: var(--cg-surface); font-weight: 500; font-size: 14px; cursor: pointer; }
#guide .cg-btn-secondary:hover { background: var(--cg-surface-2); }
#guide .cg-btn-primary { height: auto; min-height: 48px; padding: 10px 26px; border: 0; border-radius: var(--cg-radius-sm); background: var(--cg-orange); color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; white-space: normal; }
#guide .cg-btn-primary:hover { background: var(--cg-orange-hover); }
#guide .cg-btn-primary:disabled { background: #b9c7bf; cursor: default; }

@media (max-width: 1100px) {
  #guide { padding: 12px; }
  #guide .cg-body { grid-template-columns: 1fr; }
  #guide .cg-stage { border-right: 0; border-bottom: 1px solid var(--cg-line); }
  #guide .cg-stage-view { height: clamp(200px, 34vh, 340px); }
  #guide .cg-detail { padding: 16px 18px; }
  #guide .cg-head { padding: 14px 14px 4px 16px; }
}
@media (max-width: 720px) {
  #guide { padding: 0; height: 100%; height: 100dvh; }
  #guide .cg-panel { border-radius: 0; width: 100%; height: 100%; max-height: none; max-height: 100dvh; padding-top: env(safe-area-inset-top, 0px); }
  #guide .cg-head { padding: 12px 8px 4px 14px; }
  #guide .cg-head h2 { font-size: 18px; }
  #guide .cg-head p { font-size: 12.5px; }
  #guide .cg-tabs { padding: 0 6px; }
  #guide .cg-tab { padding: 10px 12px; font-size: 13.5px; }
  #guide .cg-stage-view { height: clamp(180px, 32vh, 280px); }
  #guide .cg-detail { padding: 16px 14px; gap: 12px; }
  #guide .cg-detail h3 { font-size: 20px; }
  #guide .cg-rows div { grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
  #guide .cg-tools { display: grid; grid-template-columns: 1fr; padding: 10px 12px; gap: 8px; }
  #guide .cg-group { width: 100%; }
  #guide .cg-group button { flex: 1 1 0; min-width: 0; padding: 0 6px; }
  #guide .cg-foot { flex-direction: column; align-items: stretch; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
  #guide .cg-foot-actions { width: 100%; margin-left: 0; }
  #guide .cg-foot-actions .cg-btn-secondary,
  #guide .cg-foot-actions .cg-btn-primary { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 420px) {
  #guide .cg-rows div { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  #guide .cg-tabs { padding: 0 4px; gap: 0; }
  #guide .cg-tab { padding: 10px 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #guide .cg-spinner { animation-duration: 2s; }
  #guide .cg-hint { transition: none; }
}
