/* Isolated styles for the circle-search enhancement. */
body.circle-search-open { overflow: hidden; touch-action: none; }
.note-gallery[data-circle-search-ready] { position: relative; }

.circle-entry-button {
  position: absolute; z-index: 6; right: 14px; bottom: 15px;
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.55);
  border-radius: 19px; color: #fff; background: rgba(16,16,18,.62);
  box-shadow: 0 4px 16px rgba(0,0,0,.2); backdrop-filter: blur(12px);
  font-size: 13px; font-weight: 650;
}
.circle-entry-button span { font-size: 19px; line-height: 1; }
.video-stage .circle-entry-button { top: 120px; bottom: auto; height: 34px; }

#circle-search-host { position: fixed; z-index: 100; inset: 0; display: flex; justify-content: center; }
.circle-search-overlay {
  --circle-accent: #72f0df;
  position: relative; width: min(100%, 430px); height: 100svh; overflow: hidden;
  color: #fff; background: #090a0c; box-shadow: 0 0 45px rgba(0,0,0,.3);
  isolation: isolate;
}
.circle-search-header {
  position: relative; z-index: 5; height: calc(70px + env(safe-area-inset-top));
  display: grid; grid-template-columns: 42px 1fr 42px; align-items: end;
  padding: env(safe-area-inset-top) 12px 11px; background: rgba(9,10,12,.96);
}
.circle-search-header button { width: 36px; height: 36px; border-radius: 50%; color: #fff; background: rgba(255,255,255,.1); font-size: 25px; }
.circle-search-header button:last-child { justify-self: end; font-size: 16px; font-weight: 700; }
.circle-search-header div { min-width: 0; text-align: center; }
.circle-search-header strong { display: block; font-size: 16px; }
.circle-search-header small { display: block; margin-top: 3px; color: rgba(255,255,255,.58); font-size: 11px; }

.circle-search-stage { position: relative; height: min(67svh, 570px); overflow: hidden; background: #18191d; touch-action: none; }
.circle-media-snapshot, .circle-stage-shade, .circle-drawing-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.circle-media-snapshot .shot { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto !important; }
.circle-media-snapshot .shot > img { min-width: 100%; min-height: 100%; object-fit: cover; }
.circle-media-snapshot .circle-snapshot-image { width: 100%; height: 100%; display: block; object-fit: cover; }
.circle-media-snapshot .circle-snapshot-photo-window { width: 100%; height: 100%; }
.circle-media-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: #aaa; background: #222; }
.circle-stage-shade { pointer-events: none; background: rgba(0,0,0,.25); }
.circle-drawing-layer { z-index: 2; cursor: crosshair; }
.circle-drawing-layer.is-locked { pointer-events: none; }
.circle-selection-path {
  fill: rgba(114,240,223,.1); stroke: #f8fffe; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  filter: url(#circle-glow); vector-effect: non-scaling-stroke;
}
.circle-search-tip {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%,-50%);
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 48px);
  padding: 10px 15px; border: 1px solid rgba(255,255,255,.22); border-radius: 24px;
  color: #fff; background: rgba(0,0,0,.52); backdrop-filter: blur(12px); font-size: 13px;
  transition: opacity .18s, transform .18s; pointer-events: none;
}
.circle-search-tip b { color: var(--circle-accent); font-size: 23px; }
.circle-search-tip.is-hidden { opacity: 0; transform: translate(-50%,-45%); }
.circle-onboarding {
  position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 24px 38px; text-align: center; background: linear-gradient(180deg,rgba(4,7,10,.48),rgba(4,7,10,.78));
  backdrop-filter: blur(1.5px); transition: opacity .18s, transform .18s;
}
.circle-onboarding.is-leaving { opacity: 0; transform: scale(1.02); pointer-events: none; }
.circle-guide-demo { position: relative; width: 220px; height: 150px; }
.circle-guide-demo svg { width: 100%; height: 100%; overflow: visible; }
.circle-guide-demo ellipse {
  fill: rgba(114,240,223,.06); stroke: #fff; stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 400; filter: drop-shadow(0 0 7px rgba(114,240,223,.95));
  animation: circle-guide-draw 2.2s ease-in-out infinite;
}
.circle-guide-hand {
  position: absolute; left: 168px; top: 98px; font-size: 43px; line-height: 1;
  filter: grayscale(1) brightness(2.4) drop-shadow(0 4px 5px rgba(0,0,0,.35));
  transform-origin: 20% 15%; animation: circle-guide-hand 2.2s ease-in-out infinite;
}
.circle-guide-copy { margin-top: 13px; }
.circle-guide-copy strong { display: block; font-size: 21px; font-weight: 700; letter-spacing: .2px; }
.circle-guide-copy p { margin: 10px 0 19px; color: rgba(255,255,255,.76); font-size: 13px; line-height: 1.7; }
.circle-guide-copy button { min-width: 156px; height: 42px; padding: 0 24px; border-radius: 22px; color: #151719; background: #fff; font-size: 14px; font-weight: 650; box-shadow: 0 7px 22px rgba(0,0,0,.24); }
.circle-recognizing {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%,-50%);
  min-width: 220px; padding: 18px; border-radius: 18px; text-align: center;
  background: rgba(10,12,14,.82); backdrop-filter: blur(16px);
}
.circle-recognizing span, .circle-result-loading span {
  display: block; width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid rgba(114,240,223,.23);
  border-top-color: var(--circle-accent); border-radius: 50%; animation: circle-spin .8s linear infinite;
}
.circle-recognizing strong, .circle-recognizing small { display: block; }
.circle-recognizing small { margin-top: 5px; color: rgba(255,255,255,.58); font-size: 11px; }
.circle-toast {
  position: fixed; z-index: 120; left: 50%; top: 23%; transform: translateX(-50%);
  max-width: min(330px, 82vw); padding: 10px 15px; border-radius: 20px;
  color: #fff; background: rgba(20,20,22,.88); box-shadow: 0 5px 20px rgba(0,0,0,.2); font-size: 13px; text-align: center;
}

