.TrailStopCard {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  padding: 0 0.5rem;
}

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

.TrailStopCard-title {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  letter-spacing: 0;
  text-transform: lowercase;
  position: relative;
}

/* Wrap the title text in a span with filter for proper hue rotation */
.TrailStopCard-title > * {
  color: var(--accent-color);
  filter: var(--user-content-filter);
}

.TrailStopCard-counter {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
  font-family: "SF Mono", "Monaco", monospace;
  text-transform: lowercase;
}

.TrailStopCard-content {
  margin-bottom: 3.5rem;
}

.TrailStopCard-text {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  margin: 0;
  white-space: pre-wrap;
}

.TrailStopCard-embed {
  margin-top: 1.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  overflow: visible;
}

@media (min-width: 769px) {
  .TrailStopCard-embed {
    margin-left: -2rem;
    margin-right: -2rem;
  }
}

.TrailStopCard-externalLink {
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  .TrailStopCard-externalLink {
    background: rgba(255, 255, 255, 0.03);
  }
}

.TrailStopCard-externalLinkAnchor {
  text-decoration: none;
  font-weight: 500;
}

/* Wrap link text in filtered span */
.TrailStopCard-externalLinkAnchor > * {
  color: var(--accent-color);
  filter: var(--user-content-filter);
}

.TrailStopCard-externalLinkAnchor:hover {
  text-decoration: underline;
}

.TrailStopCard-externalDescription {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0;
}

.TrailStopCard-titleEdit {
  width: 100%;
  border: none;
  background: transparent;
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-size: 1.25rem;
  font-weight: 500;
  outline: none;
  letter-spacing: 0;
  text-transform: lowercase;
  transition: all 0.2s;
  padding: 0;
  margin: 0 0 0.5rem;
  text-align: center;
}

/* Wrap accent color in a pseudo-element for filtering */
.TrailStopCard-titleEdit {
  color: var(--accent-color);
  background-image: linear-gradient(var(--accent-color), var(--accent-color));
  background-clip: text;
  -webkit-background-clip: text;
  filter: var(--user-content-filter);
}

.TrailStopCard-titleEdit::placeholder {
  color: var(--accent-color);
  opacity: 0.3;
}

.TrailStopCard-titleEdit:focus {
  opacity: 1;
}

.TrailStopCard-contentEdit {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  outline: none;
  resize: none;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
    "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  transition: opacity 0.2s;
  white-space: pre-wrap;
  padding: 0;
  margin: 0;
}

.TrailStopCard-contentEdit::placeholder {
  color: var(--text-primary);
  opacity: 0.3;
}

.TrailStopCard-contentEdit:focus {
  opacity: 1;
}

.TrailStopCard-buttonPreview {
  text-align: center;
}

.TrailStopCard-buttonTextInput {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.875rem 1.5rem;
  background-color: transparent;
  border: 2px dashed var(--accent-color);
  border-radius: 8px;
  cursor: text;
  transition: all 0.2s ease;
  font-weight: 500;
  text-transform: lowercase;
  text-align: center;
  outline: none;
  min-width: 160px;
  max-width: 100%;
  position: relative;
  isolation: isolate;
  color: var(--accent-color);
  filter: var(--user-content-filter);
}

.TrailStopCard-buttonTextInput::placeholder {
  color: var(--accent-color);
  opacity: 0.4;
}

.TrailStopCard-buttonTextInput:hover,
.TrailStopCard-buttonTextInput:focus {
  background-color: rgba(0, 0, 0, 0.02);
  border-style: solid;
}

@media (prefers-color-scheme: dark) {
  .TrailStopCard-buttonTextInput:hover,
  .TrailStopCard-buttonTextInput:focus {
    background-color: rgba(255, 255, 255, 0.03);
  }
}

.TrailStopCard-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.875rem;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

@media (prefers-color-scheme: dark) {
  .TrailStopCard-error {
    color: #fca5a5;
  }
}

/* Desktop enhancements */
@media (min-width: 769px) {
  .TrailStopCard {
    padding: 0 1rem;
  }

  .TrailStopCard-title {
    font-size: 1.5rem;
  }

  .TrailStopCard-titleEdit {
    font-size: 1.5rem;
  }

  .TrailStopCard-text {
    font-size: 1.0625rem;
    line-height: 1.75;
  }

  .TrailStopCard-contentEdit {
    font-size: 1.0625rem;
    line-height: 1.75;
  }

  .TrailStopCard-buttonTextInput {
    font-size: 1.125rem;
    padding: 1rem 3rem;
    min-width: 200px;
  }
}
