/* 1.7.2: feedback over the preview; progress bar remains static. */
.progress-area { position: sticky; top: 8px; z-index: 25; min-height: 64px; }
@keyframes mosaic-pulse { 0%, 75%, 100% { opacity: .28; } 35% { opacity: 1; } }
.focus-choice { margin: 20px 0; border-radius: 10px; padding: 14px; background: #f7f7f7; text-align: left; }
.focus-choice .input-note { margin: 8px 0 0; }
.focus-editor { margin: 14px 0 24px; text-align: left; border-top: 1px solid #eee; padding-top: 18px; }
.focus-toolbar, .focus-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.focus-toolbar .button { padding: 10px 13px; min-height: 42px; font-size: 13px; }
.focus-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 12px 0; }
.focus-tools button { border: 1px solid #ddd; border-radius: 7px; background: #fff; padding: 9px 3px; font: inherit; font-size: 12px; min-height: 40px; color: #666; }
.focus-tools button[aria-pressed="true"] { background: #82b22c; color: #fff; border-color: #82b22c; }
.focus-tools button:disabled { opacity: .45; }
.focus-canvas-wrap { width: 100%; margin: auto; background: #f5f5f5; border: 1px solid #e4e4e4; border-radius: 8px; overflow: hidden; line-height: 0; }
#focus-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
#focus-canvas[aria-busy="true"] { cursor: wait; }
.focus-legend { display: flex; gap: 7px; align-items: center; justify-content: center; font-size: 11px; margin: 10px 0 16px; }
.focus-legend > span[aria-hidden="true"] { flex: 0 0 10px; width: 10px; height: 10px; background: #47b15a; border-radius: 3px; }
.focus-legend > span:not([aria-hidden]) { flex: 0 1 auto; min-width: 0; max-width: 100%; width: auto; height: auto; background: transparent; border-radius: 0; line-height: 1.45; overflow-wrap: normal; }
.focus-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.focus-options label { font-size: 12px; }
.focus-options select { margin-top: 7px; min-height: 40px; font-size: 13px; padding: 8px; }
.focus-actions { margin-top: 10px; }
.focus-actions .link-button { font-size: 12px; min-height: 40px; }
.detect-indicator { display: none; width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.detecting .detect-indicator { display: inline-block; animation: mosaic-pulse 1s infinite; }
@media (min-width: 641px) { .focus-canvas-wrap { max-width: 520px; } }
@media (max-width: 380px) { .focus-tools { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { .preview-spinner, .detecting .detect-indicator { animation: none; opacity: .7; } }


.stage-wrap { position: relative; }
.preview-loading {
  position: absolute; inset: 0; z-index: 5; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center;
  background: rgba(255, 255, 255, .82); color: #4c4c4c; cursor: wait;
}
.preview-loading[hidden] { display: none; }
.preview-loading strong { font-size: 16px; font-weight: 600; }
#preview-loading-text { font-size: 12px; line-height: 1.45; max-width: 320px; overflow-wrap: anywhere; }
.preview-spinner {
  width: 42px; height: 42px; border: 4px solid #dbdfd5;
  border-top-color: var(--green, #82b22c); border-radius: 50%;
  animation: preview-turn 1.05s linear infinite;
}
@keyframes preview-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .preview-spinner { animation: none; } }

/* Quiet, opt-in focus tools. Status remains visible while recognition runs. */
.focus-status-area { margin: 0 0 14px; text-align: left; }
.focus-entry { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; }
.focus-entry .link-button { min-height: 40px; font-size: 13px; }
.focus-status-area .input-note { margin: 5px 0 0; line-height: 1.55; }
.storage-disclaimer { max-width: 620px; margin-inline: auto; padding: 22px 8px; font-size: 11px; line-height: 1.65; }
.storage-disclaimer p { margin: 0; }
.storage-disclaimer .storage-warning { margin-top: 8px; color: #9a4425; }

/* The two source choices remain side by side on small phones. */
.source-switches { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.source-switches .option-group { margin: 0; min-width: 0; padding: 13px 12px; }
.source-switches .switch-heading { height: 100%; flex-direction: column; align-items: flex-start; gap: 12px; }
.source-switches .heading-label { width: 100%; align-items: flex-start; gap: 4px; flex: 1; }
.source-switches .field-label { min-width: 0; font-size: 12px; line-height: 1.45; overflow-wrap: break-word; }
.source-switches .info-button { flex: 0 0 26px; width: 26px; height: 26px; }
.source-switches + .info-panel { margin-top: 8px; }

.image-look-control { margin: 22px 0 4px; text-align: left; }
.image-look-control .control-heading { justify-content: center; margin-bottom: 10px; }
.image-look-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.image-look-choice { overflow: hidden; min-width: 0; padding: 3px; border: 2px solid #e5e5e5; border-radius: 9px; background: #fff; color: #666; font: inherit; cursor: pointer; }
.image-look-choice img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; background: #f3f3f3; }
.image-look-choice span { display: block; padding: 9px 1px 7px; font-size: 12px; }
.image-look-choice[aria-pressed="true"] { border-color: var(--green, #82b22c); }
.image-look-choice[aria-pressed="true"] span { color: #638d1e; font-weight: 600; }
.image-look-choice:focus-visible { outline: 2px solid #333; outline-offset: 3px; }
.image-look-choice:disabled { opacity: .55; cursor: default; }
.source-switches .option-group { background: var(--card, #f6f6f6); border-radius: 10px; }
.source-switches input.switch-input { flex: 0 0 auto; width: 55px; height: 30px; }
