/* ==========================================================================
   ESTUDIO DE DISEÑO — ARMARIO INFINITO DE CAJONES Y CURIOSIDADES
   Inspirado en estante.jpg y maderas decapadas de botica/imprenta antigua
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800&family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Caveat:wght@600&family=Playfair+Display:wght@700;900&display=swap');

:root {
  --marco-exterior: #3d2312;
  --marco-borde: #6e4121;
  --madera-divisoria: #784722;
  --madera-divisoria-luz: #a86836;
  --madera-divisoria-sombra: #241308;
  --hueco-fondo: #120b07;
  --laton-claro: #d6b265;
  --laton-medio: #9c7a38;
  --laton-oscuro: #4a3714;
  --hierro-oscuro: #252321;
  --hierro-brillo: #5c5752;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: #0d0704;
  color: #e8dcc8;
  font-family: 'Courier Prime', monospace;
  overflow-x: hidden;
  user-select: none;
}

/* Filtros SVG ocultos para texturas de veta de madera y decapado */
.svg-filtros-ocultos {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ==========================================================================
   ESTRUCTURA DEL ARMARIO (SIN TÍTULO NI MENÚ - SOLO CAJONES Y ESTANTES)
   ========================================================================== */

.armario-contenedor {
  position: relative;
  width: 100%;
  min-height: 100vh;
  /* Montantes laterales de madera maciza envejecida como en estante.jpg */
  padding: 10px 12px;
  background:
    linear-gradient(90deg,
      #2b170a 0px,
      #6b3e1d 4px,
      #8b5228 8px,
      #3b200e 12px,
      #1a0e06 14px,
      #1a0e06 calc(100% - 14px),
      #3b200e calc(100% - 12px),
      #8b5228 calc(100% - 8px),
      #6b3e1d calc(100% - 4px),
      #2b170a 100%
    );
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
}

/* Herrajes laterales de hierro forjado (como los cierres laterales de estante.jpg) */
.armario-contenedor::before,
.armario-contenedor::after {
  content: '';
  position: fixed;
  top: 48%;
  width: 11px;
  height: 96px;
  background: linear-gradient(180deg, #1f1d1b, #4a4642 30%, #1c1a18 50%, #524d48 70%, #171514);
  border: 1px solid #0e0d0c;
  box-shadow: 0 6px 14px rgba(0,0,0,0.85), inset 0 1px 1px rgba(255,255,255,0.2);
  z-index: 40;
  pointer-events: none;
  border-radius: 2px;
}

.armario-contenedor::before {
  left: 1px;
}

.armario-contenedor::after {
  right: 1px;
}

/* Retícula adaptable en función del espacio de la pantalla (Móvil primero -> Escritorio) */
.reticula-cajones {
  display: grid;
  /* En móvil: 2 columnas amplias y táctiles; en pantallas más grandes: 3, 4, 5, 6 columnas */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 158px;
  grid-auto-flow: dense;
  gap: 10px;
  background-color: var(--madera-divisoria);
  /* Textura de los listones divisores de madera tipo estante.jpg */
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 195, 130, 0.06) 0px,
      rgba(0, 0, 0, 0.14) 2px,
      transparent 4px,
      transparent 9px
    ),
    linear-gradient(180deg, #6e401e 0%, #4f2c13 50%, #633819 100%);
  padding: 8px;
  border: 3px solid #231207;
  box-shadow:
    inset 0 0 25px rgba(0,0,0,0.85),
    0 0 0 2px #8c5429;
  perspective: 1200px;
}

@media (min-width: 520px) {
  .reticula-cajones {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 170px;
    gap: 11px;
  }
}

@media (min-width: 820px) {
  .armario-contenedor {
    padding: 14px 18px;
  }
  .reticula-cajones {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 185px;
    gap: 12px;
    padding: 10px;
  }
}

@media (min-width: 1140px) {
  .reticula-cajones {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: 195px;
    gap: 13px;
  }
}

@media (min-width: 1480px) {
  .reticula-cajones {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: 205px;
  }
}

/* Tamaños de compartimento */
.celda-armario {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--hueco-fondo);
  /* Sombra profunda del hueco de madera donde encaja el cajón o estante */
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.95),
    inset 0 0 0 2px #1c0f07,
    0 -3px 0 #995d30,
    0 3px 0 #381e0b,
    -3px 0 0 #4d2b12,
    3px 0 0 #4d2b12;
  transform-style: preserve-3d;
  transition: z-index 0.2s;
}

