@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=M+PLUS+Rounded+1c:wght@400;700&display=swap');

:root {
  --bg:           #16031f;
  --surface:      #960016;
  --card:         #6e0010;
  --accent:       #E88A38;
  --highlight:    #BF00AC;
  --hot:          #ED2100;
  --text:         #ffe8e0;
  --text-muted:   #e8a89c;
  --border:       rgba(232, 138, 56, 0.25);
  --like:         #BF00AC;
  --nope:         #ED2100;
  --pixel:        2px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: row;   /* sidebar + main en fila */
  align-items: flex-start;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 138, 56, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 138, 56, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* ── header ── */
header {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  padding: 20px 20px 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--highlight);
  letter-spacing: 2px;
  text-shadow: 0 0 16px rgba(191, 0, 172, 0.5);
}

/* ── filter buttons ── */
.filter-row {
  display: flex;
  gap: 8px;
}

.filter-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 8px 14px;
  border: var(--pixel) solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  image-rendering: pixelated;
  position: relative;
}

.filter-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border: var(--pixel) solid transparent;
}

.filter-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(232, 138, 56, 0.1);
}

.filter-btn.active {
  color: #fff;
  background: var(--highlight);
  border-color: var(--highlight);
  text-shadow: none;
}

.filter-btn.active-miku {
  background: var(--highlight);
  border-color: var(--highlight);
  color: #fff;
}

.filter-btn.active-teto {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* ── main area ── */
main {
  position: relative;
  z-index: 5;
  flex: 1;                 /* ocupa el espacio que queda después del sidebar */
  min-width: 0;            /* evita overflow horizontal */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 3rem;
}

/* ── card stack ── */
#card-stack {
    position: relative;
  width: 50%;
  height: 70vh;        /* ocupa el 70% de la altura de la pantalla */
}

#search-input{
  width: 300px;
}

.art-card {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--card);
  border: var(--pixel) solid var(--border);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  transform-origin: bottom center;
  transition: box-shadow 0.2s;
}

.art-card:active { cursor: grabbing; }

.art-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.art-card .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(22, 0, 4, 0.92));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-artist {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--accent);
}

.card-tags {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

p {
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-size: 9px;
  color: var(--text);
  line-height: 1.2;
}

/* ── swipe stamps ── */
.stamp {
  position: absolute;
  top: 28px;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 8px 14px;
  border: 3px solid;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
  z-index: 20;
}

.stamp-like {
  left: 20px;
  color: var(--like);
  border-color: var(--like);
  transform: rotate(-12deg);
  text-shadow: 0 0 10px rgba(191, 0, 172, 0.6);
}

.stamp-nope {
  right: 20px;
  color: var(--nope);
  border-color: var(--nope);
  transform: rotate(12deg);
  text-shadow: 0 0 10px rgba(237, 33, 0, 0.6);
}

/* ── behind cards (stack preview) ── */
.behind-card {
  position: absolute;
  inset: 0;
  background: var(--card);
  border: var(--pixel) solid var(--border);
  transform: scale(0.95) translateY(8px);
  z-index: -1;
  opacity: 0.5;
}

.behind-card-2 {
  transform: scale(0.9) translateY(16px);
  z-index: -2;
  opacity: 0.3;
}

/* ── pixel scanline effect on card ── */
.art-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.04) 3px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* ── action buttons ── */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 12px 20px;
  border: var(--pixel) solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-nope {
  color: var(--nope);
  border-color: var(--nope);
}

.btn-nope:hover {
  background: rgba(237, 33, 0, 0.12);
  box-shadow: 0 0 16px rgba(237, 33, 0, 0.3);
}

.btn-like {
  color: var(--like);
  border-color: var(--like);
}

.btn-like:hover {
  background: rgba(191, 0, 172, 0.12);
  box-shadow: 0 0 16px rgba(191, 0, 172, 0.3);
}

.btn-icon { font-size: 16px; }

/* ── counter ── */
.counter {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--text-muted);
  text-align: center;
}

