/* Scene Architect v2 — style.css
   Color scheme:
   - Accent: #00BFFF (cyan)
   - Highlight: #FFD700 (yellow)
   - Background: #0f0f14
   - Surface: #1a1a24
   - Surface2: #22222e
   - Border: #333344
   - Text: #e0e0ee
   - Muted: #888899
   No red/green — colorblind safe.
*/

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

:root {
  --accent: #00BFFF;
  --highlight: #FFD700;
  --bg: #0f0f14;
  --surface: #1a1a24;
  --surface2: #22222e;
  --border: #333344;
  --text: #e0e0ee;
  --muted: #888899;
  --radius: 8px;
  --radius-sm: 4px;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Nav */

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Layout */

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.container--wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-highlight {
  background: var(--highlight);
  color: #000;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card + .card {
  margin-top: 1rem;
}

/* Form elements */

.form-group {
  margin-bottom: 1.25rem;
}

label, .form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.6rem 0.85rem;
  transition: border-color 0.15s;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* Scene type chips */

.type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.type-chip {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  transition: all 0.15s;
  user-select: none;
}

.type-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.type-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* Display-only type tags */
.type-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(0, 191, 255, 0.15);
  border: 1px solid rgba(0, 191, 255, 0.4);
  color: var(--accent);
}

.type-tag--alt {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--highlight);
}

/* Multi-select dropdowns */

.multi-select-wrapper {
  position: relative;
}

.multi-select-dropdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.multi-select-dropdown select {
  flex: 1;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--accent);
}

.selected-tag .remove-tag {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.1s;
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
}

.selected-tag .remove-tag:hover {
  opacity: 1;
}

.custom-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.custom-input-row input {
  flex: 1;
}

/* Category cards grid on create page */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.category-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

/* Split fields */

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.split-field h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* Safety section */

.safety-box {
  border: 1px solid var(--highlight);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: rgba(255, 215, 0, 0.05);
}

.safety-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--highlight);
  margin-bottom: 0.6rem;
  display: block;
}

/* Share link display */

.share-box {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.share-box h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
}

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

.share-url {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  color: var(--text);
  font-family: monospace;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
  user-select: all;
}

/* Vote sliders */

.vote-axes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vote-axis {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  align-items: center;
  gap: 0.75rem;
}

.vote-axis-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.vote-axis input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.vote-axis-value {
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}

/* Average bars */

.avg-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.avg-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.avg-bar-label {
  color: var(--muted);
}

.avg-bar-track {
  background: var(--surface2);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.avg-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.avg-bar-fill--highlight {
  background: var(--highlight);
}

.avg-bar-value {
  text-align: right;
  color: var(--text);
  font-weight: 600;
}

/* Comments */

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.comment-item {
  background: var(--surface2);
  border-left: 3px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.comment-item p {
  margin: 0;
  font-size: 0.92rem;
}

.comment-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* Scene shareable page */

.scene-page .scene-header {
  margin-bottom: 1.5rem;
}

.scene-page .types-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.scene-narrative {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.narrative-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.narrative-block h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.narrative-block p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
}

.components-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.component-tag {
  padding: 0.2rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Browse scene cards */

.scenes-grid {
  display: grid;
  gap: 1rem;
}

.scene-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.scene-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.scene-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.scene-card-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
}

.scene-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.scene-card-setup {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scene-card-components {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.scene-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mini-bars {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mini-bar {
  font-size: 0.78rem;
  color: var(--muted);
}

.mini-bar span {
  color: var(--accent);
  font-weight: 600;
}

/* Leaderboard */

.leaderboard-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.lb-tab {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  transition: all 0.15s;
}

.lb-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.lb-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.lb-table td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid rgba(51, 51, 68, 0.5);
  font-size: 0.9rem;
}

.lb-table tr:last-child td {
  border-bottom: none;
}

.lb-rank {
  font-weight: 700;
  color: var(--muted);
  width: 40px;
}

.lb-score {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}

/* Auth forms */

.auth-box {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-box h2 {
  margin-bottom: 1.5rem;
  color: var(--accent);
}

/* Index hero */

.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  max-width: 860px;
  margin: 0 auto 3rem;
  padding: 0 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.feature-card h3 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Pagination */

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

/* Utilities */

.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-highlight { color: var(--highlight); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert--info {
  background: rgba(0, 191, 255, 0.1);
  border: 1px solid rgba(0, 191, 255, 0.3);
  color: var(--accent);
}

.alert--warn {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--highlight);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 0.5rem;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Mobile */

@media (max-width: 600px) {
  .nav {
    padding: 0 1rem;
    gap: 0.75rem;
    overflow-x: auto;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .categories-grid {
    grid-template-columns: 1fr;
  }

  .vote-axis {
    grid-template-columns: 1fr;
  }

  .avg-bar-row {
    grid-template-columns: 90px 1fr 36px;
  }

  .split-fields {
    grid-template-columns: 1fr;
  }

  .scene-narrative {
    grid-template-columns: 1fr;
  }
}