.celda-armario.tamano-2x1 {
  grid-column: span 2;
}

.celda-armario.tamano-1x2 {
  grid-row: span 2;
}

/* En móviles muy estrechos evitamos que un 2x1 rompa si solo hay 2 columnas, o permitimos que ocupe el ancho */
@media (max-width: 360px) {
  .celda-armario.tamano-2x1 {
    grid-column: span 1;
  }
}

/* Pequeña placa metálica oxidada en el listón inferior del hueco (detalle icónico de estante.jpg) */
.celda-armario::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 6px;
  background: linear-gradient(90deg, #2b2927, #59554f 50%, #242220);
  border: 1px solid #141312;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.8);
  z-index: 5;
  pointer-events: none;
}

/* ==========================================================================
   CAJONES DE MADERA (NATURALES Y PINTADOS DECAPADOS)
   ========================================================================== */

.cajon-frente {
  position: relative;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  margin: 3px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  transform-origin: center bottom;
  transform: translateZ(0);
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.25s ease;
  /* Bisel 3D realista de frente de cajón macizo */
  box-shadow:
    inset 0 2px 2px rgba(255, 235, 200, 0.28),
    inset 0 -3px 4px rgba(0, 0, 0, 0.65),
    inset 2px 0 3px rgba(255, 220, 180, 0.16),
    inset -2px 0 3px rgba(0, 0, 0, 0.55),
    0 3px 7px rgba(0, 0, 0, 0.85);
  overflow: visible;
}

/* Borde superior del cajón que se ve cuando el cajón sobresale hacia afuera */
.cajon-frente::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 2px;
  right: 2px;
  height: 12px;
  background: linear-gradient(180deg, #4a2c14 0%, #6e4423 40%, #241409 100%);
  border-top: 1px solid #966138;
  transform-origin: bottom;
  transform: rotateX(-75deg);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.7);
}

/* Algunos cajones están ligeramente salidos como el cajón central de estante.jpg */
.celda-armario.cajon-saliente {
  z-index: 12;
}
.celda-armario.cajon-saliente .cajon-frente {
  transform: translateY(5px) scale(1.035);
  box-shadow:
    inset 0 2px 2px rgba(255, 235, 200, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.7),
    0 16px 26px rgba(0, 0, 0, 0.92),
    0 6px 10px rgba(0, 0, 0, 0.75);
}
.celda-armario.cajon-saliente .cajon-frente::before {
  opacity: 1;
  transform: rotateX(-35deg);
}

/* Hover / Interacción en cajones que se abren */
.cajon-frente.abrible:hover {
  filter: brightness(1.06);
}

/* Estado cuando se hace clic y el cajón se abre hacia el usuario */
.celda-armario.abriendo {
  z-index: 30;
}
.celda-armario.abriendo .cajon-frente {
  transform: translateY(16px) scale(1.08);
  box-shadow:
    inset 0 2px 3px rgba(255, 240, 210, 0.4),
    inset 0 -4px 6px rgba(0, 0, 0, 0.75),
    0 28px 38px rgba(0, 0, 0, 0.96),
    0 10px 16px rgba(0, 0, 0, 0.85);
}
.celda-armario.abriendo .cajon-frente::before {
  opacity: 1;
  transform: rotateX(-15deg);
}

/* Animación de cajón cerrado con llave / atascado (no se abre) */
@keyframes cajonAtascado {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  15% { transform: translate(-3px, 1px) rotate(-0.8deg); }
  30% { transform: translate(3px, -1px) rotate(0.9deg); }
  45% { transform: translate(-3px, 0px) rotate(-0.6deg); }
  60% { transform: translate(2px, 1px) rotate(0.5deg); }
  75% { transform: translate(-1px, 0px) rotate(-0.3deg); }
}

