/* Hast Rekha scan flow — page-specific styles (extends css/tokens.css) */

.pane-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  margin: 6px 0 8px;
  text-align: center;
}
.lede { color: var(--ink-dim); text-align: center; max-width: 560px; margin: 0 auto 26px; }
.sub-h {
  font-family: var(--font-display); font-weight: 400; font-size: 1.25rem;
  margin: 30px 0 12px;
}
.pane-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.center { text-align: center; }
.hint { color: var(--ink-faint); font-size: 0.88rem; text-align: center; }
.form-err { color: var(--bad); text-align: center; font-weight: 600; }
.notice {
  border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 20px 22px; margin: 22px 0; background: var(--card);
}
.notice h3 { margin: 0 0 6px; }
.notice p { margin: 6px 0; color: var(--ink-dim); }
.notice.warn { border-color: rgba(240, 195, 107, 0.45); }
.notice.bad { border-color: rgba(239, 154, 154, 0.45); }
.advice { margin: 10px 0 0; padding-left: 20px; color: var(--warn); font-size: 0.92rem; }

/* ---- step 1 · animated hand coach ---- */
.guide-art { display: flex; justify-content: center; margin: 8px 0 24px; }
.hand-coach { width: min(240px, 62vw); height: auto; }
.coach-frame {
  fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: 10 8;
  opacity: 0.7; animation: framepulse 2.6s ease-in-out infinite;
  transform-origin: center; transform-box: fill-box;
}
@keyframes framepulse { 0%, 100% { transform: scale(1); opacity: 0.55; } 50% { transform: scale(1.025); opacity: 0.9; } }
.coach-palm .hand-silhouette {
  fill: rgba(232, 180, 160, 0.06); stroke: var(--rose); stroke-width: 2.5;
}
.coach-palm { transform-box: fill-box; transform-origin: 50% 92%; animation: handsway 4.2s ease-in-out infinite; }
@keyframes handsway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.6deg); } }
.coach-line { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; fill: none;
  stroke-dasharray: 90; stroke-dashoffset: 90; animation: linedraw 2.4s ease forwards; }
.coach-line.l2 { animation-delay: 0.5s; }
.coach-line.l3 { animation-delay: 1s; }
@keyframes linedraw { to { stroke-dashoffset: 0; } }

.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tip {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.tip h3 { margin: 0 0 4px; font-size: 0.95rem; color: var(--rose); }
.tip p { margin: 0; font-size: 0.88rem; color: var(--ink-dim); }

/* ---- step 2 · capture ---- */
.cam-wrap { margin-bottom: 18px; }
.cam-wrap video {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--card-border); background: #000; display: block;
}
.cam-actions { display: flex; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.drop strong { display: block; margin: 10px 0 2px; font-size: 1.02rem; }
.drop { display: block; margin-top: 18px; }
.thumbs-head { margin-top: 16px; }
.thumb { position: relative; }
.thumb img { display: block; }
.thumb-rm {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--card-border);
  background: var(--bg-3); color: var(--ink); font-size: 16px; line-height: 1;
  cursor: pointer;
}

/* ---- step 3 · quality ---- */
.quality-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.qcard {
  position: relative; background: var(--card); border: 2px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer; color: var(--ink);
  font-family: inherit; text-align: left; transition: border-color 0.2s;
}
.qcard.best { border-color: var(--gold); }
.qcard img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; display: block; }
.qring { position: absolute; top: 16px; right: 16px; width: 52px; height: 52px; }
.qring svg { width: 100%; height: 100%; }
.qring .qbg { fill: rgba(26,16,51,0.75); stroke: rgba(255,255,255,0.15); stroke-width: 6; }
.qring .qfg { fill: none; stroke-width: 6; stroke-linecap: round; }
.qring .qfg.ok { stroke: var(--ok); }
.qring .qfg.mid { stroke: var(--warn); }
.qring .qfg.low { stroke: var(--bad); }
.qring b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.8rem; color: var(--ink);
}
.qcard .badge { margin: 8px 0 0; }
.qbars { display: block; margin-top: 8px; }
.qbars span { display: block; margin-top: 4px; }
.qbars i { font-style: normal; font-size: 0.72rem; color: var(--ink-faint); display: block; }
.qbars em {
  display: block; height: 4px; border-radius: 4px; font-style: normal;
  background: linear-gradient(90deg, var(--rose-deep), var(--gold));
}

/* ---- step 4 · enhance ---- */
.cmp-labels { display: flex; justify-content: space-between; margin: 8px 2px 0; font-size: 0.85rem; color: var(--ink-dim); }
.steps-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 12px;
  scroll-snap-type: x mandatory;
}
.step-chip { flex: 0 0 118px; scroll-snap-align: start; margin: 0; }
.step-chip img {
  width: 118px; height: 118px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--card-border); display: block;
}
.step-chip figcaption { font-size: 0.72rem; color: var(--ink-dim); margin-top: 6px; line-height: 1.35; }

/* ---- step 5 · detect ---- */
.detect-art { width: min(200px, 54vw); height: auto; margin: 10px auto; display: block; }
.detect-art .d-palm { fill: rgba(232,180,160,0.05); stroke: var(--rose); stroke-width: 2.5; }
.detect-art .d-line {
  fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 220; stroke-dashoffset: 220;
  animation: ddraw 2.2s ease-in-out infinite;
}
.detect-art .dl2 { animation-delay: 0.4s; }
.detect-art .dl3 { animation-delay: 0.8s; }
@keyframes ddraw { 0% { stroke-dashoffset: 220; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -220; } }
.stage-text { color: var(--ink-dim); margin: 6px 0 14px; min-height: 1.6em; }
.pbar { height: 6px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; max-width: 380px; margin: 0 auto; }
.pbar i { display: block; height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--rose-deep), var(--gold)); transition: width 0.5s ease; }