.circle-selection-toolbar {
  position: relative; z-index: 3; height: 68px; display: grid; grid-template-columns: 66px 1fr 66px; align-items: center;
  padding: 0 12px; background: #090a0c;
}
.circle-selection-toolbar button { display: grid; justify-items: center; gap: 1px; color: #fff; font-size: 11px; }
.circle-selection-toolbar button:disabled { opacity: .3; }
.circle-selection-toolbar button span { font-size: 22px; }
.circle-selection-toolbar p { margin: 0; color: rgba(255,255,255,.42); font-size: 11px; text-align: center; }

.circle-result-sheet {
  position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; height: 58svh; overflow: auto;
  container-type: inline-size;
  color: #242424; background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 36px rgba(0,0,0,.25); transform: translateY(105%);
  transition: transform .28s cubic-bezier(.22,.72,.2,1), height .26s; overscroll-behavior: contain;
}
.circle-result-sheet.is-open { transform: translateY(0); }
.circle-result-sheet.is-full { height: calc(100svh - 12px); border-radius: 24px 24px 0 0; }
#circle-search-host.has-results .circle-search-overlay { background: #fff; }
#circle-search-host.has-results .circle-search-header {
  color: #242424; background: #fff; border-bottom: 1px solid #f2f2f2;
}
#circle-search-host.has-results .circle-search-header button { color: #242424; background: transparent; }
#circle-search-host.has-results .circle-search-header small { color: #999; }
#circle-search-host.has-results .circle-search-stage,
#circle-search-host.has-results .circle-selection-toolbar { display: none; }
#circle-search-host.has-results .circle-result-sheet,
#circle-search-host.has-results .circle-result-sheet.is-full {
  top: calc(70px + env(safe-area-inset-top)); bottom: 0; height: auto;
  border-radius: 0; box-shadow: none;
}
#circle-search-host.has-results .circle-sheet-grip { display: none; }
.circle-sheet-grip { position: sticky; z-index: 3; top: 0; width: 40px; height: 5px; margin: 8px auto 4px; border-radius: 3px; background: #d9d9d9; }
.circle-result-loading { display: grid; place-items: center; padding: 52px 20px; text-align: center; }
.circle-result-loading span { --circle-accent: #ff2442; margin-bottom: 13px; border-color: #ffd6dc; border-top-color: #ff2442; }
.circle-result-loading strong { font-size: 16px; }
.circle-result-loading p { margin: 7px 0 0; color: #999; font-size: 13px; }
.circle-results-toolbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; }
.circle-query { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; height: 44px; padding: 4px 5px; border-radius: 12px; background: #f5f5f5; }
.circle-query > img { flex: none; width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.circle-query input { min-width: 0; width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #333; font-size: 13px; }
.circle-query button { flex: none; width: 28px; height: 34px; color: #555; font-size: 25px; }
.circle-change-image { flex: none; color: #666; font-size: 12px; }
.circle-image-samples { display: flex; gap: 8px; padding: 0 14px 10px; background: #fff; }
.circle-image-samples button { padding: 6px 12px; border-radius: 15px; color: #777; background: #f6f6f6; font-size: 12px; }
.circle-image-samples button.active { color: #a34a43; background: #fff0ee; }
.circle-result-tabs { position: sticky; z-index: 3; top: 64px; display: flex; gap: 26px; padding: 0 16px; background: #fff; border-bottom: 1px solid #eee; }
.circle-result-tabs button { position: relative; padding: 10px 0 13px; color: #888; font-size: 14px; white-space: nowrap; }
.circle-result-tabs button.active { color: #222; font-weight: 650; }
.circle-result-tabs button.active::after { content: ''; position: absolute; left: 24%; right: 24%; bottom: 5px; height: 3px; border-radius: 3px; background: #ff2442; }
.circle-results-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px 7px; color: #888; background: #f7f7f7; font-size: 11px; }
.circle-results-caption small { flex: none; color: #aaa; font-size: 10px; }
.circle-result-grid { display: flex; align-items: flex-start; gap: 6px; padding: 3px 5px 24px; background: #f8f8f8; }
.circle-result-column { min-width: 0; flex: 1; }
.circle-result-card { display: block; width: 100%; min-width: 0; margin-bottom: 7px; overflow: hidden; border-radius: 5px; background: #fff; text-align: left; }
.circle-result-thumb { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; background: #f6f5f2; }
.circle-result-thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.circle-product-photo { position: absolute; inset: 0; overflow: hidden; }
.circle-product-photo > img { position: absolute; width: 400%; height: 400%; max-width: none; object-fit: fill; }
.circle-result-thumb.is-screenshot > img { position: absolute; left: 0; top: -29%; width: 100%; height: auto; max-width: none; }
.circle-result-thumb i { position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #fff; background: #0007; font-size: 9px; font-style: normal; }
.circle-card-copy { padding: 9px 10px 11px; }
.circle-card-copy > strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #333; font-size: 13px; font-weight: 500; line-height: 1.45; }
.circle-match-label { display: inline-block; margin-bottom: 5px; padding: 2px 5px; border-radius: 4px; color: #888; background: #f5f5f5; font-size: 10px; }
.circle-match-label.is-same { color: #a06b44; background: #f7f0e7; }
.circle-card-price { display: flex; align-items: baseline; gap: 5px; margin-top: 8px; }
.circle-card-price b { color: #e44848; font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.circle-card-price span { color: #aaa; font-size: 9px; }
.circle-card-shop { display: block; margin-top: 6px; overflow: hidden; color: #999; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.circle-card-author { display: flex; justify-content: space-between; gap: 4px; margin-top: 9px; color: #999; font-size: 10px; }
.circle-card-author span { flex: none; }
.circle-results-empty { width: 100%; padding: 70px 20px; color: #999; text-align: center; font-size: 13px; line-height: 1.7; }
.circle-product-preview { min-height: 100%; background: #fff; }
.circle-product-preview .circle-result-thumb { width: 100%; aspect-ratio: 1; }
.circle-product-info { padding: 18px; }
.circle-product-info > small { display: block; margin-bottom: 7px; color: #a06b44; font-size: 12px; }
.circle-product-info > strong { color: #e44848; font-size: 26px; font-weight: 650; }
.circle-product-info h2 { margin: 10px 0; font-size: 18px; font-weight: 600; line-height: 1.5; }
.circle-product-info p { color: #888; font-size: 13px; line-height: 1.6; }
.circle-product-store { display: flex; justify-content: space-between; margin-top: 18px; padding: 16px 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; color: #555; font-size: 13px; }
.circle-product-store span { color: #aaa; font-size: 11px; }
.circle-product-info .circle-product-notice { color: #aaa; font-size: 11px; }
.circle-product-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #f2f2f2; }
.circle-product-actions button { flex: 1; height: 42px; border-radius: 22px; color: #555; background: #f5f5f5; font-size: 14px; }
.circle-product-actions button:last-child { color: #fff; background: #ff2442; }

@keyframes circle-spin { to { transform: rotate(360deg); } }
@keyframes circle-guide-draw {
  0%,12% { stroke-dashoffset: 400; opacity: .4; }
  65%,88% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: .35; }
}
@keyframes circle-guide-hand {
  0%,12% { transform: translate(0,0) rotate(-13deg) scale(.94); opacity: .45; }
  30% { transform: translate(-75px,19px) rotate(-7deg) scale(1); opacity: 1; }
  48% { transform: translate(-142px,-24px) rotate(5deg) scale(1); }
  66% { transform: translate(-79px,-91px) rotate(8deg) scale(1); }
  84%,92% { transform: translate(0,0) rotate(-13deg) scale(1); opacity: 1; }
  100% { transform: translate(0,0) rotate(-13deg) scale(.94); opacity: .45; }
}
@media (prefers-reduced-motion: reduce) {
  .circle-result-sheet, .circle-search-tip { transition: none; }
}