/* ── collection toggle ── */
.collection-toggle {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 8px 16px;
  border: var(--pixel) solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.collection-toggle:hover {
  color: var(--highlight);
  border-color: var(--highlight);
}

.collection-count {
  background: var(--highlight);
  color: #fff;
  padding: 2px 6px;
  font-size: 7px;
}

/* ── collection panel ── */
#collection-panel {
  width: 100%;
  max-width: 480px;
  padding: 0 20px 20px;
  position: relative;
  z-index: 5;
  display: none;
  margin: 0 auto;          /* centra dentro del main */
}

#collection-panel.open { display: block; }

.collection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 10px;
  border-bottom: var(--pixel) solid var(--border);
  margin-bottom: 12px;
}

.collection-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent);
}

.btn-clear {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: var(--nope);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
}

.btn-clear:hover { opacity: 1; }

#collection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.col-thumb {
  aspect-ratio: 1;
  background: var(--surface);
  border: var(--pixel) solid var(--border);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s;
}

.col-thumb:hover { border-color: var(--highlight); }

.col-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.col-thumb .remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(237, 33, 0, 0.9);
  color: #fff;
  border: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.col-thumb:hover .remove-btn { opacity: 1; }

/* ── loading / empty states ── */
.state-msg {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
  line-height: 2.2;
}

.empty-collection {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 0;
  line-height: 2;
}

/* ── preview button ── */
#previwebtn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 8px 16px;
  border: var(--pixel) solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

#previwebtn:hover {
  color: var(--highlight);
  border-color: var(--highlight);
}

/* ── preview modal ── */
#preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 0, 4, 0.93);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#preview-modal.open {
  display: flex;
}

.modal-inner {
  background: var(--card);
  border: var(--pixel) solid var(--border);
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  max-height: 90vh;
}

.modal-inner img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--bg);
}

.modal-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}

.modal-info span {
  color: var(--accent);
}

.modal-info a {
  color: var(--highlight);
  text-decoration: none;
}

.modal-info a:hover { text-decoration: underline; }

.modal-close {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 8px;
  border: var(--pixel) solid var(--nope);
  background: transparent;
  color: var(--nope);
  cursor: pointer;
  align-self: flex-end;
}

.modal-close:hover {
  background: rgba(237, 33, 0, 0.12);
}

#help-text {
    display: none; /* Inicia oculto */
    position: fixed;
    bottom: 120px; /* Ajusta según la altura de tu peluche */
    right: 20px;
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #ff77aa;
    color: #333;
    font-family: sans-serif;
    font-size: 14px;
    width: 200px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
}

/* El "triangulito" del globo */
#help-text::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #ff77aa transparent;
}


.sidebar {
    background-color:#960016;
    width: max-content;
    min-height: 100vh;      /* ocupa toda la altura */
    position: sticky;       /* se queda fijo al hacer scroll */
    top: 0;
    align-self: flex-start;
    border-radius: 0 16px 16px 0;
    padding: 1.5rem 1rem;
    z-index: 100;
}

.sidebar:hover .sidebar_element {
    grid-template-columns: 40px 1fr;
}

.sidebar_list {
    list-style: none;
    padding: 0;
    min-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.sidebar_element {
    padding: .8rem 1.3rem;
    border-radius: 10px;
    display: grid;
    align-items: center;
    grid-template-columns: 40px 0fr;
    transition: .3s ease-in-out;
    color: black;
    fill: black;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar_element:not(.sidebar_element--logo):hover {
    background-color: #E88A38;
    color: white;
    fill: white;
    cursor: pointer;
}

.sidebar_element--logo {
    margin-bottom: 1.5rem;
}

.sidebar_icon {
    width: 28px;
    height: 28px;
    overflow: hidden;
    justify-self: center;
    flex-shrink: 0;
}

.sidebar_icon--logo {
    width: 36px;
    height: 36px;
}

.sidebar_hide {
    overflow: hidden;
    padding-left: .8rem;
}

.sidebar_text {
    font-size: .95rem;
    font-weight: 600;
}

.sidebar_text--logo {
    font-size: 1.2rem;
    font-weight: 800;
}

.filter-row {
  position: relative; /* necesario para el dropdown absoluto */
}

#tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: var(--pixel) solid var(--border);
  z-index: 50;
  display: none;
  max-height: 260px;
  overflow-y: auto;
}

#tag-dropdown.open {
  display: block;
}

