* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-dim: #888;
  --accent: #ff3b3b;
  --accent-glow: rgba(255, 59, 59, 0.15);
  --yellow: #ffd60a;
  --green: #34d399;
  --blue: #60a5fa;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ===== TOP NAV ===== */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topnav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.topnav-logo .wall {
  color: var(--accent);
}

.logo-dino {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topnav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.topnav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
  font-weight: 500;
}

.topnav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.topnav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.topnav-links a.nav-x-link {
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.topnav-links a.nav-x-link:hover {
  color: var(--text);
  border-color: var(--text-dim);
  background: var(--surface-2);
}

.topnav .btn-submit {
  color: #fff;
  background: var(--accent);
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  margin-left: 0.75rem;
  transition: opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.topnav .btn-submit:hover {
  opacity: 0.9;
  background: var(--accent);
  color: #fff;
}

/* ===== PAGE LAYOUT ===== */
.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
}

.page-content.wide {
  max-width: 1100px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.page-header .desc {
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 500px;
}

/* ===== SORT TABS ===== */
.sort-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.sort-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.sort-tab.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ===== SUBMISSION CARDS ===== */
.submission-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  transition: border-color 0.2s;
}

.submission-card:hover {
  border-color: #333;
}

.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 40px;
  padding-top: 0.1rem;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
  border-radius: 4px;
  transition: all 0.15s;
  color: var(--text-dim);
  line-height: 1;
}

.vote-btn:hover {
  background: var(--surface-2);
}

.vote-btn.up.voted {
  color: var(--accent);
}


.vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  min-width: 30px;
  text-align: center;
}

.vote-score.positive { color: var(--accent); }
.vote-score.negative { color: var(--blue); }

.submission-body {
  flex: 1;
  min-width: 0;
}

.submission-text {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  word-wrap: break-word;
}

.submission-text .slop-highlight {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 0.05em 0.25em;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
}

/* Clickable slop phrase — tooltip on hover */
.submission-text .slop-highlight.slop-tooltip-anchor,
.slop-highlight.slop-tooltip-anchor {
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255, 59, 59, 0.5);
  cursor: pointer;
}

.submission-text .slop-highlight.slop-tooltip-anchor:hover,
.slop-highlight.slop-tooltip-anchor:hover,
.slop-highlight.slop-tooltip-anchor:focus {
  background: rgba(255, 59, 59, 0.25);
  text-decoration-color: var(--accent);
  outline: none;
}

/* ===== SLOP TOOLTIP ===== */
.slop-tooltip {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid rgba(255, 59, 59, 0.6);
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  max-width: 240px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.12s;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.slop-tooltip.visible {
  opacity: 1;
}

/* Slopsaurus word card — highlighted when scrolled to from the Wall */
.word-card.word-card-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow), 0 0 16px var(--accent-glow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Fade out transition */
.word-card {
  transition: border-color 0.2s, box-shadow 1.5s ease-out;
}

.submission-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.submission-meta .source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.submission-meta .source-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.7rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submission-meta .source-link:hover {
  color: var(--accent);
}

.submission-meta .rank-badge {
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.submission-meta .time-ago {
  color: var(--text-dim);
}

.submission-meta .submitted-by {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.7rem;
}

/* ===== OFFENDER ATTRIBUTION (primary shame target) ===== */
.offender-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.offender-badge {
  background: rgba(255, 59, 59, 0.12);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  border: 1px solid rgba(255, 59, 59, 0.3);
  flex-shrink: 0;
}

.offender-name {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

/* ===== FORM ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group textarea,
.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-group .char-count {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 0.3rem;
}

.form-group .char-count.warn {
  color: var(--yellow);
}

.form-group .char-count.over {
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.form-error {
  color: var(--accent);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.form-success {
  color: var(--green);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* ===== SLOPSAURUS WORDS ===== */
.words-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.word-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s;
}

.word-card:hover {
  border-color: #333;
}

.word-vote-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.word-vote-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.word-vote-btn.voted {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.word-info {
  flex: 1;
  min-width: 0;
}

.word-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.word-name .rank-num {
  color: var(--accent);
  font-size: 0.75rem;
  margin-right: 0.5rem;
}

.word-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-bar .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-item {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.stat-item .stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text);
  margin-right: 0.3rem;
}

/* ===== LOADING ===== */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-dim);
}

.loading-spinner::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  color: var(--text-dim);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
  z-index: 300;
  transition: transform 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--accent);
}

.toast.success {
  border-color: var(--green);
}

/* ===== HAMBURGER MENU ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .topnav {
    padding: 0.6rem 1rem;
  }

  .hamburger {
    display: flex;
  }

  .topnav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    gap: 0;
  }

  .topnav-links.open {
    display: flex;
  }

  .topnav-links a {
    padding: 0.7rem 0.8rem;
    font-size: 0.95rem;
    border-radius: 6px;
  }

  .topnav-links a:hover {
    background: var(--surface-2);
  }

  .topnav .btn-submit {
    margin-left: 0;
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
  }

  .page-content {
    padding: 4.5rem 1rem 2rem;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .submission-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .vote-col {
    min-width: 32px;
  }

  .stats-bar {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .word-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .word-vote-btn {
    align-self: flex-start;
  }
}

/* ===== FOOTER ===== */
.app-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 3rem;
}

.app-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--text);
}
