/* Tessera High-Res Showcase Storefront Theme */
:root {
  --bg-deep: #0e1117;
  --bg-base: #12151c;
  --bg-card: #1c202a;
  --bg-elevated: #242a38;
  --border: #2e3648;
  --border-light: #3d475e;
  
  --text-main: #f0f4f8;
  --text-dim: #90a4ae;
  --text-muted: #607d8b;

  --cyan: #00e5ff;
  --cyan-glow: rgba(0, 229, 255, 0.25);
  --gold: #fbc02d;
  --gold-glow: rgba(251, 192, 45, 0.25);
  --green: #00c853;
  --magenta: #9c27b0;
  --red: #d8343c;
  --blue: #1976d2;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 0.15s ease;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  image-rendering: pixelated;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.4rem;
  background: rgba(0, 229, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: var(--radius-sm);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--cyan);
  color: #051017;
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}
.btn-primary:hover {
  background: #26ebff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: #2d3546;
  border-color: var(--cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--cyan);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-base) 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 1.5rem 2rem;
}

.hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.hero-content {
  flex: 1 1 0;
  min-width: 0;
}

.hero-figure {
  flex: 0 1 520px;
  margin: 0;
}

.hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border);
  image-rendering: pixelated;
}

.hero-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}

.hero-figure figcaption a {
  color: var(--cyan);
}

@media (max-width: 960px) {
  .hero-inner { flex-direction: column; align-items: stretch; }
  .hero-figure { flex-basis: auto; }
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 800px;
  margin-bottom: 1.25rem;
}

.hero-lead strong {
  color: var(--text-main);
}

.hero-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.meta-tag {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.825rem;
  color: var(--text-dim);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.cyan { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.dot.gold { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.magenta { background: var(--magenta); box-shadow: 0 0 6px var(--magenta); }

/* Main Store Container */
.store-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

/* Toolbar: Search & Sort */
.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 2.2rem 0.65rem 2.5rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}
.search-box input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-glow);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.sort-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.sort-box select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}
.sort-box select:focus {
  border-color: var(--cyan);
}

/* Category Pills */
.category-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.pill:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}
.pill.active {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border-color: var(--cyan);
  font-weight: 600;
}

/* Results summary bar */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(46, 54, 72, 0.4);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}

/* Single Cart Card */
.cart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.cart-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px var(--cyan-glow);
}

.card-label-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.card-label-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  transition: transform 0.2s ease;
}
.cart-card:hover .card-label-img {
  transform: scale(1.02);
}

.card-badge-row {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.badge-genre {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(18, 21, 28, 0.9);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
  backdrop-filter: blur(4px);
}

.badge-featured {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(251, 192, 45, 0.9);
  color: #1a1500;
}

.card-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(14, 17, 23, 0.6);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
  backdrop-filter: blur(2px);
}
.card-label-wrap:hover .card-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 60px;
  height: 60px;
  background: var(--cyan);
  color: #051017;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 20px var(--cyan);
  transform: scale(0.9);
  transition: transform var(--transition);
}
.card-label-wrap:hover .play-circle {
  transform: scale(1);
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-header-row {
  margin-bottom: 0.35rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

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

.card-stats-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin: 0.5rem 0;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.tag-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 18, 0.85);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.modal-header {
  padding: 0.85rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-group {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.modal-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
}
.modal-badge.gold {
  background: rgba(251, 192, 45, 0.15);
  color: var(--gold);
  border-color: rgba(251, 192, 45, 0.4);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-author {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Player Frame */
.player-dialog {
  max-width: 1040px;
  background: #000000;
}

.player-frame-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  position: relative;
}

.player-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.player-footer {
  background: var(--bg-card);
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.controls-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.775rem;
  color: var(--text-dim);
}

kbd {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.35rem;
  color: var(--text-main);
  font-size: 0.75rem;
}

.legend-item.highlight kbd {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--cyan);
  color: var(--cyan);
}

.footer-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Source Code Dialog */
.source-dialog {
  max-width: 880px;
}

.source-content-container {
  padding: 1rem;
  overflow-y: auto;
  max-height: 70vh;
  background: #0c0f14;
}

.source-code {
  font-family: var(--font-mono);
  font-size: 0.825rem;
  line-height: 1.5;
  color: #d1d5db;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Submit Modal Body */
.submit-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.submit-step {
  display: flex;
  gap: 1rem;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--gold);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}
.step-desc p {
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.submit-drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-base);
  cursor: pointer;
  transition: all var(--transition);
}
.submit-drop-zone:hover, .submit-drop-zone.dragover {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.05);
}

.submit-validation-result {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.submit-validation-result.success {
  background: rgba(0, 200, 83, 0.15);
  border: 1px solid var(--green);
  color: #a7f3d0;
}
.submit-validation-result.error {
  background: rgba(216, 52, 60, 0.15);
  border: 1px solid var(--red);
  color: #fca5a5;
}

.submit-action-btn {
  margin-top: 0.5rem;
}

/* Drag overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 23, 0.9);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-overlay.hidden { display: none; }

.drop-box {
  background: var(--bg-card);
  border: 3px dashed var(--cyan);
  border-radius: var(--radius-lg);
  padding: 3rem 4rem;
  text-align: center;
  box-shadow: 0 0 40px var(--cyan-glow);
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--cyan);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px var(--cyan-glow);
  font-size: 0.875rem;
  z-index: 300;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* Footer */
.site-footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: auto;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left p.dim {
  color: var(--text-muted);
  font-size: 0.775rem;
  margin-top: 0.2rem;
}

.footer-right {
  display: flex;
  gap: 1.25rem;
}
.footer-right a {
  color: var(--text-dim);
  text-decoration: none;
}
.footer-right a:hover {
  color: var(--cyan);
}

@media (max-width: 768px) {
  .hero-title { font-size: 1.75rem; }
  .header-inner { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .header-nav { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .modal { padding: 0.5rem; }
  .player-footer { flex-direction: column; align-items: flex-start; }
}

/* Built with MCP badge & quickstart modal */
.badge-mcp {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(156, 39, 176, 0.9);
  color: #f8e8ff;
  border: 1px solid rgba(213, 128, 255, 0.55);
  backdrop-filter: blur(4px);
}

.modal-badge.mcp {
  background: rgba(156, 39, 176, 0.25);
  color: #e2a8ff;
  border-color: rgba(213, 128, 255, 0.5);
}

.pill-mcp {
  border-color: rgba(213, 128, 255, 0.45);
  color: #e6b8ff;
}

.pill-mcp.active,
.pill-mcp:hover {
  background: rgba(156, 39, 176, 0.28);
  border-color: rgba(213, 128, 255, 0.85);
  color: #ffffff;
}

.mcp-code-wrap {
  position: relative;
  margin-top: 0.65rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

.mcp-code-wrap pre {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--cyan);
}

.mcp-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.mcp-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