.tag-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  transition: background 0.1s;
}

.tag-option:hover {
  background: rgba(232, 138, 56, 0.12);
}

.tag-option:last-child {
  border-bottom: none;
}

.tag-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: var(--text);
}

.tag-count {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: var(--text-muted);
  white-space: nowrap;
}

.tag-category {
  font-size: 6px;
  font-family: 'Press Start 2P', monospace;
  padding: 2px 6px;
  border-radius: 2px;
}

.tag-category.character {
  background: rgba(191, 0, 172, 0.2);
  color: var(--highlight);
}

.tag-category.series {
  background: rgba(232, 138, 56, 0.2);
  color: var(--accent);
}

/* ═══════════════════════════════════════
   RESPONSIVE — móvil (max 768px)
   Sidebar lateral → barra inferior fija
   ═══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Body vuelve a columna, deja espacio abajo para la navbar */
  body {
    flex-direction: column;
    align-items: center;
    padding-bottom: 70px; /* espacio para la barra inferior */
  }

  /* ── Sidebar se convierte en barra inferior ── */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;             /* cancela el sticky vertical */
    min-height: unset;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 0.2px;
    z-index: 100;
  }

  .sidebar_list {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    min-height: unset;
    gap: 0;
  }

  /* Oculta el logo en móvil (no cabe en barra horizontal) */
  .sidebar_element--logo {
    display: none;
  }

  /* Elementos en columna: icono arriba, texto abajo */
  .sidebar_element {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.3rem;
    gap: 2px;
    grid-template-columns: unset;
    white-space: nowrap;
  }

  /* Fuerza que el texto sea siempre visible en móvil */
  .sidebar:hover .sidebar_element {
    grid-template-columns: unset;
  }

  .sidebar_hide {
    overflow: visible;
    padding-left: 0;
  }

  .sidebar_text {
    font-size: 0.55rem;
    font-weight: 600;
  }

  .sidebar_icon {
    width: 22px;
    height: 22px;
  }

  /* ── Main ocupa todo el ancho ── */
  main {
    width: 100%;
    padding: 0.5rem;
    gap: 1.2rem;
  }

  /* ── Header apilado en columna ── */
  header {
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    padding: 16px 16px 0;
    gap: 10px;
  }

  /* Input de búsqueda más ancho */
  .filter-btn {
    width: 100%;
    max-width: 200px;
    font-size: 8px;
  }

  /* ── Card stack más compacto ── */
  #card-stack {
    height: 400px;
  }

  /* ── Botones de acción más grandes (táctil) ── */
  .action-btn {
    padding: 14px 24px;
    font-size: 9px;
  }

  .btn-icon { font-size: 18px; }

  /* ── Colección panel full width ── */
  #collection-panel {
    max-width: 100%;
    padding: 0 12px 12px;
  }

  #collection-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  /* ── Modal más cómodo en pantalla chica ── */
  .modal-inner {
    max-width: 100%;
    padding: 10px;
  }

  .modal-inner img {
    max-height: 55vh;
  }


  #help-text {
    bottom: 145px;
    right: 10px;
    width: 180px;
    font-size: 12px;
  }
}

/* Pantallas muy pequeñas (menos de 380px) */
@media (max-width: 380px) {
  #card-stack {
    height: 300px;
    width: 100%;
  }

  .action-btn {
    padding: 10px 16px;
    font-size: 7px;
  }

  .sidebar_text {
    font-size: 0.45rem;
  }

  #search-input{
  width: 150px;
}
}