/* ---- step 6 · verify overlay ---- */
.ovl-root { margin-bottom: 6px; }
.ovl-toolbar { display: grid; gap: 8px; margin-top: 14px; }
.ovl-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.ovl-row.active { border-color: rgba(212,162,78,0.55); }
.ovl-rowhead {
  display: flex; align-items: center; gap: 10px; background: none; border: 0;
  color: var(--ink); font-family: inherit; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; padding: 4px; flex: 1 1 auto; text-align: left;
}
.ovl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rose); flex: none; }
.ovl-dot.fate { background: var(--gold); }
.ovl-conf { font-size: 0.78rem; color: var(--ink-faint); font-weight: 400; }
.ovl-seg { display: inline-flex; border: 1px solid var(--card-border); border-radius: 999px; overflow: hidden; }
.ovl-segbtn {
  background: transparent; border: 0; color: var(--ink-dim); font-family: inherit;
  font-size: 0.78rem; padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
.ovl-segbtn.on { background: linear-gradient(120deg, var(--rose-deep), var(--gold)); color: #241303; font-weight: 700; }
.ovl-reset {
  background: none; border: 1px solid var(--card-border); border-radius: 50%;
  width: 30px; height: 30px; display: grid; place-items: center;
  color: var(--ink-dim); cursor: pointer; flex: none;
}
.ovl-reset:hover { color: var(--rose); border-color: var(--rose); }
.ov-line.active { stroke-width: 4.5; }
.ov-pt.h-end { fill: var(--gold); r: 9; }
.ov-pt.h-mid { fill: var(--rose); }
.ov-pt.h-curv { fill: transparent; stroke-dasharray: 4 3; }
.ov-arms { fill: none; stroke: rgba(212,162,78,0.5); stroke-width: 1.5; stroke-dasharray: 5 5; }
.ovl-g text.ov-label { pointer-events: none; }

/* ---- step 7 · results ---- */
.result-card.summary { border-color: rgba(212,162,78,0.4); }
.result-card.summary h2 { font-family: var(--font-display); font-weight: 400; margin: 0 0 8px; font-size: 1.3rem; }
.share-wrap { margin-bottom: 8px; }
#share-canvas { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--card-border); display: block; }
.history { display: grid; gap: 10px; }
.hist-item {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 10px;
}
.hist-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.hist-item strong { display: block; font-size: 0.9rem; }
.hist-item span { font-size: 0.82rem; color: var(--ink-dim); display: block; }

@media (max-width: 560px) {
  .ovl-row { gap: 8px; }
  .ovl-segbtn { padding: 7px 9px; font-size: 0.72rem; }
  .pane-actions .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .coach-frame, .coach-palm,
  .coach-line, .detect-art .d-line { animation: none !important; }
  .coach-line, .detect-art .d-line { stroke-dashoffset: 0 !important; }
}

/* ---- Hast Rekha Engine transparency panel ---- */
.engine-panel {
  margin: 26px 0 6px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.engine-head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink); font-family: inherit; font-size: 1.02rem; font-weight: 700;
  padding: 18px 20px; text-align: left;
}
.engine-head .eng-chev { margin-left: auto; transition: transform .25s ease; color: var(--ink-dim); flex: none; }
.engine-head.open .eng-chev { transform: rotate(180deg); }
.engine-body { padding: 0 16px 16px; }
.eng-chips { display: grid; gap: 10px; }
.eng-chip {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--card-border);
  border-radius: 14px; overflow: hidden;
}
.eng-chip-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink); font-family: inherit; padding: 13px 14px; text-align: left;
}
.eng-chip-label { font-weight: 700; font-size: .92rem; }
.eng-chip-val {
  margin-left: auto; font-size: .85rem; color: var(--gold-soft);
  background: rgba(212,162,78,0.12); border: 1px solid rgba(212,162,78,0.3);
  border-radius: 999px; padding: 3px 12px; white-space: nowrap;
}
.eng-chip-head .eng-chev { color: var(--ink-faint); transition: transform .25s ease; flex: none; }
.eng-chip-head.open .eng-chev { transform: rotate(180deg); }
.eng-chip-x { padding: 0 14px 14px; }
.eng-chip-x p { margin: 0 0 10px; color: var(--ink-dim); font-size: .9rem; }
.eng-steps {
  font-size: .8rem; color: var(--ink-faint);
  background: rgba(255,255,255,0.04); border-radius: 10px; padding: 10px 12px;
  margin: 0; line-height: 1.7; word-break: break-word;
}
.eng-bars { display: grid; gap: 8px; }
.eng-bar-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 10px; font-size: .82rem; }
.eng-bar-row i { font-style: normal; color: var(--ink-dim); }
.eng-bar-row s { text-decoration: none; color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }
.eng-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.10); overflow: hidden; display: block; }
.eng-bar b { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--rose-deep), var(--gold)); }

.lefthand-banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(212, 162, 78, 0.12);
  border: 1px solid rgba(212, 162, 78, 0.45);
  border-radius: 14px; padding: 14px 16px; margin: 16px 0;
}
.lefthand-banner svg { flex: none; color: #d4a24e; margin-top: 2px; }
.lefthand-banner strong { display: block; font-size: 1.05em; margin-bottom: 4px; color: #f0d9a8; }
.lefthand-banner span { font-size: 0.92em; opacity: 0.9; }
