:root {
    color-scheme: dark light;
}

* {
    box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #111;
  color: #f4f4f5;
  display: flex;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  min-height: 100vh;
}

main.layout {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

main.layout > * {
  margin: 0;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  color: #fafafa;
}

.site-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #d4d4d8;
}

.site-links a {
    color: inherit;
    text-decoration: none;
    opacity: 0.75;
}

.site-links a:hover {
    opacity: 1;
}

.site-links a.active-link {
    opacity: 1;
    text-decoration: underline;
}

.site-links a.external::after {
    content: "↗";
    font-size: 0.7rem;
    margin-left: 0.2rem;
    opacity: 0.6;
}

.site-links a.external:hover::after {
    opacity: 1;
}

.page-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #d4d4d8;
  font-size: 0.95rem;
  line-height: 1.35;
}

.page-copy p {
  margin: 0;
}

.page-copy a {
  color: inherit;
  text-decoration: underline;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field {
    position: relative;
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid #3f3f46;
    background: #0c0c0c;
    color: inherit;
    padding: 0.3rem 0.45rem;
    font-size: 0.85rem;
    border-radius: 4px;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.field--narrow {
  max-width: 60%;
}

.field textarea {
    min-height: 130px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: #fafafa;
    box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.12);
}

.actions {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
}

button {
    border: 1px solid #3f3f46;
    background: transparent;
    color: inherit;
    padding: 0.3rem 0.45rem;
    font-size: 0.9rem;
    border-radius: 4px;
    transition:
        border-color 0.15s ease,
        color 0.15s ease;
    cursor: pointer;
}

button:hover {
    border-color: #fafafa;
    color: #fafafa;
}

button:disabled {
    opacity: 0.4;
    cursor: wait;
}

.status {
    border: 1px solid #3f3f46;
    padding: 0.35rem 0.45rem;
    border-radius: 4px;
    display: none;
    background: #0c0c0c;
    font-size: 0.8rem;
}

.status.success {
    display: block;
    border-color: #34d399;
    color: #34d399;
}

.status.error {
    display: block;
    border-color: #f87171;
    color: #f87171;
}

.token-section {
    display: none;
    grid-column: 2;
}

.token-section.active {
    display: block;
}

.token-section input {
    border-color: #ef4444;
    color: #ef4444;
}

.token-section input:focus {
    border-color: #ef4444;
    box-shadow: none;
}

.token-section input::placeholder {
    color: #ef4444;
}

.saved-note {
    display: none;
    grid-column: 2;
    justify-self: end;
    font-size: 0.75rem;
}

.saved-note.visible {
    display: block;
}

.saved-note.success {
    color: #34d399;
}

.saved-note.error {
    color: #ef4444;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


.quote-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.quote-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quote-card {
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  background: #0c0c0c;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.quote-item.editing .quote-card {
  border-color: #facc15;
}

.quote-view {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quote-item.editing .quote-view {
  display: none;
}

.quote-item blockquote {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
}

.quote-source {
  font-size: 0.85rem;
  color: #a1a1aa;
}




.quote-links {
  display: block;
  font-size: 0.75rem;
}

.quote-links .source-link {
  display: block;
  color: inherit;
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-links .source-link.muted {
  opacity: 0.6;
  text-decoration: none;
}

.quote-actions-wrapper {
  width: 100%;
  max-width: 720px;
  padding: 0 0.85rem;
  margin: 0 auto;
  margin-top: 0.05rem;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.quote-actions {
  display: flex;
  gap: 0.35rem;
}

.quote-item:hover .quote-actions-wrapper,
.quote-item:focus-within .quote-actions-wrapper {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.quote-actions button {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  font: inherit;
  display: inline-flex;
  align-items: center;
}

.quote-actions button.delete {
  color: #f87171;
}

.quote-actions button.copied {
  color: #34d399;
}

.quote-actions button:hover {
  opacity: 0.8;
}

.quote-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.quote-actions .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: none) {
  .quote-actions-wrapper {
    display: none;
  }
}

@media (max-width: 520px) {
  .quote-links .source-link {
    white-space: normal;
    word-break: break-word;
  }

  .quote-actions-wrapper {
    justify-content: flex-start;
    padding: 0 0.5rem;
  }

  .quote-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.quote-edit-form {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid #27272a;
}

.quote-item.editing .quote-edit-form {
  display: flex;
}

.quote-edit-actions {
  display: flex;
  gap: 0.4rem;
}

.quote-edit-actions button {
  border: 1px solid #3f3f46;
  background: transparent;
  color: inherit;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.quote-edit-actions button:hover {
  border-color: #fafafa;
  color: #fafafa;
}

.quote-edit-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.quote-edit-status {
  min-height: 1em;
  font-size: 0.75rem;
  color: #f87171;
}

.empty {
    font-size: 0.85rem;
    color: #a1a1aa;
}

@media (max-width: 520px) {
    .actions {
        grid-template-columns: 1fr;
    }

    .token-section,
    .saved-note {
        grid-column: 1;
        justify-self: start;
    }
}
@media (hover: none) {
  .quote-card {
    cursor: pointer;
  }
}

.mobile-action-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.mobile-action-backdrop.active {
  display: flex;
}

.mobile-action-sheet {
  background: #1b1b1d;
  border: 1px solid #2f2f35;
  border-radius: 18px;
  padding: 1rem;
  width: min(280px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.mobile-action-sheet button {
  border: none;
  background: none;
  color: #f4f4f5;
  font: inherit;
  text-align: left;
  padding: 0.4rem 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 10px;
}

.mobile-action-sheet button:hover,
.mobile-action-sheet button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.mobile-action-sheet button.delete {
  color: #f87171;
}

.mobile-action-sheet button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
