/* AI and media tools. Plain semantic CSS; all selectors are scoped to this feature. */
[data-page="ai-tools"],
ps-scorecard-scanner,
ps-pin-locator,
ps-gear-valuator,
[data-page="golf-gif-generator"],
ps-golf-shots-page,
ps-shot-tracer {
  display: block;
  box-sizing: border-box;
}

[data-page="ai-tools"] *,
ps-scorecard-scanner *,
ps-pin-locator *,
ps-gear-valuator *,
[data-page="golf-gif-generator"] *,
ps-golf-shots-page *,
ps-shot-tracer * {
  box-sizing: border-box;
}

.ps-am-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.ps-am-icon.is-spinning {
  animation: am-spin 0.9s linear infinite;
}

@keyframes am-spin {
  to { transform: rotate(360deg); }
}

.am-hidden {
  display: none !important;
}

.am-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.am-stack--small {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.am-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.am-row--between { justify-content: space-between; }
.am-row--start { justify-content: flex-start; }
.am-row--end { justify-content: flex-end; }
.am-align-start { align-items: flex-start; }
.am-center { text-align: center; }
.am-muted { color: var(--ps-text-secondary, #a3a3a3); }
.am-uppercase { display: block; color: var(--ps-text-muted, #737373); font-size: 0.75rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.am-primary-text { color: var(--ps-primary, #22c55e) !important; }
.am-success-text { color: var(--ps-success, #22c55e) !important; }
.am-blue-text { color: #3b82f6; }

.am-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.am-button,
.am-dark-button,
.am-generate-button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  min-height: 2.5rem;
  padding: 0.6rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.am-button:disabled,
.am-dark-button:disabled,
.am-generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.am-button--full,
.am-dark-button--full { width: 100%; }
.am-button--tall { min-height: 3rem; }
.am-button--hero { min-height: 3.5rem; font-size: 1.125rem; font-weight: 700; }

.am-button--primary {
  color: #fff;
  background: var(--ps-primary, #16a34a);
}

.am-button--primary:hover:not(:disabled) { background: var(--ps-primary-dark, #15803d); }
.am-button--gold { color: #080808; background: var(--ps-gold, #fbbf24); }
.am-button--gold:hover:not(:disabled) { filter: brightness(0.95); }
.am-button--green { color: #fff; background: #16a34a; }
.am-button--green:hover:not(:disabled) { background: #22c55e; }
.am-button--blue { color: #fff; background: #2563eb; }
.am-button--blue:hover:not(:disabled) { background: #3b82f6; }

.am-button--outline,
.am-dark-button {
  color: var(--ps-text-secondary, #d4d4d4);
  background: transparent;
  border-color: var(--ps-border, #404040);
}

.am-button--outline:hover:not(:disabled),
.am-dark-button:hover:not(:disabled) {
  color: var(--ps-text-primary, #fff);
  background: var(--ps-bg-hover, #262626);
}

.am-icon-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ps-text-muted, #a3a3a3);
  border-radius: 0.375rem;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.am-icon-button:hover,
.am-icon-button.is-active { color: var(--ps-primary, #22c55e); background: var(--ps-bg-hover, #262626); }

.am-link {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ps-primary, #22c55e);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.am-link:hover { text-decoration: underline; }

/* AI tools landing and active tools */
.am-ai-tools-page {
  min-height: 100vh;
  padding: 1rem;
  color: var(--ps-text-primary, #f5f5f5);
  background: var(--ps-bg-base, #0a0a0a);
}

.am-ai-tools-page > * {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.am-ai-header {
  margin-bottom: 2rem;
  text-align: center;
}

.am-ai-header > div {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--ps-primary, #22c55e), var(--ps-gold, #fbbf24), #f97316);
}

.am-ai-header .ps-am-icon { width: 2.5rem; height: 2.5rem; }
.am-ai-header h1 { margin: 0; font-size: 1.5rem; line-height: 2rem; font-weight: 900; }
.am-ai-header p { margin: 0.25rem 0 0; color: var(--ps-text-secondary, #a3a3a3); }

.am-tool-card-list { display: flex; flex-direction: column; gap: 1rem; }

.am-tool-card {
  width: 100%;
  min-height: 6rem;
  padding: 1.25rem;
  border: 1px solid var(--ps-border, #2f2f2f);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  color: var(--ps-text-primary, #f5f5f5);
  background: var(--ps-bg-surface, #171717);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.am-tool-card:hover { border-color: color-mix(in srgb, var(--ps-primary, #22c55e) 50%, transparent); background: var(--ps-bg-hover, #202020); }

.am-tool-card__icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 160ms ease;
}

.am-tool-card:hover .am-tool-card__icon { transform: scale(1.05); }
.am-tool-card__icon .ps-am-icon { width: 1.75rem; height: 1.75rem; }
.am-tool-card__icon--green { background: linear-gradient(135deg, var(--ps-primary, #22c55e), #059669); }
.am-tool-card__icon--gold { background: linear-gradient(135deg, var(--ps-gold, #fbbf24), #ea580c); }
.am-tool-card__icon--yellow { background: linear-gradient(135deg, #facc15, #eab308); }
.am-tool-card__icon--blue { background: linear-gradient(135deg, #3b82f6, #9333ea); }

.am-tool-card__copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.am-tool-card__copy strong { font-size: 1.125rem; }
.am-tool-card__copy small { margin-top: 0.1rem; color: var(--ps-text-secondary, #a3a3a3); font-size: 0.875rem; }
.am-tool-card__arrow { color: var(--ps-text-muted, #737373); transform: rotate(180deg); transition: transform 160ms ease; }
.am-tool-card:hover .am-tool-card__arrow { transform: rotate(180deg) translateX(-0.25rem); }

.am-ai-tip {
  margin-top: 2rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--ps-primary, #22c55e) 20%, transparent);
  border-radius: 0.75rem;
  color: var(--ps-text-secondary, #a3a3a3);
  background: color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent);
  font-size: 0.875rem;
  line-height: 1.5;
}

.am-ai-tip p { margin: 0; }
.am-ai-tip strong { color: var(--ps-primary, #22c55e); }

.am-back {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ps-text-secondary, #a3a3a3);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.am-back:hover { color: var(--ps-text-primary, #fff); }

.am-tool { display: flex; flex-direction: column; gap: 1.5rem; }
.am-tool-header { text-align: center; }
.am-tool-header img { display: block; width: 5rem; height: 5rem; object-fit: contain; margin: 0 auto 0.75rem; }
.am-tool-header h2 { margin: 0; color: var(--ps-text-primary, #fff); font-size: 1.25rem; line-height: 1.75rem; }
.am-tool-header p { margin: 0.25rem 0 0; color: var(--ps-text-secondary, #a3a3a3); font-size: 0.875rem; }

.am-segmented { display: flex; justify-content: center; gap: 0.5rem; }
.am-segmented button {
  border: 0;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--ps-text-secondary, #a3a3a3);
  background: var(--ps-bg-elevated, #222);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.am-segmented button:hover { background: var(--ps-bg-hover, #2b2b2b); }
.am-segmented button.is-active { color: #fff; background: var(--ps-primary, #16a34a); }

.am-upload-actions { gap: 0.75rem; }
.am-drop {
  width: 100%;
  border: 2px dashed var(--ps-border, #404040);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ps-text-secondary, #a3a3a3);
  background: transparent;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.am-drop .ps-am-icon { width: 2rem; height: 2rem; margin-bottom: 0.5rem; color: var(--ps-text-muted, #737373); }
.am-drop strong { font-size: 1rem; }
.am-drop span { margin-top: 0.15rem; font-size: 0.875rem; }
.am-drop:hover { border-color: var(--ps-text-muted, #737373); background: var(--ps-bg-elevated, #202020); }
.am-drop--primary { padding: 2rem; border-color: color-mix(in srgb, var(--ps-primary, #22c55e) 50%, transparent); color: var(--ps-primary, #22c55e); }
.am-drop--primary .ps-am-icon { width: 3rem; height: 3rem; color: var(--ps-primary, #22c55e); margin-bottom: 0.75rem; }
.am-drop--primary strong, .am-drop--gold strong { font-size: 1.125rem; }
.am-drop--primary:hover { border-color: var(--ps-primary, #22c55e); background: color-mix(in srgb, var(--ps-primary, #22c55e) 5%, transparent); }
.am-drop--gold { padding: 2rem; border-color: color-mix(in srgb, var(--ps-gold, #fbbf24) 50%, transparent); color: var(--ps-gold, #fbbf24); }
.am-drop--gold .ps-am-icon { width: 3rem; height: 3rem; color: var(--ps-gold, #fbbf24); margin-bottom: 0.75rem; }
.am-drop--gold:hover { border-color: var(--ps-gold, #fbbf24); background: color-mix(in srgb, var(--ps-gold, #fbbf24) 5%, transparent); }

.am-preview { position: relative; }
.am-preview img { display: block; width: 100%; max-height: 18rem; object-fit: contain; border: 2px solid var(--ps-border, #333); border-radius: 0.75rem; background: var(--ps-bg-elevated, #202020); }
.am-preview > button { position: absolute; top: 0.5rem; right: 0.5rem; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--ps-error, #ef4444); cursor: pointer; }

.am-panel {
  padding: 1rem;
  border: 1px solid var(--ps-border, #333);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--ps-text-primary, #f5f5f5);
  background: var(--ps-bg-surface, #171717);
}

.am-panel small { color: var(--ps-text-muted, #737373); }
.am-success-heading, .am-primary-heading, .am-gold-heading { display: inline-flex; align-items: center; gap: 0.5rem; }
.am-success-heading { color: var(--ps-success, #22c55e); }
.am-primary-heading { color: var(--ps-primary, #22c55e); }
.am-gold-heading { color: var(--ps-gold, #fbbf24); }

.am-player-selection { display: flex; flex-direction: column; gap: 0.5rem; }
.am-player-selection > .am-row > span { color: var(--ps-text-secondary, #a3a3a3); font-size: 0.875rem; font-weight: 500; }
.am-player-list { max-height: 16rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.am-player-card { width: 100%; padding: 0.75rem; border: 2px solid transparent; border-radius: 0.5rem; display: flex; align-items: center; gap: 0.75rem; text-align: left; color: var(--ps-text-primary, #fff); background: var(--ps-bg-elevated, #222); cursor: pointer; }
.am-player-card:hover { border-color: var(--ps-border, #444); }
.am-player-card.is-selected { border-color: var(--ps-primary, #22c55e); }
.am-checkbox { width: 1.25rem; height: 1.25rem; border: 2px solid var(--ps-border, #555); border-radius: 0.25rem; display: flex; align-items: center; justify-content: center; }
.am-checkbox .ps-am-icon { width: 0.75rem; height: 0.75rem; }
.am-player-card.is-selected .am-checkbox { color: #fff; border-color: var(--ps-primary, #22c55e); background: var(--ps-primary, #22c55e); }
.am-player-copy { min-width: 0; flex: 1; }
.am-player-copy strong { max-width: 13rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.am-player-copy b { margin-left: 0.5rem; color: var(--ps-primary, #22c55e); font-size: 1.25rem; font-weight: 900; }
.am-mini-scores { margin-top: 0.25rem; display: flex; gap: 0.25rem; overflow-x: auto; }
.am-mini-scores i { padding: 0 0.25rem; border-radius: 0.2rem; color: var(--ps-text-muted, #858585); background: var(--ps-bg-surface, #171717); font-size: 0.75rem; font-style: normal; }
.am-selection-count { margin: 0; color: var(--ps-text-muted, #737373); text-align: center; font-size: 0.875rem; }

.am-chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.am-chip { padding: 0.375rem 0.75rem; border: 0; border-radius: 0.5rem; color: var(--ps-text-secondary, #aaa); background: var(--ps-bg-elevated, #222); font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.am-chip:hover { background: var(--ps-bg-hover, #2d2d2d); }
.am-chip.is-selected { color: #fff; background: var(--ps-primary, #22c55e); }

.am-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.am-fieldset legend, .am-field { color: var(--ps-text-secondary, #aaa); font-size: 0.875rem; font-weight: 500; }
.am-field { position: relative; display: flex; flex-direction: column; gap: 0.25rem; }
.am-field input, .am-field select, .am-field textarea,
.am-gif-card textarea, .am-settings-grid select {
  width: 100%;
  border: 1px solid var(--ps-border, #404040);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  color: var(--ps-text-primary, #fff);
  background: var(--ps-bg-elevated, #202020);
  font: inherit;
  outline: none;
}
.am-field input:focus, .am-field select:focus, .am-field textarea:focus,
.am-gif-card textarea:focus, .am-settings-grid select:focus { border-color: var(--ps-primary, #22c55e); }
.am-field textarea { resize: none; }
.am-input-icon { display: none; }

.am-layout-option { padding: 0.75rem; border: 2px solid var(--ps-border, #3b3b3b); border-radius: 0.5rem; color: var(--ps-text-secondary, #aaa); background: transparent; text-align: center; cursor: pointer; }
.am-layout-option.is-selected { border-color: var(--ps-primary, #22c55e); background: color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent); }
.am-layout-option small { display: block; margin-bottom: 0.25rem; }
.am-layout-option code { color: var(--ps-text-secondary, #aaa); font-size: 0.625rem; line-height: 1.4; }

.am-file-info, .am-score-summary, .am-analysis-grid, .am-description-card, .am-supported {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--ps-bg-elevated, #222);
}
.am-file-info { min-width: 0; display: flex; flex-direction: column; }
.am-file-info strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.am-file-info small { margin-top: 0.2rem; }
.am-score-summary { display: flex; align-items: center; justify-content: space-between; color: var(--ps-text-muted, #858585); font-size: 0.875rem; }
.am-score-summary b { color: var(--ps-primary, #22c55e); font-size: 1.25rem; font-weight: 900; }

.am-share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.am-share-option { padding: 1rem; border: 1px solid var(--ps-border, #3b3b3b); border-radius: 0.75rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--ps-text-primary, #fff); background: var(--ps-bg-elevated, #222); font: inherit; cursor: pointer; }
.am-share-option:hover { background: var(--ps-bg-hover, #2b2b2b); }
.am-share-option small { font-size: 0.75rem; }
.am-share-icon { width: 3rem; height: 3rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.am-share-icon--primary { color: var(--ps-primary, #22c55e); background: color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent); }
.am-share-icon--blue { color: #3b82f6; background: rgba(59,130,246,.1); }
.am-share-icon--green { color: #22c55e; background: rgba(34,197,94,.1); }
.am-share-icon--purple { color: #a855f7; background: rgba(168,85,247,.1); }

.am-course-menu { margin-top: -0.75rem; border: 1px solid var(--ps-border, #3b3b3b); border-radius: 0.5rem; overflow: hidden; background: var(--ps-bg-elevated, #222); }
.am-course-menu button { width: 100%; padding: 0.5rem 0.75rem; border: 0; display: flex; flex-direction: column; text-align: left; color: var(--ps-text-primary, #fff); background: transparent; font: inherit; cursor: pointer; }
.am-course-menu button:hover { background: var(--ps-bg-hover, #2c2c2c); }
.am-course-menu small { margin-top: 0.15rem; }

.am-analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem; }
.am-analysis-grid div { min-width: 0; display: flex; flex-direction: column; }
.am-analysis-grid small { margin-bottom: 0.15rem; font-size: 0.75rem; }
.am-analysis-grid b { font-size: 1.125rem; }
.am-analysis-grid strong { font-size: 0.875rem; }
.am-hazard-chip { padding: 0.25rem 0.75rem; border-radius: 999px; color: var(--ps-error, #ef4444); background: color-mix(in srgb, var(--ps-error, #ef4444) 10%, transparent); font-size: 0.875rem; }
.am-pro-tip { margin: 0; padding: 0.75rem; border-radius: 0.5rem; color: var(--ps-text-primary, #fff); background: color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent); font-size: 0.875rem; }
.am-pro-tip strong { color: var(--ps-primary, #22c55e); }

.am-supported { border: 1px solid var(--ps-border, #333); color: var(--ps-text-secondary, #aaa); }
.am-supported > strong { font-size: 0.875rem; }
.am-supported .am-chip-list span, .am-category { padding: 0.25rem 0.5rem; border-radius: 999px; color: var(--ps-text-muted, #858585); background: var(--ps-bg-surface, #171717); font-size: 0.75rem; }
.am-result-title { margin: 0; font-size: 1.125rem; }
.am-result-title + p { margin: 0.15rem 0 0; font-size: 0.875rem; }
.am-condition { padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.am-condition--success { color: #22c55e; background: rgba(34,197,94,.1); }
.am-condition--primary { color: var(--ps-primary, #22c55e); background: color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent); }
.am-condition--info { color: #3b82f6; background: rgba(59,130,246,.1); }
.am-condition--warning { color: #f59e0b; background: rgba(245,158,11,.1); }
.am-condition--error { color: #ef4444; background: rgba(239,68,68,.1); }
.am-price-card { padding: 1rem; border: 1px solid color-mix(in srgb, var(--ps-primary, #22c55e) 20%, transparent); border-radius: 0.5rem; background: linear-gradient(90deg, color-mix(in srgb, var(--ps-primary, #22c55e) 10%, transparent), color-mix(in srgb, var(--ps-gold, #fbbf24) 10%, transparent)); }
.am-price-card > small:first-child { display: block; margin-bottom: 0.25rem; }
.am-price-card p { margin: 0; display: flex; align-items: baseline; gap: 0.5rem; }
.am-price-card b, .am-price-card strong { font-size: 1.875rem; font-weight: 900; }
.am-price-card b { color: var(--ps-primary, #22c55e); }
.am-price-card strong { color: var(--ps-gold, #fbbf24); }
.am-price-card span { color: var(--ps-text-muted, #737373); font-size: 1.125rem; }
.am-description-card { margin: 0; color: var(--ps-text-primary, #fff); font-size: 0.875rem; }

/* Standalone GIF generator */
.am-gif-page {
  min-height: 100vh;
  padding: 1rem;
  color: #fff;
  background: linear-gradient(to bottom, #0a0a0a, #1a1a1a);
}
.am-gif-header { max-width: 56rem; margin: 0 auto 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.am-gif-header h1 { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 1.5rem; line-height: 2rem; }
.am-gif-header h1 .ps-am-icon { width: 1.5rem; height: 1.5rem; color: #22c55e; }
.am-gif-header p { margin: 0.1rem 0 0; color: #9ca3af; font-size: 0.875rem; }
.am-gif-layout { max-width: 56rem; margin: 0 auto; display: grid; grid-template-columns: minmax(0,1fr); gap: 1.5rem; }
.am-gif-card { overflow: hidden; border: 1px solid #1f2937; border-radius: 0.75rem; color: #fff; background: #1a1a1a; }
.am-gif-card > header { padding: 1.25rem 1.5rem 0.75rem; }
.am-gif-card > header h2 { margin: 0; font-size: 1.125rem; }
.am-gif-card > header p { margin: 0.25rem 0 0; color: #6b7280; font-size: 0.875rem; }
.am-gif-card__body { padding: 0 1.5rem 1.5rem; }
.am-mode-tabs { padding: 0.25rem; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0.25rem; border-radius: 0.4rem; background: #0a0a0a; }
.am-mode-tabs button { min-width: 0; padding: 0.45rem 0.25rem; border: 0; border-radius: 0.25rem; display: flex; align-items: center; justify-content: center; gap: 0.25rem; color: #9ca3af; background: transparent; font: inherit; font-size: 0.75rem; cursor: pointer; }
.am-mode-tabs .ps-am-icon { width: 0.75rem; height: 0.75rem; }
.am-mode-tabs button.is-active { color: #fff; background: #16a34a; }
.am-gif-mode-copy { margin: 1rem 0 0; color: #9ca3af; font-size: 0.875rem; }
.am-gif-card textarea { min-height: 6.25rem; color: #fff; background: #0a0a0a; border-color: #374151; resize: none; }
.am-small-label { display: block; margin-bottom: 0.5rem; color: #6b7280; font-size: 0.75rem; }
.am-prompt-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.am-prompt-list button { padding: 0.25rem 0.5rem; border: 1px solid #374151; border-radius: 999px; color: #9ca3af; background: #0a0a0a; font: inherit; font-size: 0.75rem; cursor: pointer; }
.am-prompt-list button:hover { color: #4ade80; border-color: #16a34a; }
.am-gif-upload { width: 100%; padding: 2rem; border: 2px dashed #374151; border-radius: 0.5rem; display: flex; flex-direction: column; align-items: center; color: #9ca3af; background: transparent; font: inherit; cursor: pointer; }
.am-gif-upload:hover { border-color: #16a34a; }
.am-gif-upload .ps-am-icon { width: 2.5rem; height: 2.5rem; margin-bottom: 0.75rem; color: #6b7280; }
.am-gif-upload small { margin-top: 0.25rem; color: #4b5563; }
.am-gif-media-preview { position: relative; }
.am-gif-media-preview img, .am-gif-media-preview video { display: block; width: 100%; max-height: 12rem; object-fit: cover; border-radius: 0.5rem; }
.am-gif-media-preview button { position: absolute; top: 0.5rem; right: 0.5rem; width: 1.75rem; height: 1.75rem; padding: 0; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(0,0,0,.7); cursor: pointer; }
.am-gif-media-preview button:hover { background: #dc2626; }
.am-gif-media-preview .ps-am-icon { width: 1rem; height: 1rem; }
.am-settings-grid { display: flex; flex-direction: column; gap: 1rem; }
.am-settings-grid label { color: #9ca3af; font-size: 0.875rem; }
.am-settings-grid select { margin-top: 0.25rem; color: #fff; background: #0a0a0a; border-color: #374151; }
.am-generate-button { width: 100%; min-height: 3.75rem; color: #fff; background: linear-gradient(to right,#16a34a,#22c55e); font-size: 1.125rem; }
.am-generate-button > [data-generate-busy],
.am-generate-button > [data-generate-idle] { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.am-generate-button:hover:not(:disabled) { background: linear-gradient(to right,#22c55e,#4ade80); }
.am-generation-status { text-align: center; }
.am-generation-status p { margin: 0; color: #9ca3af; font-size: 0.875rem; animation: am-pulse 1.5s ease-in-out infinite; }
.am-generation-status aside { margin-top: 0.5rem; padding: 0.75rem; border: 1px solid rgba(21,128,61,.3); border-radius: 0.5rem; color: #4ade80; background: rgba(20,83,45,.2); font-size: 0.75rem; }
.am-generation-status .am-link { margin-top: 0.5rem; color: #9ca3af; }
@keyframes am-pulse { 50% { opacity: .5; } }
.am-gif-preview { aspect-ratio: 16/9; overflow: hidden; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; background: #0a0a0a; }
.am-gif-preview > img, .am-gif-preview > video { max-width: 100%; max-height: 100%; object-fit: contain; }
.am-empty-preview { color: #4b5563; text-align: center; }
.am-empty-preview .ps-am-icon { width: 4rem; height: 4rem; margin: 0 auto 0.75rem; opacity: .3; }
.am-empty-preview p, .am-magic-preview p { margin: 0; }
.am-magic-preview { color: #9ca3af; text-align: center; }
.am-magic-preview span { position: relative; width: 5rem; height: 5rem; margin: 0 auto 1rem; border: 4px solid rgba(34,197,94,.3); border-top-color: #22c55e; border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: am-spin 1s linear infinite; }
.am-magic-preview span .ps-am-icon { color: #22c55e; animation: am-spin 1s linear infinite reverse; }
.am-share-to { margin-top: 0.25rem; padding-top: 0.75rem; border-top: 1px solid #1f2937; }
.am-share-to > label { display: block; margin-bottom: 0.5rem; color: #6b7280; font-size: 0.75rem; }
.am-gif-tips { padding: 1rem 1.5rem 1.5rem; border: 1px solid rgba(22,101,52,.3); border-radius: 0.75rem; background: linear-gradient(135deg,rgba(20,83,45,.2),rgba(22,101,52,.1)); }
.am-gif-tips h3 { margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; color: #4ade80; font-size: 1rem; }
.am-gif-tips .ps-am-icon { width: 1rem; height: 1rem; }
.am-gif-tips ul { margin: 0; padding: 0; list-style: none; color: #9ca3af; font-size: 0.875rem; line-height: 1.5; }

/* Golf Shots recorder */
.am-shots-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: #fff; background: #0a0a0a; }
.am-shot-backdrop { position: fixed; inset: 0; z-index: 70; padding: 1rem; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.78); }
.am-shot-modal { width: 92vw; max-width: 21.25rem; max-height: 85vh; overflow: hidden; border: 1px solid #1f2937; border-radius: 0.75rem; display: flex; flex-direction: column; color: #fff; background: #111; box-shadow: 0 24px 70px rgba(0,0,0,.65); }
.am-shot-header { padding: 0.375rem 0.5rem; border-bottom: 1px solid #1f2937; display: flex; align-items: center; justify-content: space-between; flex: none; }
.am-shot-header > div { display: flex; align-items: center; gap: 0.5rem; }
.am-shot-header button { width: 1.75rem; height: 1.75rem; padding: 0; border: 0; display: flex; align-items: center; justify-content: center; color: #9ca3af; background: transparent; cursor: pointer; }
.am-shot-header button:hover { color: #fff; }
.am-shot-header b { padding: 0.125rem 0.25rem; border-radius: 0.2rem; color: #22c55e; background: rgba(34,197,94,.15); font-size: 0.75rem; }
.am-shot-header strong { font-size: 0.875rem; }
.am-shot-body { padding: 0.5rem max(0.5rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.am-filter-label { margin: 0 0 0.5rem; color: #6b7280; font-size: 0.625rem; text-align: center; }
.am-shot-filters { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 0.75rem; row-gap: 0.25rem; }
.am-shot-filter { padding: 0 0.25rem; border: 0; color: var(--filter-color); background: transparent; font: inherit; font-size: 0.75rem; font-weight: 500; opacity: .5; cursor: pointer; transition: opacity 160ms ease, transform 160ms ease; }
.am-shot-filter.is-active { opacity: 1; text-decoration: underline; text-underline-offset: 3px; transform: scale(1.06); }
.am-capture-choices { padding-top: 0.5rem; display: flex; justify-content: center; gap: 2rem; }
.am-capture-choices button { border: 0; display: flex; flex-direction: column; align-items: center; gap: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; cursor: pointer; }
.am-capture-choices button:first-child { color: #22c55e; }
.am-capture-choices button:last-child { color: #3b82f6; }
.am-capture-choices .ps-am-icon { width: 2rem; height: 2rem; }
.am-gallery-button { width: 100%; padding: 0.75rem; border: 0; display: flex; align-items: center; justify-content: center; gap: 0.5rem; color: #9ca3af; background: transparent; font: inherit; cursor: pointer; }
.am-gallery-button:hover { color: #fff; }
.am-camera-error { padding: 0.75rem; border: 1px solid rgba(239,68,68,.3); border-radius: 0.5rem; display: flex; align-items: flex-start; gap: 0.5rem; background: rgba(239,68,68,.1); }
.am-camera-error > .ps-am-icon { color: #f87171; }
.am-camera-error strong { color: #f87171; font-size: 0.875rem; }
.am-camera-error p { margin: 0.25rem 0 0; color: #9ca3af; font-size: 0.75rem; }
.am-camera-error button { padding: 0; border: 0; margin-top: 0.5rem; color: #60a5fa; background: none; text-decoration: underline; font: inherit; font-size: 0.75rem; cursor: pointer; }
.am-camera-loading { min-height: 6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #9ca3af; }
.am-camera-loading .ps-am-icon { color: #3b82f6; }
.am-camera-loading p { margin: 0.5rem 0 0; font-size: 0.75rem; }
.am-camera-view { position: relative; width: 100%; max-width: 17.5rem; aspect-ratio: 3/4; margin: 0 auto; overflow: hidden; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; background: #000; }
.am-camera-view.is-loading { display: none; }
.am-camera-view video { width: 100%; height: 100%; object-fit: cover; }
.am-record-indicator { position: absolute; top: 0.75rem; left: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; display: flex; align-items: center; gap: 0.5rem; background: rgba(0,0,0,.5); z-index: 2; }
.am-record-indicator i { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: #ef4444; animation: am-pulse 1s ease-in-out infinite; }
.am-record-indicator span { color: #ef4444; font: 0.875rem ui-monospace,monospace; }
.am-camera-mode { position: absolute; top: 0.75rem; right: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; background: rgba(0,0,0,.5); font-size: 0.75rem; }
.am-camera-flip { position: absolute; right: 0.75rem; bottom: 0.75rem; z-index: 3; width: 3rem; height: 3rem; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(0,0,0,.7); cursor: pointer; }
.am-camera-flip:hover { background: rgba(0,0,0,.9); }
.am-camera-flip:disabled { opacity: .5; cursor: not-allowed; }
.am-camera-flip .ps-am-icon { width: 1.5rem; height: 1.5rem; }
.am-selfie-label { position: absolute; left: 0.75rem; bottom: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; color: #fff; background: rgba(37,99,235,.8); font-size: 0.75rem; }
.am-capture-control { padding: 0.5rem 0; display: flex; flex-direction: column; align-items: center; }
.am-capture-control p { margin: 0 0 0.5rem; color: #9ca3af; font-size: 0.625rem; }
.am-capture-control > small { margin-top: 0.25rem; color: #6b7280; font-size: 0.625rem; }
.am-photo-shutter, .am-record-button { position: relative; width: 4rem; height: 4rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer; touch-action: none; user-select: none; }
.am-photo-shutter { display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: 0 0 15px rgba(255,255,255,.3); }
.am-photo-shutter span { width: 3rem; height: 3rem; border: 4px solid #16a34a; border-radius: 50%; }
.am-record-button { background: #2563eb; box-shadow: 0 0 15px rgba(59,130,246,.4); transition: transform 160ms ease, background 160ms ease; }
.am-record-button > span { position: absolute; top: 50%; left: 50%; width: 1.5rem; height: 1.5rem; border-radius: 50%; transform: translate(-50%,-50%); background: #fff; transition: border-radius 160ms ease, width 160ms ease, height 160ms ease; }
.am-record-button.is-recording { background: #dc2626; transform: scale(1.1); box-shadow: 0 0 25px rgba(239,68,68,.6); }
.am-record-button.is-recording > span { width: 1.25rem; height: 1.25rem; border-radius: 0.125rem; }
.am-record-button svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.am-record-button circle { fill: none; stroke: rgba(255,255,255,.3); stroke-width: 3; }
.am-record-button circle:last-child { stroke: #fff; stroke-linecap: round; }
.am-zoom-list { display: flex; align-items: center; justify-content: center; gap: 0.25rem; }
.am-zoom-list button { padding: 0.375rem 0.75rem; border: 0; border-radius: 999px; color: #9ca3af; background: #1f2937; font: inherit; font-size: 0.75rem; font-weight: 500; cursor: pointer; }
.am-zoom-list button.is-active { color: #000; background: #eab308; }
.am-review-label { margin: 0; color: #9ca3af; text-align: center; font-size: 0.75rem; }
.am-review-label span { color: #60a5fa; }
.am-review-photo, .am-review-video { position: relative; width: 100%; max-width: 17.5rem; max-height: 45vh; margin: 0 auto; overflow: hidden; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; background: #000; }
.am-review-photo img { display: block; width: 100%; max-height: 45vh; object-fit: contain; }
.am-review-video { max-height: 40vh; }
.am-review-video video { width: 100%; height: 100%; object-fit: cover; }
.am-review-video > span { position: absolute; right: 0.5rem; bottom: 0.5rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; background: rgba(0,0,0,.7); font: 0.75rem ui-monospace,monospace; }
.am-pill-button { padding: 0.5rem 1rem; border: 0; border-radius: 999px; display: inline-flex; align-items: center; gap: 0.5rem; color: #d1d5db; background: #1f2937; font: inherit; cursor: pointer; }
.am-pill-button:hover { color: #fff; background: #374151; }
.am-pill-button small { color: #60a5fa; }
.am-pill-button--small { padding: 0.25rem 0.75rem; color: #9ca3af; font-size: 0.875rem; }
.am-hd-note { margin: 0; color: #4ade80; text-align: center; font-size: 0.75rem; }
.am-trim-video { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; background: #000; cursor: pointer; }
.am-trim-video video { width: 100%; height: 100%; object-fit: contain; }
.am-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); }
.am-play-overlay .ps-am-icon { width: 3.5rem; height: 3.5rem; padding: 0.75rem; border-radius: 50%; color: #fff; background: #2563eb; }
.am-sound-indicator { position: absolute; top: 0.5rem; right: 0.5rem; padding: 0.25rem 0.5rem; border-radius: 999px; display: flex; align-items: center; gap: 0.25rem; background: rgba(22,163,74,.8); font-size: 0.75rem; }
.am-sound-indicator .ps-am-icon { width: 0.75rem; height: 0.75rem; }
.am-shot-step code { color: #9ca3af; font-size: 0.875rem; }
.am-scrubber { position: relative; height: 3.5rem; margin-top: 1.25rem; border-radius: 0.5rem; overflow: visible; background: #1f2937; touch-action: none; user-select: none; }
.am-time-markers { position: absolute; inset: -1.25rem 0 auto; height: 1rem; }
.am-time-markers small { position: absolute; color: #6b7280; font: 0.625rem ui-monospace,monospace; transform: translateX(-50%); }
.am-scrubber-track, .am-trim-selection { position: absolute; top: 50%; height: 2rem; border-radius: 0.375rem; transform: translateY(-50%); }
.am-scrubber-track { left: 0; right: 0; background: #374151; }
.am-trim-selection { background: rgba(37,99,235,.5); }
.am-trim-handle { position: absolute; top: 50%; z-index: 2; width: 1.5rem; height: 3rem; padding: 0; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem; background: #3b82f6; transform: translateY(-50%); cursor: ew-resize; }
.am-trim-handle--left { border-radius: 0.5rem 0 0 0.5rem; }
.am-trim-handle--right { border-radius: 0 0.5rem 0.5rem 0; }
.am-trim-handle i { width: 0.125rem; height: 1rem; border-radius: 999px; background: rgba(255,255,255,.7); }
.am-trim-center { position: absolute; top: 50%; z-index: 1; height: 2rem; padding: 0; border: 0; display: flex; align-items: center; justify-content: center; gap: 0.25rem; background: transparent; transform: translateY(-50%); cursor: grab; }
.am-trim-center i { width: 0.125rem; height: 1rem; background: rgba(255,255,255,.5); }
.am-trim-help { margin: 0; color: #6b7280; text-align: center; font-size: 0.75rem; }
.am-sound-toggle { padding: 0.5rem 1rem; border: 1px solid #374151; border-radius: 999px; display: inline-flex; align-items: center; gap: 0.5rem; color: #6b7280; background: #1f2937; font: inherit; cursor: pointer; }
.am-sound-toggle.is-on { color: #4ade80; border-color: rgba(34,197,94,.5); background: rgba(22,163,74,.2); }
.am-processing { padding: 4rem 0; text-align: center; }
.am-processing > .ps-am-icon { width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; color: #22c55e; }
.am-processing h2 { margin: 0; font-size: 1.125rem; }
.am-processing p { margin: 0.5rem 0 0; color: #9ca3af; font-size: 0.875rem; }
.am-processing > span { width: 12rem; height: 0.375rem; margin: 1rem auto 0; border-radius: 999px; display: block; background: #1f2937; }
.am-processing > span i { width: 60%; height: 100%; border-radius: inherit; display: block; background: #22c55e; animation: am-pulse 1s ease-in-out infinite; }
.am-output-video { overflow: hidden; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; background: #000; }
.am-output-video video { max-width: 100%; max-height: 60vh; object-fit: contain; }
.am-output-video.is-round { width: 18rem; height: 18rem; margin: 0 auto; border-radius: 50%; box-shadow: 0 0 30px rgba(59,130,246,.3); }
.am-output-video.is-round video { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.am-output-sound { margin: 0; display: flex; align-items: center; justify-content: center; gap: 0.25rem; color: #4ade80; font-size: 0.75rem; }
.am-output-sound .ps-am-icon { width: 0.75rem; height: 0.75rem; }

/* PS Tracer keeps the original full-screen, video-first editor layout. */
.am-tracer-page {
  position: fixed;
  inset: 0;
  z-index: 1400;
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: #fff;
  background: #000;
  font-family: inherit;
}

.am-tracer-page button,
.am-tracer-page input { font: inherit; }

.am-tracer-page button { -webkit-tap-highlight-color: transparent; }

.am-tracer-page--closed {
  position: relative;
  inset: auto;
  z-index: auto;
  min-height: 18rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.am-tracer-simple-header,
.am-tracer-done > header {
  height: 3.5rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.am-tracer-simple-header h1,
.am-tracer-done h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 600;
}

.am-tracer-simple-header h1 .ps-am-icon { color: #facc15; }
.am-tracer-done h1 .ps-am-icon { color: #4ade80; }

.am-tracer-simple-header > button,
.am-tracer-done header > button,
.am-tracer-top-row > button,
.am-tracer-zoom button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  background: transparent;
  cursor: pointer;
}

.am-tracer-simple-header > button:hover,
.am-tracer-done header > button:hover,
.am-tracer-top-row > button:hover,
.am-tracer-zoom button:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.am-tracer-simple-header > button .ps-am-icon,
.am-tracer-done header > button .ps-am-icon,
.am-tracer-top-row > button .ps-am-icon { width: 1.25rem; height: 1.25rem; }

.am-tracer-upload-panel {
  height: calc(100% - 3.5rem);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.am-tracer-upload {
  width: min(100%, 28rem);
  padding: 3rem 1.5rem;
  border: 2px dashed #374151;
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  background: transparent;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.am-tracer-upload:hover,
.am-tracer-upload:focus-visible {
  border-color: rgba(250, 204, 21, 0.65);
  background: rgba(250, 204, 21, 0.04);
  outline: none;
}

.am-tracer-upload > .ps-am-icon {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  color: #6b7280;
}

.am-tracer-upload strong { margin-bottom: 0.5rem; font-size: 1.125rem; font-weight: 400; }
.am-tracer-upload span { color: #6b7280; font-size: 0.875rem; }

.am-tracer-editor,
.am-tracer-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.am-tracer-video-transform {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center;
  transition: transform 140ms ease-out;
  will-change: transform;
}

.am-tracer-video-transform video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.am-tracer-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.am-tracer-marker-layer > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.am-tracer-top-overlay {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem 1rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.76), transparent);
  pointer-events: none;
}

.am-tracer-top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 2rem;
  pointer-events: auto;
}

.am-tracer-top-row > button { justify-self: start; color: #fff; }
.am-tracer-top-row > strong { font-size: 0.75rem; font-weight: 500; }

.am-tracer-zoom {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.am-tracer-zoom button { color: #fff; font-size: 1.1rem; }
.am-tracer-zoom button:disabled { opacity: 0.4; cursor: not-allowed; }
.am-tracer-zoom span { width: 1.9rem; color: #fff; text-align: center; font-size: 0.625rem; }

.am-tracer-ai-status {
  width: fit-content;
  max-width: calc(100% - 1rem);
  min-height: 1.9rem;
  margin: 0.25rem auto 0;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #fff;
  background: rgba(37, 99, 235, 0.92);
  font-size: 0.75rem;
  text-align: center;
  pointer-events: auto;
}

.am-tracer-ai-status--scanning { background: rgba(147, 51, 234, 0.92); }
.am-tracer-ai-status--calculating { background: rgba(37, 99, 235, 0.92); }
.am-tracer-ai-status--complete { background: rgba(22, 163, 74, 0.92); }
.am-tracer-ai-status--mark { color: #050505; background: #eab308; font-weight: 700; }
.am-tracer-ai-status .ps-am-icon { width: 1rem; height: 1rem; }

.am-tracer-bottom-overlay {
  position: absolute;
  inset: auto 0 0;
  z-index: 30;
  padding: 1.5rem 0 max(0.35rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.98) 0%, rgba(0, 0, 0, 0.84) 68%, transparent 100%);
}

.am-tracer-analysis {
  min-height: 1.5rem;
  margin: 0 0.5rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.am-tracer-analysis::-webkit-scrollbar { display: none; }

.am-tracer-stat {
  flex: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: #fff;
  background: rgba(31, 41, 55, 0.72);
  font-size: 0.625rem;
  text-transform: capitalize;
}

.am-tracer-stat small { margin-right: 0.25rem; font: inherit; }
.am-tracer-stat--blue { background: rgba(30, 58, 138, 0.64); }
.am-tracer-stat--blue small { color: #93c5fd; }
.am-tracer-stat--green { background: rgba(20, 83, 45, 0.64); }
.am-tracer-stat--green small { color: #86efac; }
.am-tracer-stat--purple { background: rgba(88, 28, 135, 0.64); }
.am-tracer-stat--purple small { color: #d8b4fe; }
.am-tracer-stat--yellow { background: rgba(113, 63, 18, 0.64); }
.am-tracer-stat--yellow small { color: #fde047; }

.am-tracer-timeline {
  position: relative;
  height: 2.5rem;
  margin: 0 0.5rem;
  overflow: visible;
  border-radius: 0.25rem;
  background: #111827;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.am-tracer-thumbnails {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: inherit;
}

.am-tracer-thumbnails i {
  flex: 1 1 10%;
  min-width: 0;
  height: 100%;
  display: block;
  background-color: #1f2937;
  background-position: center;
  background-size: cover;
}

.am-tracer-mask {
  position: absolute;
  inset-block: 0;
  z-index: 2;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.am-tracer-mask--left { left: 0; border-radius: 0.25rem 0 0 0.25rem; }
.am-tracer-mask--right { right: 0; border-radius: 0 0.25rem 0.25rem 0; }

.am-tracer-selection {
  position: absolute;
  inset-block: 0;
  z-index: 3;
  border-top: 2px solid #facc15;
  border-bottom: 2px solid #facc15;
  pointer-events: none;
}

.am-tracer-trim-handle {
  position: absolute;
  top: 0;
  z-index: 10;
  width: 1rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.am-tracer-trim-handle i {
  width: 0.5rem;
  height: 2.5rem;
  display: block;
  background: #facc15;
}

.am-tracer-trim-handle--start i { border-radius: 0.25rem 0 0 0.25rem; }
.am-tracer-trim-handle--end i { border-radius: 0 0.25rem 0.25rem 0; }

.am-tracer-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 12;
  width: 2px;
  background: #fff;
  transform: translateX(-1px);
  pointer-events: none;
}

.am-tracer-times {
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #9ca3af;
  font-size: 0.625rem;
}

.am-tracer-times strong { color: #fff; font: 0.75rem ui-monospace, SFMono-Regular, Consolas, monospace; }

.am-tracer-actions-row {
  padding: 0 0.5rem 0.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem;
}

.am-tracer-marker-buttons,
.am-tracer-frame-controls,
.am-tracer-create-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.am-tracer-frame-controls { justify-self: center; }
.am-tracer-create-actions { justify-self: end; }

.am-tracer-marker-action,
.am-tracer-frame-controls > button,
.am-tracer-create-actions > button {
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: #fff;
  background: #374151;
  font-size: 0.625rem;
  cursor: pointer;
}

.am-tracer-marker-action--green.is-active { background: #22c55e; }
.am-tracer-marker-action--green.is-complete:not(.is-active) { background: #166534; }
.am-tracer-marker-action--yellow.is-active { color: #050505; background: #eab308; }
.am-tracer-marker-action--yellow.is-complete:not(.is-active) { background: #854d0e; }
.am-tracer-marker-action--red.is-active { background: #ef4444; }
.am-tracer-marker-action--red.is-complete:not(.is-active) { background: #991b1b; }

.am-tracer-frame-controls > button { width: 2rem; padding: 0; color: #d1d5db; background: rgba(31, 41, 55, 0.88); }
.am-tracer-frame-controls .am-tracer-play-button { border-radius: 50%; color: #050505; background: #fff; }
.am-tracer-play-button .ps-am-icon { width: 1rem; height: 1rem; }
.am-tracer-create-actions > button:first-child { width: 1.75rem; padding: 0; }
.am-tracer-create-actions > button .ps-am-icon { width: 0.75rem; height: 0.75rem; }

.am-tracer-create-actions .am-tracer-create-button {
  padding-inline: 0.75rem;
  color: #050505;
  background: #eab308;
  font-weight: 600;
}

.am-tracer-create-actions .am-tracer-create-button:disabled { background: #4b5563; cursor: not-allowed; opacity: 0.8; }

.am-tracer-appearance {
  min-height: 1.6rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.am-tracer-colors { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }

.am-tracer-colors button {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--tracer-swatch);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.am-tracer-colors button.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28); transform: scale(1.1); }

.am-tracer-width {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #9ca3af;
  font-size: 0.625rem;
}

.am-tracer-width input { width: 5.5rem; accent-color: #facc15; cursor: pointer; }
.am-tracer-width span { width: 2rem; color: #fff; font: 0.625rem ui-monospace, SFMono-Regular, Consolas, monospace; }

.am-tracer-marker {
  position: absolute;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  color: currentColor;
  background: transparent;
  transform: translate(-50%, -50%) scale(var(--marker-scale, 1));
  transform-origin: center;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.am-tracer-marker:active { cursor: grabbing; }

.am-tracer-marker > span {
  width: 100%;
  height: 100%;
  border: 3px solid currentColor;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, currentColor 30%, transparent);
  box-shadow: 0 0 0.9rem color-mix(in srgb, currentColor 55%, transparent);
}

.am-tracer-marker > span .ps-am-icon { width: 1.25rem; height: 1.25rem; }
.am-tracer-marker > span i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: currentColor; }

.am-tracer-marker small {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 50%;
  padding: 0.125rem 0.375rem;
  border-radius: 0.2rem;
  color: currentColor;
  background: rgba(0, 0, 0, 0.82);
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
}

.am-tracer-marker--green { color: #4ade80; }
.am-tracer-marker--yellow { color: #facc15; }
.am-tracer-marker--red { color: #f87171; }

.am-tracer-processing,
.am-tracer-done {
  width: 100%;
  height: 100%;
  background: #000;
}

.am-tracer-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.am-tracer-processing > .ps-am-icon { width: 4rem; height: 4rem; margin-bottom: 1.5rem; color: #facc15; }
.am-tracer-processing h1 { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 400; }
.am-tracer-processing p { margin: 0; color: #9ca3af; }

.am-tracer-processing > span {
  width: min(16rem, calc(100% - 3rem));
  height: 0.5rem;
  margin-top: 1.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: #1f2937;
}

.am-tracer-processing > span i { width: 60%; height: 100%; display: block; border-radius: inherit; background: #facc15; animation: am-pulse 1s ease-in-out infinite; }

.am-tracer-processing > button {
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  color: #d1d5db;
  background: transparent;
  cursor: pointer;
}

.am-tracer-done { display: flex; flex-direction: column; }
.am-tracer-output { flex: 1; min-height: 0; padding: 1rem; display: flex; align-items: center; justify-content: center; }
.am-tracer-output video { display: block; max-width: 100%; max-height: 100%; border-radius: 0.5rem; object-fit: contain; background: #000; }

.am-tracer-done-actions {
  padding: 1rem max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
  display: flex;
  gap: 0.75rem;
}

.am-tracer-done-actions button {
  flex: 1 1 0;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.am-tracer-done-actions button.is-primary { border-color: #16a34a; background: #16a34a; }
.am-tracer-done-actions .ps-am-icon { width: 1rem; height: 1rem; }

@media (min-width: 768px) {
  .am-gif-page { padding: 1.5rem; }
}

@media (min-width: 1024px) {
  .am-gif-layout { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 380px) {
  .am-grid-2 { gap: 0.4rem; }
  .am-button, .am-dark-button { padding-left: 0.6rem; padding-right: 0.6rem; font-size: 0.875rem; }
  .am-shot-modal { width: 96vw; }
  .am-tracer-analysis { justify-content: flex-start; gap: 0.35rem; }
  .am-tracer-actions-row { grid-template-columns: 1fr auto; }
  .am-tracer-frame-controls { grid-column: 1 / -1; grid-row: 2; margin-top: 0.2rem; }
  .am-tracer-create-actions { grid-column: 2; grid-row: 1; }
  .am-tracer-marker-action { padding-inline: 0.4rem; }
  .am-tracer-appearance { gap: 0.5rem; }
  .am-tracer-colors { gap: 0.35rem; }
  .am-tracer-width input { width: 4rem; }
  .am-tracer-done-actions { flex-wrap: wrap; }
  .am-tracer-done-actions button { flex-basis: calc(50% - 0.4rem); }
  .am-tracer-done-actions button.is-primary { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-am-icon.is-spinning,
  .am-magic-preview span,
  .am-generation-status p,
  .am-processing > span i,
  .am-tracer-processing > span i { animation-duration: 2s; }
  .am-tracer-video-transform { transition: none; }
}