.cajon-frente.atascado-anim {
  animation: cajonAtascado 0.42s ease-in-out;
}

/* Textura de veta de madera superpuesta a todos los cajones */
.veta-madera {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 2px;
  opacity: 0.42;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(
      2deg,
      rgba(0,0,0,0.18) 0px,
      rgba(0,0,0,0.03) 2px,
      transparent 4px,
      rgba(35,15,5,0.12) 7px,
      transparent 11px
    ),
    radial-gradient(ellipse at 25% 40%, rgba(0,0,0,0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 75%, rgba(0,0,0,0.25) 0%, transparent 50%);
}

/* Desgaste y decapado en los bordes para maderas pintadas (estilo 226109...jpg y a8264a...jpg) */
.desgaste-bordes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 2px;
  box-shadow:
    inset 0 0 12px rgba(28, 15, 6, 0.72),
    inset 0 0 3px rgba(20, 10, 3, 0.9);
}

/* ==========================================================================
   PALETA DE MADERAS NATURALES Y PINTADAS
   ========================================================================== */

/* 1. Roble miel envejecido (como el cajón central de estante.jpg) */
.madera-roble {
  background:
    radial-gradient(circle at 50% 45%, #c87832 0%, #9e561b 68%, #6e380e 100%);
}

/* 2. Nogal oscuro de botica (como ac253389...jpg) */
.madera-nogal {
  background:
    radial-gradient(circle at 45% 40%, #694127 0%, #4a2c18 65%, #2e190c 100%);
}

/* 3. Cerezo cálido */
.madera-cerezo {
  background:
    radial-gradient(circle at 50% 40%, #a84c24 0%, #7d3213 70%, #521d08 100%);
}

/* 4. Pino rústico claro (como 76187c8b...jpg) */
.madera-pino {
  background:
    radial-gradient(circle at 50% 50%, #cfa063 0%, #ad7d42 70%, #7d5526 100%);
}

/* 5. Caoba rojiza profunda */
.madera-caoba {
  background:
    radial-gradient(circle at 50% 45%, #782c1a 0%, #541b0e 70%, #360f06 100%);
}

/* 6. Ébano / Madera carbonizada (como el cajón inferior de estante.jpg) */
.madera-ebano {
  background:
    radial-gradient(circle at 50% 45%, #4f463f 0%, #332c27 65%, #1c1815 100%);
}

/* 7. Verde boticario craquelado (como a8264a61...jpg) */
.madera-verde {
  background:
    radial-gradient(circle at 15% 15%, #593a1e 0%, transparent 18%),
    radial-gradient(circle at 88% 85%, #4d3118 0%, transparent 22%),
    linear-gradient(135deg, #2d6340 0%, #3b7850 45%, #234f33 85%, #47321d 100%);
}

/* 8. Azul turquesa decapado (como 22610913...jpg) */
.madera-turquesa {
  background:
    radial-gradient(circle at 12% 85%, #664222 0%, transparent 22%),
    radial-gradient(circle at 90% 15%, #5c3b1e 0%, transparent 20%),
    linear-gradient(140deg, #2c7d8b 0%, #3b95a3 48%, #22626e 85%, #593a1e 100%);
}

/* 9. Ocre mostaza antiguo (como 22610913...jpg) */
.madera-ocre {
  background:
    radial-gradient(circle at 85% 12%, #633e1d 0%, transparent 22%),
    radial-gradient(circle at 10% 88%, #573518 0%, transparent 20%),
    linear-gradient(135deg, #d1972c 0%, #dead3e 50%, #a67218 88%, #5e3c1b 100%);
}

/* 10. Terracota / Rojo óxido decapado (como 22610913...jpg) */
.madera-terracota {
  background:
    radial-gradient(circle at 15% 82%, #5e3b1c 0%, transparent 20%),
    radial-gradient(circle at 88% 18%, #543418 0%, transparent 20%),
    linear-gradient(135deg, #b54128 0%, #c95136 48%, #8c2d19 88%, #523318 100%);
}

/* 11. Blanco tiza muy decapado con madera vista (como 22610913...jpg y 76187c8b...jpg) */
.madera-blanco {
  background:
    radial-gradient(ellipse at 12% 18%, #734b26 0%, #734b26 8%, transparent 24%),
    radial-gradient(ellipse at 88% 82%, #694320 0%, #694320 10%, transparent 28%),
    radial-gradient(ellipse at 85% 12%, #754c27 0%, transparent 18%),
    linear-gradient(135deg, #d9cfc1 0%, #e6dfd3 50%, #bfb29f 86%, #704824 100%);
}

/* 12. Naranja quemado rústico (como 22610913...jpg) */
.madera-naranja {
  background:
    radial-gradient(circle at 86% 84%, #5c391a 0%, transparent 22%),
    linear-gradient(135deg, #cc6525 0%, #db7535 50%, #9e4813 88%, #593719 100%);
}

/* 13. Gris zinc desgastado (como 22610913...jpg) */
.madera-gris {
  background:
    radial-gradient(circle at 16% 16%, #5e3d1f 0%, transparent 20%),
    linear-gradient(135deg, #6e7d75 0%, #809188 48%, #536159 88%, #57381b 100%);
}

/* ==========================================================================
   ETIQUETAS DE TEMA (TRES ESTILOS FIELES A LAS FOTOS DE REFERENCIA)
   ========================================================================== */

/* Estilo 1: Marco de latón/hierro envejecido con papel escrito (a8264a61...jpg / 44885f3c...jpg) */
.etiqueta-laton {
  position: relative;
  z-index: 3;
  background: linear-gradient(180deg, #b89348 0%, #806227 50%, #9e7c38 100%);
  padding: 3px 6px;
  border-radius: 2px;
  border: 1px solid #38280b;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,240,190,0.45);
  max-width: 92%;
  margin-bottom: 6px;
}

/* Tornillos del portacarátulas de latón */
.etiqueta-laton::before,
.etiqueta-laton::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #2b1e08;
  box-shadow: 0 0 0 1px #cfb06b;
}
.etiqueta-laton::before { left: 2px; }
.etiqueta-laton::after { right: 2px; }

.etiqueta-laton .etiqueta-papel {
  display: block;
  background:
    radial-gradient(circle at 80% 30%, #dfd1b4 0%, #efe5cf 60%, #cbb894 100%);
  color: #211811;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border: 1px solid #594626;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

/* Estilo 2: Placa tipográfica negra y dorada embutida (335109e4...jpg Chadwick's) */
.etiqueta-placa {
  position: relative;
  z-index: 3;
  background: linear-gradient(180deg, #171513 0%, #292521 50%, #12100e 100%);
  color: #dec078;
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 3px 12px;
  border-radius: 12px;
  border: 1.5px solid #8a6c32;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.9),
    0 1px 1px rgba(255,215,140,0.35),
    0 2px 4px rgba(0,0,0,0.6);
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

/* Estilo 3: Pequeña chapa de porcelana/esmalte clavada (22610913...jpg) */
.etiqueta-porcelana {
  position: relative;
  z-index: 3;
  background: linear-gradient(180deg, #f2eadc 0%, #dfd3be 80%, #b8a88f 100%);
  color: #292018;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1;
  padding: 2px 9px;
  border-radius: 2px;
  border: 1px solid #4a3f33;
  box-shadow:
    0 2px 3px rgba(0,0,0,0.65),
    inset 0 0 3px rgba(90,65,35,0.4);
  margin-top: 4px;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: rotate(-1.2deg);
}

/* ==========================================================================
   TIRADORES Y CERRADURAS (HERRAJES TRIDIMENSIONALES)
   ========================================================================== */

.herrajes-fila {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px 0;
}

/* 1. Tirador Roseta ornamentada (como el cajón central de estante.jpg) */
.tirador-roseta {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 35%, #78726a 0%, #3d3934 45%, #1c1a17 72%, #4a443d 85%, #171513 100%);
  border: 2px dotted #6e675f;
  box-shadow:
    0 5px 9px rgba(0,0,0,0.85),
    inset 0 1px 2px rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tirador-roseta::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b5ada2 0%, #45403b 55%, #141210 100%);
  box-shadow:
    0 3px 5px rgba(0,0,0,0.9),
    0 0 0 2px #292522;
}

/* 2. Tirador de Concha / Media luna (como 76187c8b...jpg y 16fcdaac...jpg) */
.tirador-concha {
  position: relative;
  width: 48px;
  height: 22px;
  border-radius: 24px 24px 5px 5px;
  background:
    radial-gradient(ellipse at 50% 25%, #b89858 0%, #6e5628 55%, #2e230e 95%);
  border: 1px solid #241b0a;
  box-shadow:
    0 5px 8px rgba(0,0,0,0.85),
    inset 0 2px 3px rgba(255, 235, 185, 0.45),
    inset 0 -4px 5px rgba(0,0,0,0.9);
}

/* 3. Tirador de Anilla / Péndulo colgante de hierro (como 22610913...jpg) */
.tirador-anilla {
  position: relative;
  width: 44px;
  height: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tirador-anilla::before {
  content: '';
  width: 38px;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, #2b1d12, #6e4e32 50%, #2b1d12);
  box-shadow: 0 2px 4px rgba(0,0,0,0.8);
}
.tirador-anilla::after {
  content: '';
  width: 12px;
  height: 18px;
  margin-top: -2px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 35% 35%, #8c6543 0%, #47301c 65%, #1f140b 100%);
  box-shadow: 0 4px 6px rgba(0,0,0,0.85);
}

/* 4. Pomo redondo negro/bronce (como a8264a61...jpg y ac253389...jpg) */
.tirador-pomo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #6e6a66 0%, #292624 48%, #0f0e0d 85%, #38332e 100%);
  box-shadow:
    0 5px 8px rgba(0,0,0,0.88),
    0 0 0 2px #42392c,
    inset 0 2px 3px rgba(255,255,255,0.25);
}

/* 5. Tirador de Barra industrial rústica (como 76187c8b...jpg) */
.tirador-barra {
  width: 58px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, #9fa6a8 0%, #575d5e 55%, #2b2e2e 100%);
  border: 1px solid #1f2121;
  box-shadow:
    0 4px 7px rgba(0,0,0,0.85),
    inset 0 1px 1px rgba(255,255,255,0.4);
}

/* 6. Doble pomo lateral (para cajones anchos como 335109e4...jpg y 16fcdaac...jpg) */
.tirador-doble {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
}
.tirador-doble span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #756b5e 0%, #24201c 55%, #0d0b09 100%);
  box-shadow:
    0 4px 7px rgba(0,0,0,0.85),
    0 0 0 2px #ab8b48;
}

/* Bocallave / Cerradura antigua (algunos cajones tienen cerradura) */
.cerradura-bocallave {
  position: relative;
  width: 16px;
  height: 22px;
  border-radius: 8px 8px 6px 6px;
  background: linear-gradient(135deg, #c29d52 0%, #6e5422 60%, #3b2b0e 100%);
  border: 1px solid #241906;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.75),
    inset 0 1px 1px rgba(255,235,180,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Hueco de la llave */
.cerradura-bocallave::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0d0905;
  margin-top: -2px;
}
.cerradura-bocallave::after {
  content: '';
  width: 3px;
  height: 6px;
  background: #0d0905;
  margin-top: -1px;
  clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

/* Indicador sutil en cerradura cuando el cajón está bloqueado y se intenta abrir */
.cajon-frente.atascado-anim .cerradura-bocallave {
  box-shadow: 0 0 10px rgba(225, 130, 55, 0.85);
}

/* ==========================================================================
   ESTANTES CON ESCULTURAS Y OBJETOS (ESTILO ESTANTE.JPG)
   ========================================================================== */

.estante-nicho {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 10px 14px;
  overflow: hidden;
  /* Fondo profundo de madera oscura envejecida como los casilleros de estante.jpg */
  background:
    radial-gradient(circle at 50% 60%, rgba(75, 45, 22, 0.38) 0%, rgba(12, 7, 4, 0.94) 85%),
    repeating-linear-gradient(
      90deg,
      #1a1009 0px,
      #24160c 14px,
      #140c06 15px,
      #1f120a 32px
    );
  box-shadow:
    inset 0 16px 28px rgba(0, 0, 0, 0.95),
    inset 0 -10px 16px rgba(0, 0, 0, 0.85),
    inset 10px 0 18px rgba(0, 0, 0, 0.8),
    inset -10px 0 18px rgba(0, 0, 0, 0.8);
  transition: filter 0.3s ease;
}

/* Repisa interior de madera donde apoya la escultura */
.estante-nicho::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(180deg, #593519 0%, #361e0c 45%, #1c0f06 100%);
  border-top: 1px solid #82512b;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.8);
  z-index: 1;
}

.estante-nicho:hover {
  filter: brightness(1.14);
}

.estante-nicho:hover .escultura-svg-wrap,
.estante-nicho:hover .escultura-png-wrap {
  transform: scale(1.05) translateY(-2px);
}

.escultura-svg-wrap,
.escultura-png-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.92)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8));
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.escultura-svg-wrap svg {
  width: 88%;
  height: 88%;
  max-height: 128px;
  overflow: visible;
}

.escultura-png-wrap {
  padding: 8px;
}

.escultura-png-img {
  max-width: 82%;
  max-height: 115px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.85));
  pointer-events: none;
  transition: filter 0.3s ease;
}

/* Pequeña etiqueta grabada en el estante si tiene tema */
.estante-etiqueta {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(24, 18, 13, 0.88);
  color: #b89c6f;
  font-family: 'Courier Prime', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border: 1px solid #544127;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

/* ==========================================================================
   BOTÓN EN ESQUINA INFERIOR DERECHA PARA VER EL NÚMERO (1 AL 100)
   ========================================================================== */

.btn-numero-esquina {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  outline: none;
}

/* El pequeño botón/remache metálico en la esquina inferior derecha */
.remache-boton {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d4b26a 0%, #7d5f26 55%, #33240a 100%);
  border: 1px solid #1c1305;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.85),
    inset 0 1px 1px rgba(255,240,190,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Pequeña ranura de tornillo/marca en el botón */
.remache-boton::after {
  content: '№';
  font-family: 'Courier Prime', monospace;
  font-size: 7px;
  font-weight: 700;
  color: #1f1404;
  line-height: 1;
}

.btn-numero-esquina:hover .remache-boton {
  transform: scale(1.18);
  box-shadow: 0 0 6px rgba(214, 178, 101, 0.75);
}

/* Chapa con el número del 1 al 100 que se despliega al hacer clic en el botón */
.chapa-numero {
  pointer-events: none;
  background: linear-gradient(180deg, #1f1b16 0%, #0f0d0a 100%);
  color: #e6c67c;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  margin-right: 4px;
  border-radius: 2px;
  border: 1px solid #a3803e;
  box-shadow: 0 3px 7px rgba(0,0,0,0.9);
  opacity: 0;
  transform: translateX(6px) scale(0.85);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-numero-esquina.visible .chapa-numero {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.btn-numero-esquina.visible .remache-boton {
  background: radial-gradient(circle at 35% 35%, #f0d28c 0%, #a88238 60%, #4a3510 100%);
}

/* ==========================================================================
   CAJÓN MAESTRO DE CONTROL (CELIMA.NET)
   ========================================================================== */

.cajon-frente.cajon-maestro-control {
  border: 1.5px solid #d4af37;
  box-shadow:
    inset 0 2px 2px rgba(255, 235, 200, 0.4),
    inset 0 -3px 4px rgba(0, 0, 0, 0.8),
    0 4px 10px rgba(0, 0, 0, 0.9),
    0 0 12px rgba(212, 175, 55, 0.35);
  animation: pulsoMaestro 4.5s ease-in-out infinite;
}

@keyframes pulsoMaestro {
  0%, 100% {
    box-shadow:
      inset 0 2px 2px rgba(255, 235, 200, 0.4),
      inset 0 -3px 4px rgba(0, 0, 0, 0.8),
      0 4px 10px rgba(0, 0, 0, 0.9),
      0 0 10px rgba(212, 175, 55, 0.25);
  }
  50% {
    box-shadow:
      inset 0 2px 3px rgba(255, 245, 215, 0.5),
      inset 0 -3px 4px rgba(0, 0, 0, 0.8),
      0 6px 14px rgba(0, 0, 0, 0.95),
      0 0 20px rgba(212, 175, 55, 0.65);
  }
}

.cajon-frente.cajon-maestro-control .etiqueta-placa {
  border-color: #d4af37;
  color: #ffea9f;
  background: linear-gradient(180deg, #1c1914 0%, #3a3227 50%, #15130f 100%);
  text-shadow: 0 0 6px rgba(255, 234, 159, 0.7);
  letter-spacing: 0.16em;
}

.badge-maestro {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  color: #d6b265;
  background: rgba(15, 12, 8, 0.85);
  padding: 1px 7px;
  border-radius: 2px;
  border: 1px solid #785a21;
  text-transform: uppercase;
}

/* ==========================================================================
   MODO TEXTO EN EL ARMARIO (RESALTA ETIQUETAS Y TIPOGRAFÍA)
   ========================================================================== */

.reticula-cajones.modo-vista-texto .cajon-frente {
  filter: brightness(0.92);
}

.reticula-cajones.modo-vista-texto .etiqueta-laton,
.reticula-cajones.modo-vista-texto .etiqueta-placa,
.reticula-cajones.modo-vista-texto .etiqueta-porcelana {
  transform: scale(1.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.95), 0 0 8px rgba(214, 178, 101, 0.5);
  z-index: 20;
}

.reticula-cajones.modo-vista-texto .etiqueta-laton .etiqueta-papel {
  font-size: 0.78rem;
  color: #100b06;
  font-weight: 800;
}

.reticula-cajones.modo-vista-texto .estante-etiqueta {
  font-size: 0.72rem;
  background: rgba(15, 10, 6, 0.95);
  color: #ffd88a;
  border-color: #d4af37;
  box-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

/* ==========================================================================
   MODAL / VENTANA DE CONTROL CELIMA.NET
   ========================================================================== */

.modal-control-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(7, 4, 2, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal-control-backdrop.activo {
  opacity: 1;
  pointer-events: auto;
}

.panel-control {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 20%, #4a2d16 0%, #2b180a 65%, #150a04 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.15) 0px, transparent 2px, transparent 4px);
  border: 4px solid #6e4121;
  border-radius: 4px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.95),
    0 0 0 1px #1a0d05,
    inset 0 0 35px rgba(0, 0, 0, 0.85),
    inset 0 2px 2px rgba(255, 230, 180, 0.25);
  transform: scale(0.92) translateY(14px);
  transition: transform 0.35s cubic-bezier(0.18, 1, 0.32, 1);
  overflow: hidden;
}

.modal-control-backdrop.activo .panel-control {
  transform: scale(1) translateY(0);
}

/* Encabezado de placa metálica remachada */
.panel-control-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, #1d1914 0%, #2e2820 48%, #14120e 100%);
  border-bottom: 2px solid #5a4225;
  box-shadow: 0 4px 12px rgba(0,0,0,0.85);
}

.placa-titulo-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.remache-cabecera {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d4b26a 0%, #694e1e 65%, #291c07 100%);
  border: 1px solid #140d04;
  box-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.panel-control-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #f5d78a;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(245, 215, 138, 0.4);
  line-height: 1.1;
}

.subtitulo-control {
  font-family: 'Courier Prime', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #ad9472;
  margin-top: 2px;
}

.btn-cerrar-control {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #59351e 0%, #2b1509 70%, #170a04 100%);
  border: 1px solid #8f5a2e;
  color: #dec078;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.25);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-cerrar-control:hover {
  filter: brightness(1.25);
  transform: scale(1.08);
}

/* Cuerpo con scroll interior */
.panel-control-body {
  padding: 16px;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-control-body::-webkit-scrollbar {
  width: 7px;
}
.panel-control-body::-webkit-scrollbar-track {
  background: #190e06;
}
.panel-control-body::-webkit-scrollbar-thumb {
  background: #5c371a;
  border-radius: 3px;
  border: 1px solid #291507;
}

.seccion-control {
  background: rgba(22, 13, 7, 0.75);
  border: 1px solid #4a2f18;
  border-radius: 3px;
  padding: 12px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
}

.seccion-control-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px dashed #4f331b;
  padding-bottom: 6px;
}

.seccion-control-titulo .icono-seccion {
  font-size: 1rem;
}

.seccion-control-titulo h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: #dfbe7b;
  flex: 1;
}

.contador-directorio {
  font-family: 'Courier Prime', monospace;
  font-size: 0.65rem;
  color: #9c805a;
  background: #170d06;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid #3d2310;
}

/* Botones de Modos de Visualización */
.grid-modos-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 440px) {
  .grid-modos-control {
    grid-template-columns: 1fr;
  }
}

.btn-modo-control {
  background:
    radial-gradient(circle at 40% 30%, #3d2514 0%, #241409 75%, #170a04 100%);
  border: 1px solid #573519;
  border-radius: 3px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.7), inset 0 1px 1px rgba(255,230,180,0.15);
  transition: all 0.22s ease;
}

.btn-modo-control:hover {
  border-color: #8f5a2e;
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-modo-control.activo {
  border-color: #d4af37;
  background:
    radial-gradient(circle at 40% 30%, #543318 0%, #361c0a 75%, #210e05 100%);
  box-shadow:
    0 3px 8px rgba(0,0,0,0.85),
    0 0 10px rgba(212, 175, 55, 0.4),
    inset 0 1px 1px rgba(255,240,190,0.4);
}

.btn-modo-control .modo-icono {
  font-size: 1.1rem;
  line-height: 1;
  margin-bottom: 2px;
}

.btn-modo-control .modo-nombre {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffebaa;
}

.btn-modo-control.activo .modo-nombre {
  color: #ffd86b;
}

.btn-modo-control .modo-desc {
  font-family: 'Courier Prime', monospace;
  font-size: 0.6rem;
  color: #a89173;
}

/* Buscador del Directorio */
.filtro-directorio-wrap {
  margin-bottom: 10px;
}

.input-buscador-directorio {
  width: 100%;
  background: #110904;
  border: 1px solid #4a2e16;
  border-radius: 2px;
  padding: 8px 10px;
  font-family: 'Courier Prime', monospace;
  font-size: 0.78rem;
  color: #e8dcc8;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.85);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-buscador-directorio:focus {
  border-color: #a87e38;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.85), 0 0 6px rgba(168, 126, 56, 0.4);
}

.input-buscador-directorio::placeholder {
  color: #6e5944;
}

/* Lista de elementos del directorio */
.lista-directorio-scroll {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.lista-directorio-scroll::-webkit-scrollbar {
  width: 6px;
}
.lista-directorio-scroll::-webkit-scrollbar-track {
  background: #140b05;
}
.lista-directorio-scroll::-webkit-scrollbar-thumb {
  background: #472912;
  border-radius: 3px;
}

.item-directorio-fila {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: rgba(36, 20, 11, 0.65);
  border: 1px solid #3d2311;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.item-directorio-fila:hover {
  background: rgba(69, 39, 21, 0.85);
  border-color: #8c5528;
}

.item-dir-num {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 0.72rem;
  color: #e5c378;
  min-width: 32px;
}

.item-dir-tipo {
  font-size: 0.75rem;
}

.item-dir-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-dir-etiqueta {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffeed0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-dir-url {
  font-family: 'Courier Prime', monospace;
  font-size: 0.58rem;
  color: #8f7962;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-dir-estado {
  font-size: 0.65rem;
}

/* Pie del panel */
.panel-control-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #140c06;
  border-top: 1px solid #3b200e;
  font-family: 'Courier Prime', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: #7d654c;
}

.panel-control-footer .version-panel {
  color: #a88243;
}


