/* EMPI Beats — Dark theme inspired by EMPI House pixel art palettes */

:root {
  --bg: #0a0f1a;
  --surface: #182a3c;
  --text: #f0fafc;
  --accent: #d49050;
  --muted: #82d0dc;
  --link: #eabc78;
  --link-hover: #d49050;
  --border: #243a50;
  --max-width: 800px;

  /* Genre accent colors */
  --warm-house: #d49050;
  --cool-ambient: #48a0b0;
  --trap-hard: #a24898;
  --soul-gold: #d0a048;
  --boombap-dust: #948852;

  /* MAP-state colors */
  --state-dwell: #48a0b0;
  --state-shift: #4CAF50;
  --state-conflict: #f44336;
  --state-anticipation: #FFC107;
  --state-transition: #9E9E9E;

  --glow-accent: rgba(212, 144, 80, 0.35);
  --glow-heart: rgba(220, 60, 60, 0.5);
  --surface-elevated: #1e3248;
  --scanline-opacity: 0.03;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

.pixel-render {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

body {
  background-image:
    linear-gradient(rgba(36, 58, 80, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 58, 80, 0.15) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px, transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heart-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px var(--glow-heart)); }
  50% { filter: drop-shadow(0 0 20px var(--glow-heart)) drop-shadow(0 0 40px rgba(220, 60, 60, 0.25)); }
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navigation */
.nav {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  border-image: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 8px) 2;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-shadow: 0 0 10px var(--glow-accent);
}

.nav-icon {
  width: 24px;
  height: 24px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Hero */
.hero {
  padding: 3rem 0 2rem;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.hero-text { flex: 1; }

.hero h1 {
  font-family: 'Courier New', Courier, monospace;
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px var(--glow-accent);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.hero-accent {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--warm-house), var(--cool-ambient), var(--trap-hard), var(--soul-gold));
  border-radius: 2px;
  margin-bottom: 1rem;
}

.hero-desc {
  color: var(--text);
  opacity: 0.85;
  max-width: 500px;
  line-height: 1.7;
}

.hero-character {
  flex-shrink: 0;
  width: 200px;
}

.hero-character img {
  width: 100%;
  height: auto;
  animation: heart-pulse 2.5s ease-in-out infinite;
}

/* Sections */
.section {
  padding: 2rem 0;
}

.section h2 {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.section h2::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  margin-right: 0.6rem;
  vertical-align: middle;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: fade-up 0.4s ease-out both;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 12px var(--glow-accent);
}

.card.featured {
  border-color: var(--accent);
  border-left-width: 3px;
  box-shadow: 0 0 15px var(--glow-accent);
}

.card[data-genre="warm_house"] { border-left-color: var(--warm-house); }
.card[data-genre="cool_ambient"] { border-left-color: var(--cool-ambient); }
.card[data-genre="trap_hard"] { border-left-color: var(--trap-hard); }
.card[data-genre="soul_gold"] { border-left-color: var(--soul-gold); }
.card[data-genre="boombap_dust"] { border-left-color: var(--boombap-dust); }
.card[data-genre="supercollider"] { border-left-color: var(--accent); }
.card[data-genre="p5js"] { border-left-color: var(--cool-ambient); }

.card h2, .card h3 {
  margin-bottom: 0.4rem;
}

.card h2 a, .card h3 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover, .card h3 a:hover {
  color: var(--link);
}

.card-header {
  margin-bottom: 0.5rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

/* Single pages */
.single {
  padding: 2rem 0 4rem;
}

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

.single h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.single time {
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  line-height: 1.75;
}

.content h2 {
  color: var(--accent);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.content h3 {
  color: var(--link);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content p {
  margin-bottom: 1rem;
}

.content ul, .content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.content li {
  margin-bottom: 0.3rem;
}

.content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(212, 144, 80, 0.08);
  color: var(--muted);
}

.content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.content pre code {
  background: none;
  padding: 0;
}

.content a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content a:hover {
  color: var(--link-hover);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--border);
  color: var(--text);
}

.genre-warm_house { background: var(--warm-house); color: #0a0f1a; }
.genre-cool_ambient { background: var(--cool-ambient); color: #0a0f1a; }
.genre-trap_hard { background: var(--trap-hard); color: #f0fafc; }
.genre-soul_gold { background: var(--soul-gold); color: #0a0f1a; }
.genre-boombap_dust { background: var(--boombap-dust); color: #0a0f1a; }

.badge-stage {
  background: var(--border);
  color: var(--muted);
}

.badge-score {
  background: var(--border);
  color: var(--accent);
}

.badge-status-success { background: #2d5a3d; color: #a0e8b8; }
.badge-status-failed { background: #5a2d2d; color: #e8a0a0; }
.badge-status-pending { background: #5a4e2d; color: #e8d8a0; }
.badge-attempt { background: #3d3040; color: #c0a8cc; }
.card-attempt { opacity: 0.7; border-left: 3px solid #3d3040; }
.card-attempt:hover { opacity: 1; }
.attempt-explainer { font-style: italic; margin-bottom: 1.5rem; }
.parent-link { margin-top: 1rem; }
.parent-link-small { display: block; font-size: 0.8rem; margin-top: 0.25rem; opacity: 0.7; }

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent);
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* Genre filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.filter-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.filter-btn:hover { background: var(--surface-elevated); color: var(--text); }
.filter-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Lightbox overlay */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  image-rendering: pixelated;
}

/* MAP-States timeline */
.reflection-body.has-timeline {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .reflection-body.has-timeline { grid-template-columns: 1fr; }
}
.map-timeline {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border-radius: 4px;
  padding: 1rem;
  border-left: 2px solid var(--border);
  max-height: 80vh;
  overflow-y: auto;
}
.map-timeline h3 { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--accent); }
.timeline-explainer { font-size: 0.7rem; margin-bottom: 0.75rem; }
.timeline-nodes {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
}
.timeline-node {
  position: relative;
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
}
.timeline-node::before {
  content: '';
  position: absolute;
  left: -1.35rem;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.timeline-node.state-dwell::before { background: var(--state-dwell); }
.timeline-node.state-orientation::before { background: var(--state-shift); }
.timeline-node.state-shift::before { background: var(--state-shift); }
.timeline-node.state-preference::before { background: var(--accent); }
.timeline-node.state-uncertain::before { background: var(--state-anticipation); }
.timeline-node.state-anticipating::before { background: var(--state-anticipation); }
.timeline-node.state-conflict::before { background: var(--state-conflict); }
.timeline-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.timeline-note {
  display: block;
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.85;
  word-break: break-word;
}

/* Intent block */
.intent {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
  background: rgba(212, 144, 80, 0.08);
  color: var(--muted);
  font-style: italic;
}

.intent-block {
  background: var(--surface-elevated);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.intent-block .intent {
  border-left: none;
  background: none;
  padding: 0;
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.7;
}

.rationale {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Callouts */
.callout {
  background: rgba(72, 160, 176, 0.1);
  border: 1px solid var(--cool-ambient);
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
}

.callout-warn {
  color: #FFC107;
}

.contradiction-list {
  list-style: none;
  padding: 0;
}

.contradiction-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.contradiction-list li::before {
  content: "\26A0";
  margin-right: 0.5rem;
}

/* Audio player */
.audio-player {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
}

.audio-title {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.audio-player audio {
  width: 100%;
  height: 36px;
}

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

/* Fingerprint chart */
.fingerprint-section, .audio-section {
  margin: 2rem 0;
}

.fingerprint-chart {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.fingerprint-section {
  background: radial-gradient(circle at center, rgba(212, 144, 80, 0.04) 0%, transparent 65%);
  padding: 1.5rem;
  border-radius: 8px;
  margin: 2rem 0;
}

.reflection-snapshot {
  margin: 1.5rem 0;
  text-align: center;
}

.reflection-snapshot img {
  max-width: 100%;
  border: 2px solid var(--border);
  border-radius: 6px;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  opacity: 0.8;
}

.empty-state img {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
}

.empty-state p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Swimlane */
.swimlane-container {
  margin: 1rem 0;
  overflow-x: auto;
}

#swimlane-chart {
  min-height: 200px;
}

/* Activity list */
.activity-list {
  list-style: none;
  padding: 0;
}

.activity-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-list a {
  color: var(--link);
  text-decoration: none;
  flex: 1;
}

.activity-list a:hover {
  color: var(--link-hover);
}

.activity-list time {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Links */
.link-map {
  margin-top: 2rem;
}

.link-map a {
  color: var(--link);
  text-decoration: none;
}

.link-map a:hover {
  color: var(--link-hover);
}

/* Muted */
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
  list-style: none;
}

.pagination li a,
.pagination li span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.pagination li.active span {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.pagination li a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-portrait {
  width: 48px;
  height: 48px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  flex-shrink: 0;
}

.footer-text { flex: 1; }

.footer-text .tagline {
  font-family: 'Courier New', Courier, monospace;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.footer-text .muted { margin-top: 0.25rem; }

.footer-links {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--link);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--link-hover);
}

/* Session meta */
.session-meta, .reflection-meta, .music-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Sketches grid */
.sketches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.sketch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.sketch-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 12px var(--glow-accent);
}

.sketch-card a {
  color: var(--text);
  text-decoration: none;
  display: block;
}

.sketch-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.sketch-thumb-placeholder {
  background: linear-gradient(135deg, var(--surface-elevated), var(--bg));
}

.sketch-card h3 {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 1rem;
  color: var(--text);
}

.sketch-card time {
  padding: 0 1rem 1rem;
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.sketch-image {
  margin: 1.5rem 0;
  text-align: center;
}

.sketch-image img {
  max-width: 100%;
  border: 2px solid var(--border);
  border-radius: 6px;
}

.sketch-intent {
  margin: 2rem 0;
}

.sketch-intent dl {
  background: var(--surface-elevated);
  padding: 1rem 1.5rem;
  border-radius: 6px;
  border-left: 3px solid var(--cool-ambient);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
}

.sketch-intent dt {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sketch-intent dd {
  color: var(--text);
}

.sketch-data ul {
  list-style: none;
  padding: 0;
}

.sketch-data li {
  padding: 0.35rem 0;
  color: var(--muted);
}

/* Practice journal section */
.journal-section {
  margin: 2rem 0;
}

.journal-section h2 {
  font-family: 'Courier New', Courier, monospace;
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

.journal-body {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1.25rem 1.5rem;
  white-space: pre-wrap;
}

/* Reflection class badges */
.badge-cross-reflection {
  background: var(--accent);
  color: var(--bg);
}

.badge-session-reflection {
  background: var(--cool-ambient);
  color: var(--bg);
}

.card.reflection-session {
  border-left-color: var(--cool-ambient);
}

.card.reflection-cross-session {
  border-left-color: var(--accent);
}

.score-explainer {
  background: var(--surface-elevated);
  border-left: 3px solid var(--muted);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  margin: 1rem 0 1.5rem;
}

/* Discovery cards */
.discovery-card .seed {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Creative session badge + card accent */
.badge-creative {
  background: var(--cool-ambient);
  color: var(--bg);
}

.card.session-creative {
  border-left-color: var(--cool-ambient);
}

/* MAP-State canon tag table (on list page) */
.map-tag-table {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0 2.5rem;
}

.map-tag-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: start;
}

.map-tag-row .map-tag {
  justify-self: start;
  align-self: start;
}

.map-tag-row p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .map-tag-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* MAP-State notes feed */
.mapstate-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mapstate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.mapstate-intro {
  margin: 1.5rem 0;
  font-style: italic;
}

.mapstate-notes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.map-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 4px;
  padding: 0.9rem 1.15rem;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.map-time {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin-right: 0.5rem;
}

.map-tag {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bg);
  margin-right: 0.3rem;
}

/* Per-state color cues (border + tag bg) */
.map-state-dwell { border-left-color: var(--state-dwell); }
.map-state-dwell .map-tag { background: var(--state-dwell); }

.map-state-shift { border-left-color: var(--state-shift); }
.map-state-shift .map-tag { background: var(--state-shift); color: #fff; }

.map-state-conflict { border-left-color: var(--state-conflict); }
.map-state-conflict .map-tag { background: var(--state-conflict); color: #fff; }

.map-state-anticipation { border-left-color: var(--state-anticipation); }
.map-state-anticipation .map-tag { background: var(--state-anticipation); }

.map-state-transition { border-left-color: var(--state-transition); }
.map-state-transition .map-tag { background: var(--state-transition); }

.map-state-frame { border-left-color: var(--accent); }
.map-state-frame .map-tag { background: var(--accent); }

.badge-state-dwell { background: var(--state-dwell); color: var(--bg); }
.badge-state-shift { background: var(--state-shift); color: #fff; }
.badge-state-conflict { background: var(--state-conflict); color: #fff; }
.badge-state-anticipation { background: var(--state-anticipation); color: var(--bg); }
.badge-state-transition { background: var(--state-transition); color: var(--bg); }
.badge-state-frame { background: var(--accent); color: var(--bg); }

/* Mobile responsive */
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0; right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
  }
  .nav-inner.open .nav-links { display: flex; }
  .hero { flex-direction: column-reverse; text-align: center; padding: 2rem 0; }
  .hero-character { width: 140px; }
  .hero-accent { margin: 0 auto 1rem; }
  .hero-desc { margin: 0 auto; }
  .hero h1 { font-size: 1.8rem; }
  .hero-sub { font-size: 1rem; }
  .single h1 { font-size: 1.5rem; }
  .music-grid { grid-template-columns: 1fr; }
  .container { padding: 0 1rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

/* --- Status Card (CAE live indicator) --- */
.status-card {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-left: 3px solid var(--accent);
}
.status-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.status-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.status-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  image-rendering: pixelated;
}
.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-elevated);
}
.status-dot.active { background: #4CAF50; }
.status-dot.resting { background: var(--muted); }
.status-identity {
  display: flex;
  flex-direction: column;
}
.status-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}
.status-time {
  font-size: 0.75rem;
  color: var(--muted);
}
.status-body { margin-top: 0.25rem; }
.status-text {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 0.75rem 0;
  line-height: 1.5;
}
.status-threads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.threads-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 0.25rem;
}
.thread-tag {
  background: var(--surface);
  color: var(--link);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}
.status-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.status-next {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: auto;
}
